diff --git a/Jamfile b/Jamfile index 942323c29e..3ea234bde4 100644 --- a/Jamfile +++ b/Jamfile @@ -173,11 +173,7 @@ SubDir HAIKU_TOP ; UserBuildConfigRulePostBuildTargets ; # specify the Haiku image and network boot archive contents -if $(TARGET_ARCH) = x86_64 { - include [ FDirName $(HAIKU_BUILD_RULES_DIR) Haiku64Image ] ; -} else { - include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuImage ] ; -} +include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) NetBootArchive ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) FloppyBootImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootImage ] ; diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures index 6f1cca69ae..cb38b6b912 100644 --- a/build/jam/BuildFeatures +++ b/build/jam/BuildFeatures @@ -344,9 +344,9 @@ if $(TARGET_ARCH) = x86 { if $(TARGET_ARCH) = x86 { local zipFile ; if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_MESA_FILE = mesa-9.1.1-x86-gcc4-2013-03-20.zip ; + HAIKU_MESA_FILE = mesa-9.1.1-x86-gcc4-2013-04-27.zip ; } else { - HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2013-02-17.zip ; + HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2013-04-28.zip ; } zipFile = [ DownloadFile $(HAIKU_MESA_FILE) @@ -355,50 +355,54 @@ if $(TARGET_ARCH) = x86 { HAIKU_MESA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) $(HAIKU_MESA_FILE:B) ] ; + HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ; HAIKU_MESA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MESA_DIR) : include/ : $(zipFile) : extracted-mesa ] ; - HAIKU_GLAPI_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libglapi.a - : $(zipFile) - : extracted-mesa ] ; - HAIKU_GLSL_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libglsl.a - : $(zipFile) - : extracted-mesa ] ; + # Base Mesa libraries HAIKU_MESA_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) : lib.haiku/libmesa.a : $(zipFile) : extracted-mesa ] ; - HAIKU_GALLIUM_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + HAIKU_GLAPI_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) : - lib.haiku/libgallium.a + lib.haiku/libglapi.a : $(zipFile) : extracted-mesa ] ; - if FIsBuildFeatureEnabled(llvm) { - HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libllvmpipe.a - : $(zipFile) - : extracted-mesa ] ; - Depends $(HAIKU_GALLIUM_LLVMPIPE_LIB) : $(HAIKU_LLVM_LIBS) ; - } else { - HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libsoftpipe.a - : $(zipFile) - : extracted-mesa ] ; - } - - HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ; - Depends $(HAIKU_MESA_HEADERS_DEPENDENCY) : $(HAIKU_GLU_HEADERS_DEPENDENCY) ; Depends $(HAIKU_GLAPI_LIBS) : $(HAIKU_GLU_LIBS) ; + # Extended Mesa libraries for newer versions + if $(HAIKU_GCC_VERSION[1]) >= 4 { + HAIKU_GLSL_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libglsl.a + : $(zipFile) + : extracted-mesa ] ; + HAIKU_GALLIUM_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libgallium.a + : $(zipFile) + : extracted-mesa ] ; + + if FIsBuildFeatureEnabled(llvm) { + HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libllvmpipe.a + : $(zipFile) + : extracted-mesa ] ; + Depends $(HAIKU_GALLIUM_LLVMPIPE_LIB) : $(HAIKU_LLVM_LIBS) ; + } else { + HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) + : + lib.haiku/libsoftpipe.a + : $(zipFile) + : extracted-mesa ] ; + } + } + EnableBuildFeatures mesa ; } else { Echo "Mesa 3D rendering support not available on $(TARGET_ARCH)" ; diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 9bf91156bc..84af617b4c 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -35,7 +35,7 @@ SYSTEM_BIN = [ FFilterByBuildFeatures setversion setvolume seq sha1sum shar shred shuf shutdown sleep sort spamdbm split stat strace stty su sum sync sysinfo tac tail tcpdump tcptester tee telnet telnetd test timeout top touch - tput tr traceroute translate trash true truncate tsort tty + tput tr traceroute translate trash true truncate tsort tty uname unchop unexpand unmount uniq unlink unshar unzip unzipsfx updatedb uptime urlwrapper useradd uudecode uuencode vdir version vmstat @@ -45,8 +45,8 @@ SYSTEM_BIN = [ FFilterByBuildFeatures ] ; SYSTEM_APPS = [ FFilterByBuildFeatures - AboutSystem ActivityMonitor BootManager@x86 CharacterMap - CodyCam DeskCalc Devices DiskProbe DiskUsage DriveSetup CDPlayer Debugger + AboutSystem ActivityMonitor BootManager@x86 CDPlayer CharacterMap + CodyCam Debugger DeskCalc Devices DiskProbe DiskUsage DriveSetup Expander GLInfo@x86 Icon-O-Matic Installer LaunchBox Magnify Mail MediaConverter MediaPlayer MidiPlayer NetworkStatus PackageInstaller People PoorMan PowerStatus ProcessController Screenshot ShowImage SoundRecorder @@ -97,10 +97,13 @@ SYSTEM_NETWORK_DATALINK_PROTOCOLS = ethernet_frame arp loopback_frame SYSTEM_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix icmp6 ipv6 ; SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures + x86,x86_64 @{ + vesa.accelerant + }@ # x86,x86_64 x86 @{ 3dfx.accelerant ati.accelerant matrox.accelerant neomagic.accelerant nvidia.accelerant intel_810.accelerant intel_extreme.accelerant - radeon.accelerant radeon_hd.accelerant s3.accelerant vesa.accelerant + radeon.accelerant radeon_hd.accelerant s3.accelerant #via.accelerant vmware.accelerant }@ # x86 ] ; @@ -122,7 +125,7 @@ SYSTEM_ADD_ONS_MEDIA = [ FFilterByBuildFeatures usb_webcam.media_addon video_producer_demo.media_addon video_window_demo.media_addon - firewire_dv.media_addon + firewire_dv.media_addon@x86 #legacy.media_addon equalizer.media_addon vst_host.media_addon @@ -152,18 +155,21 @@ SYSTEM_ADD_ONS_SCREENSAVERS = [ FFilterByBuildFeatures SYSTEM_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki hda ice1712 sis7018 ; SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia usb_audio ; SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures + x86,x86_64 @{ + vesa + }@ # x86,x86_64 x86 @{ ati 3dfx intel_810 intel_extreme matrox neomagic nvidia radeon radeon_hd - s3 vesa #via vmware + s3 #via vmware }@ # x86 ] ; SYSTEM_ADD_ONS_DRIVERS_MIDI = emuxki ice1712 usb_midi ; SYSTEM_ADD_ONS_DRIVERS_NET = [ FFilterByBuildFeatures - x86 @{ + x86,x86_64 @{ 3com atheros813x ar81xx attansic_l1 attansic_l2 broadcom440x broadcom570x dec21xxx ipro100 ipro1000 jmicron2x0 marvell_yukon nforce pcnet rtl8139 rtl81xx sis19x syskonnect via_rhine vt612x - }@ # x86 + }@ # x86_64 etherpci pegasus sis900 usb_davicom usb_asix usb_ecm wb840 @@ -180,11 +186,12 @@ SYSTEM_ADD_ONS_DRIVERS_NET = [ FFilterByBuildFeatures ] ; SYSTEM_ADD_ONS_DRIVERS_POWER = [ FFilterByBuildFeatures acpi_button@x86 ] ; SYSTEM_ADD_ONS_BUS_MANAGERS = [ FFilterByBuildFeatures - ata@ata pci ps2@x86 isa@x86 - ide@ide scsi config_manager agp_gart usb firewire acpi@x86 + ata@ata pci ps2@x86,x86_64 isa@x86,x86_64 + ide@ide scsi config_manager agp_gart@x86 usb firewire@x86 acpi@x86 + virtio ] ; SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs btrfs cdda exfat ext2 fat iso9660 nfs nfs4 - attribute_overlay write_overlay ntfs reiserfs udf googlefs ; + attribute_overlay write_overlay ntfs reiserfs@x86 udf googlefs ; # wifi firmware for driver in $(SYSTEM_ADD_ONS_DRIVERS_NET) { @@ -223,6 +230,8 @@ AddFilesToHaikuImage system add-ons kernel busses scsi : ahci ; AddFilesToHaikuImage system add-ons kernel busses usb : uhci ohci ehci ; +AddFilesToHaikuImage system add-ons kernel busses virtio + : virtio_pci ; AddFilesToHaikuImage system add-ons kernel console : vga_text ; AddFilesToHaikuImage system add-ons kernel debugger : demangle disasm@x86 hangman @@ -231,22 +240,22 @@ AddFilesToHaikuImage system add-ons kernel debugger AddFilesToHaikuImage system add-ons kernel file_systems : $(SYSTEM_ADD_ONS_FILE_SYSTEMS) ; AddFilesToHaikuImage system add-ons kernel generic - : ata_adapter@ata bios@x86 dpc ide_adapter@ide - locked_pool mpu401 scsi_periph tty cpuidle@x86 ; + : ata_adapter@ata bios@x86,x86_64 dpc ide_adapter@ide + locked_pool mpu401 scsi_periph tty ; AddFilesToHaikuImage system add-ons kernel partitioning_systems : amiga_rdb apple efi_gpt intel session ; AddFilesToHaikuImage system add-ons kernel interrupt_controllers : openpic@ppc ; -if $(TARGET_ARCH) = x86 { +if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 { AddFilesToHaikuImage system add-ons kernel cpu : generic_x86 ; } # drivers AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ; +AddNewDriversToHaikuImage disk virtual : virtio_block ; AddNewDriversToHaikuImage power : enhanced_speedstep@x86 ; AddNewDriversToHaikuImage power : acpi_battery@x86 ; -AddNewDriversToHaikuImage power : x86_cpuidle@x86 ; #AddNewDriversToHaikuImage display : display_controls@x86 ; # legacy drivers @@ -255,7 +264,7 @@ AddDriversToHaikuImage : console dprintf null AddDriversToHaikuImage audio hmulti : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO) ; AddDriversToHaikuImage audio old : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD) ; AddDriversToHaikuImage midi : $(SYSTEM_ADD_ONS_DRIVERS_MIDI) ; -AddDriversToHaikuImage bus : usb_raw fw_raw ; +AddDriversToHaikuImage bus : usb_raw fw_raw@x86 ; AddDriversToHaikuImage disk floppy : pc_floppy@x86 ; AddDriversToHaikuImage disk usb : usb_disk ; AddDriversToHaikuImage disk usb : usb_floppy ; @@ -302,22 +311,11 @@ if $(TARGET_ARCH) = x86 { } } -# libbe.so now includes what used to be in liblocale.so -# TODO: Remove this once all optional packages have been rebuilt (i.e. after -# next release)! -SYSTEM_LIBS_LIBBE_ALIASES = liblocale.so ; -if $(TARGET_ARCH) = x86 { - local lib ; - for lib in $(SYSTEM_LIBS_LIBBE_ALIASES) { - AddSymlinkToHaikuHybridImage system lib : libbe.so : $(lib) : : true ; - } -} SYSTEM_LIBS_ALIASES = $(SYSTEM_LIBS_LIBNETWORK_ALIASES) libnetapi.so $(SYSTEM_LIBS_LIBGL_ALIASES) - $(SYSTEM_LIBS_LIBBE_ALIASES) ; OPTIONAL_LIBS_ALIASES = @@ -613,6 +611,7 @@ AddBootModuleSymlinksToHaikuImage ide_isa@x86 uhci ohci ehci scsi_cd scsi_disk usb_disk + virtio virtio_pci virtio_block efi_gpt intel bfs diff --git a/build/jam/LocaleRules b/build/jam/LocaleRules index 7fcfd693d5..7bd875d4eb 100644 --- a/build/jam/LocaleRules +++ b/build/jam/LocaleRules @@ -10,6 +10,7 @@ rule ExtractCatalogEntries target : sources : signature : regexp local sysHeaders ; local cc ; local defines ; + local includesSeparator ; local localIncludesOption ; local systemIncludesOption ; @@ -22,20 +23,20 @@ rule ExtractCatalogEntries target : sources : signature : regexp if $(PLATFORM) = host { sysHeaders += $(HOST_HDRS) ; defines += $(HOST_DEFINES) ; - + cc = $(HOST_CC) ; if $(USES_BE_API) { sysHeaders += $(HOST_BE_API_HEADERS) ; } - - defines += $(HOST_DEFINES) ; - cc = $(HOST_CC) ; + + includesSeparator = $(HOST_INCLUDES_SEPARATOR) ; localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ; systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ; } else { sysHeaders += $(TARGET_HDRS) ; defines += $(TARGET_DEFINES) ; - defines += $(TARGET_DEFINES) ; cc = $(TARGET_CC) ; + + includesSeparator = $(TARGET_INCLUDES_SEPARATOR) ; localIncludesOption = $(TARGET_LOCAL_INCLUDES_OPTION) ; systemIncludesOption = $(TARGET_SYSTEM_INCLUDES_OPTION) ; } diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules index 4284ae7720..e650f9abd2 100644 --- a/build/jam/MainBuildRules +++ b/build/jam/MainBuildRules @@ -115,7 +115,7 @@ rule Addon target : sources : libraries : isExecutable local linkFlags = -Xlinker -soname=\"$(target:G=)\" ; if $(isExecutable) != true { - linkFlags = -nostart $(linkFlags) ; + linkFlags = -shared $(linkFlags) ; } LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] $(linkFlags) ; LinkAgainst $(target) : $(libraries) ; @@ -421,7 +421,7 @@ rule SharedLibraryFromObjects MainFromObjects $(_lib) : $(2) ; LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ] - -nostart -Xlinker -soname=\"$(soname)\" ; + -shared -Xlinker -soname=\"$(soname)\" ; LinkAgainst $(_lib) : $(3) ; AddSharedObjectGlueCode $(_lib) : false ; diff --git a/build/jam/MiscRules b/build/jam/MiscRules index 32195453f9..7a140db2cb 100644 --- a/build/jam/MiscRules +++ b/build/jam/MiscRules @@ -502,7 +502,7 @@ rule FFilterByBuildFeatures list switch $(element) { case }@ : { - # Pop the topmost specificaton off the stack. + # Pop the topmost specification off the stack. evaluationStack = $(evaluationStack[2-]) ; if ! $(evaluationStack) { Exit "FFilterByBuildFeatures: Unbalanced @( in: " $(list) ; diff --git a/build/jam/OptionalPackageDependencies b/build/jam/OptionalPackageDependencies index 84d12ca66e..3adb2b15b1 100644 --- a/build/jam/OptionalPackageDependencies +++ b/build/jam/OptionalPackageDependencies @@ -41,4 +41,4 @@ OptionalPackageDependencies WebPositive : Curl LibXML2 SQLite WebKit WebPositive OptionalPackageDependencies wpa_supplicant : OpenSSL ; OptionalPackageDependencies XZ-Utils : Tar ; -OptionalPackageDependencies MandatoryPackages : Bzip Ctags Grep ICU Sed Tar ; +OptionalPackageDependencies MandatoryPackages : Bzip Ctags Grep ICU Sed Tar TermInfo ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 737a9e9b4d..288268aada 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -97,6 +97,7 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 # System-sounds - a collection of system sounds # TagLib - id3 tag library # Tar - archiving utility +# TermInfo - terminal capabilites database # TimGMSoundFont - a good quality General MIDI Sound Font # TrackerNewTemplates - template files for Tracker's New menu # Transmission - a fast, easy, and free BitTorrent Client @@ -749,8 +750,8 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] { if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) { InstallOptionalHaikuImagePackage - gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip - : $(baseURL)/gcc-4.6.3-r1a4-x86-gcc4-2012-11-01.zip ; + gcc-4.7.3-r1a4-x86-gcc4-2013-05-13.zip + : $(baseURL)/gcc-4.7.3-r1a4-x86-gcc4-2013-05-13.zip ; } if $(HAIKU_GCC_VERSION[1]) = 4 { @@ -762,7 +763,7 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ] { local libs = libstdc++.so libsupc++.so ; for lib in $(libs) { AddSymlinkToHaikuHybridImage - develop abi x86 gcc4 tools gcc-4.6.3-haiku-121101 lib + develop abi x86 gcc4 tools gcc-4.7.3-haiku-130513 lib : /system/lib $(lib) : : true ; } } @@ -961,7 +962,6 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] # third party libs headers AddHeaderDirectoryToHaikuImage libs ncurses : 3rdparty ; - AddHeaderDirectoryToHaikuImage libs termcap : 3rdparty ; AddHeaderDirectoryToHaikuImage libs tiff : 3rdparty ; CopyDirectoryToHaikuImage develop headers : @@ -1299,7 +1299,7 @@ if [ IsOptionalHaikuImagePackageAdded ICU ] { } } else if $(TARGET_ARCH) = arm { InstallOptionalHaikuImagePackage $(HAIKU_ICU_ARM_PACKAGE) - : $(baseURL)/(HAIKU_ICU_ARM_PACKAGE) + : $(baseURL)/$(HAIKU_ICU_ARM_PACKAGE) : system lib ; } else if $(TARGET_ARCH) = x86_64 { InstallOptionalHaikuImagePackage $(HAIKU_ICU_X86_64_PACKAGE) @@ -2065,6 +2065,13 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] { } +# TermInfo +if [ IsOptionalHaikuImagePackageAdded TermInfo ] { + InstallOptionalHaikuImagePackage terminfo-1.383-2013-05-21.zip + : $(baseURL)/terminfo-1.383-2013-05-21.zip ; +} + + # TimGMSoundFont if [ IsOptionalHaikuImagePackageAdded TimGMSoundFont ] { InstallOptionalHaikuImagePackage TimGMSoundFont-2010-06-16.zip diff --git a/build/jam/board/raspberry_pi/info.txt b/build/jam/board/raspberry_pi/info.txt deleted file mode 100644 index 5b7ed7a60a..0000000000 --- a/build/jam/board/raspberry_pi/info.txt +++ /dev/null @@ -1,34 +0,0 @@ -Setting up the Haiku boot partition -------------------------------------- -partition 1 -- FAT32, bootable flag, type 'c' -partition 2 -- BeFS, Haiku filesystem, type 'eb' - -The boot partition must contain the following files to boot Haiku: -* bootcode.bin : 2nd stage bootloader -* start.elf: The GPU binary firmware image -* haiku_loader: Haiku Loader -* haiku-floppyboot.tgz: Compressed image with Haiku kernel -* config.txt: A configuration file read by the GPU. - -Optional files: -* vlls directory: Additional GPU code, e.g. extra codecs. - -Building -------------------------------------- -jam -q -sHAIKU_BOOT_BOARD=raspberry_pi -sHAIKU_BOOT_PLATFORM=raspberrypi_arm haiku_loader -jam -q -sHAIKU_BOOT_BOARD=raspberry_pi -sHAIKU_BOOT_PLATFORM=raspberrypi_arm haiku-floppyboot.tgz - -config.txt options -------------------------------------- -kernel=haiku_loader -kernel_address=0x0 -disable_commandline_tags=1 -ramfsfile=haiku-floppyboot.tgz -ramfsaddr=0x04000000 - -Additional information -------------------------------------- -* Latest Raspberry Pi firmware: - http://github.com/raspberrypi/firmware/tree/master/boot -* config.txt options: - http://www.elinux.org/RPiconfig diff --git a/data/catalogs/add-ons/disk_systems/intel/be.catkeys b/data/catalogs/add-ons/disk_systems/intel/be.catkeys index 37e0388eb0..b3ce1b77d1 100644 --- a/data/catalogs/add-ons/disk_systems/intel/be.catkeys +++ b/data/catalogs/add-ons/disk_systems/intel/be.catkeys @@ -1,2 +1,2 @@ -1 belarusian x-vnd.Haiku-IntelDiskAddOn 4191422532 -Active partition BFS_Creation_Parameter Актыўны падзел +1 belarusian x-vnd.Haiku-IntelDiskAddOn 946918966 +Active partition PrimaryPartitionEditor Актыўны падзел diff --git a/data/catalogs/add-ons/disk_systems/intel/nl.catkeys b/data/catalogs/add-ons/disk_systems/intel/nl.catkeys index 1cdbd8211b..7733db3505 100644 --- a/data/catalogs/add-ons/disk_systems/intel/nl.catkeys +++ b/data/catalogs/add-ons/disk_systems/intel/nl.catkeys @@ -1,2 +1,2 @@ -1 dutch; flemish x-vnd.Haiku-IntelDiskAddOn 4191422532 -Active partition BFS_Creation_Parameter Actieve partitie +1 dutch; flemish x-vnd.Haiku-IntelDiskAddOn 946918966 +Active partition PrimaryPartitionEditor Actieve partitie diff --git a/data/catalogs/add-ons/disk_systems/ntfs/be.catkeys b/data/catalogs/add-ons/disk_systems/ntfs/be.catkeys new file mode 100644 index 0000000000..66cab76b2e --- /dev/null +++ b/data/catalogs/add-ons/disk_systems/ntfs/be.catkeys @@ -0,0 +1,2 @@ +1 belarusian x-vnd.Haiku-NTFSDiskAddOn 25755486 +Name: NTFS_Initialize_Parameter Імя: diff --git a/data/catalogs/add-ons/disk_systems/ntfs/nl.catkeys b/data/catalogs/add-ons/disk_systems/ntfs/nl.catkeys new file mode 100644 index 0000000000..4a585cb2b3 --- /dev/null +++ b/data/catalogs/add-ons/disk_systems/ntfs/nl.catkeys @@ -0,0 +1,2 @@ +1 dutch; flemish x-vnd.Haiku-NTFSDiskAddOn 25755486 +Name: NTFS_Initialize_Parameter Naam: diff --git a/data/catalogs/add-ons/input_server/devices/keyboard/pt_BR.catkeys b/data/catalogs/add-ons/input_server/devices/keyboard/pt_BR.catkeys index 0dd28a58f3..e345e9ab9b 100644 --- a/data/catalogs/add-ons/input_server/devices/keyboard/pt_BR.catkeys +++ b/data/catalogs/add-ons/input_server/devices/keyboard/pt_BR.catkeys @@ -1,7 +1,7 @@ 1 portuguese (brazil) x-vnd.Haiku-KeyboardInputServerDevice 2536418998 Kill application Team monitor Matar aplicação Quit application Team monitor Fechar aplicativo -Select an application from the list above and click one of the buttons 'Kill application' and 'Quit application' in order to close it.\n\nHold CONTROL+ALT+DELETE for %ld seconds to reboot. Team monitor Selecione uma aplicação da lista acima e clique um dos botões 'Matar aplicativo' e 'Fechar aplicativo' de maneira a fechá-lo.\n\nPressione CONTROL+ALT+DELETE por %ld segundos para reiniciar. +Select an application from the list above and click one of the buttons 'Kill application' and 'Quit application' in order to close it.\n\nHold CONTROL+ALT+DELETE for %ld seconds to reboot. Team monitor Selecione um aplicativo da lista acima e clique um dos botões 'Matar aplicativo' e 'Fechar aplicativo' de maneira a fechá-lo.\n\nPressione CONTROL+ALT+DELETE por %ld segundos para reiniciar. If the application will not quit you may have to kill it. Team monitor Se a aplicação não fechar, você deve matá-la. Force reboot Team monitor Forçar a reinicialização Team monitor Team monitor Monitor de equipe diff --git a/data/catalogs/add-ons/media/media-add-ons/mixer/fr.catkeys b/data/catalogs/add-ons/media/media-add-ons/mixer/fr.catkeys index 39fbc602ae..016388401d 100644 --- a/data/catalogs/add-ons/media/media-add-ons/mixer/fr.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/mixer/fr.catkeys @@ -1,7 +1,7 @@ 1 french x-vnd.Haiku-mixer.media_addon 3450667169 Input gain controls represent AudioMixer Les contrôles de gain d'entrée représentent Linear interpolation AudioMixer Interpolation linéaire -Virtual output channels AudioMixer Canaux de sortie virtuelles +Virtual output channels AudioMixer Canaux de la sortie virtuelle Refuse output format changes AudioMixer Refuser les changements de formats de sorties Output mapping AudioMixer Correspondances de sorties Allow input channel remapping AudioMixer Autoriser la réassignation des canaux d'entrées diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys index 5497b93946..c1161e0f17 100644 --- a/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys @@ -18,7 +18,7 @@ Output treble MultiAudio Выхад высокіх Mono mix MultiAudio Моно мікс General MultiAudio Агульны Input & Output MultiAudio Выхад і Ўваход -Enhanced Setup MultiAudio Спец. Наладкі +Enhanced Setup MultiAudio Спецыяльныя Наладкі Stereo mix MultiAudio Стэрэа мікс Output 3D depth MultiAudio Выхад глыбіня 3D Volume MultiAudio Гучнасьць diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/fr.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/fr.catkeys index de15db504e..f555d45feb 100644 --- a/data/catalogs/add-ons/media/media-add-ons/multi_audio/fr.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/fr.catkeys @@ -1,7 +1,8 @@ -1 french x-vnd.Haiku-hmulti_audio.media_addon 1510080944 +1 french x-vnd.Haiku-hmulti_audio.media_addon 451057402 Master MultiAudio Général SPDIF MultiAudio SPDIF Gain MultiAudio Gain +Output 3D center MultiAudio Sortie 3D centrale Extended Setup MultiAudio Réglages étendus CD MultiAudio CD Tone control MultiAudio Tonalité @@ -19,6 +20,7 @@ General MultiAudio Général Input & Output MultiAudio Entrée & Sortie Enhanced Setup MultiAudio Réglages fins Stereo mix MultiAudio Mélangeur stéréo +Output 3D depth MultiAudio Profondeur de la sortie 3D Volume MultiAudio Volume Output MultiAudio Sortie Video MultiAudio Vidéo diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/nl.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/nl.catkeys new file mode 100644 index 0000000000..893544cb47 --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/nl.catkeys @@ -0,0 +1,5 @@ +1 dutch; flemish x-vnd.Haiku-hmulti_audio.media_addon 2576815106 +Master MultiAudio Master +SPDIF MultiAudio SPDIF +Gain MultiAudio Versterking +Output 3D center MultiAudio Uitvoer 3D midden diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/pl.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/pl.catkeys index 21e9452217..b7a01d1c52 100644 --- a/data/catalogs/add-ons/media/media-add-ons/multi_audio/pl.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/pl.catkeys @@ -1,11 +1,13 @@ -1 polish x-vnd.Haiku-hmulti_audio.media_addon 1938843440 +1 polish x-vnd.Haiku-hmulti_audio.media_addon 2905288525 Master MultiAudio Master SPDIF MultiAudio SPDIF Gain MultiAudio Wzmocnienie Output 3D center MultiAudio Wyjście 3D, środek Extended Setup MultiAudio Zaawansowane Ustawienia CD MultiAudio CD +Tone control MultiAudio Kontrola tonów Phone MultiAudio Telefon +Aux MultiAudio Aux Headphones MultiAudio Słuchawki Beep MultiAudio Brzęczyk Input MultiAudio Wejście diff --git a/data/catalogs/add-ons/translators/exr/el.catkeys b/data/catalogs/add-ons/translators/exr/el.catkeys index 00d829d467..e74e703d44 100644 --- a/data/catalogs/add-ons/translators/exr/el.catkeys +++ b/data/catalogs/add-ons/translators/exr/el.catkeys @@ -1,7 +1,8 @@ -1 greek, modern (1453-) x-vnd.Haiku-EXRTranslator 2253035870 +1 greek, modern (1453-) x-vnd.Haiku-EXRTranslator 33353118 Version %d.%d.%d, %s ConfigView Έκδοση %d.%d.%d, %s EXR image translator EXRTranslator Μεταφραστής εικόνων EXR Based on OpenEXR (http://www.openexr.com) ConfigView Βασισμένο στο OpenEXR (http://www.openexr.com) EXR Settings main EXR Ρυθμίσεις a division of Lucasfilm Entertainment Company Ltd ConfigView τμήμα της Lucasfilm Entertainment Company Ltd EXR image EXRTranslator EXR εικόνα +EXR image translator ConfigView Μεταφραστής εικόνων EXR diff --git a/data/catalogs/add-ons/translators/exr/hi.catkeys b/data/catalogs/add-ons/translators/exr/hi.catkeys index 81ab7a4cb2..da50b9fbcc 100644 --- a/data/catalogs/add-ons/translators/exr/hi.catkeys +++ b/data/catalogs/add-ons/translators/exr/hi.catkeys @@ -1,7 +1,8 @@ -1 hindi x-vnd.Haiku-EXRTranslator 2253035870 +1 hindi x-vnd.Haiku-EXRTranslator 33353118 Version %d.%d.%d, %s ConfigView संस्करण %d.%d.%d, %s EXR image translator EXRTranslator एक्सर छवि का अनुवादक Based on OpenEXR (http://www.openexr.com) ConfigView एक्सरओपन के आधार पर(http://www.openexr.com) EXR Settings main एक्सर की सेटिंग a division of Lucasfilm Entertainment Company Ltd ConfigView लुकास्फिल्म एन्टरटेन्मेंट कंपनी लटीडी का एक प्रभाग EXR image EXRTranslator एक्सर छवि +EXR image translator ConfigView एक्सर छवि का अनुवादक diff --git a/data/catalogs/add-ons/translators/exr/ro.catkeys b/data/catalogs/add-ons/translators/exr/ro.catkeys index 220ab59bed..22a4fb91f4 100644 --- a/data/catalogs/add-ons/translators/exr/ro.catkeys +++ b/data/catalogs/add-ons/translators/exr/ro.catkeys @@ -1,7 +1,8 @@ -1 romanian x-vnd.Haiku-EXRTranslator 2253035870 +1 romanian x-vnd.Haiku-EXRTranslator 33353118 Version %d.%d.%d, %s ConfigView Versiune %d.%d.%d, %s EXR image translator EXRTranslator Traducătorul de imagini EXR Based on OpenEXR (http://www.openexr.com) ConfigView Bazat pe OpenEXR (http://www.openexr.com) EXR Settings main Configurări EXR a division of Lucasfilm Entertainment Company Ltd ConfigView o diviziune a Lucasfilm Entertainment Company Ltd EXR image EXRTranslator Imagine EXR +EXR image translator ConfigView Traducătorul de imagini EXR diff --git a/data/catalogs/add-ons/translators/exr/uk.catkeys b/data/catalogs/add-ons/translators/exr/uk.catkeys index ec24be0c2a..f5b013acd1 100644 --- a/data/catalogs/add-ons/translators/exr/uk.catkeys +++ b/data/catalogs/add-ons/translators/exr/uk.catkeys @@ -1,7 +1,8 @@ -1 ukrainian x-vnd.Haiku-EXRTranslator 2253035870 +1 ukrainian x-vnd.Haiku-EXRTranslator 33353118 Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s EXR image translator EXRTranslator Перетворювач зображень EXR Based on OpenEXR (http://www.openexr.com) ConfigView Базоване на OpenEXR (http://www.openexr.com) EXR Settings main Настройки EXR a division of Lucasfilm Entertainment Company Ltd ConfigView відділення Lucasfilm Entertainment Company Ltd EXR image EXRTranslator Зображення EXR +EXR image translator ConfigView Перетворювач зображень EXR diff --git a/data/catalogs/add-ons/translators/gif/pt_BR.catkeys b/data/catalogs/add-ons/translators/gif/pt_BR.catkeys index 28d7e456ec..ac6f390946 100644 --- a/data/catalogs/add-ons/translators/gif/pt_BR.catkeys +++ b/data/catalogs/add-ons/translators/gif/pt_BR.catkeys @@ -1,11 +1,11 @@ 1 portuguese (brazil) x-vnd.Haiku-GIFTranslator 2708495435 Websafe GIFView Websafe Write interlaced images GIFView Escrever imagens entrelaçadas -Optimal GIFView Ideal +Optimal GIFView Ótimo Greyscale GIFView Escala de cinza Be Bitmap Format (GIFTranslator) GIFTranslator Formato de Mapa de Bits Be (Tradutor GIF) GIF image translator GIFView Tradutor de imagem GIF -GIF image GIFTranslator imagem GIF +GIF image GIFTranslator Imagem GIF Write transparent images GIFView Gravar imagens transparentes Palette GIFView Paleta Use RGB color GIFView Usar cor RGB diff --git a/data/catalogs/add-ons/translators/ico/el.catkeys b/data/catalogs/add-ons/translators/ico/el.catkeys index 34c1fe4051..164d5489e1 100644 --- a/data/catalogs/add-ons/translators/ico/el.catkeys +++ b/data/catalogs/add-ons/translators/ico/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-ICOTranslator 1637901496 +1 greek, modern (1453-) x-vnd.Haiku-ICOTranslator 1211895126 Cursor ICOTranslator Κέρσορας Version %d.%d.%d, %s ConfigView Έκδοση %d.%d.%d, %s Windows %s %ld bit image ICOTranslator Windows %s %ld bit εικόνα @@ -10,3 +10,4 @@ pixels in either direction. ConfigView pixels σε κάθε κατεύθυνσ Write 32 bit images on true color input ConfigView Γράψιμο 32 bit εικώνων σε true color input Icon ICOTranslator Εικονίδιο ICOTranslator Settings ConfigView Ρυθμίσεις ICOTranslator +Windows icon translator ConfigView Windows icon μεταφραστής diff --git a/data/catalogs/add-ons/translators/ico/hi.catkeys b/data/catalogs/add-ons/translators/ico/hi.catkeys index 5ff2915b9f..d6ab14d569 100644 --- a/data/catalogs/add-ons/translators/ico/hi.catkeys +++ b/data/catalogs/add-ons/translators/ico/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-ICOTranslator 1637901496 +1 hindi x-vnd.Haiku-ICOTranslator 1211895126 Cursor ICOTranslator कर्सर Version %d.%d.%d, %s ConfigView संस्करण %d.%d.%d, %s Windows %s %ld bit image ICOTranslator विंडोज़ %s %ld बिट चित्र @@ -10,3 +10,4 @@ pixels in either direction. ConfigView पिक्सेल्स कोई Write 32 bit images on true color input ConfigView 32 बिट चित्र सही कलर इनपुट में लिखे Icon ICOTranslator आइकन ICOTranslator Settings ConfigView आईसीऔ संवादक सेत्तिंग्स +Windows icon translator ConfigView विंडोज़ आइकन संवादक diff --git a/data/catalogs/add-ons/translators/ico/ro.catkeys b/data/catalogs/add-ons/translators/ico/ro.catkeys index ea74b7d5eb..7d2d78cec4 100644 --- a/data/catalogs/add-ons/translators/ico/ro.catkeys +++ b/data/catalogs/add-ons/translators/ico/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-ICOTranslator 1637901496 +1 romanian x-vnd.Haiku-ICOTranslator 1211895126 Cursor ICOTranslator Cursor Version %d.%d.%d, %s ConfigView Versiune %d.%d.%d, %s Windows %s %ld bit image ICOTranslator Imagine Windows %s %ld bit @@ -10,3 +10,4 @@ pixels in either direction. ConfigView pixeli în ambele sensuri. Write 32 bit images on true color input ConfigView Scrie imagini de 32 biți la intrarea de culoare reală Icon ICOTranslator Pictogramă ICOTranslator Settings ConfigView Configurări TraducătorICO +Windows icon translator ConfigView Traducător pictogramă Windows diff --git a/data/catalogs/add-ons/translators/ico/uk.catkeys b/data/catalogs/add-ons/translators/ico/uk.catkeys index 4bd5a6d47a..a804d60a94 100644 --- a/data/catalogs/add-ons/translators/ico/uk.catkeys +++ b/data/catalogs/add-ons/translators/ico/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-ICOTranslator 1637901496 +1 ukrainian x-vnd.Haiku-ICOTranslator 1211895126 Cursor ICOTranslator Курсор Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s Windows %s %ld bit image ICOTranslator Вікна зображення %s %ld bit @@ -10,3 +10,4 @@ pixels in either direction. ConfigView пікселів в кожному на Write 32 bit images on true color input ConfigView Записати зображення 32 bit на вхід true color Icon ICOTranslator Іконка ICOTranslator Settings ConfigView Настройки перетворювача ICO +Windows icon translator ConfigView Перетворювач вікон іконок diff --git a/data/catalogs/add-ons/translators/raw/de.catkeys b/data/catalogs/add-ons/translators/raw/de.catkeys index 5d3963ba48..eae23f03cb 100644 --- a/data/catalogs/add-ons/translators/raw/de.catkeys +++ b/data/catalogs/add-ons/translators/raw/de.catkeys @@ -1,8 +1,9 @@ -1 german x-vnd.Haiku-RAWTranslator 2229230003 +1 german x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAWTranslator-Einstellungen Version %d.%d.%d, %s ConfigView Version %d.%d.%d, %s RAW image translator RAWTranslator RAW-Bild-Translator RAW Settings RAWTranslator main RAW-Einstellungen RAW images RAWTranslator RAW-Bilder +RAW image translator ConfigView RAW-Bild-Translator %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW-Bild Based on Dave Coffin's dcraw 8.63 ConfigView Basiert auf Dave Coffins dcraw 8.63 diff --git a/data/catalogs/add-ons/translators/raw/el.catkeys b/data/catalogs/add-ons/translators/raw/el.catkeys index b5639e56a8..7dc4f2365a 100644 --- a/data/catalogs/add-ons/translators/raw/el.catkeys +++ b/data/catalogs/add-ons/translators/raw/el.catkeys @@ -1,8 +1,9 @@ -1 greek, modern (1453-) x-vnd.Haiku-RAWTranslator 2229230003 +1 greek, modern (1453-) x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Ρυθμίσεις μεταφραστή RAW Version %d.%d.%d, %s ConfigView Έκδοση %d.%d.%d, %s RAW image translator RAWTranslator Μεταφραστής εικόνας RAW RAW Settings RAWTranslator main RAW Ρυθμίσεις RAW images RAWTranslator RAW εικόνες +RAW image translator ConfigView Μεταφραστής εικόνας RAW %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') % RAW εικόνα Based on Dave Coffin's dcraw 8.63 ConfigView Βασισμένο το dcraw 8.63 του Dave Coffin diff --git a/data/catalogs/add-ons/translators/raw/fi.catkeys b/data/catalogs/add-ons/translators/raw/fi.catkeys index bffc0f0d0e..af5fad955e 100644 --- a/data/catalogs/add-ons/translators/raw/fi.catkeys +++ b/data/catalogs/add-ons/translators/raw/fi.catkeys @@ -1,8 +1,9 @@ -1 finnish x-vnd.Haiku-RAWTranslator 2229230003 +1 finnish x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAW-muunninasetukset Version %d.%d.%d, %s ConfigView Versio %d.%d.%d, %s RAW image translator RAWTranslator RAW-kuvamuunnin RAW Settings RAWTranslator main RAW-asetukset RAW images RAWTranslator RAW-kuvat +RAW image translator ConfigView RAW-kuvamuunnin %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW-kuva Based on Dave Coffin's dcraw 8.63 ConfigView Perustuu Dave Coffinin ohjelmaan dcraw 8.63 diff --git a/data/catalogs/add-ons/translators/raw/fr.catkeys b/data/catalogs/add-ons/translators/raw/fr.catkeys index f39a351fc7..5d4edfea40 100644 --- a/data/catalogs/add-ons/translators/raw/fr.catkeys +++ b/data/catalogs/add-ons/translators/raw/fr.catkeys @@ -1,8 +1,9 @@ -1 french x-vnd.Haiku-RAWTranslator 2229230003 +1 french x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Réglages du traducteur RAW Version %d.%d.%d, %s ConfigView Version %d.%d.%d, %s RAW image translator RAWTranslator Traducteur d'images RAW RAW Settings RAWTranslator main Réglages RAW RAW images RAWTranslator Images RAW +RAW image translator ConfigView Traducteur d'images RAW %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') Image brute %s Based on Dave Coffin's dcraw 8.63 ConfigView Basé sur dcraw 8.63 de Dave Coffin diff --git a/data/catalogs/add-ons/translators/raw/hi.catkeys b/data/catalogs/add-ons/translators/raw/hi.catkeys index 4e6818bf80..0f7dfae155 100644 --- a/data/catalogs/add-ons/translators/raw/hi.catkeys +++ b/data/catalogs/add-ons/translators/raw/hi.catkeys @@ -1,8 +1,9 @@ -1 hindi x-vnd.Haiku-RAWTranslator 2229230003 +1 hindi x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAWTranslator की सेत्तिंग्स Version %d.%d.%d, %s ConfigView संस्करण %d.%d.%d, %s RAW image translator RAWTranslator RAW चित्र का अनुवादक RAW Settings RAWTranslator main RAW की सेत्तिंग्स RAW images RAWTranslator RAW चित्र +RAW image translator ConfigView RAW चित्र का अनुवादक %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW चित्र Based on Dave Coffin's dcraw 8.63 ConfigView देव कोफ्फिन के dcraw 8.63 पर आधार्रित diff --git a/data/catalogs/add-ons/translators/raw/ja.catkeys b/data/catalogs/add-ons/translators/raw/ja.catkeys index 6ec794939d..170485420e 100644 --- a/data/catalogs/add-ons/translators/raw/ja.catkeys +++ b/data/catalogs/add-ons/translators/raw/ja.catkeys @@ -1,8 +1,9 @@ -1 japanese x-vnd.Haiku-RAWTranslator 2229230003 +1 japanese x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAW トランスレーター設定 Version %d.%d.%d, %s ConfigView バージョン %d.%d.%d, %s RAW image translator RAWTranslator RAW イメージトランスレーター RAW Settings RAWTranslator main RAW 設定 RAW images RAWTranslator RAW イメージ +RAW image translator ConfigView RAW イメージトランスレーター %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s のRAW イメージ Based on Dave Coffin's dcraw 8.63 ConfigView Dave Coffin作の dcraw 8.63 に基づいています。 diff --git a/data/catalogs/add-ons/translators/raw/lt.catkeys b/data/catalogs/add-ons/translators/raw/lt.catkeys index 904c8fb50e..433f4b5383 100644 --- a/data/catalogs/add-ons/translators/raw/lt.catkeys +++ b/data/catalogs/add-ons/translators/raw/lt.catkeys @@ -1,8 +1,9 @@ -1 lithuanian x-vnd.Haiku-RAWTranslator 2229230003 +1 lithuanian x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAW keitiklio nuostatos Version %d.%d.%d, %s ConfigView Versija %d.%d.%d, %s RAW image translator RAWTranslator RAW paveikslų keitiklis RAW Settings RAWTranslator main RAW nuostatos RAW images RAWTranslator RAW paveikslai +RAW image translator ConfigView RAW paveikslų keitiklis %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') „%s“ RAW paveikslas Based on Dave Coffin's dcraw 8.63 ConfigView Sukurta Dave'o Coffin'o „dcraw 8.63“ pagrindu diff --git a/data/catalogs/add-ons/translators/raw/nl.catkeys b/data/catalogs/add-ons/translators/raw/nl.catkeys index 3f1800a647..641327e097 100644 --- a/data/catalogs/add-ons/translators/raw/nl.catkeys +++ b/data/catalogs/add-ons/translators/raw/nl.catkeys @@ -1,8 +1,9 @@ -1 dutch; flemish x-vnd.Haiku-RAWTranslator 2229230003 +1 dutch; flemish x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAWTranslator Instellingen Version %d.%d.%d, %s ConfigView Versie %d.%d.%d, %s RAW image translator RAWTranslator RAW afbeelding vertaler RAW Settings RAWTranslator main RAW Instellingen RAW images RAWTranslator RAW afbeeldingen +RAW image translator ConfigView RAW afbeelding vertaler %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW afbeelding Based on Dave Coffin's dcraw 8.63 ConfigView Gebaseerd op Dave Coffin's dcraw 8.63 diff --git a/data/catalogs/add-ons/translators/raw/pl.catkeys b/data/catalogs/add-ons/translators/raw/pl.catkeys index 1f64820188..4560cc8d6e 100644 --- a/data/catalogs/add-ons/translators/raw/pl.catkeys +++ b/data/catalogs/add-ons/translators/raw/pl.catkeys @@ -1,8 +1,9 @@ -1 polish x-vnd.Haiku-RAWTranslator 2229230003 +1 polish x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Ustawienia translatora RAW Version %d.%d.%d, %s ConfigView Wersja %d.%d.%d, %s RAW image translator RAWTranslator Translator obrazów RAW RAW Settings RAWTranslator main Ustawienia RAW RAW images RAWTranslator Obrazy RAW +RAW image translator ConfigView Translator obrazów RAW %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') Obraz RAW %s Based on Dave Coffin's dcraw 8.63 ConfigView Oparte o dcraw Dave Coffina w wersji 8.63 diff --git a/data/catalogs/add-ons/translators/raw/ru.catkeys b/data/catalogs/add-ons/translators/raw/ru.catkeys index 7d53f8d86e..7e16c71b96 100644 --- a/data/catalogs/add-ons/translators/raw/ru.catkeys +++ b/data/catalogs/add-ons/translators/raw/ru.catkeys @@ -1,8 +1,9 @@ -1 russian x-vnd.Haiku-RAWTranslator 2229230003 +1 russian x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Настройки RAW транслятора Version %d.%d.%d, %s ConfigView Версия %d.%d.%d, %s RAW image translator RAWTranslator Транслятор RAW изображений RAW Settings RAWTranslator main Настройки RAW транслятора RAW images RAWTranslator RAW изображения +RAW image translator ConfigView Транслятор RAW изображений %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') RAW изображение %s Based on Dave Coffin's dcraw 8.63 ConfigView Основан на dcraw 8.63 от Dave Coffin diff --git a/data/catalogs/add-ons/translators/raw/sk.catkeys b/data/catalogs/add-ons/translators/raw/sk.catkeys index f05ad62a1d..b794017352 100644 --- a/data/catalogs/add-ons/translators/raw/sk.catkeys +++ b/data/catalogs/add-ons/translators/raw/sk.catkeys @@ -1,8 +1,9 @@ -1 slovak x-vnd.Haiku-RAWTranslator 2229230003 +1 slovak x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Nastavenia Prekladača RAW Version %d.%d.%d, %s ConfigView Verzia %d.%d.%d, %s RAW image translator RAWTranslator Prekladač obrázkov RAW RAW Settings RAWTranslator main Nastavenia RAW RAW images RAWTranslator Obrázky RAW +RAW image translator ConfigView Prekladač obrázkov RAW %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s obrázok RAW Based on Dave Coffin's dcraw 8.63 ConfigView Založené na dcraw 8.63 od Dava Coffina diff --git a/data/catalogs/add-ons/translators/raw/uk.catkeys b/data/catalogs/add-ons/translators/raw/uk.catkeys index 974aff609e..04ca963b51 100644 --- a/data/catalogs/add-ons/translators/raw/uk.catkeys +++ b/data/catalogs/add-ons/translators/raw/uk.catkeys @@ -1,8 +1,9 @@ -1 ukrainian x-vnd.Haiku-RAWTranslator 2229230003 +1 ukrainian x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView Настройки Перетворювача RAW Version %d.%d.%d, %s ConfigView Версія %d.%d.%d, %s RAW image translator RAWTranslator Перетворювач зображень RAW RAW Settings RAWTranslator main Настройки RAW RAW images RAWTranslator Зображення RAW +RAW image translator ConfigView Перетворювач зображень RAW %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW образу Based on Dave Coffin's dcraw 8.63 ConfigView На основі Dave Coffin's dcraw 8.63 diff --git a/data/catalogs/add-ons/translators/raw/zh_Hans.catkeys b/data/catalogs/add-ons/translators/raw/zh_Hans.catkeys index 231974d285..8fdeef97f2 100644 --- a/data/catalogs/add-ons/translators/raw/zh_Hans.catkeys +++ b/data/catalogs/add-ons/translators/raw/zh_Hans.catkeys @@ -1,8 +1,9 @@ -1 english x-vnd.Haiku-RAWTranslator 2229230003 +1 english x-vnd.Haiku-RAWTranslator 2975919330 RAWTranslator Settings ConfigView RAW 转换器设置 Version %d.%d.%d, %s ConfigView 版本 %d.%d.%d, %s RAW image translator RAWTranslator RAW 图像转换器 RAW Settings RAWTranslator main RAW 设置 RAW images RAWTranslator RAW 图像 +RAW image translator ConfigView RAW 图像转换器 %s RAW image RAWTranslator Parameter (%s) is the name of the manufacturer (like 'Canon') %s RAW 图像 Based on Dave Coffin's dcraw 8.63 ConfigView 基于 Dave Coffin 的 dcraw 8.63 diff --git a/data/catalogs/add-ons/translators/tga/de.catkeys b/data/catalogs/add-ons/translators/tga/de.catkeys index 0e5ea3b166..2abfa8a323 100644 --- a/data/catalogs/add-ons/translators/tga/de.catkeys +++ b/data/catalogs/add-ons/translators/tga/de.catkeys @@ -1,8 +1,9 @@ -1 german x-vnd.Haiku-TGATranslator 2221210336 +1 german x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa-Bild (%d Bits Truecolor) Version %d.%d.%d %s TGAView Version %d.%d.%d %s Ignore TGA alpha channel TGAView TGA-Alphakanal ignorieren Targa image (%d bits colormap) TGATranslator Targa-Bild (%d Bits Colormap) +TGA image translator TGAView TGA-Bild-Translator Targa image (%d bits RLE colormap) TGATranslator Targa-Bild (%d Bits RLE Colormap) Targa image (%d bits gray) TGATranslator Targa-Bild (%d Bits Graustufen) Written by the Haiku Translation Kit Team TGAView vom Haiku Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/el.catkeys b/data/catalogs/add-ons/translators/tga/el.catkeys index 739b076437..66a97fa6bc 100644 --- a/data/catalogs/add-ons/translators/tga/el.catkeys +++ b/data/catalogs/add-ons/translators/tga/el.catkeys @@ -1,8 +1,9 @@ -1 greek, modern (1453-) x-vnd.Haiku-TGATranslator 2221210336 +1 greek, modern (1453-) x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Εικόνα Targa (%d bits truecolor) Version %d.%d.%d %s TGAView Έκδοση %d.%d.%d %s Ignore TGA alpha channel TGAView Αγνοήση καναλιού TGA άλφα Targa image (%d bits colormap) TGATranslator Εικόνα Targa (%d bits colormap) +TGA image translator TGAView Μεταφραστής εικόνας TGA Targa image (%d bits RLE colormap) TGATranslator Εικόνα Targa (%d bits RLE colormap) Targa image (%d bits gray) TGATranslator Εικόνα Targa (%d bits gray) Written by the Haiku Translation Kit Team TGAView Γράφτηκε από την ομάδα του Haiku Translation Kit diff --git a/data/catalogs/add-ons/translators/tga/fi.catkeys b/data/catalogs/add-ons/translators/tga/fi.catkeys index 790f9f67ac..bda69a7344 100644 --- a/data/catalogs/add-ons/translators/tga/fi.catkeys +++ b/data/catalogs/add-ons/translators/tga/fi.catkeys @@ -1,8 +1,9 @@ -1 finnish x-vnd.Haiku-TGATranslator 2221210336 +1 finnish x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa-kuva (%d-bittinen truecolor-kuva) Version %d.%d.%d %s TGAView Versio %d.%d.%d %s Ignore TGA alpha channel TGAView Ohita TGA-alfakanava Targa image (%d bits colormap) TGATranslator Targa-kuva (%d-bittinen värikartta) +TGA image translator TGAView TGA-kuvamuunnin Targa image (%d bits RLE colormap) TGATranslator Targa-kuva (%d-bittinen RLE-värikartta) Targa image (%d bits gray) TGATranslator Targa-kuva (%d-bittinen harmaa) Written by the Haiku Translation Kit Team TGAView Tekijä: Haiku Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/fr.catkeys b/data/catalogs/add-ons/translators/tga/fr.catkeys index 260d8cc853..2da25b4c1c 100644 --- a/data/catalogs/add-ons/translators/tga/fr.catkeys +++ b/data/catalogs/add-ons/translators/tga/fr.catkeys @@ -1,8 +1,9 @@ -1 french x-vnd.Haiku-TGATranslator 2221210336 +1 french x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Image Targa (Vraie couleur %d bits) Version %d.%d.%d %s TGAView Version %d.%d.%d %s Ignore TGA alpha channel TGAView Ignorer le canal alpha TGA Targa image (%d bits colormap) TGATranslator Image Targa (Palette %d bits) +TGA image translator TGAView Traducteur d'images TGA Targa image (%d bits RLE colormap) TGATranslator Image Targa (Palette %d bits RLE) Targa image (%d bits gray) TGATranslator Image Targa (Gris %d bits) Written by the Haiku Translation Kit Team TGAView Écrit par l'équipe du Kit de TraductionDeDonnées de Haiku diff --git a/data/catalogs/add-ons/translators/tga/hi.catkeys b/data/catalogs/add-ons/translators/tga/hi.catkeys index 4182c1158f..1e54e95549 100644 --- a/data/catalogs/add-ons/translators/tga/hi.catkeys +++ b/data/catalogs/add-ons/translators/tga/hi.catkeys @@ -1,8 +1,9 @@ -1 hindi x-vnd.Haiku-TGATranslator 2221210336 +1 hindi x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator तारगा चित्र (%d bits truecolor) Version %d.%d.%d %s TGAView संस्करण %d.%d.%d %s Ignore TGA alpha channel TGAView TGA अल्फा चैनल को नज़र अंदाज़ करें Targa image (%d bits colormap) TGATranslator तारगा का चित्र (%d bits colormap) +TGA image translator TGAView TGA चित्र का अनुवादक Targa image (%d bits RLE colormap) TGATranslator तारगा का चित्र (%d bits RLE colormap) Targa image (%d bits gray) TGATranslator तारगा का चित्र (%d bits gray) Written by the Haiku Translation Kit Team TGAView हैकू ट्रांसलेशन किट टीम के द्वारा लिखा गया diff --git a/data/catalogs/add-ons/translators/tga/ja.catkeys b/data/catalogs/add-ons/translators/tga/ja.catkeys index 03b255d274..25c5c32fb0 100644 --- a/data/catalogs/add-ons/translators/tga/ja.catkeys +++ b/data/catalogs/add-ons/translators/tga/ja.catkeys @@ -1,8 +1,9 @@ -1 japanese x-vnd.Haiku-TGATranslator 2221210336 +1 japanese x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa イメージ (%d ビット トゥルーカラー) Version %d.%d.%d %s TGAView バージョン %d.%d.%d %s Ignore TGA alpha channel TGAView TGA のαチャンネルを無視する Targa image (%d bits colormap) TGATranslator Targa イメージ (%d ビット カラーマップ) +TGA image translator TGAView TGA イメージトランスレーター Targa image (%d bits RLE colormap) TGATranslator Targa イメージ (%d ビット RLE カラーマップ) Targa image (%d bits gray) TGATranslator Targa イメージ (%d ビット グレー) Written by the Haiku Translation Kit Team TGAView Haiku トランスレーターキットチーム作 diff --git a/data/catalogs/add-ons/translators/tga/lt.catkeys b/data/catalogs/add-ons/translators/tga/lt.catkeys index dd0a59d19e..31c6981353 100644 --- a/data/catalogs/add-ons/translators/tga/lt.catkeys +++ b/data/catalogs/add-ons/translators/tga/lt.catkeys @@ -1,8 +1,9 @@ -1 lithuanian x-vnd.Haiku-TGATranslator 2221210336 +1 lithuanian x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator TGA paveikslas (%d bitų tikrosios spalvos) Version %d.%d.%d %s TGAView Versija %d.%d.%d %s Ignore TGA alpha channel TGAView Nepaisyti TGA alfa kanalo Targa image (%d bits colormap) TGATranslator TGA paveikslas (%d bitų spalvų atvaizdis) +TGA image translator TGAView TGA paveikslų keitiklis Targa image (%d bits RLE colormap) TGATranslator TGA paveikslas (%d bitų RLE spalvų atvaizdis) Targa image (%d bits gray) TGATranslator TGA paveikslas (%d bitų pilkumo tonai) Written by the Haiku Translation Kit Team TGAView Sukūrė „Haiku“ komanda diff --git a/data/catalogs/add-ons/translators/tga/nl.catkeys b/data/catalogs/add-ons/translators/tga/nl.catkeys index 10f9d55b50..97633e6e1e 100644 --- a/data/catalogs/add-ons/translators/tga/nl.catkeys +++ b/data/catalogs/add-ons/translators/tga/nl.catkeys @@ -1,8 +1,9 @@ -1 dutch; flemish x-vnd.Haiku-TGATranslator 2221210336 +1 dutch; flemish x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa afbeelding (%d bits truecolor) Version %d.%d.%d %s TGAView Versie %d.%d.%d %s Ignore TGA alpha channel TGAView Negeer TGA alpha kanaal Targa image (%d bits colormap) TGATranslator Targa afbeelding (%d bits kleurmap) +TGA image translator TGAView TGA afbeelding vertaler Targa image (%d bits RLE colormap) TGATranslator Targa afbeelding (%d bits RLE kleurmap) Targa image (%d bits gray) TGATranslator Targa afbeelding (%d bits grijs) Written by the Haiku Translation Kit Team TGAView Geschreven door het Haiku Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/pl.catkeys b/data/catalogs/add-ons/translators/tga/pl.catkeys index 5b8de52817..e61a045bd4 100644 --- a/data/catalogs/add-ons/translators/tga/pl.catkeys +++ b/data/catalogs/add-ons/translators/tga/pl.catkeys @@ -1,8 +1,9 @@ -1 polish x-vnd.Haiku-TGATranslator 2221210336 +1 polish x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Obraz Targa (%d bitów Truecolor) Version %d.%d.%d %s TGAView Wersja %d.%d.%d %s Ignore TGA alpha channel TGAView Ignoruj kanał alpha TGA Targa image (%d bits colormap) TGATranslator Obraz Targa (%d bitów colormap) +TGA image translator TGAView Translator obrazów TGA Targa image (%d bits RLE colormap) TGATranslator Obraz Targa (%d bitów RLE colormap) Targa image (%d bits gray) TGATranslator Obraz Targa (%d-bitowa skala szarości) Written by the Haiku Translation Kit Team TGAView Stworzone przez Zespół Translation Kit Haiku diff --git a/data/catalogs/add-ons/translators/tga/ru.catkeys b/data/catalogs/add-ons/translators/tga/ru.catkeys index 81bfc99fe5..67e6093aed 100644 --- a/data/catalogs/add-ons/translators/tga/ru.catkeys +++ b/data/catalogs/add-ons/translators/tga/ru.catkeys @@ -1,8 +1,9 @@ -1 russian x-vnd.Haiku-TGATranslator 2221210336 +1 russian x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa изображение (%d битный истинный цвет) Version %d.%d.%d %s TGAView Версия %d.%d.%d %s Ignore TGA alpha channel TGAView Игнорировать альфа канал TGA Targa image (%d bits colormap) TGATranslator Targa изображение (%d битная цветовая карта) +TGA image translator TGAView Транслятор TGA изображений Targa image (%d bits RLE colormap) TGATranslator Targa изображение (%d битная цветовая карта RLE) Targa image (%d bits gray) TGATranslator Targa изображение (%d битное серое) Written by the Haiku Translation Kit Team TGAView Разработан командой Haiku Translation Kit diff --git a/data/catalogs/add-ons/translators/tga/sk.catkeys b/data/catalogs/add-ons/translators/tga/sk.catkeys index 8845c583ec..144004ccd8 100644 --- a/data/catalogs/add-ons/translators/tga/sk.catkeys +++ b/data/catalogs/add-ons/translators/tga/sk.catkeys @@ -1,8 +1,9 @@ -1 slovak x-vnd.Haiku-TGATranslator 2221210336 +1 slovak x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Obrázok Targa (%d-bitový truecolor) Version %d.%d.%d %s TGAView Verzia %d.%d.%d %s Ignore TGA alpha channel TGAView Ignorovať alfa kanál TGA Targa image (%d bits colormap) TGATranslator Obrázok Targa (%d-bitová farebná mapa) +TGA image translator TGAView Prekladač obrázkov TGA Targa image (%d bits RLE colormap) TGATranslator Obrázok Targa (%d-bitová farebná mapa RLE) Targa image (%d bits gray) TGATranslator Obrázok Targa (%d bitov šedej) Written by the Haiku Translation Kit Team TGAView Napísal Haiku Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/sv.catkeys b/data/catalogs/add-ons/translators/tga/sv.catkeys index 04f168ddee..1c066b8491 100644 --- a/data/catalogs/add-ons/translators/tga/sv.catkeys +++ b/data/catalogs/add-ons/translators/tga/sv.catkeys @@ -1,8 +1,9 @@ -1 swedish x-vnd.Haiku-TGATranslator 2221210336 +1 swedish x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targabild (%d bitars truecolor) Version %d.%d.%d %s TGAView Version %d.%d.%d %s Ignore TGA alpha channel TGAView Ignorera TGA-alfakanal Targa image (%d bits colormap) TGATranslator Targabild (%d bitars färgbibliotek) +TGA image translator TGAView TGA-bildöversättare Targa image (%d bits RLE colormap) TGATranslator Targabild (%d bitars RLE färgbibliotek) Targa image (%d bits gray) TGATranslator Targabild (%d bitars gråskala) Written by the Haiku Translation Kit Team TGAView Skrivet av Haikus Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/uk.catkeys b/data/catalogs/add-ons/translators/tga/uk.catkeys index 372cbf6640..ab5c2fbb15 100644 --- a/data/catalogs/add-ons/translators/tga/uk.catkeys +++ b/data/catalogs/add-ons/translators/tga/uk.catkeys @@ -1,8 +1,9 @@ -1 ukrainian x-vnd.Haiku-TGATranslator 2221210336 +1 ukrainian x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Зображення Targa (%d біт повнокольорове) Version %d.%d.%d %s TGAView Версія %d.%d.%d %s Ignore TGA alpha channel TGAView Ігнорувати альфа канал TGA Targa image (%d bits colormap) TGATranslator Зображення Targa ( палітра кольорів %d біт) +TGA image translator TGAView Перетворювач зображеньTGA Targa image (%d bits RLE colormap) TGATranslator Зображення Targa (палітра кольорів RLE %d біт) Targa image (%d bits gray) TGATranslator Зображення Targa (у відтінках сірого %d біт) Written by the Haiku Translation Kit Team TGAView Автори Haiku Translation Kit Team diff --git a/data/catalogs/add-ons/translators/tga/zh_Hans.catkeys b/data/catalogs/add-ons/translators/tga/zh_Hans.catkeys index 91343cd062..1a0e70a7a3 100644 --- a/data/catalogs/add-ons/translators/tga/zh_Hans.catkeys +++ b/data/catalogs/add-ons/translators/tga/zh_Hans.catkeys @@ -1,8 +1,9 @@ -1 english x-vnd.Haiku-TGATranslator 2221210336 +1 english x-vnd.Haiku-TGATranslator 3289993499 Targa image (%d bits truecolor) TGATranslator Targa 图像(%d 位真彩) Version %d.%d.%d %s TGAView 版本 %d.%d.%d %s Ignore TGA alpha channel TGAView 忽略 TGA 测试频道 Targa image (%d bits colormap) TGATranslator Targa 图像(%d 位色图) +TGA image translator TGAView TGA 图像转换器 Targa image (%d bits RLE colormap) TGATranslator Targa 图像(%d 为 RLE 色图) Targa image (%d bits gray) TGATranslator Targa 图像(%d 位灰度) Written by the Haiku Translation Kit Team TGAView 由 Haiku Translation Kit Team 编写 diff --git a/data/catalogs/add-ons/translators/tiff/de.catkeys b/data/catalogs/add-ons/translators/tiff/de.catkeys index 9d20f84b26..393ba1af76 100644 --- a/data/catalogs/add-ons/translators/tiff/de.catkeys +++ b/data/catalogs/add-ons/translators/tiff/de.catkeys @@ -1,8 +1,9 @@ -1 german x-vnd.Haiku-TIFFTranslator 2354712721 +1 german x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: Ordner konnte nicht gesetzt werden\n TIFF image TIFFTranslator TIFF-Bild TIFF Library: TIFFView TIFF-Bibliothek: +TIFF image translator TIFFView TIFF-Bild-Translator None TIFFView Keine TIFF images TIFFTranslator TIFF-Bilder TIFFTranslator Settings TIFFTranslator TIFFTranslator-Einstellungen diff --git a/data/catalogs/add-ons/translators/tiff/el.catkeys b/data/catalogs/add-ons/translators/tiff/el.catkeys index 9b358b760a..9c229341c6 100644 --- a/data/catalogs/add-ons/translators/tiff/el.catkeys +++ b/data/catalogs/add-ons/translators/tiff/el.catkeys @@ -1,8 +1,9 @@ -1 greek, modern (1453-) x-vnd.Haiku-TIFFTranslator 2354712721 +1 greek, modern (1453-) x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: αδυναμία ορισμού του καταλόγου\n TIFF image TIFFTranslator TIFF εικόνα TIFF Library: TIFFView TIFF Βιβλιοθήκη: +TIFF image translator TIFFView Μεταφραστής εικόνων TIFF None TIFFView Κανένα TIFF images TIFFTranslator TIFF εικόνες TIFFTranslator Settings TIFFTranslator Ρυθμίσεις μεταφραστή TIFF diff --git a/data/catalogs/add-ons/translators/tiff/fi.catkeys b/data/catalogs/add-ons/translators/tiff/fi.catkeys index 9496a04d64..46a6393dfa 100644 --- a/data/catalogs/add-ons/translators/tiff/fi.catkeys +++ b/data/catalogs/add-ons/translators/tiff/fi.catkeys @@ -1,8 +1,9 @@ -1 finnish x-vnd.Haiku-TIFFTranslator 2354712721 +1 finnish x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: ei voitu asettaa hakemistoa\n TIFF image TIFFTranslator TIFF-kuva TIFF Library: TIFFView TIFF-kirjasto: +TIFF image translator TIFFView TIFF-kuvamuunnin None TIFFView Ei mikään TIFF images TIFFTranslator TIFF-kuvat TIFFTranslator Settings TIFFTranslator TIFF-muunninasetukset diff --git a/data/catalogs/add-ons/translators/tiff/fr.catkeys b/data/catalogs/add-ons/translators/tiff/fr.catkeys index 216bad8521..00dc9e2993 100644 --- a/data/catalogs/add-ons/translators/tiff/fr.catkeys +++ b/data/catalogs/add-ons/translators/tiff/fr.catkeys @@ -1,8 +1,9 @@ -1 french x-vnd.Haiku-TIFFTranslator 2354712721 +1 french x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identification de l'entête TIFF : impossible de déterminer l'annuaire\n TIFF image TIFFTranslator Image TIFF TIFF Library: TIFFView Bibliothèque TIFF : +TIFF image translator TIFFView Traducteur d'images TIFF None TIFFView Aucun TIFF images TIFFTranslator Images TIFF TIFFTranslator Settings TIFFTranslator Réglages du traducteur TIFF diff --git a/data/catalogs/add-ons/translators/tiff/lt.catkeys b/data/catalogs/add-ons/translators/tiff/lt.catkeys index 6b49a8831e..2d66de3099 100644 --- a/data/catalogs/add-ons/translators/tiff/lt.catkeys +++ b/data/catalogs/add-ons/translators/tiff/lt.catkeys @@ -1,8 +1,9 @@ -1 lithuanian x-vnd.Haiku-TIFFTranslator 2354712721 +1 lithuanian x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: nepavyko nustatyti katalogo\n TIFF image TIFFTranslator TIFF paveikslas TIFF Library: TIFFView TIFF biblioteka: +TIFF image translator TIFFView TIFF paveikslų keitiklis None TIFFView jokio TIFF images TIFFTranslator TIFF paveikslai TIFFTranslator Settings TIFFTranslator TIFF keitiklio nuostatos diff --git a/data/catalogs/add-ons/translators/tiff/nl.catkeys b/data/catalogs/add-ons/translators/tiff/nl.catkeys index 25d558fc50..0ac95f4ce6 100644 --- a/data/catalogs/add-ons/translators/tiff/nl.catkeys +++ b/data/catalogs/add-ons/translators/tiff/nl.catkeys @@ -1,8 +1,9 @@ -1 dutch; flemish x-vnd.Haiku-TIFFTranslator 2354712721 +1 dutch; flemish x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: kan directory niet plaatsen\n TIFF image TIFFTranslator TIFF afbeelding TIFF Library: TIFFView TIFF bibliotheek: +TIFF image translator TIFFView TIFF afbeelding vertaler None TIFFView Geen TIFF images TIFFTranslator TIFF afbeeldingen TIFFTranslator Settings TIFFTranslator TIFFTranslator Instellingen diff --git a/data/catalogs/add-ons/translators/tiff/pl.catkeys b/data/catalogs/add-ons/translators/tiff/pl.catkeys index 136cebe1a6..a1367d80cd 100644 --- a/data/catalogs/add-ons/translators/tiff/pl.catkeys +++ b/data/catalogs/add-ons/translators/tiff/pl.catkeys @@ -1,8 +1,9 @@ -1 polish x-vnd.Haiku-TIFFTranslator 2354712721 +1 polish x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: nie można ustawić katalogu\n TIFF image TIFFTranslator Obraz TIFF TIFF Library: TIFFView Biblioteka TIFF +TIFF image translator TIFFView Translator obrazów TIFF None TIFFView Brak TIFF images TIFFTranslator Obrazy TIFF TIFFTranslator Settings TIFFTranslator Ustawienia translatora TIFF diff --git a/data/catalogs/add-ons/translators/tiff/ro.catkeys b/data/catalogs/add-ons/translators/tiff/ro.catkeys index 819ca9a525..884f2d1c68 100644 --- a/data/catalogs/add-ons/translators/tiff/ro.catkeys +++ b/data/catalogs/add-ons/translators/tiff/ro.catkeys @@ -1,8 +1,9 @@ -1 romanian x-vnd.Haiku-TIFFTranslator 2354712721 +1 romanian x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: nu s-a putut configura dosarul\n TIFF image TIFFTranslator Imagine TIFF TIFF Library: TIFFView Bibliotecă TIFF: +TIFF image translator TIFFView Traducător imagine TIFF None TIFFView Nimic TIFF images TIFFTranslator Imagini TIFF TIFFTranslator Settings TIFFTranslator Configurări TraducătorTIFF diff --git a/data/catalogs/add-ons/translators/tiff/sk.catkeys b/data/catalogs/add-ons/translators/tiff/sk.catkeys index 51c07139bf..8501457ab0 100644 --- a/data/catalogs/add-ons/translators/tiff/sk.catkeys +++ b/data/catalogs/add-ons/translators/tiff/sk.catkeys @@ -1,8 +1,9 @@ -1 slovak x-vnd.Haiku-TIFFTranslator 2354712721 +1 slovak x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: nepodarilo sa nastaviť adresár\n TIFF image TIFFTranslator Obrázok TIFF TIFF Library: TIFFView Knižnica TIFF: +TIFF image translator TIFFView Prekladač obrázkov TIFF None TIFFView Žiadne TIFF images TIFFTranslator Obrázky TIFF TIFFTranslator Settings TIFFTranslator Nastavenia TIFFTranslator diff --git a/data/catalogs/add-ons/translators/tiff/sv.catkeys b/data/catalogs/add-ons/translators/tiff/sv.catkeys index 3316ba5ea0..adb8783520 100644 --- a/data/catalogs/add-ons/translators/tiff/sv.catkeys +++ b/data/catalogs/add-ons/translators/tiff/sv.catkeys @@ -1,8 +1,9 @@ -1 swedish x-vnd.Haiku-TIFFTranslator 2354712721 +1 swedish x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header: kunde inte ange mapp\n TIFF image TIFFTranslator TIFF-bild TIFF Library: TIFFView TIFF-bibliotek: +TIFF image translator TIFFView TIFF-bildöversättare None TIFFView Ingen TIFF images TIFFTranslator TIFF-bilder TIFFTranslator Settings TIFFTranslator TIFF-bildinställningar diff --git a/data/catalogs/add-ons/translators/tiff/uk.catkeys b/data/catalogs/add-ons/translators/tiff/uk.catkeys index 9c31d43be7..0976f14cb7 100644 --- a/data/catalogs/add-ons/translators/tiff/uk.catkeys +++ b/data/catalogs/add-ons/translators/tiff/uk.catkeys @@ -1,8 +1,9 @@ -1 ukrainian x-vnd.Haiku-TIFFTranslator 2354712721 +1 ukrainian x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator iВизначення заголовка tiff: неможливо встановити каталог\n TIFF image TIFFTranslator Зображення TIFF TIFF Library: TIFFView Бібліотека TIFF: +TIFF image translator TIFFView Перетворювач зображень TIFF None TIFFView Жоден TIFF images TIFFTranslator Зображення TIFF TIFFTranslator Settings TIFFTranslator Настройки перетворювача TIFF diff --git a/data/catalogs/add-ons/translators/tiff/zh_Hans.catkeys b/data/catalogs/add-ons/translators/tiff/zh_Hans.catkeys index df83378260..e94181f349 100644 --- a/data/catalogs/add-ons/translators/tiff/zh_Hans.catkeys +++ b/data/catalogs/add-ons/translators/tiff/zh_Hans.catkeys @@ -1,8 +1,9 @@ -1 english x-vnd.Haiku-TIFFTranslator 2354712721 +1 english x-vnd.Haiku-TIFFTranslator 237855326 LZW TIFFView LZW identify_tiff_header: couldn't set directory\n TIFFTranslator identify_tiff_header:无法设置目录\n TIFF image TIFFTranslator TIFF 图像 TIFF Library: TIFFView TIFF 库: +TIFF image translator TIFFView TIFF 图像转换器 None TIFFView 无 TIFF images TIFFTranslator TIFF 图像 TIFFTranslator Settings TIFFTranslator TIFF 转换器设置 diff --git a/data/catalogs/add-ons/translators/webp/de.catkeys b/data/catalogs/add-ons/translators/webp/de.catkeys index 6ff6a87182..b8f2069722 100644 --- a/data/catalogs/add-ons/translators/webp/de.catkeys +++ b/data/catalogs/add-ons/translators/webp/de.catkeys @@ -1,5 +1,6 @@ -1 german x-vnd.Haiku-WebPTranslator 2427600890 +1 german x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Komprimierungsart: +WebP image translator ConfigView WebP-Bild-Translator Based on libwebp v0.1, ConfigView Basiert auf libwebp v0.1 Preset ConfigView Voreinstellung WebP images WebPTranslator WebP-Bilder diff --git a/data/catalogs/add-ons/translators/webp/el.catkeys b/data/catalogs/add-ons/translators/webp/el.catkeys index e3dbd78829..450cb1a3e5 100644 --- a/data/catalogs/add-ons/translators/webp/el.catkeys +++ b/data/catalogs/add-ons/translators/webp/el.catkeys @@ -1,5 +1,6 @@ -1 greek, modern (1453-) x-vnd.Haiku-WebPTranslator 2427600890 +1 greek, modern (1453-) x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Μέθοδος συμπίεσης: +WebP image translator ConfigView Μεταφραστής εικόνας WebP Based on libwebp v0.1, ConfigView Βασισμένο στο libwebp v0.1, Preset ConfigView Προεπιλογή WebP images WebPTranslator Εικόνες WebP diff --git a/data/catalogs/add-ons/translators/webp/fr.catkeys b/data/catalogs/add-ons/translators/webp/fr.catkeys index d2f3b463c6..f97f1fff28 100644 --- a/data/catalogs/add-ons/translators/webp/fr.catkeys +++ b/data/catalogs/add-ons/translators/webp/fr.catkeys @@ -1,5 +1,6 @@ -1 french x-vnd.Haiku-WebPTranslator 2427600890 +1 french x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Méthode de compression : +WebP image translator ConfigView Traducteur d'images WebP Based on libwebp v0.1, ConfigView Basé sur libwebp v0.1, Preset ConfigView Préréglage WebP images WebPTranslator Images WebP diff --git a/data/catalogs/add-ons/translators/webp/hi.catkeys b/data/catalogs/add-ons/translators/webp/hi.catkeys index 58fc25e32c..98450b3c27 100644 --- a/data/catalogs/add-ons/translators/webp/hi.catkeys +++ b/data/catalogs/add-ons/translators/webp/hi.catkeys @@ -1,5 +1,6 @@ -1 hindi x-vnd.Haiku-WebPTranslator 2427600890 +1 hindi x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView काम्प्रेस्शन का तरीका: +WebP image translator ConfigView WebP चित्र का अनुवादक Based on libwebp v0.1, ConfigView libwebp v0.1 पर आधारित, Preset ConfigView प्रीसेट WebP images WebPTranslator WebP चित्र diff --git a/data/catalogs/add-ons/translators/webp/ja.catkeys b/data/catalogs/add-ons/translators/webp/ja.catkeys index 186ba72b31..b9178c0536 100644 --- a/data/catalogs/add-ons/translators/webp/ja.catkeys +++ b/data/catalogs/add-ons/translators/webp/ja.catkeys @@ -1,5 +1,6 @@ -1 japanese x-vnd.Haiku-WebPTranslator 2427600890 +1 japanese x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView 圧縮方法: +WebP image translator ConfigView WebP イメージトランスレーター Based on libwebp v0.1, ConfigView libwebp v0.1 に基づく、 Preset ConfigView プリセット: WebP images WebPTranslator WebP イメージ diff --git a/data/catalogs/add-ons/translators/webp/lt.catkeys b/data/catalogs/add-ons/translators/webp/lt.catkeys index 1bdf672156..d9d8252813 100644 --- a/data/catalogs/add-ons/translators/webp/lt.catkeys +++ b/data/catalogs/add-ons/translators/webp/lt.catkeys @@ -1,5 +1,6 @@ -1 lithuanian x-vnd.Haiku-WebPTranslator 2427600890 +1 lithuanian x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Glaudinimo būdas: +WebP image translator ConfigView „WebP“ paveikslų keitiklis Based on libwebp v0.1, ConfigView Sukurta „libwebp v0.1“ pagrindu, Preset ConfigView Ruošinys WebP images WebPTranslator WebP paveikslai diff --git a/data/catalogs/add-ons/translators/webp/nl.catkeys b/data/catalogs/add-ons/translators/webp/nl.catkeys index 71db77ebf9..39f718c6e1 100644 --- a/data/catalogs/add-ons/translators/webp/nl.catkeys +++ b/data/catalogs/add-ons/translators/webp/nl.catkeys @@ -1,5 +1,6 @@ -1 dutch; flemish x-vnd.Haiku-WebPTranslator 2427600890 +1 dutch; flemish x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Compressie methode: +WebP image translator ConfigView WebP afbeelding vertaler Based on libwebp v0.1, ConfigView Gebaseerd op libwebp v0.1, Preset ConfigView Voorinstelling WebP images WebPTranslator WebP afbeeldingen diff --git a/data/catalogs/add-ons/translators/webp/pl.catkeys b/data/catalogs/add-ons/translators/webp/pl.catkeys index 47fa1c4fa0..8226b06ad6 100644 --- a/data/catalogs/add-ons/translators/webp/pl.catkeys +++ b/data/catalogs/add-ons/translators/webp/pl.catkeys @@ -1,5 +1,6 @@ -1 polish x-vnd.Haiku-WebPTranslator 2427600890 +1 polish x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Metoda kompresji: +WebP image translator ConfigView Translator obrazów WebP Based on libwebp v0.1, ConfigView Bazuje na libwebp v0.1, Preset ConfigView Ustawienie WebP images WebPTranslator Obrazki WebP diff --git a/data/catalogs/add-ons/translators/webp/ro.catkeys b/data/catalogs/add-ons/translators/webp/ro.catkeys index ba2bcb3318..de73d62d55 100644 --- a/data/catalogs/add-ons/translators/webp/ro.catkeys +++ b/data/catalogs/add-ons/translators/webp/ro.catkeys @@ -1,4 +1,5 @@ -1 romanian x-vnd.Haiku-WebPTranslator 220563709 +1 romanian x-vnd.Haiku-WebPTranslator 990065984 +WebP image translator ConfigView Traducător imagine WebP WebP images WebPTranslator Imagini WebP WebPTranslator Settings ConfigView Configurări TraducătorWebP WebP Settings main Configurări WebP diff --git a/data/catalogs/add-ons/translators/webp/ru.catkeys b/data/catalogs/add-ons/translators/webp/ru.catkeys index 642081a026..38a157e6ff 100644 --- a/data/catalogs/add-ons/translators/webp/ru.catkeys +++ b/data/catalogs/add-ons/translators/webp/ru.catkeys @@ -1,5 +1,6 @@ -1 russian x-vnd.Haiku-WebPTranslator 2427600890 +1 russian x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Метод сжатия +WebP image translator ConfigView Транслятор WebP изображений Based on libwebp v0.1, ConfigView Основано на libwebp v0.1, Preset ConfigView Пресет WebP images WebPTranslator WebP изображения diff --git a/data/catalogs/add-ons/translators/webp/sk.catkeys b/data/catalogs/add-ons/translators/webp/sk.catkeys index 0e26410570..70827d44dc 100644 --- a/data/catalogs/add-ons/translators/webp/sk.catkeys +++ b/data/catalogs/add-ons/translators/webp/sk.catkeys @@ -1,5 +1,6 @@ -1 slovak x-vnd.Haiku-WebPTranslator 2427600890 +1 slovak x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Spôsob kompresie: +WebP image translator ConfigView Prekladač obrázkov WebP Based on libwebp v0.1, ConfigView Založené na libwebp v0.1, Preset ConfigView Predvoľby WebP images WebPTranslator Obrázky WebP diff --git a/data/catalogs/add-ons/translators/webp/sv.catkeys b/data/catalogs/add-ons/translators/webp/sv.catkeys index 8ba1c66903..752db3ff9f 100644 --- a/data/catalogs/add-ons/translators/webp/sv.catkeys +++ b/data/catalogs/add-ons/translators/webp/sv.catkeys @@ -1,5 +1,6 @@ -1 swedish x-vnd.Haiku-WebPTranslator 2427600890 +1 swedish x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Komprimeringsmetod +WebP image translator ConfigView WebP bildöversättare Based on libwebp v0.1, ConfigView Baserat på libwebp v0.1, Preset ConfigView Förval WebP images WebPTranslator WebP bilder diff --git a/data/catalogs/add-ons/translators/webp/uk.catkeys b/data/catalogs/add-ons/translators/webp/uk.catkeys index cbc6b63c23..5121fde7f4 100644 --- a/data/catalogs/add-ons/translators/webp/uk.catkeys +++ b/data/catalogs/add-ons/translators/webp/uk.catkeys @@ -1,5 +1,6 @@ -1 ukrainian x-vnd.Haiku-WebPTranslator 2427600890 +1 ukrainian x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView Метод стискання +WebP image translator ConfigView Перетворювач зображень WebP Based on libwebp v0.1, ConfigView На основі libwebp v0.1, Preset ConfigView Набір параметрів WebP images WebPTranslator Зображення WebP diff --git a/data/catalogs/add-ons/translators/webp/zh_Hans.catkeys b/data/catalogs/add-ons/translators/webp/zh_Hans.catkeys index c6b716a690..ca5db020bb 100644 --- a/data/catalogs/add-ons/translators/webp/zh_Hans.catkeys +++ b/data/catalogs/add-ons/translators/webp/zh_Hans.catkeys @@ -1,5 +1,6 @@ -1 english x-vnd.Haiku-WebPTranslator 2427600890 +1 english x-vnd.Haiku-WebPTranslator 3197103165 Compression method: ConfigView 压缩方法: +WebP image translator ConfigView WebP 图像转换器 Based on libwebp v0.1, ConfigView 基于 libwebp v0.1, Preset ConfigView 预设 WebP images WebPTranslator WebP 图像 diff --git a/data/catalogs/apps/activitymonitor/be.catkeys b/data/catalogs/apps/activitymonitor/be.catkeys index 136cbb9184..d44362f1e1 100644 --- a/data/catalogs/apps/activitymonitor/be.catkeys +++ b/data/catalogs/apps/activitymonitor/be.catkeys @@ -1,8 +1,9 @@ -1 belarusian x-vnd.Haiku-ActivityMonitor 3704566709 +1 belarusian x-vnd.Haiku-ActivityMonitor 1913625522 P-faults DataSource Памылкі старонак памяці Media nodes DataSource Медыя узлы Threads DataSource Патокі MB DataSource МБ +Always on top ActivityWindow Заўсёды наверсе Add graph ActivityWindow Дадаць графік Teams DataSource Групы Hide legend ActivityView Схаваць легенду diff --git a/data/catalogs/apps/activitymonitor/pl.catkeys b/data/catalogs/apps/activitymonitor/pl.catkeys index 5dec03207a..08af687f0d 100644 --- a/data/catalogs/apps/activitymonitor/pl.catkeys +++ b/data/catalogs/apps/activitymonitor/pl.catkeys @@ -1,8 +1,9 @@ -1 polish x-vnd.Haiku-ActivityMonitor 3704566709 +1 polish x-vnd.Haiku-ActivityMonitor 1913625522 P-faults DataSource P-błędy Media nodes DataSource Węzły multimedialne Threads DataSource Wątki MB DataSource MB +Always on top ActivityWindow Zawsze na wierzchu Add graph ActivityWindow Dodaj wykres Teams DataSource Zespoły Hide legend ActivityView Ukryj legendę diff --git a/data/catalogs/apps/deskbar/be.catkeys b/data/catalogs/apps/deskbar/be.catkeys index 7c21144ad2..8dfe58a47e 100644 --- a/data/catalogs/apps/deskbar/be.catkeys +++ b/data/catalogs/apps/deskbar/be.catkeys @@ -1,16 +1,19 @@ -1 belarusian x-vnd.Be-TSKB 1042823442 +1 belarusian x-vnd.Be-TSKB 2335730970 Power off DeskbarMenu Выключыць +Sort applications by name PreferencesWindow Сартаваць прагамы па назвах Suspend DeskbarMenu Прыпыніць Hide clock TimeView Схаваць гадзіннік Applications PreferencesWindow Праграмы Time preferences… TimeView Наладкі Часу… About Haiku DeskbarMenu Пра Haiku +Edit in Tracker… PreferencesWindow Рэдагаваць у Тракеры… Recent documents: PreferencesWindow Нядаўнія дакументы: Recent applications DeskbarMenu Нядаўнія праграмы Applications B_USER_DESKBAR_DIRECTORY/Applications Праграмы Find… DeskbarMenu Знайсці… Show clock Tray Паказаць гадзіннік Window PreferencesWindow Акно +Defaults PreferencesWindow Прадвызначаныя Menu PreferencesWindow Меню Recent documents DeskbarMenu Нядаўнія дакументы Auto-hide PreferencesWindow Схаваць аўтаматычна @@ -28,6 +31,7 @@ Restart Tracker DeskbarMenu Перазапусціць Tracker Close all WindowMenu Закрыць усё Deskbar preferences PreferencesWindow Наладкі Deskbar Mount DeskbarMenu Прымацаваць +Revert PreferencesWindow Вярнуць Small PreferencesWindow Малы Recent applications: PreferencesWindow Нядаўнія праграмы: Shutdown… DeskbarMenu Спыніць… diff --git a/data/catalogs/apps/deskbar/el.catkeys b/data/catalogs/apps/deskbar/el.catkeys index 0ddc6df1ea..e2a47aac2b 100644 --- a/data/catalogs/apps/deskbar/el.catkeys +++ b/data/catalogs/apps/deskbar/el.catkeys @@ -1,5 +1,6 @@ -1 greek, modern (1453-) x-vnd.Be-TSKB 1615035932 +1 greek, modern (1453-) x-vnd.Be-TSKB 1259752388 Power off DeskbarMenu Απενεργοποίηση +Applications PreferencesWindow Εφαρμογές Recent documents: PreferencesWindow Πρόσφατα έγγραφα: Recent applications DeskbarMenu Πρόσφατες εφαρμογές Applications B_USER_DESKBAR_DIRECTORY/Applications Εφαρμογές diff --git a/data/catalogs/apps/deskbar/fr.catkeys b/data/catalogs/apps/deskbar/fr.catkeys index f7731a1988..2fc7902251 100644 --- a/data/catalogs/apps/deskbar/fr.catkeys +++ b/data/catalogs/apps/deskbar/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Be-TSKB 4028879882 +1 french x-vnd.Be-TSKB 2335730970 Power off DeskbarMenu Éteindre Sort applications by name PreferencesWindow Trier les applications par nom Suspend DeskbarMenu Mettre en veille @@ -6,12 +6,14 @@ Hide clock TimeView Masquer l'horloge Applications PreferencesWindow Applications Time preferences… TimeView Préférences de l'heure… About Haiku DeskbarMenu À propos de Haiku +Edit in Tracker… PreferencesWindow Éditer dans le Tracker… Recent documents: PreferencesWindow Documents récents : Recent applications DeskbarMenu Applications récentes Applications B_USER_DESKBAR_DIRECTORY/Applications Applications Find… DeskbarMenu Rechercher… Show clock Tray Afficher l'horloge Window PreferencesWindow Fenêtre +Defaults PreferencesWindow Valeurs par défaut Menu PreferencesWindow Menu Recent documents DeskbarMenu Documents récents Auto-hide PreferencesWindow Masquer automatiquement @@ -29,6 +31,7 @@ Restart Tracker DeskbarMenu Redémarrer le Tracker Close all WindowMenu Tout fermer Deskbar preferences PreferencesWindow Réglages de la Deskbar Mount DeskbarMenu Monter +Revert PreferencesWindow Rétablir Small PreferencesWindow Petite Recent applications: PreferencesWindow Applications récentes : Shutdown… DeskbarMenu Arrêter… diff --git a/data/catalogs/apps/deskbar/hi.catkeys b/data/catalogs/apps/deskbar/hi.catkeys index 4e5ffaf97c..50364f614c 100644 --- a/data/catalogs/apps/deskbar/hi.catkeys +++ b/data/catalogs/apps/deskbar/hi.catkeys @@ -1,4 +1,5 @@ -1 hindi x-vnd.Be-TSKB 1712999025 +1 hindi x-vnd.Be-TSKB 1357715481 +Applications PreferencesWindow अनुप्रयोग Recent documents: PreferencesWindow हाल ही में दस्तावेजों: Applications B_USER_DESKBAR_DIRECTORY/Applications अनुप्रयोग Window PreferencesWindow विन्दोव्स diff --git a/data/catalogs/apps/deskbar/ja.catkeys b/data/catalogs/apps/deskbar/ja.catkeys index 98561a6bdb..9b9a7f9227 100644 --- a/data/catalogs/apps/deskbar/ja.catkeys +++ b/data/catalogs/apps/deskbar/ja.catkeys @@ -25,7 +25,7 @@ Deskbar System name Deskbar Restart system DeskbarMenu システムを再起動 Large PreferencesWindow 大 Auto-raise PreferencesWindow マウスオーバーで手前に -Recent folders: PreferencesWindow 最近開いたフォルダー: +Recent folders: PreferencesWindow 最近開いたフォルダー Show application expander PreferencesWindow エキスパンダーを表示 Restart Tracker DeskbarMenu Tracker を再起動 Close all WindowMenu すべて閉じる diff --git a/data/catalogs/apps/deskbar/nl.catkeys b/data/catalogs/apps/deskbar/nl.catkeys index cf6099c246..141838e7c7 100644 --- a/data/catalogs/apps/deskbar/nl.catkeys +++ b/data/catalogs/apps/deskbar/nl.catkeys @@ -1,6 +1,7 @@ -1 dutch; flemish x-vnd.Be-TSKB 2987454543 +1 dutch; flemish x-vnd.Be-TSKB 2632170999 Power off DeskbarMenu Uitzetten Suspend DeskbarMenu Opschorten +Applications PreferencesWindow Toepassingen Time preferences… TimeView Tijdsvoorkeuren… About Haiku DeskbarMenu Over Haiku Recent documents: PreferencesWindow Recente documenten: diff --git a/data/catalogs/apps/deskbar/pl.catkeys b/data/catalogs/apps/deskbar/pl.catkeys index f720e5d40a..498ab84b8c 100644 --- a/data/catalogs/apps/deskbar/pl.catkeys +++ b/data/catalogs/apps/deskbar/pl.catkeys @@ -1,15 +1,19 @@ -1 polish x-vnd.Be-TSKB 1398106986 +1 polish x-vnd.Be-TSKB 2335730970 Power off DeskbarMenu Wyłącz komputer +Sort applications by name PreferencesWindow Sortuj programy po nazwie Suspend DeskbarMenu Wstrzymaj Hide clock TimeView Ukryj zegar +Applications PreferencesWindow Aplikacje Time preferences… TimeView Ustawienia czasu... About Haiku DeskbarMenu O Haiku +Edit in Tracker… PreferencesWindow Edytuj w Trakerze… Recent documents: PreferencesWindow Ostatnio przeglądane dokumenty: Recent applications DeskbarMenu Ostatnio uruchomione aplikacje Applications B_USER_DESKBAR_DIRECTORY/Applications Aplikacje Find… DeskbarMenu Wyszukaj… Show clock Tray Pokaż zegar Window PreferencesWindow Położenie +Defaults PreferencesWindow Ustawienia domyślne Menu PreferencesWindow Menu Recent documents DeskbarMenu Ostatnio otwarte dokumenty Auto-hide PreferencesWindow Autoukrywanie @@ -27,6 +31,7 @@ Restart Tracker DeskbarMenu Uruchom ponownie Trackera Close all WindowMenu Zamknij wszystkie okna Deskbar preferences PreferencesWindow Ustawienia Panelu Pulpitu Mount DeskbarMenu Zamontuj +Revert PreferencesWindow Przywróć Small PreferencesWindow Małe Recent applications: PreferencesWindow Ostatnio używane aplikacje: Shutdown… DeskbarMenu Wyłącz… diff --git a/data/catalogs/apps/deskbar/pt_BR.catkeys b/data/catalogs/apps/deskbar/pt_BR.catkeys index 55d70242bb..bf9581185b 100644 --- a/data/catalogs/apps/deskbar/pt_BR.catkeys +++ b/data/catalogs/apps/deskbar/pt_BR.catkeys @@ -1,16 +1,19 @@ -1 portuguese (brazil) x-vnd.Be-TSKB 1042823442 +1 portuguese (brazil) x-vnd.Be-TSKB 2335730970 Power off DeskbarMenu Desligar +Sort applications by name PreferencesWindow Ordenar aplicativos pelo nome Suspend DeskbarMenu Suspender Hide clock TimeView Ocultar relógio Applications PreferencesWindow Aplicativos Time preferences… TimeView Preferências de hora… About Haiku DeskbarMenu Sobre o Haiku +Edit in Tracker… PreferencesWindow Editar no Rastreador… Recent documents: PreferencesWindow Documentos recentes: Recent applications DeskbarMenu Aplicativos recentes Applications B_USER_DESKBAR_DIRECTORY/Applications Aplicativos Find… DeskbarMenu Localizar… Show clock Tray Exibir relógio Window PreferencesWindow Janela +Defaults PreferencesWindow Padrões Menu PreferencesWindow Menu Recent documents DeskbarMenu Documentos recentes Auto-hide PreferencesWindow Ocultar automaticamente @@ -28,6 +31,7 @@ Restart Tracker DeskbarMenu Reiniciar Rastreador Close all WindowMenu Fechar tudo Deskbar preferences PreferencesWindow Preferências da Deskbar Mount DeskbarMenu Montar +Revert PreferencesWindow Reverter Small PreferencesWindow Pequeno Recent applications: PreferencesWindow Aplicativos recentes: Shutdown… DeskbarMenu Desligar… diff --git a/data/catalogs/apps/deskbar/ro.catkeys b/data/catalogs/apps/deskbar/ro.catkeys index 8aff504d2d..fb796c0b65 100644 --- a/data/catalogs/apps/deskbar/ro.catkeys +++ b/data/catalogs/apps/deskbar/ro.catkeys @@ -1,4 +1,5 @@ -1 romanian x-vnd.Be-TSKB 1712999025 +1 romanian x-vnd.Be-TSKB 1357715481 +Applications PreferencesWindow Aplicații Recent documents: PreferencesWindow Documente recente: Applications B_USER_DESKBAR_DIRECTORY/Applications Aplicații Window PreferencesWindow Fereastră diff --git a/data/catalogs/apps/deskbar/uk.catkeys b/data/catalogs/apps/deskbar/uk.catkeys index 62fb031e0b..80efbccc7a 100644 --- a/data/catalogs/apps/deskbar/uk.catkeys +++ b/data/catalogs/apps/deskbar/uk.catkeys @@ -1,5 +1,6 @@ -1 ukrainian x-vnd.Be-TSKB 1615035932 +1 ukrainian x-vnd.Be-TSKB 1259752388 Power off DeskbarMenu Вимкнути +Applications PreferencesWindow Додатки Recent documents: PreferencesWindow Недавні документи: Recent applications DeskbarMenu Останні програми Applications B_USER_DESKBAR_DIRECTORY/Applications Додатки diff --git a/data/catalogs/apps/diskusage/el.catkeys b/data/catalogs/apps/diskusage/el.catkeys index 51e4e67732..1c00b51ae7 100644 --- a/data/catalogs/apps/diskusage/el.catkeys +++ b/data/catalogs/apps/diskusage/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-DiskUsage 2682355634 +1 greek, modern (1453-) x-vnd.Haiku-DiskUsage 1031969768 Scanning %refName% Scanner Σάρωση %refName% Size Info Window Μέγεθος Rescan Pie View Σάρωσε Ξανά @@ -9,6 +9,7 @@ no supporting apps Pie View καμιά υποστηριζόμενη εφαρμ Path Info Window Διαδρομή Scan Status View Σάρωση 9999.99 GB Status View 9999.99 GB +Rescan Status View Σάρωσε Ξανά file unavailable Status View μη διαθέσιμο αρχείο DiskUsage System name Χρήση Δίσκου %d files Status View %d αρχεία diff --git a/data/catalogs/apps/diskusage/hi.catkeys b/data/catalogs/apps/diskusage/hi.catkeys index 7e76ca8c2d..3d85827da9 100644 --- a/data/catalogs/apps/diskusage/hi.catkeys +++ b/data/catalogs/apps/diskusage/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-DiskUsage 2447717116 +1 hindi x-vnd.Haiku-DiskUsage 797331250 Scanning %refName% Scanner अवलोकन कर रहा है %refName% Size Info Window आकार Rescan Pie View पुनः अवलोकन करे @@ -9,6 +9,7 @@ no supporting apps Pie View कोई समर्थन करने वाल Path Info Window पथ Scan Status View अवलोकन करे 9999.99 GB Status View 9999.99 जीबी +Rescan Status View पुनः अवलोकन करे file unavailable Status View फ़ाइल अनुपलब्ध है DiskUsage System name डिस्क का उपयोग in %d files Info Window %d फ़ाइलो में diff --git a/data/catalogs/apps/diskusage/nl.catkeys b/data/catalogs/apps/diskusage/nl.catkeys index f36449fdd1..a3418b18e0 100644 --- a/data/catalogs/apps/diskusage/nl.catkeys +++ b/data/catalogs/apps/diskusage/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-DiskUsage 2447717116 +1 dutch; flemish x-vnd.Haiku-DiskUsage 797331250 Scanning %refName% Scanner %refName% scannen Size Info Window Grootte Rescan Pie View Opnieuw scannen @@ -9,6 +9,7 @@ no supporting apps Pie View geen ondersteunende programma's Path Info Window Pad Scan Status View Scannen 9999.99 GB Status View 9999.99 GB +Rescan Status View Opnieuw scannen file unavailable Status View bestand niet beschikbaar DiskUsage System name DiskUsage in %d files Info Window in %d bestanden diff --git a/data/catalogs/apps/diskusage/ro.catkeys b/data/catalogs/apps/diskusage/ro.catkeys index 36ef5957f9..c9b3daf007 100644 --- a/data/catalogs/apps/diskusage/ro.catkeys +++ b/data/catalogs/apps/diskusage/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-DiskUsage 2682355634 +1 romanian x-vnd.Haiku-DiskUsage 1031969768 Scanning %refName% Scanner Se scanează %refName% Size Info Window Dimensiune Rescan Pie View Rescanează @@ -9,6 +9,7 @@ no supporting apps Pie View fără aplicații compatibile Path Info Window Cale Scan Status View Scanează 9999.99 GB Status View 9999.99 GB +Rescan Status View Rescanează file unavailable Status View fișier indisponibil DiskUsage System name UtilizareDisc %d files Status View %d fișiere diff --git a/data/catalogs/apps/diskusage/uk.catkeys b/data/catalogs/apps/diskusage/uk.catkeys index 9a0f1d5d11..3526bdd3d5 100644 --- a/data/catalogs/apps/diskusage/uk.catkeys +++ b/data/catalogs/apps/diskusage/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-DiskUsage 2682355634 +1 ukrainian x-vnd.Haiku-DiskUsage 1031969768 Scanning %refName% Scanner Сканування %refName% Size Info Window Розмір Rescan Pie View Пересканувати @@ -9,6 +9,7 @@ no supporting apps Pie View відсутні підтримувані дода Path Info Window Шлях Scan Status View Сканувати 9999.99 GB Status View 9999.99 +Rescan Status View Пересканувати file unavailable Status View файл недоступний DiskUsage System name Використання дисків %d files Status View %d файлів diff --git a/data/catalogs/apps/drivesetup/be.catkeys b/data/catalogs/apps/drivesetup/be.catkeys index 88fdcd25c5..993b97c0f6 100644 --- a/data/catalogs/apps/drivesetup/be.catkeys +++ b/data/catalogs/apps/drivesetup/be.catkeys @@ -1,11 +1,14 @@ -1 belarusian x-vnd.Haiku-DriveSetup 644135944 +1 belarusian x-vnd.Haiku-DriveSetup 3775412465 DriveSetup System name Рэдыктар дыскаў +Cancel AbstractParametersPanel Адмяніць Delete MainWindow Выдаліць Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Сапрўды жадаеце запісаць змены на дыск?\n\nУсе данные на абраным падзеле будуць беззваротна згублены! Rescan MainWindow Перасканіраваць OK MainWindow ОК Could not aquire partitioning information. MainWindow Не ўдалося атрымаць інфармацыю аб падзелах. There's no space on the partition where a child partition could be created. MainWindow Няма мечца на падзеле для стварэння даччынага падзела. +Initialize InitializeParametersPanel Ініцыялізіраваць +OK AbstractParametersPanel Добра PartitionList <пуста> Unable to find the selected partition by ID. MainWindow Не ўдалося знайсці абраны падзел па ID. Select a partition from the list below. DiskView Абярыце падзел са спісу нішэй. @@ -15,6 +18,7 @@ The selected disk is read-only. MainWindow Абраны дыск толькі Are you sure you want to format the partition \"%s\"? You will be asked again before changes are written to the disk. MainWindow Вы упэўнены, што жадаеце фарматаваць падзел \"%s\"? Дадатковае пацвержанне спатрэбіцца і непасрэдна перад запісам на дыск. Could not mount partition %s. MainWindow Не ўдалося змантаваць падзел %s. The partition %s has been successfully formatted.\n MainWindow Падзел %s паспяхова фарматаваны.\n +Change parameters MainWindow Змяніць параметры The partition %s is already unmounted. MainWindow Падзел %s ужо змантаваны. Failed to delete the partition. No changes have been written to disk. MainWindow Не ўдалося выдаліць падзел. Змены не былі запісаны на дыск. Could not delete the selected partition. MainWindow Немагчыма выдаліць абраны падзел. @@ -33,38 +37,53 @@ Write changes MainWindow Запісаць змены There was an error preparing the disk for modifications. MainWindow Адбылася памылка пры падрыхтоўцы дыску да мадыфікацый. The partition %s is already mounted. MainWindow Падзел %s ужо змантаваны. Are you sure you want to format the partition? You will be asked again before changes are written to the disk. MainWindow Вы упэўнены, што жадаеце фарматаваць падзел? Дадатковае пацвержанне спатрэбіцца і непасрэдна перад запісам на дыск. +Partition name: ChangeParametersPanel Імя падзела: +Change ChangeParametersPanel Змяніць Are you sure you want to write the changes back to disk now?\n\nAll data on the disk %s will be irretrievably lost if you do so! MainWindow Сапраўды жадаеце запісаць змены на дыск?\n\nУсе данные на абраным падзеле %s будуць беззваротна згублены! Are you sure you want to delete the selected partition?\n\nAll data on the partition will be irretrievably lost if you do so! MainWindow Сапрўды жадаеце выдаліць абраны падзел?\n\nУсе данные на абраным падзеле будуць беззваротна згублены! Create… MainWindow Стварыць… Disk system \"%s\"\" not found! MainWindow Дыскавая сістэма \"%s\"\" не знойдзена! The disk has been successfully initialized.\n MainWindow Дыск быў паспяхова ініцыялізаваны.\n Could not unmount partition %s. MainWindow Не ўдалося змантаваць падзел %s. +Failed to change the parameters of the partition. No changes have been written to disk. MainWindow Не ўдалося зманіць параметры падзела. Змены не былі запісаныя на дыск. Failed to format the partition %s!\n MainWindow Не ўдалося фарматаваць падзел %s!\n Mount MainWindow Змантаваць +Partition type PartitionList Тып падзела Are you sure you want to format a raw disk? (most people initialize the disk with a partitioning system first) You will be asked again before changes are written to the disk. MainWindow Вы упэўнены, што жадаеце фарматаваць ўвесь дыск? (у большасці выпадкаў на дыску ствараюць сыстэму падзелаў) Дадатковае пацвержанне спатрэбіцца і непасрэдна перад запісам на дыск. +The panel experienced a problem! MainWindow З панэллю ёсьць пэўная праблема! +Change parameters… MainWindow Змяніць параметры… Device PartitionList Прылада Disk MainWindow Дыск Are you sure you want to initialize the selected disk? All data will be lost. You will be asked again before changes are written to the disk.\n MainWindow Вы упэўнены, што жадаеце ініцыялізаваць абраны дыск? Усе дадзеныя з яго будуць страчаны. Дадатковае пацвержанне спатрэбіцца і непасрэдна перад запісам на дыск.\n +Partition size CreateParametersPanel Памер падзела Device DiskView Прылада Active PartitionList Актыўны Volume name PartitionList Імя тому Continue MainWindow Працягнуць Cannot delete the selected partition. MainWindow Немагчыма выдаліць абраны падзел. Mount all MainWindow Зманатаваць усё +End: %s Support Канец: %s +The panel could not return successfully. MainWindow Панэль не можа вярнуцца карэктна. Cancel MainWindow Адмяніць Delete partition MainWindow Выдаліць падзел +Are you sure you want to change parameters of the selected partition?\n\nThe partition may no longer be recognized by other operating systems anymore! MainWindow Вы ўпэўнены, што жадаеце зманіць параметры абранага падзел?\n\nГэты падзел можа стаць нераспазнаваным для іншых аперацыйных сістэм! Eject MainWindow Выцягнуць Partition MainWindow Падзел +Validation of the given parameters failed. MainWindow Не удалася праверка дадзеных параметраў стварэння падзелу. +Create CreateParametersPanel Стварыць File system PartitionList Файлавая сістэма Validation of the given creation parameters failed. MainWindow Не удалася праверка дадзеных параметраў стварэння падзелу. +Partition type: ChangeParametersPanel Тып падзела: Size PartitionList Памер Wipe (not implemented) MainWindow Вынішчыць усе дадзеныя (пакуль не працуе) Validation of the given initialization parameters failed. MainWindow Не удалася праверка дадзеных параметраў ініцыялізацыі падзелу. The selected partition does not contain a partitioning system. MainWindow Абраны падзел не мае сістымы дзялення. +Offset: %s Support Зрух: %s Are you sure you want to write the changes back to disk now?\n\nAll data on the partition %s will be irretrievably lost if you do so! MainWindow Сапрўды жадаеце запісаць змены на дыск?\n\nУсе данные на абраным падзеле %s будуць беззваротна згублены! The partition %s is currently mounted. MainWindow Падзел %s зараз змантаваны. Surface test (not implemented) MainWindow Тэст паверхні (не ажыццявіма) Format MainWindow Фарматаваць +Could not change the parameters of the selected partition. MainWindow Немагчыма змяніць параметры абранага падзела. Parameters PartitionList Параметры Creation of the partition has failed. MainWindow Не удалося стварыць падзел. The currently selected partition is not empty. MainWindow Абраны зараз падзел не пусты. diff --git a/data/catalogs/apps/drivesetup/el.catkeys b/data/catalogs/apps/drivesetup/el.catkeys index c29599dba5..e4ec367438 100644 --- a/data/catalogs/apps/drivesetup/el.catkeys +++ b/data/catalogs/apps/drivesetup/el.catkeys @@ -1,10 +1,13 @@ -1 greek, modern (1453-) x-vnd.Haiku-DriveSetup 2224844276 +1 greek, modern (1453-) x-vnd.Haiku-DriveSetup 3333034725 DriveSetup System name Εγκατάσταση Οδηγού +Cancel AbstractParametersPanel Άκυρο Delete MainWindow Διαγραφή Rescan MainWindow Επανάληψη σάρωσης OK MainWindow Εντάξει Could not aquire partitioning information. MainWindow Αδυναμία απόκτησης πληροφορίας διαμέρισης. There's no space on the partition where a child partition could be created. MainWindow Δεν υπάρχει χώρος στη κατάτμηση, όπου θα μπορούσε να δημιουργηθεί νέα κατάτμηση. +Initialize InitializeParametersPanel Αρχικοποίηση +OK AbstractParametersPanel Εντάξει PartitionList <άδειο> Unable to find the selected partition by ID. MainWindow Αδύνατο να βρεθεί η επιλεγμένη κατάτμηση ID. Select a partition from the list below. DiskView Επιλέξτε μία κατάτμηση από την παρακάτω λίστα. diff --git a/data/catalogs/apps/drivesetup/fr.catkeys b/data/catalogs/apps/drivesetup/fr.catkeys index 7c1e619ab3..4b2df6b18f 100644 --- a/data/catalogs/apps/drivesetup/fr.catkeys +++ b/data/catalogs/apps/drivesetup/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-DriveSetup 12870063 +1 french x-vnd.Haiku-DriveSetup 3775412465 DriveSetup System name Gestionnaire de disque Cancel AbstractParametersPanel Annuler Delete MainWindow Supprimer @@ -63,10 +63,13 @@ Continue MainWindow Continuer Cannot delete the selected partition. MainWindow La partition sélectionnée ne peut pas être supprimée. Mount all MainWindow Monter tout End: %s Support Fin : %s +The panel could not return successfully. MainWindow Résultat infructueux de la fenêtre. Cancel MainWindow Annuler Delete partition MainWindow Supprimer la partition +Are you sure you want to change parameters of the selected partition?\n\nThe partition may no longer be recognized by other operating systems anymore! MainWindow Êtes-vous sûr de vouloir changer les paramètres de la partition sélectionnée ?\n\nLa partition pourrait ne plus être reconnue par d'autres systèmes d'exploitation ! Eject MainWindow Éjecter Partition MainWindow Partition +Validation of the given parameters failed. MainWindow La validation des paramètres fournis a échoué. Create CreateParametersPanel Créer File system PartitionList Système de fichiers Validation of the given creation parameters failed. MainWindow Le contrôle des paramètres de création donnés a échoué. diff --git a/data/catalogs/apps/drivesetup/hi.catkeys b/data/catalogs/apps/drivesetup/hi.catkeys index 05e0382b42..59da3c4641 100644 --- a/data/catalogs/apps/drivesetup/hi.catkeys +++ b/data/catalogs/apps/drivesetup/hi.catkeys @@ -1,6 +1,7 @@ -1 hindi x-vnd.Haiku-DriveSetup 2675227205 +1 hindi x-vnd.Haiku-DriveSetup 403706406 DriveSetup System name ड्राइव सेटअप Delete MainWindow हटाएँ Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow क्या आप वास्तव में परिवर्तनों को डिस्क में अब वापस लिखना चाहते हैं ?\n\nचुने हुए विभाजन पर सभी डेटा सदा के लिए खो जाएगा, अगर आप ऐसा करते हैं! Rescan MainWindow रीस्कैन OK MainWindow ठीक है +OK AbstractParametersPanel ठीक है diff --git a/data/catalogs/apps/drivesetup/lt.catkeys b/data/catalogs/apps/drivesetup/lt.catkeys index 1bfb7a5840..01ef5f0176 100644 --- a/data/catalogs/apps/drivesetup/lt.catkeys +++ b/data/catalogs/apps/drivesetup/lt.catkeys @@ -1,11 +1,14 @@ -1 lithuanian x-vnd.Haiku-DriveSetup 644135944 +1 lithuanian x-vnd.Haiku-DriveSetup 1752326393 DriveSetup System name Diskų ženklintuvas +Cancel AbstractParametersPanel Atsisakyti Delete MainWindow Šalinti Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Ar tikrai norite pakeitimus dabar įrašyti į diską?\n\nJei tęsite toliau – visi duomenys, esantys pasirinktame skaidinyje, bus negrįžtamai prarasti! Rescan MainWindow Peržvalgyti OK MainWindow Gerai Could not aquire partitioning information. MainWindow Duomenų apie skaidinius nerasta. There's no space on the partition where a child partition could be created. MainWindow Skaidinyje nepakanka vietos loginiam diskui sukurti. +Initialize InitializeParametersPanel Ženklinti +OK AbstractParametersPanel Gerai PartitionList Unable to find the selected partition by ID. MainWindow Pasirinkto skaidinio pagal ID rasti nepavyko. Select a partition from the list below. DiskView Pasirinkite skaidinį iš žemiau esančio sąrašo. diff --git a/data/catalogs/apps/drivesetup/nl.catkeys b/data/catalogs/apps/drivesetup/nl.catkeys index 2d838c30d6..7302b06508 100644 --- a/data/catalogs/apps/drivesetup/nl.catkeys +++ b/data/catalogs/apps/drivesetup/nl.catkeys @@ -1,11 +1,14 @@ -1 dutch; flemish x-vnd.Haiku-DriveSetup 644135944 +1 dutch; flemish x-vnd.Haiku-DriveSetup 1752326393 DriveSetup System name DriveSetup +Cancel AbstractParametersPanel Annuleren Delete MainWindow Verwijderen Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Bent u zeker dat u de veranderingen nu wilt terugschrijven naar de schijf?\n\nU zult alle gegevens op de geselecteerde partitie onherroepelijk kwijt zijn als u dit doet! Rescan MainWindow Opnieuw afzoeken OK MainWindow Oké Could not aquire partitioning information. MainWindow Kon geen partitie-informatie verkrijgen. There's no space on the partition where a child partition could be created. MainWindow De partitie heeft geen ruimte waarin een onderliggende partitie kan worden gemaakt. +Initialize InitializeParametersPanel Initialiseren +OK AbstractParametersPanel Oké PartitionList Unable to find the selected partition by ID. MainWindow Kan de geselecteerde partitie niet vinden op basis van ID. Select a partition from the list below. DiskView Selecteer een partitie uit onderstaande lijst. diff --git a/data/catalogs/apps/drivesetup/ro.catkeys b/data/catalogs/apps/drivesetup/ro.catkeys index 07efcc8fb1..7ccee61117 100644 --- a/data/catalogs/apps/drivesetup/ro.catkeys +++ b/data/catalogs/apps/drivesetup/ro.catkeys @@ -1,11 +1,14 @@ -1 romanian x-vnd.Haiku-DriveSetup 2180533037 +1 romanian x-vnd.Haiku-DriveSetup 3288723486 DriveSetup System name ConfigurareDiscuri +Cancel AbstractParametersPanel Anulează Delete MainWindow Șterge Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Sigur doriți să scrieți modificările înapoi pe disc acum?\n\nToate datele de pe partiția selectată vor fi pierdute fără posibilitatea de a le recupera dacă faceți acest lucru! Rescan MainWindow Rescanează OK MainWindow Bine Could not aquire partitioning information. MainWindow Nu s-au putut obține infomațiile de partiționare. There's no space on the partition where a child partition could be created. MainWindow Nu mai există spațiu liber pe partiția unde se poate crea o partiție secundară. +Initialize InitializeParametersPanel Inițializează +OK AbstractParametersPanel Bine PartitionList Unable to find the selected partition by ID. MainWindow Nu s-a putut găsi partiția selectată după ID. Select a partition from the list below. DiskView Selectați o partiție din lista de mai jos. diff --git a/data/catalogs/apps/drivesetup/ru.catkeys b/data/catalogs/apps/drivesetup/ru.catkeys index db908bf518..7baf0c935a 100644 --- a/data/catalogs/apps/drivesetup/ru.catkeys +++ b/data/catalogs/apps/drivesetup/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-DriveSetup 2015202924 +1 russian x-vnd.Haiku-DriveSetup 3460572565 DriveSetup System name Разметка диска Cancel AbstractParametersPanel Отмена Delete MainWindow Удалить @@ -45,6 +45,7 @@ Create… MainWindow Создать… Disk system \"%s\"\" not found! MainWindow Дисковая система \"%s\"\" не обнаружена! The disk has been successfully initialized.\n MainWindow Диск был успешно инициализирован.\n Could not unmount partition %s. MainWindow Невозможно отключить раздел %s. +Failed to change the parameters of the partition. No changes have been written to disk. MainWindow Не удалось изменить параметры раздела. Изменения не были записаны на диск. Failed to format the partition %s!\n MainWindow Не удалось инициализировать раздел %s!\n Mount MainWindow Подключить Partition type PartitionList Тип раздела @@ -63,6 +64,7 @@ Mount all MainWindow Подключить все End: %s Support Конец: %s Cancel MainWindow Отмена Delete partition MainWindow Удалить раздел +Are you sure you want to change parameters of the selected partition?\n\nThe partition may no longer be recognized by other operating systems anymore! MainWindow Вы уверены, что хотите изменить параметры выбранного раздела?\n\nРаздел может больше не распознаваться другими операционными системами! Eject MainWindow Извлечь Partition MainWindow Раздел Validation of the given parameters failed. MainWindow Проверка введённых параметров не удалась. @@ -79,6 +81,7 @@ Are you sure you want to write the changes back to disk now?\n\nAll data on the The partition %s is currently mounted. MainWindow Раздел %s в данный момент подключен. Surface test (not implemented) MainWindow Тест поверхности (еще не реализовано) Format MainWindow Инициализировать +Could not change the parameters of the selected partition. MainWindow Невозможно изменить параметры выбранного раздела. Parameters PartitionList Параметры Creation of the partition has failed. MainWindow Не удалось создать раздел. The currently selected partition is not empty. MainWindow Текущий выбранный раздел не является пустым. diff --git a/data/catalogs/apps/drivesetup/sk.catkeys b/data/catalogs/apps/drivesetup/sk.catkeys index 239c25f769..eae0369f59 100644 --- a/data/catalogs/apps/drivesetup/sk.catkeys +++ b/data/catalogs/apps/drivesetup/sk.catkeys @@ -1,11 +1,14 @@ -1 slovak x-vnd.Haiku-DriveSetup 644135944 +1 slovak x-vnd.Haiku-DriveSetup 1752326393 DriveSetup System name Nastavenie diskových oblastí +Cancel AbstractParametersPanel Zrušiť Delete MainWindow Zmazať Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Ste si istí, že chcete tieto zmeny teraz zapísať na disk?\n\nAk tak urobíte, všetky údaje na vybranej diskovej oblasti budú nenávratne stratené! Rescan MainWindow Znovu preskúmať OK MainWindow OK Could not aquire partitioning information. MainWindow Nepodarilo sa získať informácie o diskových oblastiach. There's no space on the partition where a child partition could be created. MainWindow Na oblasti nie je miesto, kde by bolo možné vytvoriť podriadenú oblasť. +Initialize InitializeParametersPanel Inicializovať +OK AbstractParametersPanel OK PartitionList Unable to find the selected partition by ID. MainWindow Nebolo možné nájsť vybranú oblasť podľa ID. Select a partition from the list below. DiskView Vyberte oblasť zo zoznamu dolu. diff --git a/data/catalogs/apps/drivesetup/uk.catkeys b/data/catalogs/apps/drivesetup/uk.catkeys index 6fe867099f..b09cbc4196 100644 --- a/data/catalogs/apps/drivesetup/uk.catkeys +++ b/data/catalogs/apps/drivesetup/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-DriveSetup 4088461154 +1 ukrainian x-vnd.Haiku-DriveSetup 2061656786 DriveSetup System name DriveSetup Delete MainWindow Видалити Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Ви впевнені, що бажаєте записати зміни на диск зараз?\n\nВсі дані на вибраному розділі будуть безповоротно втрачені! @@ -6,6 +6,8 @@ Rescan MainWindow Пересканувати OK MainWindow Гаразд Could not aquire partitioning information. MainWindow Неможливо відобразити інформацію про розмітку. There's no space on the partition where a child partition could be created. MainWindow Відсутнє місце в розділі , де ви бажаєте створити дочірній розділ. +Initialize InitializeParametersPanel Ініціалізація +OK AbstractParametersPanel Гаразд PartitionList <пусто> Unable to find the selected partition by ID. MainWindow Неможливо знайти розділ за ID. Select a partition from the list below. DiskView Виберіть розділ зі списку нижче. diff --git a/data/catalogs/apps/firstbootprompt/be.catkeys b/data/catalogs/apps/firstbootprompt/be.catkeys index 63abce77e1..68702bba37 100644 --- a/data/catalogs/apps/firstbootprompt/be.catkeys +++ b/data/catalogs/apps/firstbootprompt/be.catkeys @@ -1,5 +1,6 @@ -1 belarusian x-vnd.Haiku-FirstBootPrompt 988630706 +1 belarusian x-vnd.Haiku-FirstBootPrompt 2649051796 Custom BootPromptWindow Карыстальніка +Boot to Desktop BootPromptWindow Загрузіць Працоўны Стол Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Мы дзякуем вас за спробу усталяваць Haiku. Спадзяемся, што вам спадабаецца!\n\nВы можаце абраць пажаданую мову інтэрфейса і раскладку клавіятуры ў левым спісе. Гэтыя параметры таксма могуць быць змененыя пазней.\n\nЖадаеце запусціць Усталёўшчык ці загрузіць Дэсктоп?\n Language BootPromptWindow Мова Welcome to Haiku! BootPromptWindow Вітаем! diff --git a/data/catalogs/apps/firstbootprompt/hu.catkeys b/data/catalogs/apps/firstbootprompt/hu.catkeys index 15bae403a3..42ae09a2c7 100644 --- a/data/catalogs/apps/firstbootprompt/hu.catkeys +++ b/data/catalogs/apps/firstbootprompt/hu.catkeys @@ -1,5 +1,6 @@ -1 hungarian x-vnd.Haiku-FirstBootPrompt 988630706 +1 hungarian x-vnd.Haiku-FirstBootPrompt 2649051796 Custom BootPromptWindow Egyéni +Boot to Desktop BootPromptWindow Az Asztalt Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Köszönjük, hogy kipróbálja a Haiku-t!\n\nA baloldali listából választhat nyelvet és billentyűzetkiosztást. Mindkét beállítást könnyen átállíthatja majd később az Asztalról.\n\nA Telepítőt vagy az Asztalt indítsuk most el?\n\nMegjegyzés: A Haiku programjait önkéntesek fordítják, folyamatosan. Könnyen megeshet hogy hiányosan, vagy hibásan fordított programokkal fog találkozni. Ha szeretné, csatlakozhat a munkához és kijavíthatja ezeket a oldalon. Köszönjük! Language BootPromptWindow Nyelv Welcome to Haiku! BootPromptWindow A Haiku üdvözli Önt! diff --git a/data/catalogs/apps/firstbootprompt/ja.catkeys b/data/catalogs/apps/firstbootprompt/ja.catkeys index 42e37bbaee..d1dee27f17 100644 --- a/data/catalogs/apps/firstbootprompt/ja.catkeys +++ b/data/catalogs/apps/firstbootprompt/ja.catkeys @@ -1,5 +1,6 @@ -1 japanese x-vnd.Haiku-FirstBootPrompt 988630706 +1 japanese x-vnd.Haiku-FirstBootPrompt 2649051796 Custom BootPromptWindow カスタム +Boot to Desktop BootPromptWindow デスクトップを起動 Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Haikuを試用していただきありがとうございます。Haikuのことを気に入っていただければ幸いです。\n\n左欄からご希望の言語とキーマップの選択がすぐできます。あとで、デスクトップからこれらの設定をすぐに簡単に変更できます。\n\nインストーラーを実行しますか、それともライブCDモードでデスクトップを起動しますか?\n\n注釈:Haikuアプリケーションや他のコンポーネントのロケール化は進行中のため、翻訳されていない部分が表示されることや翻訳がおかしいことがあります。Haikuの翻訳に協力したい方は、haiku-i18n-jp MLにてご連絡ください(http://freelists.org/list/haiku-i18n-jp)。\n Language BootPromptWindow 言語 Welcome to Haiku! BootPromptWindow Haiku へようこそ! diff --git a/data/catalogs/apps/firstbootprompt/pt_BR.catkeys b/data/catalogs/apps/firstbootprompt/pt_BR.catkeys index 8e95ba1ae6..5b61cbc922 100644 --- a/data/catalogs/apps/firstbootprompt/pt_BR.catkeys +++ b/data/catalogs/apps/firstbootprompt/pt_BR.catkeys @@ -1,5 +1,6 @@ -1 portuguese (brazil) x-vnd.Haiku-FirstBootPrompt 988630706 +1 portuguese (brazil) x-vnd.Haiku-FirstBootPrompt 2649051796 Custom BootPromptWindow Personalizado +Boot to Desktop BootPromptWindow Inicializar a Área de Trabalho Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Obrigado por experimentar o Haiku! Nós esperamos que você se divirta!!\n\nVocê pode escolher sua língua e o layout do teclado da lista na esquerda da qual serão usadas instantaneamente. Você pode facilmente mudar ambas as configurações no Desktop depois.\n\nVocê deseja abrir o Instalar ou continuar a carregar o Desktop?\n Language BootPromptWindow Linguagem Welcome to Haiku! BootPromptWindow Bem vindo ao Haiku! diff --git a/data/catalogs/apps/firstbootprompt/sv.catkeys b/data/catalogs/apps/firstbootprompt/sv.catkeys index 770722a6ab..e89080cb64 100644 --- a/data/catalogs/apps/firstbootprompt/sv.catkeys +++ b/data/catalogs/apps/firstbootprompt/sv.catkeys @@ -1,5 +1,6 @@ -1 swedish x-vnd.Haiku-FirstBootPrompt 988630706 +1 swedish x-vnd.Haiku-FirstBootPrompt 2649051796 Custom BootPromptWindow Anpassad +Boot to Desktop BootPromptWindow Boota till Skrivbordet Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Tack för att du testar Haiku! Vi hoppas att du kommer att gilla det!\n\nDu kan välja ditt föredragna språk och tangentbordslayout från listan till vänster. Du kan enkelt byta båda inställningarna från skrivbordet vid ett senare tillfälle.\n\nVill du starta Installeraren eller gå direkt till skrivbordet?\n Language BootPromptWindow Språk Welcome to Haiku! BootPromptWindow Välkommen till Haiku! diff --git a/data/catalogs/apps/fontdemo/pl.catkeys b/data/catalogs/apps/fontdemo/pl.catkeys index dc9b219967..27fc6c5e80 100644 --- a/data/catalogs/apps/fontdemo/pl.catkeys +++ b/data/catalogs/apps/fontdemo/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-FontDemo 1300625863 +1 polish x-vnd.Haiku-FontDemo 3522850500 Outline: ControlView Kontur: Size: 50 ControlView Rozmiar: 50 Stop cycling ControlView Zatrzymaj zmianę @@ -13,7 +13,8 @@ Font: ControlView Font: Rotation: 0 ControlView Obrót: 0 Drawing mode: ControlView Tryb rysowania: Haiku, Inc. ControlView Haiku, Inc. -Controls FontDemo Regulacja +Controls FontDemo Sterowanie +FontDemo System name Demo Czcionek Outline: %d ControlView Kontur: %d Text: ControlView Tekst: Antialiased text ControlView Wygładzany tekst diff --git a/data/catalogs/apps/launchbox/be.catkeys b/data/catalogs/apps/launchbox/be.catkeys index f4ec61ba85..2a42b7a1b6 100644 --- a/data/catalogs/apps/launchbox/be.catkeys +++ b/data/catalogs/apps/launchbox/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-LaunchBox 3016105370 +1 belarusian x-vnd.Haiku-LaunchBox 3692177981 New LaunchBox Новы Set description… LaunchBox Прызначыць апісанне… Vertical layout LaunchBox Вертыкальная расстаноўка @@ -6,6 +6,7 @@ OK LaunchBox ОК Pad 1 LaunchBox Падложка 1 last chance LaunchBox апошняя магчымасць Quit LaunchBox Выйсці +Open containing folder LaunchBox Адкрыць папку, якая змяшчае аб'ект Clear button LaunchBox Ачысціць кнопку LaunchBox System name СтартПалічка Ignore double-click LaunchBox Ігнараваць падвойны клік diff --git a/data/catalogs/apps/mediaconverter/be.catkeys b/data/catalogs/apps/mediaconverter/be.catkeys index 70495941ad..575219da33 100644 --- a/data/catalogs/apps/mediaconverter/be.catkeys +++ b/data/catalogs/apps/mediaconverter/be.catkeys @@ -1,9 +1,11 @@ -1 belarusian x-vnd.Haiku-MediaConverter 2955071341 +1 belarusian x-vnd.Haiku-MediaConverter 2722282283 Video using parameters form settings MediaConverter Відэа карыстае параметры з наладак Video encoding: MediaConverter Кадаванне відэа: +Error read audio frame %lld MediaConverter Памылка чытання фрэйма %lld No audio Audio codecs list Няма аўдыё Error MediaConverter Памылка Error loading a file MediaConverter Немагчыма адкрыць файл +Error read video frame %lld MediaConverter Памылка чытання фрэйма %lld File Error MediaConverter-FileInfo Памылка файла Open… Menu Адкрыць… Start [ms]: MediaConverter Пачатак [мсек]: @@ -22,6 +24,8 @@ Audio: MediaConverter-FileInfo Аўдыё: OK MediaConverter-FileInfo ОК seconds MediaFileInfo секундаў Source files MediaConverter Зыходныя файлы +Error writing video frame %lld MediaConverter Памылка запісу фрэйма %lld +Error writing audio frame %lld MediaConverter Памылка запіса аўдыё фрэйма %lld Cancelling MediaConverter Адмена %d byte MediaFileInfo %d байтаў Error loading files MediaConverter Немагчыма загрузіць файлы diff --git a/data/catalogs/apps/mediaconverter/pl.catkeys b/data/catalogs/apps/mediaconverter/pl.catkeys index 6ba33456c7..3f574b763a 100644 --- a/data/catalogs/apps/mediaconverter/pl.catkeys +++ b/data/catalogs/apps/mediaconverter/pl.catkeys @@ -1,9 +1,11 @@ -1 polish x-vnd.Haiku-MediaConverter 2955071341 +1 polish x-vnd.Haiku-MediaConverter 2722282283 Video using parameters form settings MediaConverter Wideo używa parametrów z ustawień Video encoding: MediaConverter Kodowanie wideo: +Error read audio frame %lld MediaConverter Błąd odczytu ramki audio %lld No audio Audio codecs list Brak dźwięku Error MediaConverter Błąd Error loading a file MediaConverter Błąd ładowania pliku +Error read video frame %lld MediaConverter Błąd odczytu ramki video %lld File Error MediaConverter-FileInfo Błąd pliku Open… Menu Otwórz… Start [ms]: MediaConverter Początek [ms]: @@ -22,6 +24,8 @@ Audio: MediaConverter-FileInfo Dźwięk: OK MediaConverter-FileInfo OK seconds MediaFileInfo sekundy Source files MediaConverter Pliki źródłowe +Error writing video frame %lld MediaConverter Błąd zapisu ramki video %lld +Error writing audio frame %lld MediaConverter Błąd zapisu ramki audio %lld Cancelling MediaConverter Anulowanie %d byte MediaFileInfo %d bajt Error loading files MediaConverter Błąd wczytywania plików diff --git a/data/catalogs/apps/midiplayer/de.catkeys b/data/catalogs/apps/midiplayer/de.catkeys index 2972132754..e7d695f561 100644 --- a/data/catalogs/apps/midiplayer/de.catkeys +++ b/data/catalogs/apps/midiplayer/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-MidiPlayer 4180509704 +1 german x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Kein Live input: Main Window Live-Eingang: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Midi-Player\n\nDas kleine Programm \nKann tausend Lieder spielen\nKlingt etwas seltsam @@ -13,6 +13,7 @@ Play Main Window Abspielen Garage Main Window Garage Closet Main Window Schrank MidiPlayer System name Midi-Player +OK Main Application OK Drop MIDI file here Scope View Midi-Dateien hier fallen lassen Igor's lab Main Window Igors Labor Scope Main Window Wellenform diff --git a/data/catalogs/apps/midiplayer/el.catkeys b/data/catalogs/apps/midiplayer/el.catkeys index 148e6c8cd4..4edda1cf9e 100644 --- a/data/catalogs/apps/midiplayer/el.catkeys +++ b/data/catalogs/apps/midiplayer/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-MidiPlayer 4180509704 +1 greek, modern (1453-) x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Κανένα Live input: Main Window Live είσοδος: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI Player 1.0.0 beta\n\nΑυτό το μικρό πρόγραμμα\nμπορεί να παίξει χιλιάδες \nμουσικές μελωδίες @@ -13,6 +13,7 @@ Play Main Window Αναπαραγωγή Garage Main Window Γκαράζ Closet Main Window Θάλαμος MidiPlayer System name MidiPlayer +OK Main Application Εντάξει Drop MIDI file here Scope View Αφήστε τα αρχεία MIDI εδώ Igor's lab Main Window Εργαστήριο του Igor Scope Main Window Επισκόπηση diff --git a/data/catalogs/apps/midiplayer/fr.catkeys b/data/catalogs/apps/midiplayer/fr.catkeys index 6fe2e90625..7753c4feb8 100644 --- a/data/catalogs/apps/midiplayer/fr.catkeys +++ b/data/catalogs/apps/midiplayer/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-MidiPlayer 4180509704 +1 french x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Aucun Live input: Main Window Entrée directe : Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Lecteur MIDI Haiku 1.0.0 beta\n\nCe petit programe\nEst dans un ordinateur\nLa boîte à musique @@ -13,6 +13,7 @@ Play Main Window Lire Garage Main Window Garage Closet Main Window Cabinet MidiPlayer System name Lecteur MIDI +OK Main Application OK Drop MIDI file here Scope View Déposer un fichier MIDI ici Igor's lab Main Window Laboratoire d'Igor Scope Main Window Portée diff --git a/data/catalogs/apps/midiplayer/hi.catkeys b/data/catalogs/apps/midiplayer/hi.catkeys index cf5cb3bdcf..473f7a187a 100644 --- a/data/catalogs/apps/midiplayer/hi.catkeys +++ b/data/catalogs/apps/midiplayer/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-MidiPlayer 4180509704 +1 hindi x-vnd.Haiku-MidiPlayer 1227982606 None Main Window कोई नहीं Live input: Main Window लाइव इनपुट: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. हाइकू मिडी प्लेयर 1.0.0 बीटा\n\n @@ -13,6 +13,7 @@ Play Main Window खेल Garage Main Window गेराज Closet Main Window कोठरी MidiPlayer System name मिडीप्लेयर +OK Main Application ठीक है Drop MIDI file here Scope View मिडी फ़ाइल ड्रॉप यहाँ करें Igor's lab Main Window इगोर'स प्रयोगशाला Scope Main Window क्षेत्र diff --git a/data/catalogs/apps/midiplayer/ja.catkeys b/data/catalogs/apps/midiplayer/ja.catkeys index 5156100bb8..c99b51a112 100644 --- a/data/catalogs/apps/midiplayer/ja.catkeys +++ b/data/catalogs/apps/midiplayer/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-MidiPlayer 4180509704 +1 japanese x-vnd.Haiku-MidiPlayer 1227982606 None Main Window 無し Live input: Main Window ライブ入力: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI Player 1.0.0 ベータ版\n\n幾千の\n曲を奏でる\nきりぎりす @@ -13,6 +13,7 @@ Play Main Window 再生 Garage Main Window Garage (ガレージ) Closet Main Window Closet (クローゼット) MidiPlayer System name MIDI プレーヤー +OK Main Application OK Drop MIDI file here Scope View ここに MIDI ファイルをドロップ Igor's lab Main Window Igor's lab (実験室) Scope Main Window Scope (スコープ) diff --git a/data/catalogs/apps/midiplayer/lt.catkeys b/data/catalogs/apps/midiplayer/lt.catkeys index 2de07f0f5d..20d214a607 100644 --- a/data/catalogs/apps/midiplayer/lt.catkeys +++ b/data/catalogs/apps/midiplayer/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-MidiPlayer 4180509704 +1 lithuanian x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Nieko Live input: Main Window Tiesioginė įvestis: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. „Haiku“ MIDI grotuvas 1.0.0 beta\n\nŠi maža programėlė\nGeba atkurti tūkstančius\nSenokų gaidų @@ -13,6 +13,7 @@ Play Main Window Groti Garage Main Window Garažas Closet Main Window Vonia MidiPlayer System name MIDI grotuvas +OK Main Application Gerai Drop MIDI file here Scope View Numeskite MIDI failą čia Igor's lab Main Window Igorio laboratorija Scope Main Window Osciloskopas diff --git a/data/catalogs/apps/midiplayer/nl.catkeys b/data/catalogs/apps/midiplayer/nl.catkeys index 23700794da..67bcd86856 100644 --- a/data/catalogs/apps/midiplayer/nl.catkeys +++ b/data/catalogs/apps/midiplayer/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-MidiPlayer 4180509704 +1 dutch; flemish x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Geen Live input: Main Window Live input: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku's MidiPlayer 1.0.0 beta\n\nMiniscuul proggie\nspeelt voor u uit duizenden\ngoedkope deuntjes @@ -13,6 +13,7 @@ Play Main Window Afspelen Garage Main Window Garage Closet Main Window WC MidiPlayer System name MidiPlayer +OK Main Application Oké Drop MIDI file here Scope View Sleep MIDI-bestand hierheen Igor's lab Main Window Igor's lab Scope Main Window Scoop diff --git a/data/catalogs/apps/midiplayer/pl.catkeys b/data/catalogs/apps/midiplayer/pl.catkeys index bb9238e6e0..8425c2bf76 100644 --- a/data/catalogs/apps/midiplayer/pl.catkeys +++ b/data/catalogs/apps/midiplayer/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-MidiPlayer 4180509704 +1 polish x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Brak Live input: Main Window Wejście Live: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Odtwarzacz MIDI Haiku 1.0.0 beta\n\nTen mały program\npotrafi odtworzyć tysiące\nszykownych piosenek @@ -13,6 +13,7 @@ Play Main Window Odtwórz Garage Main Window Garaż Closet Main Window Szafa MidiPlayer System name MidiPlayer +OK Main Application OK Drop MIDI file here Scope View Przeciągnij plik MIDI tutaj Igor's lab Main Window Labolatorium Igora Scope Main Window Zakres diff --git a/data/catalogs/apps/midiplayer/ro.catkeys b/data/catalogs/apps/midiplayer/ro.catkeys index 14f293d0a2..5bb6224b1f 100644 --- a/data/catalogs/apps/midiplayer/ro.catkeys +++ b/data/catalogs/apps/midiplayer/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-MidiPlayer 4180509704 +1 romanian x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Nimic Live input: Main Window Intrare directă: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. MIDI Player Haiku 1.0.0 beta\n\nAcest program micuț\npoate reda mii de\nmelodii cu sunete amuzante @@ -13,6 +13,7 @@ Play Main Window Redă Garage Main Window Garaj Closet Main Window Dulap MidiPlayer System name PlayerMidi +OK Main Application OK Drop MIDI file here Scope View Plasați fișier MIDI aici Igor's lab Main Window Laboratorul lui Igor Scope Main Window Gamă diff --git a/data/catalogs/apps/midiplayer/sk.catkeys b/data/catalogs/apps/midiplayer/sk.catkeys index 08fa28c1ec..f298f771cd 100644 --- a/data/catalogs/apps/midiplayer/sk.catkeys +++ b/data/catalogs/apps/midiplayer/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-MidiPlayer 4180509704 +1 slovak x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Žiadna Live input: Main Window Živý vstup: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku Prehrávač MIDI 1.0.0 beta\n\nTento malý program\nvie prehrávať tisíce\npodradne znejúcich piesní @@ -13,6 +13,7 @@ Play Main Window Prehrať Garage Main Window Garáž Closet Main Window Skriňa MidiPlayer System name Prehrávač MIDI +OK Main Application OK Drop MIDI file here Scope View Sem pretiahnite súbor MIDI Igor's lab Main Window Igorovo laboratórium Scope Main Window Rozsah diff --git a/data/catalogs/apps/midiplayer/sv.catkeys b/data/catalogs/apps/midiplayer/sv.catkeys index 15b12ebd3d..844e2eb66f 100644 --- a/data/catalogs/apps/midiplayer/sv.catkeys +++ b/data/catalogs/apps/midiplayer/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-MidiPlayer 4180509704 +1 swedish x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Inget Live input: Main Window Livekälla: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI Spelare 1.0.0 beta\n\nDetta lilla program kan\nspela upp tusentals härliga låtar @@ -13,6 +13,7 @@ Play Main Window Spela Garage Main Window Garage Closet Main Window Garderob MidiPlayer System name MidiSpelare +OK Main Application OK Drop MIDI file here Scope View Släpp en MIDI-fil här Igor's lab Main Window Igor's labb Scope Main Window Visualisering diff --git a/data/catalogs/apps/midiplayer/uk.catkeys b/data/catalogs/apps/midiplayer/uk.catkeys index eb2cc98caa..5711fcb809 100644 --- a/data/catalogs/apps/midiplayer/uk.catkeys +++ b/data/catalogs/apps/midiplayer/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-MidiPlayer 4180509704 +1 ukrainian x-vnd.Haiku-MidiPlayer 1227982606 None Main Window Жоден Live input: Main Window Прямий вхід: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI Player 1.0.0 beta\n\nЦя крихітна програма\nвміє відтворювати тисячі\nпростих мелодій @@ -13,6 +13,7 @@ Play Main Window Відтворити Garage Main Window Гараж Closet Main Window Комірка MidiPlayer System name Програвач Midi +OK Main Application Гаразд Drop MIDI file here Scope View Перемістити MIDI файл сюди Igor's lab Main Window Лабораторія Ігоря Scope Main Window Осциллограф diff --git a/data/catalogs/apps/midiplayer/zh_Hans.catkeys b/data/catalogs/apps/midiplayer/zh_Hans.catkeys index 996efe16bc..13dd4bfb29 100644 --- a/data/catalogs/apps/midiplayer/zh_Hans.catkeys +++ b/data/catalogs/apps/midiplayer/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-MidiPlayer 4180509704 +1 english x-vnd.Haiku-MidiPlayer 1227982606 None Main Window 无 Live input: Main Window 保持输入: Haiku MIDI Player 1.0.0 beta\n\nThis tiny program\nKnows how to play thousands of\nCheesy sounding songs Main Application This is a haiku. First line has five syllables, second has seven and last has five again. Create your own. Haiku MIDI播放器 1.0.0 beta\n\n娇小且轻灵\n功能强大真无双\n美妙歌曲扬 @@ -13,6 +13,7 @@ Play Main Window 播放 Garage Main Window 车库 Closet Main Window 密室 MidiPlayer System name Midi播放器 +OK Main Application 确定 Drop MIDI file here Scope View 把 MIDI 文件放在此处 Igor's lab Main Window 伊戈尔的实验室 Scope Main Window 显示范围 diff --git a/data/catalogs/apps/processcontroller/be.catkeys b/data/catalogs/apps/processcontroller/be.catkeys index 477240a7ac..6f49ce01d9 100644 --- a/data/catalogs/apps/processcontroller/be.catkeys +++ b/data/catalogs/apps/processcontroller/be.catkeys @@ -1,14 +1,14 @@ -1 belarusian x-vnd.Haiku-ProcessController 2887520383 +1 belarusian x-vnd.Haiku-ProcessController 1848752768 Memory usage ProcessController Ужыванне памяці -Do you really want to kill the team \"%s\"? ProcessController Сапраўды жадаеце знішчыць групу \"%s\"? +Kill this team! ProcessController Знішчыць паток! Idle priority ProcessController Прыярытэт спакою Restart Deskbar ProcessController Перазапусціць Deskbar Custom priority ProcessController Нестандартны прыярытэт -Debug thread ProcessController Адладжваць паток This team is already gone… ProcessController Гэтая група ўжо не існуе… Error saving file ProcessController Памылка пры захаванні файла Real-time priority ProcessController Прыярытэт рэальнага часу Your setting file could not be saved!\n(%s) ProcessController Немагчыма захаваць файл з наладкамі!\n(%s) +What do you want to do with the team \"%s\"? ProcessController Што вы жадаеце зрабіць з патокам \"%s\"? This thread is already gone… ProcessController Гэты паток ўжо не існуе… Cancel ProcessController Адмена Display priority ProcessController Прыярытэт адлюстравання @@ -38,11 +38,11 @@ Threads and CPU usage ProcessController Патокі і ўжыванне ЦП Urgent display priority ProcessController Прыярытэт неадкладнага адлюстравання OK ProcessController ОК Damned! ProcessController Чорт! +Debug this team! ProcessController Адладжваць паток! Usage: %s [-deskbar]\n ProcessController Ужыванне: %s [-deskbar]\n ProcessController System name Працэсы і патокі Real-time display priority ProcessController Прыярытэт адлюстравання ў рэальным часе Please confirm ProcessController Калі ласка падцвердзіце -Yes, kill this team! ProcessController Так, знішчыць гэтую групу! System resources & caches… ProcessController Сістэмныя рэсурсы & кэш… That's no Fun! ProcessController Гэта непрыкольна! You can run ProcessController in a window or install it in the Deskbar. ProcessController Вы можаце запускаць ProcessController у вакне або ўсталяваць яго ў Deskbar. diff --git a/data/catalogs/apps/processcontroller/de.catkeys b/data/catalogs/apps/processcontroller/de.catkeys index cc625c326b..da05876a03 100644 --- a/data/catalogs/apps/processcontroller/de.catkeys +++ b/data/catalogs/apps/processcontroller/de.catkeys @@ -1,14 +1,14 @@ -1 german x-vnd.Haiku-ProcessController 2887520383 +1 german x-vnd.Haiku-ProcessController 1848752768 Memory usage ProcessController Speicherverbrauch -Do you really want to kill the team \"%s\"? ProcessController Soll das Team \"%s\" wirklich beendet werden? +Kill this team! ProcessController Dieses Team beenden! Idle priority ProcessController Leerlauf-Priorität Restart Deskbar ProcessController Deskbar neu starten Custom priority ProcessController Anwendungsspezifische Priorität -Debug thread ProcessController Debug Thread This team is already gone… ProcessController Dieses Team existiert nicht mehr… Error saving file ProcessController Fehler beim Speichern der Datei Real-time priority ProcessController Echtzeit-Priorität Your setting file could not be saved!\n(%s) ProcessController Die Einstellungsdatei konnte nicht gespeichert werden.\n(%s) +What do you want to do with the team \"%s\"? ProcessController Was soll mit dem Team \"%s\" geschehen? This thread is already gone… ProcessController Dieser Thread existiert nicht mehr… Cancel ProcessController Abbrechen Display priority ProcessController Anzeigen-Priorität @@ -38,11 +38,11 @@ Threads and CPU usage ProcessController Threads und CPU-Last Urgent display priority ProcessController Hohe Anzeigen-Priorität OK ProcessController OK Damned! ProcessController Herrje! +Debug this team! ProcessController Dieses Team debuggen! Usage: %s [-deskbar]\n ProcessController Gebrauch: %s [-deskbar]\n ProcessController System name Systemmanager Real-time display priority ProcessController Echtzeit-Anzeigen-Priorität Please confirm ProcessController Bitte bestätigen -Yes, kill this team! ProcessController Ja, dieses Team beenden! System resources & caches… ProcessController Systemressourcen & Cache… That's no Fun! ProcessController Nicht lustig! You can run ProcessController in a window or install it in the Deskbar. ProcessController Der Systemmanager kann im Fenster ausgeführt oder in der Deskbar installiert werden. diff --git a/data/catalogs/apps/processcontroller/el.catkeys b/data/catalogs/apps/processcontroller/el.catkeys index 00df81a8b7..8e823da153 100644 --- a/data/catalogs/apps/processcontroller/el.catkeys +++ b/data/catalogs/apps/processcontroller/el.catkeys @@ -1,10 +1,8 @@ -1 greek, modern (1453-) x-vnd.Haiku-ProcessController 2887520383 +1 greek, modern (1453-) x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Χρήση μνήμης -Do you really want to kill the team \"%s\"? ProcessController Θέλετε σίγουρα να τερματίσετε την ομάδα \"%s\"; Idle priority ProcessController Ανενεργή προτεραιότητα Restart Deskbar ProcessController Επανεκκίνηση Deskbar Custom priority ProcessController Προσαρμοσμένη προτεραιότητα -Debug thread ProcessController Αποσφαλμάτωση νήματος This team is already gone… ProcessController Αυτή η όμαδα έχει ήδη εξαφανιστεί Error saving file ProcessController Σφάλμα κατα την αποθήκευση του αρχείου Real-time priority ProcessController Προτεραιότητα πραγματικού χρόνου @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Χρήση: %s [-deskbar]\n ProcessController System name ProcessController Real-time display priority ProcessController Προτεραιότητα εμφάνισης πραγματικού χρόνου Please confirm ProcessController Παρακαλώ επιβεβαιώστε -Yes, kill this team! ProcessController Ναι, τερματισμός της ομάδας! System resources & caches… ProcessController Πόροι & λανθάνουσα μνήμη συστήματος... That's no Fun! ProcessController Αυτό δεν έχει πλάκα! You can run ProcessController in a window or install it in the Deskbar. ProcessController Μπορείτε να εκτελέσετε το ProcessController σε ένα παράθυρο ή να το εγκαταστήσετε στη Deskbar. diff --git a/data/catalogs/apps/processcontroller/fi.catkeys b/data/catalogs/apps/processcontroller/fi.catkeys index 6457d173c0..055a814d90 100644 --- a/data/catalogs/apps/processcontroller/fi.catkeys +++ b/data/catalogs/apps/processcontroller/fi.catkeys @@ -1,10 +1,8 @@ -1 finnish x-vnd.Haiku-ProcessController 2887520383 +1 finnish x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Muistikäyttö -Do you really want to kill the team \"%s\"? ProcessController Haluatko todella lopettaa ryhmän ”%s”? Idle priority ProcessController Joutokäyntiprioriteetti Restart Deskbar ProcessController Käynnistä Työpöytäpalkki uudelleen Custom priority ProcessController Räätälöity prioriteetti -Debug thread ProcessController Vikajäljitä säiettä This team is already gone… ProcessController Tämä ryhmä on jo poistunut... Error saving file ProcessController Virhe tallennettaessa tiedostoa Real-time priority ProcessController Ajantasaprioriteetti @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Käyttö: %s [-deskbar]\n ProcessController System name Prosessiohjain Real-time display priority ProcessController Ajantasanäyttöprioriteetti Please confirm ProcessController Vahvista -Yes, kill this team! ProcessController Kyllä, lopeta tämä ryhmä! System resources & caches… ProcessController Järjestelmäresurssit ja välimuistit… That's no Fun! ProcessController Se ei ole hauskaa! You can run ProcessController in a window or install it in the Deskbar. ProcessController Voit suorittaa Prosessiohjaimen ikkunassa tai asentaa sen Työpöytäpalkkiin. diff --git a/data/catalogs/apps/processcontroller/fr.catkeys b/data/catalogs/apps/processcontroller/fr.catkeys index 903b1539ee..72a7e60411 100644 --- a/data/catalogs/apps/processcontroller/fr.catkeys +++ b/data/catalogs/apps/processcontroller/fr.catkeys @@ -1,14 +1,14 @@ -1 french x-vnd.Haiku-ProcessController 2887520383 +1 french x-vnd.Haiku-ProcessController 1848752768 Memory usage ProcessController Consommation mémoire -Do you really want to kill the team \"%s\"? ProcessController Voulez-vous vraiment tuer le processus « %s » ? +Kill this team! ProcessController Tuer ce processus ! Idle priority ProcessController Priorité inactive Restart Deskbar ProcessController Redémarrer la Deskbar Custom priority ProcessController Priorité personnalisée -Debug thread ProcessController Déboguer la tâche This team is already gone… ProcessController Ce processus n'existe déjà plus… Error saving file ProcessController Erreur à l'enregistrement du fichier Real-time priority ProcessController Priorité temps-réel Your setting file could not be saved!\n(%s) ProcessController Impossible d'enregistrer votre fichier de réglages !\n(%s) +What do you want to do with the team \"%s\"? ProcessController Que voulez vous faire du processus « %s » ? This thread is already gone… ProcessController Cette tâche n'existe déjà plus… Cancel ProcessController Annuler Display priority ProcessController Priorité affichage @@ -38,11 +38,11 @@ Threads and CPU usage ProcessController Tâches et activité CPU Urgent display priority ProcessController Priorité affichage urgent OK ProcessController OK Damned! ProcessController Damnation ! +Debug this team! ProcessController Déboguer ce processus ! Usage: %s [-deskbar]\n ProcessController Utilisation : %s [-deskbar]\n ProcessController System name ProcessControlleur Real-time display priority ProcessController Priorité affichage temps-réel Please confirm ProcessController Veuillez confirmer -Yes, kill this team! ProcessController Oui, tuer ce processus ! System resources & caches… ProcessController Resources du système & caches… That's no Fun! ProcessController C'est pas fun ! You can run ProcessController in a window or install it in the Deskbar. ProcessController Vous pouvez exécuter ProcessControlleur dans une fenêtre ou l'installer dans la Deskbar. diff --git a/data/catalogs/apps/processcontroller/hi.catkeys b/data/catalogs/apps/processcontroller/hi.catkeys index 0fbc7e71f3..2fffa010d9 100644 --- a/data/catalogs/apps/processcontroller/hi.catkeys +++ b/data/catalogs/apps/processcontroller/hi.catkeys @@ -1,10 +1,8 @@ -1 hindi x-vnd.Haiku-ProcessController 2887520383 +1 hindi x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController स्मृति के उपयोग -Do you really want to kill the team \"%s\"? ProcessController क्या आप वास्तव में टीम को मारना चाहते हैं \"%s\"? Idle priority ProcessController आइडल प्राथमिकता Restart Deskbar ProcessController डेस्कबार पुनः आरंभ करें Custom priority ProcessController प्राथमिकता कस्टम है -Debug thread ProcessController डिबग थ्रेड This team is already gone… ProcessController यह टीम पहले से ही जा चुकी है... Error saving file ProcessController त्रुटि फ़ाइल सहेजने मैं Real-time priority ProcessController रियल-टाइम प्राथमिकता @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController प्रयोग: %s [-डेस् ProcessController System name ProcessController Real-time display priority ProcessController प्राथमिकता रियल-टाइम डिस्प्ले है Please confirm ProcessController कृपया पक्का करें -Yes, kill this team! ProcessController हाँ, यह टीम को मार डालो! System resources & caches… ProcessController सिस्टम रिसोर्से & कैशेस... That's no Fun! ProcessController वह कुछ भी मज़ा नहीं है! You can run ProcessController in a window or install it in the Deskbar. ProcessController आप एक खिड़की में प्रक्रिया नियंत्रक रन कर सकते या उसको डेस्कबार में स्थापित कर सकते हैं. diff --git a/data/catalogs/apps/processcontroller/hu.catkeys b/data/catalogs/apps/processcontroller/hu.catkeys index 5718e09842..5e37e1ee6c 100644 --- a/data/catalogs/apps/processcontroller/hu.catkeys +++ b/data/catalogs/apps/processcontroller/hu.catkeys @@ -1,14 +1,14 @@ -1 hungarian x-vnd.Haiku-ProcessController 2887520383 +1 hungarian x-vnd.Haiku-ProcessController 1848752768 Memory usage ProcessController Memóriahasználat -Do you really want to kill the team \"%s\"? ProcessController Biztosan le kívánja állítani: %s? +Kill this team! ProcessController Szál leállítása! Idle priority ProcessController Üresjárat prioritás Restart Deskbar ProcessController Asztalsáv újraindítása Custom priority ProcessController Egyéni prioritás -Debug thread ProcessController Szál hibakeresése This team is already gone… ProcessController Ez a csapat már eltűnt… Error saving file ProcessController Hiba történt a fájl mentése során Real-time priority ProcessController Valós idejű prioritás Your setting file could not be saved!\n(%s) ProcessController A beállításfájlt nem sikerült elmenteni!\n(%s) +What do you want to do with the team \"%s\"? ProcessController Mit kíván tenni a szállal: %s? This thread is already gone… ProcessController Ez a szál már eltűnt… Cancel ProcessController Mégse Display priority ProcessController Kijelzési prioritás @@ -38,11 +38,11 @@ Threads and CPU usage ProcessController Szálak és processzorhasználat Urgent display priority ProcessController Magas kijelzési prioritás OK ProcessController Rendben Damned! ProcessController Fenébe! +Debug this team! ProcessController Szál hibakeresése! Usage: %s [-deskbar]\n ProcessController Használat: %s [-deskbar]\n ProcessController System name Folyamatkezelő Real-time display priority ProcessController Valós idejű kijelzési prioritás Please confirm ProcessController Jóváhagyás -Yes, kill this team! ProcessController Igen, állítsa le a csapatot! System resources & caches… ProcessController Rendszer erőforrásai és gyorsítótárai… That's no Fun! ProcessController Ez nem vicces! You can run ProcessController in a window or install it in the Deskbar. ProcessController Futtathatja a Folyamatkezelőt egy ablakban, vagy feltelepítheti azt az Asztalsávra. diff --git a/data/catalogs/apps/processcontroller/ja.catkeys b/data/catalogs/apps/processcontroller/ja.catkeys index c78c2a88a3..dd0f30974d 100644 --- a/data/catalogs/apps/processcontroller/ja.catkeys +++ b/data/catalogs/apps/processcontroller/ja.catkeys @@ -1,14 +1,14 @@ -1 japanese x-vnd.Haiku-ProcessController 2887520383 +1 japanese x-vnd.Haiku-ProcessController 1848752768 Memory usage ProcessController メモリ使用量 -Do you really want to kill the team \"%s\"? ProcessController 本当に team \"%s\" を強制終了してよいですか? +Kill this team! ProcessController スレッドを強制終了 Idle priority ProcessController アイドル優先度 Restart Deskbar ProcessController Deskbar を再起動 Custom priority ProcessController カスタム優先度 -Debug thread ProcessController スレッドをデバッグ This team is already gone… ProcessController Team はすでに終了しています… Error saving file ProcessController ファイル保存中にエラーが発生しました Real-time priority ProcessController リアルタイム優先度 Your setting file could not be saved!\n(%s) ProcessController 設定ファイルは保存できませんでした。\n(%s) +What do you want to do with the team \"%s\"? ProcessController スレッド \"%s\" に対してなにをしたいですか? This thread is already gone… ProcessController スレッドはすでに終了しています… Cancel ProcessController 取り消し Display priority ProcessController 表示優先度 @@ -38,11 +38,11 @@ Threads and CPU usage ProcessController スレッドと CPU の使用量 Urgent display priority ProcessController 緊急表示優先度 OK ProcessController OK Damned! ProcessController とんでもない! +Debug this team! ProcessController スレッドをデバッグ Usage: %s [-deskbar]\n ProcessController Usage: %s [-deskbar]\n ProcessController System name プロセスコントローラー Real-time display priority ProcessController リアルタイム表示優先度 Please confirm ProcessController 確認してください。 -Yes, kill this team! ProcessController はい、team を強制終了します ! System resources & caches… ProcessController システムリソースとキャッシュ… That's no Fun! ProcessController そんなのおもしろくない! You can run ProcessController in a window or install it in the Deskbar. ProcessController プロセスコントローラーをウィンドウモードで起動するか、または Deskbar にインストールできます。 diff --git a/data/catalogs/apps/processcontroller/lt.catkeys b/data/catalogs/apps/processcontroller/lt.catkeys index 8b10f709ff..114860e1dc 100644 --- a/data/catalogs/apps/processcontroller/lt.catkeys +++ b/data/catalogs/apps/processcontroller/lt.catkeys @@ -1,10 +1,8 @@ -1 lithuanian x-vnd.Haiku-ProcessController 2887520383 +1 lithuanian x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Atminties naudojimas -Do you really want to kill the team \"%s\"? ProcessController Ar tikrai norite nutraukti užduoties „%s“ darbą? Idle priority ProcessController Nulinis prioritetas Restart Deskbar ProcessController Perleisti Užduočių juostą Custom priority ProcessController Parinktinis prioritetas -Debug thread ProcessController Derinti giją This team is already gone… ProcessController Šios užduoties jau nebėra… Error saving file ProcessController Klaida įrašant failą Real-time priority ProcessController Tikralaikis prioritetas @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Naudojimas: %s [-deskbar]\n ProcessController System name Procesų valdiklis Real-time display priority ProcessController Tikralaikio rodymo prioritetas Please confirm ProcessController Prašome patvirtinti -Yes, kill this team! ProcessController Taip, nutraukti šios užduoties darbą! System resources & caches… ProcessController Sistemos ištekliai ir podėliai… That's no Fun! ProcessController Visai nejuokinga! You can run ProcessController in a window or install it in the Deskbar. ProcessController Šią programą galite paleisti atskirame lange arba patalpinti pranešimų srityje. diff --git a/data/catalogs/apps/processcontroller/nl.catkeys b/data/catalogs/apps/processcontroller/nl.catkeys index bcf693352a..3da84655cb 100644 --- a/data/catalogs/apps/processcontroller/nl.catkeys +++ b/data/catalogs/apps/processcontroller/nl.catkeys @@ -1,10 +1,8 @@ -1 dutch; flemish x-vnd.Haiku-ProcessController 2887520383 +1 dutch; flemish x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Geheugengebruik -Do you really want to kill the team \"%s\"? ProcessController Wilt u echt team \"%s\" afbreken? Idle priority ProcessController Inactieve prioriteit Restart Deskbar ProcessController Deskbar herstarten Custom priority ProcessController Aangepaste prioriteit -Debug thread ProcessController Thread debuggen This team is already gone… ProcessController Dit team is al verdwenen... Error saving file ProcessController Fout bij bestandsopslag Real-time priority ProcessController Real-time prioriteit @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Gebruik: %s [-deskbar]\n ProcessController System name ProcessController Real-time display priority ProcessController Real-time weergave prioriteit Please confirm ProcessController Gelieve te bevestigen -Yes, kill this team! ProcessController Ja, breek dit team af! System resources & caches… ProcessController Systeembronnen en -caches... That's no Fun! ProcessController Da's niet Leuk! You can run ProcessController in a window or install it in the Deskbar. ProcessController U kunt ProcessController in een venster actief hebben, of in Deskbar installeren. diff --git a/data/catalogs/apps/processcontroller/pl.catkeys b/data/catalogs/apps/processcontroller/pl.catkeys index dc475e9028..2155f8c652 100644 --- a/data/catalogs/apps/processcontroller/pl.catkeys +++ b/data/catalogs/apps/processcontroller/pl.catkeys @@ -1,10 +1,8 @@ -1 polish x-vnd.Haiku-ProcessController 2887520383 +1 polish x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Użycie pamięci -Do you really want to kill the team \"%s\"? ProcessController Czy na pewno chcesz zakończyć zespół \"%s\"? Idle priority ProcessController Priorytet bezczynności Restart Deskbar ProcessController Zrestartuj Deskbar Custom priority ProcessController Własny priorytet -Debug thread ProcessController Debuguj wątek This team is already gone… ProcessController Ten zespół nie jest już obecny… Error saving file ProcessController Błąd przy zapisywaniu pliku Real-time priority ProcessController Priorytet czasu rzeczywistego @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Użycie: %s [-deskbar]\n ProcessController System name ProcessController Real-time display priority ProcessController Czasu rzeczywistego priorytet wyświetlania Please confirm ProcessController Proszę potwierdź -Yes, kill this team! ProcessController Tak, zakończ ten zespół! System resources & caches… ProcessController Zasoby i bufory systemu… That's no Fun! ProcessController To nie zabawa! You can run ProcessController in a window or install it in the Deskbar. ProcessController Możesz uruchomić ProcessController w oknie lub zainstalować go w Deskbarze. diff --git a/data/catalogs/apps/processcontroller/pt_BR.catkeys b/data/catalogs/apps/processcontroller/pt_BR.catkeys index ee3ee27061..7ed1f97a4b 100644 --- a/data/catalogs/apps/processcontroller/pt_BR.catkeys +++ b/data/catalogs/apps/processcontroller/pt_BR.catkeys @@ -1,10 +1,8 @@ -1 portuguese (brazil) x-vnd.Haiku-ProcessController 2887520383 +1 portuguese (brazil) x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Uso de memória -Do you really want to kill the team \"%s\"? ProcessController Deseja realmente matar a equipe \"%s\"? Idle priority ProcessController Prioridade ociosa Restart Deskbar ProcessController Reiniciar o Deskbar Custom priority ProcessController Prioridade personalizada -Debug thread ProcessController Processo de depuração This team is already gone… ProcessController Esta equipe já se foi… Error saving file ProcessController Erro ao gravar o arquivo Real-time priority ProcessController Prioridade em tempo real @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Utilização: %s [-deskbar]\n ProcessController System name Controlador de Processo Real-time display priority ProcessController Exibir prioridade de tempo real Please confirm ProcessController Favor confirmar -Yes, kill this team! ProcessController Sim, mate esta equipe! System resources & caches… ProcessController Recursos & caches de sistema… That's no Fun! ProcessController Isso não é Engraçado! You can run ProcessController in a window or install it in the Deskbar. ProcessController É possível executar o Controlador de Processo em uma janela ou instalá-lo no Deskbar. diff --git a/data/catalogs/apps/processcontroller/ro.catkeys b/data/catalogs/apps/processcontroller/ro.catkeys index 77a446f335..690ecc7c43 100644 --- a/data/catalogs/apps/processcontroller/ro.catkeys +++ b/data/catalogs/apps/processcontroller/ro.catkeys @@ -1,10 +1,8 @@ -1 romanian x-vnd.Haiku-ProcessController 2887520383 +1 romanian x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Utilizarea memoriei -Do you really want to kill the team \"%s\"? ProcessController Doriți să terminați forțat echipa „%s”? Idle priority ProcessController Prioritate în așteptare Restart Deskbar ProcessController Repornește bara de desktop Custom priority ProcessController Prioritate personalizată -Debug thread ProcessController Depanează firul de execuție This team is already gone… ProcessController Această echipă este plecată deja... Error saving file ProcessController Eroare la salvarea fișierului Real-time priority ProcessController Prioritate în timp real @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Utilizare: %s [-deskbar]\n ProcessController System name ControlProcese Real-time display priority ProcessController Prioritate afișaj în timp real Please confirm ProcessController Confirmați -Yes, kill this team! ProcessController Da, termină forțat această echipă! System resources & caches… ProcessController Resurse de sistem & cache-uri That's no Fun! ProcessController Nu e amuzant! You can run ProcessController in a window or install it in the Deskbar. ProcessController Puteți să rulați ControlerProces într-o fereastră sau să îl instalați pe bara de desktop. diff --git a/data/catalogs/apps/processcontroller/ru.catkeys b/data/catalogs/apps/processcontroller/ru.catkeys index 5c5f2ae9c7..ad5a6cc947 100644 --- a/data/catalogs/apps/processcontroller/ru.catkeys +++ b/data/catalogs/apps/processcontroller/ru.catkeys @@ -1,10 +1,8 @@ -1 russian x-vnd.Haiku-ProcessController 2887520383 +1 russian x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Использование памяти -Do you really want to kill the team \"%s\"? ProcessController Вы действительно хотите убить \"%s\"? Idle priority ProcessController Приоритет бездействия Restart Deskbar ProcessController Перезапустить Deskbar Custom priority ProcessController Заданный приоритет -Debug thread ProcessController Отладить поток This team is already gone… ProcessController Этого приложения уже не существует… Error saving file ProcessController Ошибка при сохранении файла Real-time priority ProcessController Приоритет реального времени @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Использование: %s [-deskb ProcessController System name Контроллер процессов Real-time display priority ProcessController Приоритет отображения реального времени Please confirm ProcessController Пожалуйста, подтвердите -Yes, kill this team! ProcessController Да, убить это приложение! System resources & caches… ProcessController Системные ресурсы и кеш That's no Fun! ProcessController Это не смешно! You can run ProcessController in a window or install it in the Deskbar. ProcessController Вы можете запустить контроллер процессов в окне или установить его в Deskbar. diff --git a/data/catalogs/apps/processcontroller/sk.catkeys b/data/catalogs/apps/processcontroller/sk.catkeys index fb42169a03..ec38b90d67 100644 --- a/data/catalogs/apps/processcontroller/sk.catkeys +++ b/data/catalogs/apps/processcontroller/sk.catkeys @@ -1,10 +1,8 @@ -1 slovak x-vnd.Haiku-ProcessController 2887520383 +1 slovak x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Využitie pamäte -Do you really want to kill the team \"%s\"? ProcessController Skutočne chcete ukončiť tím „%s“? Idle priority ProcessController Priorita nečinný Restart Deskbar ProcessController Reštartovať Panel Custom priority ProcessController Vlastná priorita -Debug thread ProcessController Ladiť vlákno This team is already gone… ProcessController Tento tím už je preč… Error saving file ProcessController Chyba pri ukladaní súboru Real-time priority ProcessController Priorita v reálnom čase @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Použitie: %s [-deskbar]\n ProcessController System name Správca procesov Real-time display priority ProcessController Priorita zobrazenie v reálnom čase Please confirm ProcessController Prosím, potvrďte -Yes, kill this team! ProcessController Áno, ukončiť tento tím! System resources & caches… ProcessController Zdroje a vyrovnávacia pamäť systému… That's no Fun! ProcessController To nie je sranda! You can run ProcessController in a window or install it in the Deskbar. ProcessController Správcu procesov môžete spúšťať v okne alebo ho nainštalovať do Panelu. diff --git a/data/catalogs/apps/processcontroller/sv.catkeys b/data/catalogs/apps/processcontroller/sv.catkeys index 8fb08a97e5..e933d80f5e 100644 --- a/data/catalogs/apps/processcontroller/sv.catkeys +++ b/data/catalogs/apps/processcontroller/sv.catkeys @@ -1,10 +1,8 @@ -1 swedish x-vnd.Haiku-ProcessController 2887520383 +1 swedish x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Minnesanvändning -Do you really want to kill the team \"%s\"? ProcessController Vill du verkligen avsluta processen "%s"? Idle priority ProcessController Overksam prioritet Restart Deskbar ProcessController Starta om Deskbar Custom priority ProcessController Annan prioritet -Debug thread ProcessController Felsök tråd This team is already gone… ProcessController Processen är redan avslutad... Error saving file ProcessController Fel vid sparning av fil Real-time priority ProcessController Realtidsprioritet @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Hantering: %s [-deskbar]\n ProcessController System name ProcessKontroll Real-time display priority ProcessController Realtidsvisningprioritet Please confirm ProcessController Vänligen bekräfta -Yes, kill this team! ProcessController Ja, avsluta den här processen! System resources & caches… ProcessController Systemresurser & filsystemscache… That's no Fun! ProcessController Det var inte roligt! You can run ProcessController in a window or install it in the Deskbar. ProcessController Du kan köra ProcessKontroll i ett fönster eller installera den i Deskbar. diff --git a/data/catalogs/apps/processcontroller/uk.catkeys b/data/catalogs/apps/processcontroller/uk.catkeys index 07532954ae..ec5ee6b683 100644 --- a/data/catalogs/apps/processcontroller/uk.catkeys +++ b/data/catalogs/apps/processcontroller/uk.catkeys @@ -1,10 +1,8 @@ -1 ukrainian x-vnd.Haiku-ProcessController 2887520383 +1 ukrainian x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController Використання пам'яті -Do you really want to kill the team \"%s\"? ProcessController Ви дійсно бажаєте вбити потік \"%s\"? Idle priority ProcessController Idle priority Restart Deskbar ProcessController Перезапустити Deskbar Custom priority ProcessController Заданий приорітет -Debug thread ProcessController Нитка відладки This team is already gone… ProcessController Потік повністю запущений… Error saving file ProcessController Помилка при збереженні файлу Real-time priority ProcessController Приорітет реального часу @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController Використання: %s [-deskbar ProcessController System name ProcessController Real-time display priority ProcessController Приорітет реального часу Please confirm ProcessController Повторіть -Yes, kill this team! ProcessController Так , вбити цей потік! System resources & caches… ProcessController Системні ресурси і кеші… That's no Fun! ProcessController Це не жарт! You can run ProcessController in a window or install it in the Deskbar. ProcessController Ви можете запустити ProcessController у вікні або встановити в Deskbar. diff --git a/data/catalogs/apps/processcontroller/zh_Hans.catkeys b/data/catalogs/apps/processcontroller/zh_Hans.catkeys index d873c52f3d..b85c1ca42d 100644 --- a/data/catalogs/apps/processcontroller/zh_Hans.catkeys +++ b/data/catalogs/apps/processcontroller/zh_Hans.catkeys @@ -1,10 +1,8 @@ -1 english x-vnd.Haiku-ProcessController 2887520383 +1 english x-vnd.Haiku-ProcessController 2886374724 Memory usage ProcessController 内存使用 -Do you really want to kill the team \"%s\"? ProcessController 您确定要杀死该组 \"%s\"? Idle priority ProcessController 空闲优先级 Restart Deskbar ProcessController 重启桌面栏 Custom priority ProcessController 自定义优先级 -Debug thread ProcessController 调试线程 This team is already gone… ProcessController 该组已经结束... Error saving file ProcessController 保存文件错误 Real-time priority ProcessController 实时优先级 @@ -42,7 +40,6 @@ Usage: %s [-deskbar]\n ProcessController 用法: %s [-deskbar]\n ProcessController System name 进程控制器 Real-time display priority ProcessController 实时显示优先级 Please confirm ProcessController 请确认 -Yes, kill this team! ProcessController 是的,杀死该组! System resources & caches… ProcessController 系统资源与缓存... That's no Fun! ProcessController 不好玩的! You can run ProcessController in a window or install it in the Deskbar. ProcessController 您可以在窗口中运行进程控制器或者将其安装到桌面栏。 diff --git a/data/catalogs/apps/stylededit/el.catkeys b/data/catalogs/apps/stylededit/el.catkeys index f008442bd1..a73f32dffa 100644 --- a/data/catalogs/apps/stylededit/el.catkeys +++ b/data/catalogs/apps/stylededit/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-StyledEdit 3117187160 +1 greek, modern (1453-) x-vnd.Haiku-StyledEdit 3019034824 StyledEdit System name StyledEdit Paste Menus Επικόλληση OK LoadAlert Εντάξει @@ -43,6 +43,7 @@ Don't save QuitAlert Χωρίς αποθήκευση Align Menus Στοίχιση Color Menus Χρώμα Red Menus Κόκκινο +OK QuitAlert Εντάξει Open… Menus Άνοιγμα... Center Menus Κέντρο Blue Menus Μπλέ diff --git a/data/catalogs/apps/stylededit/hi.catkeys b/data/catalogs/apps/stylededit/hi.catkeys index 9643c275aa..bd68528987 100644 --- a/data/catalogs/apps/stylededit/hi.catkeys +++ b/data/catalogs/apps/stylededit/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-StyledEdit 3117187160 +1 hindi x-vnd.Haiku-StyledEdit 3019034824 StyledEdit System name StyledEdit Paste Menus पेस्ट OK LoadAlert ठीक है @@ -43,6 +43,7 @@ Don't save QuitAlert न सहेजें Align Menus संरेखित करे Color Menus रंग Red Menus लाल +OK QuitAlert ठीक है Open… Menus खोलें... Center Menus बीच में Blue Menus नीला diff --git a/data/catalogs/apps/stylededit/nl.catkeys b/data/catalogs/apps/stylededit/nl.catkeys index 8dddca1e39..2f1273f16b 100644 --- a/data/catalogs/apps/stylededit/nl.catkeys +++ b/data/catalogs/apps/stylededit/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-StyledEdit 3117187160 +1 dutch; flemish x-vnd.Haiku-StyledEdit 3019034824 StyledEdit System name StyledEdit Paste Menus Plakken OK LoadAlert Oké @@ -43,6 +43,7 @@ Don't save QuitAlert Niet opslaan Align Menus Uitlijnen Color Menus Kleur Red Menus Rood +OK QuitAlert Oké Open… Menus Openen… Center Menus Centreren Blue Menus Blauw diff --git a/data/catalogs/apps/stylededit/ro.catkeys b/data/catalogs/apps/stylededit/ro.catkeys index 3bd9422f48..924986c0b2 100644 --- a/data/catalogs/apps/stylededit/ro.catkeys +++ b/data/catalogs/apps/stylededit/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-StyledEdit 3117187160 +1 romanian x-vnd.Haiku-StyledEdit 3019034824 StyledEdit System name EditorText Paste Menus Lipește OK LoadAlert OK @@ -43,6 +43,7 @@ Don't save QuitAlert Nu salva Align Menus Aliniază Color Menus Culoare Red Menus Roșu +OK QuitAlert OK Open… Menus Deschide... Center Menus Centru Blue Menus Albastru diff --git a/data/catalogs/apps/stylededit/uk.catkeys b/data/catalogs/apps/stylededit/uk.catkeys index 4d6aaf7162..968e4520b4 100644 --- a/data/catalogs/apps/stylededit/uk.catkeys +++ b/data/catalogs/apps/stylededit/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-StyledEdit 3117187160 +1 ukrainian x-vnd.Haiku-StyledEdit 3019034824 StyledEdit System name Редактор тексту StyledEdit Paste Menus Вставити OK LoadAlert Гаразд @@ -43,6 +43,7 @@ Don't save QuitAlert Не зберігати Align Menus Вирівняти Color Menus Колір Red Menus Червоний +OK QuitAlert Гаразд Open… Menus Відкрити… Center Menus Центр Blue Menus Синій diff --git a/data/catalogs/apps/terminal/be.catkeys b/data/catalogs/apps/terminal/be.catkeys index a2df049b1d..4efc779335 100644 --- a/data/catalogs/apps/terminal/be.catkeys +++ b/data/catalogs/apps/terminal/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Terminal 766764238 +1 belarusian x-vnd.Haiku-Terminal 2967760334 Not found. Terminal TermWindow Не знойдзена. Switch Terminals Terminal TermWindow Пераключыць Тэрміналы Change directory Terminal TermView Змяніць дырэкторыю @@ -21,6 +21,7 @@ Font: Terminal AppearancePrefView Шрыфт: Copy here Terminal TermView Капіяваць сюды Really close? Terminal TermWindow Сапраўды закрыць? Copy Terminal TermWindow Капіяваць +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Тэрмінал Color scheme: Terminal AppearancePrefView Каляровая схема: Window title: Terminal TermWindow Імя вакна: Unrecognized option \"%s\"\n Terminal arguments parsing Невядомая опцыя \"%s\"\n @@ -78,6 +79,7 @@ Clear all Terminal TermWindow Ачысціць усё Text encoding Terminal TermWindow Кадоўка тэксту size Terminal TermView памер Close window Terminal TermWindow Закрыць вакно +\t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%T\t-\tThe Terminal application name for the current locale.\n\t%e\t-\tThe encoding of the current tab. Not shown for UTF-8.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tРабочы каталог актыўнага працэсу\n\t\t\tў цякучай укладцы.Дадаткова можна ўказаць макісмальную колькасць кампанентаў пуці.\n\t\t\t Напрыклад, '%2d' - не больша за два кампаненты.\n\t%T\t-\tІмя праграмы Тэрмінала ў актуальнай лакалі.\n\t%e\t-\tКадоўка актыўнай укладкі. Калі UTF-8 то не паказваецца.\n\t%i\t-\tІндэкс вакна.\n\t%p\t-\tІмя актыўнага працэсу ў цякучай укладцы.\n\t%t\t-\tІмя цякучай укладкі.\n\t%%\t-\tСімвал '%'. Save as default Terminal TermWindow Захаваць як прадвызначаныя Set tab title Terminal TermWindow Прызначыць імя ўкладкі Settings… Terminal TermWindow Наладкі… diff --git a/data/catalogs/apps/terminal/el.catkeys b/data/catalogs/apps/terminal/el.catkeys index 520c7565e2..4d3822d240 100644 --- a/data/catalogs/apps/terminal/el.catkeys +++ b/data/catalogs/apps/terminal/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-Terminal 4173005440 +1 greek, modern (1453-) x-vnd.Haiku-Terminal 3734948558 Not found. Terminal TermWindow Δε βρέθηκε. Switch Terminals Terminal TermWindow Εναλλαγή Τερματικών Change directory Terminal TermView Αλλαγή καταλόγου @@ -19,6 +19,7 @@ Font: Terminal AppearancePrefView Γραμματοσειρά: Copy here Terminal TermView Αντιγραφή εδώ Really close? Terminal TermWindow Να κλείσει σίγουρα; Copy Terminal TermWindow Αντιγραφή +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Terminal Window title: Terminal TermWindow Τίτλος παραθύρου: Unrecognized option \"%s\"\n Terminal arguments parsing Μη αναγνωρισμένη επιλογή \"%s\"\n %app% settings Terminal PrefWindow window title Ρυθμίσεις %app% diff --git a/data/catalogs/apps/terminal/fr.catkeys b/data/catalogs/apps/terminal/fr.catkeys index 28084e1806..fc20e1d985 100644 --- a/data/catalogs/apps/terminal/fr.catkeys +++ b/data/catalogs/apps/terminal/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Terminal 328707356 +1 french x-vnd.Haiku-Terminal 2967760334 Not found. Terminal TermWindow Non trouvé. Switch Terminals Terminal TermWindow Inverser les Terminaux Change directory Terminal TermView Changer de répertoire @@ -79,6 +79,7 @@ Clear all Terminal TermWindow Effacer tout Text encoding Terminal TermWindow Encodage texte size Terminal TermView taille Close window Terminal TermWindow Fermer la fenêtre +\t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%T\t-\tThe Terminal application name for the current locale.\n\t%e\t-\tThe encoding of the current tab. Not shown for UTF-8.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tLe répertoire de travail du processus actif dans l'onglet courant.\n\t\t\tVous pouvez éventuellement spécifier le nombre d'éléments maximum\n\t\t\tdans le chemin. Par exemple, '%2d' pour au plus deux éléments.\n\t%T\t-\tLe nom de l'application Terminal suivant les préférences linguistique en cours.\n\t%e\t-\tJeu de caractère utilisé par l'onglet courant. Masqué pour UTF-8.\n\t%i\t-\tL'indice de la fenêtre.\n\t%p\t-\tLe nom du processus actif dans l'onglet courant.\n\t%t\t-\tLe titre de l'onglet courant.\n\t%%\t-\tLe caractère '%'. Save as default Terminal TermWindow Enregistrer les préférences Set tab title Terminal TermWindow Changer le titre de l'onglet Settings… Terminal TermWindow Réglages… diff --git a/data/catalogs/apps/terminal/hi.catkeys b/data/catalogs/apps/terminal/hi.catkeys index 4cad6ea3bb..520495ccc6 100644 --- a/data/catalogs/apps/terminal/hi.catkeys +++ b/data/catalogs/apps/terminal/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-Terminal 323429748 +1 hindi x-vnd.Haiku-Terminal 4180340162 Not found. Terminal TermWindow नहीं मिला. Switch Terminals Terminal TermWindow स्विच टर्मिनल्स Change directory Terminal TermView निर्देशिका बदलें @@ -18,6 +18,7 @@ Font: Terminal AppearancePrefView फ़ॉन्ट: Copy here Terminal TermView यहाँ प्रतिलिपि बनाएँ Really close? Terminal TermWindow वास्तव में बंद? Copy Terminal TermWindow प्रतिलिपि बनाएँ +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions टर्मिनल Window title: Terminal TermWindow विंडो शीर्षक: Unrecognized option \"%s\"\n Terminal arguments parsing अपरिचित विकल्प \"%s\"\n %app% settings Terminal PrefWindow window title %app% settings diff --git a/data/catalogs/apps/terminal/lt.catkeys b/data/catalogs/apps/terminal/lt.catkeys index a42362d852..344aa21373 100644 --- a/data/catalogs/apps/terminal/lt.catkeys +++ b/data/catalogs/apps/terminal/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Terminal 3678865035 +1 lithuanian x-vnd.Haiku-Terminal 3240808153 Not found. Terminal TermWindow Nerasta. Switch Terminals Terminal TermWindow Pereiti į kitą terminalą Change directory Terminal TermView Keisti aplanką @@ -21,6 +21,7 @@ Font: Terminal AppearancePrefView Šriftas: Copy here Terminal TermView Kopijuoti čia Really close? Terminal TermWindow Ar tikrai užverti? Copy Terminal TermWindow Kopijuoti +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Terminalas Color scheme: Terminal AppearancePrefView Spalvų schema: Window title: Terminal TermWindow Lango antraštė: Unrecognized option \"%s\"\n Terminal arguments parsing Nežinomas argumentas: „%s“\n diff --git a/data/catalogs/apps/terminal/nl.catkeys b/data/catalogs/apps/terminal/nl.catkeys index d9f3df0cd4..4812d6e491 100644 --- a/data/catalogs/apps/terminal/nl.catkeys +++ b/data/catalogs/apps/terminal/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-Terminal 117590684 +1 dutch; flemish x-vnd.Haiku-Terminal 3974501098 Not found. Terminal TermWindow Niet gevonden. Switch Terminals Terminal TermWindow Wissel van Terminal Change directory Terminal TermView Directory veranderen @@ -19,6 +19,7 @@ Font: Terminal AppearancePrefView Lettertype: Copy here Terminal TermView Hierheen kopiëren Really close? Terminal TermWindow Bent u zeker dat u wilt sluiten? Copy Terminal TermWindow Kopiëren +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Terminal Window title: Terminal TermWindow Venstertitel: Unrecognized option \"%s\"\n Terminal arguments parsing Niet-herkende optie \"%s\"\n %app% settings Terminal PrefWindow window title Instellingen voor %app% diff --git a/data/catalogs/apps/terminal/pl.catkeys b/data/catalogs/apps/terminal/pl.catkeys index 1c09daa7a0..ecfb482e0b 100644 --- a/data/catalogs/apps/terminal/pl.catkeys +++ b/data/catalogs/apps/terminal/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Terminal 328707356 +1 polish x-vnd.Haiku-Terminal 2967760334 Not found. Terminal TermWindow Nie znaleziono. Switch Terminals Terminal TermWindow Przełącz Terminal Change directory Terminal TermView Zmień folder @@ -79,6 +79,7 @@ Clear all Terminal TermWindow Wyczyść wszystko Text encoding Terminal TermWindow Kodowanie tekstu size Terminal TermView rozmiar Close window Terminal TermWindow Zamknij okno +\t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%T\t-\tThe Terminal application name for the current locale.\n\t%e\t-\tThe encoding of the current tab. Not shown for UTF-8.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tBieżący katalog roboczy dla aktywnego procesu w bieżącej \n\t\t\tzakładce. Ocjonalnie może być określona maksymalna \n\t\t\tliczba elementów ścieżki, np. '%2d' dla co najmnie dwóch elementów.\n\t%T\t-\tNszwa aplikacji Terminala przy obecnych ustawieniach językowych.\n\t%e\t-\tKodowanie znaków obecnej zakładki. Puste, jeśli kodowaniem \n\t\t\tjest UTF-8.\n\t%i\t-\tnr okna.\n\t%p\t-\tNazwa aktywnego procesu w bieżącej zakładce.\n\t%t\t-\tTytuł obecnej zakładki.\n\t%%\t-\tZnak '%'. Save as default Terminal TermWindow Zapisz jako domyślne Set tab title Terminal TermWindow Ustaw tytuł karty Settings… Terminal TermWindow Ustawienia… diff --git a/data/catalogs/apps/terminal/pt_BR.catkeys b/data/catalogs/apps/terminal/pt_BR.catkeys index 3ed2a75e3d..0ee0309ab8 100644 --- a/data/catalogs/apps/terminal/pt_BR.catkeys +++ b/data/catalogs/apps/terminal/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-Terminal 328707356 +1 portuguese (brazil) x-vnd.Haiku-Terminal 2967760334 Not found. Terminal TermWindow Não localizado. Switch Terminals Terminal TermWindow Alternar Terminais Change directory Terminal TermView Mudar de pasta @@ -79,6 +79,7 @@ Clear all Terminal TermWindow Limpar tudo Text encoding Terminal TermWindow Codificação de texto size Terminal TermView tamanho Close window Terminal TermWindow Fechar janela +\t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%T\t-\tThe Terminal application name for the current locale.\n\t%e\t-\tThe encoding of the current tab. Not shown for UTF-8.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tO diretório atualmente em uso do processo ativo na\n\t\t\tguia atual. Opcionalmente o número máximo de componentes do caminho\n\t\t\tpode ser especificado. Por exemplo, '%2d' para ao menos dois componentes.\n\t%T\t-\tO nome do aplicativo Terminal para a localidade atual.\n\t%e\t-\tA codificação da guia atual. Não exibido para UTF-8.\n\t%i\t-\tO índice da janela.\n\t%p\t-\tO nome do processo ativo na guia atual.\n\t%t\t-\tO título da guia atual.\n\t%%\t-\tO caractere '%'. Save as default Terminal TermWindow Salvar como padrão Set tab title Terminal TermWindow Definir o título da guia Settings… Terminal TermWindow Configurações... diff --git a/data/catalogs/apps/terminal/ro.catkeys b/data/catalogs/apps/terminal/ro.catkeys index 1c5e2aacd5..ab9b20f3d7 100644 --- a/data/catalogs/apps/terminal/ro.catkeys +++ b/data/catalogs/apps/terminal/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-Terminal 4173005440 +1 romanian x-vnd.Haiku-Terminal 3734948558 Not found. Terminal TermWindow Nu a fost găsit. Switch Terminals Terminal TermWindow Comută terminale Change directory Terminal TermView Modifică dosar @@ -19,6 +19,7 @@ Font: Terminal AppearancePrefView Font: Copy here Terminal TermView Copiază aici Really close? Terminal TermWindow Sigur închideți? Copy Terminal TermWindow Copiază +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Terminal Window title: Terminal TermWindow Titlu fereastră: Unrecognized option \"%s\"\n Terminal arguments parsing Opțiune „%s” nerecunoscută\n %app% settings Terminal PrefWindow window title Setări %app% diff --git a/data/catalogs/apps/terminal/sk.catkeys b/data/catalogs/apps/terminal/sk.catkeys index 94e393eaea..3a63d812ec 100644 --- a/data/catalogs/apps/terminal/sk.catkeys +++ b/data/catalogs/apps/terminal/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Terminal 766764238 +1 slovak x-vnd.Haiku-Terminal 328707356 Not found. Terminal TermWindow Nenájdené. Switch Terminals Terminal TermWindow Prepnúť terminály Change directory Terminal TermView Zmeniť adresár @@ -21,6 +21,7 @@ Font: Terminal AppearancePrefView Písmo: Copy here Terminal TermView Skopírovať sem Really close? Terminal TermWindow Skutočne zatvoriť? Copy Terminal TermWindow Skopírovať +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Terminál Color scheme: Terminal AppearancePrefView Schéma farieb: Window title: Terminal TermWindow Titulok okna: Unrecognized option \"%s\"\n Terminal arguments parsing Nerozpoznaná voľba „%s“\n diff --git a/data/catalogs/apps/terminal/uk.catkeys b/data/catalogs/apps/terminal/uk.catkeys index 5503840d32..7950a767b6 100644 --- a/data/catalogs/apps/terminal/uk.catkeys +++ b/data/catalogs/apps/terminal/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Terminal 4173005440 +1 ukrainian x-vnd.Haiku-Terminal 3734948558 Not found. Terminal TermWindow Не знайдено. Switch Terminals Terminal TermWindow Перемкнути термінали Change directory Terminal TermView Змінити каталог @@ -19,6 +19,7 @@ Font: Terminal AppearancePrefView Шрифт: Copy here Terminal TermView Копіювати сюди Really close? Terminal TermWindow Дійсно закрити? Copy Terminal TermWindow Копіювати +Terminal Terminal TermWindow The title for the main window menubar entry related to terminal sessions Термінал Window title: Terminal TermWindow Ім'я вікна: Unrecognized option \"%s\"\n Terminal arguments parsing Невідома опція \"%s\"\n %app% settings Terminal PrefWindow window title Параметри %app% diff --git a/data/catalogs/apps/webpositive/be.catkeys b/data/catalogs/apps/webpositive/be.catkeys index b5a0184ba6..f60b9f1795 100644 --- a/data/catalogs/apps/webpositive/be.catkeys +++ b/data/catalogs/apps/webpositive/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-WebPositive 233049275 +1 belarusian x-vnd.Haiku-WebPositive 3577331897 Show home button Settings Window Паказваць кнопку "Дадому" Username: Authentication Panel Карыстальнік: Copy URL to clipboard Download Window Скапіяваць спасылку @@ -16,6 +16,7 @@ Start page: Settings Window Пачатковая старонка: History WebPositive Window Гісторыя Error opening downloads folder Download Window Немагчыма адчыніць папку запампованых файлаў Paste WebPositive Window Уставіць +Proxy username: Settings Window Імя карыстальніка проксі: Settings Settings Window Наладкі %seconds seconds left Download Window Засталося %seconds секунд Confirmation WebPositive Window Пацверджанне @@ -41,6 +42,7 @@ Quit WebPositive Window Выйсці Full screen WebPositive Window Поўнаэкранны рэжым Open download error Download Window Немагчыма адкрыць спампаваны файл Standard font: Settings Window Звычайны шрыфт: +Find previous occurrence of search terms WebPositive Window find bar previous button tooltip Знайсці папярэдні выпадак таго што шукаеце Restart Download Window Перазапусціць Proxy server Settings Window Проксі-сервер Open containing folder Download Window Адкрыць паку з гэтым файлам @@ -58,6 +60,7 @@ Cut WebPositive Window Выразаць Bookmark this page WebPositive Window Дадаць гэтую старонку ў закладкі There was an error trying to show the Bookmarks folder.\n\nError: %error WebPositive Window Don't translate variable %error Памылка падчас апрацоўкі папкі закладак.\n\nПамылка: %error Open downloads folder Download Window Адкрыць папку спамповак +Proxy password: Settings Window Пароль проксі: Number of days to keep links in History menu: Settings Window Выдаляць спасылкі з гісторыі пасля [дзён]: Hide Download Window Схаваць Reset size WebPositive Window Вярнуць памер @@ -67,6 +70,7 @@ There was an error retrieving the bookmark folder.\n\nError: %error WebPositive Over 1 day left Download Window Засталося болей 1 дня Downloads WebPositive Window Спампоўкі Requesting %url WebPositive Window Запыт да %url +Find next occurrence of search terms WebPositive Window find bar next button tooltip Знайсці наступны выпадак таго, што шукаеце Apply Settings Window Ужыць Bookmark info WebPositive Window Інфа пра закладку Size: Font Selection view Памер: @@ -80,6 +84,7 @@ Open blank page Settings Window Адчыніць пустую старонку New tabs: Settings Window Новыя ўкаладкі: Cancel WebPositive Window Скасаваць Open all WebPositive Window Адчыніць усе +Proxy server requires authentication Settings Window Проксі сервер патрабуе ідэнтыфікацыі Clear URL Bar Ачысьціць Cut URL Bar Выразаць Clear WebPositive Window Ачысьціць diff --git a/data/catalogs/kits/be.catkeys b/data/catalogs/kits/be.catkeys index 55fa824a9f..a13d2b3acf 100644 --- a/data/catalogs/kits/be.catkeys +++ b/data/catalogs/kits/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libbe 672385853 +1 belarusian x-vnd.Haiku-libbe 3504008668 gamma AboutWindow гамма beta AboutWindow бэта %3.2f GiB StringForSize %3.2f ГіБ @@ -7,7 +7,6 @@ About %app% AboutMenuItem Пра %app% Cut TextView Выразаць Version AboutWindow Версія Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Немагчыма стварыць рэплікант \"%description\".\n%error -About AboutWindow Пра праграму Copy TextView Капіяваць %3.2f KiB StringForSize %3.2f КіБ %d bytes StringForSize %d байтаў @@ -15,9 +14,11 @@ alpha AboutWindow альфа Error PrintJob Памылка No Pages to print! PrintJob Няма старонак для друку! All Rights Reserved. AboutWindow Усе правы захаваныя. +About %app% AboutWindow Пра %app% OK Dragger ОК OK PrintJob ОК Green: ColorControl Зялёны: +Ok AboutWindow Добра Version history: AboutWindow Гісторыя версій: Remove replicant Dragger Выдаліць рэпліканта OK ZombieReplicantView ОК diff --git a/data/catalogs/kits/de.catkeys b/data/catalogs/kits/de.catkeys index 077aa2cfa7..dddbaa4932 100644 --- a/data/catalogs/kits/de.catkeys +++ b/data/catalogs/kits/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libbe 672385853 +1 german x-vnd.Haiku-libbe 3504008668 gamma AboutWindow Gamma beta AboutWindow Beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem Über %app% Cut TextView Ausschneiden Version AboutWindow Version Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Replikant für \"%description\" konnte nicht erstellt werden.\n%error -About AboutWindow Über Copy TextView Kopieren %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d Bytes @@ -15,9 +14,11 @@ alpha AboutWindow Alpha Error PrintJob Fehler No Pages to print! PrintJob Keine Seiten zu drucken! All Rights Reserved. AboutWindow Alle Rechte vorbehalten. +About %app% AboutWindow Über %app% OK Dragger OK OK PrintJob OK Green: ColorControl Grün: +Ok AboutWindow OK Version history: AboutWindow Historie: Remove replicant Dragger Replikant entfernen OK ZombieReplicantView OK diff --git a/data/catalogs/kits/fi.catkeys b/data/catalogs/kits/fi.catkeys index c82592ed8a..55e2bf7acd 100644 --- a/data/catalogs/kits/fi.catkeys +++ b/data/catalogs/kits/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-libbe 672385853 +1 finnish x-vnd.Haiku-libbe 677628532 gamma AboutWindow gamma beta AboutWindow beeta %3.2f GiB StringForSize %3.2f gibitavua @@ -7,7 +7,6 @@ About %app% AboutMenuItem Ohjelmasta %app% Cut TextView Leikkaa Version AboutWindow Versio Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Ei voida luoda replikanttia kohteelle ”%description”.\n%error -About AboutWindow Ohjelmasta Copy TextView Kopioi %3.2f KiB StringForSize %3.2f kibitavua %d bytes StringForSize %d tavua diff --git a/data/catalogs/kits/fr.catkeys b/data/catalogs/kits/fr.catkeys index 20c4b12e6b..01c883a697 100644 --- a/data/catalogs/kits/fr.catkeys +++ b/data/catalogs/kits/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-libbe 672385853 +1 french x-vnd.Haiku-libbe 3504008668 gamma AboutWindow gamma beta AboutWindow bêta %3.2f GiB StringForSize %3.2f Gio @@ -7,7 +7,6 @@ About %app% AboutMenuItem À propos de %app% Cut TextView Couper Version AboutWindow Version Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Impossible de créer le réplicant pour « %description ».\n%error -About AboutWindow À propos Copy TextView Copier %3.2f KiB StringForSize %3.2f Kio %d bytes StringForSize %d octets @@ -15,9 +14,11 @@ alpha AboutWindow alpha Error PrintJob Erreur No Pages to print! PrintJob Aucune page à imprimer ! All Rights Reserved. AboutWindow Tous droits réservés. +About %app% AboutWindow À propos de %app% OK Dragger OK OK PrintJob OK Green: ColorControl Vert : +Ok AboutWindow Ok Version history: AboutWindow Historique des versions : Remove replicant Dragger Enlever le réplicant OK ZombieReplicantView OK diff --git a/data/catalogs/kits/hu.catkeys b/data/catalogs/kits/hu.catkeys index a1fa48c9cc..7f6e3c9cdb 100644 --- a/data/catalogs/kits/hu.catkeys +++ b/data/catalogs/kits/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-libbe 672385853 +1 hungarian x-vnd.Haiku-libbe 3504008668 gamma AboutWindow gamma beta AboutWindow béta %3.2f GiB StringForSize %3.2f GB @@ -7,7 +7,6 @@ About %app% AboutMenuItem %app% névjegye Cut TextView Kivágás Version AboutWindow Verzió Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nem lehet replikánst létrehozni ehhez: %description.\n%error -About AboutWindow Névjegy Copy TextView Másolás %3.2f KiB StringForSize %3.2f KB %d bytes StringForSize %Ld byte @@ -15,9 +14,11 @@ alpha AboutWindow alfa Error PrintJob Hiba No Pages to print! PrintJob Nincs nyomtatható oldal! All Rights Reserved. AboutWindow Minden jog fenntartva. +About %app% AboutWindow %app% névjegye OK Dragger Rendben OK PrintJob Rendben Green: ColorControl Zöld: +Ok AboutWindow Rendben Version history: AboutWindow Előző verziók: Remove replicant Dragger Replikáns eltávolítása OK ZombieReplicantView Rendben diff --git a/data/catalogs/kits/ja.catkeys b/data/catalogs/kits/ja.catkeys index 44a546d427..366504f3d5 100644 --- a/data/catalogs/kits/ja.catkeys +++ b/data/catalogs/kits/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-libbe 672385853 +1 japanese x-vnd.Haiku-libbe 677628532 gamma AboutWindow γ beta AboutWindow β %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem %app% について Cut TextView 切り取り Version AboutWindow バージョン Cannot create the replicant for \"%description\".\n%error ZombieReplicantView \"%description\" 用のレプリカントを作成できません。\n%error -About AboutWindow このソフトウェアについて… Copy TextView コピー %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d バイト diff --git a/data/catalogs/kits/lt.catkeys b/data/catalogs/kits/lt.catkeys index eee56ee208..5e45b903d4 100644 --- a/data/catalogs/kits/lt.catkeys +++ b/data/catalogs/kits/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-libbe 3528204916 +1 lithuanian x-vnd.Haiku-libbe 3533447595 gamma AboutWindow gama beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem Apie „%app%“ Cut TextView Iškirpti Version AboutWindow Versija Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nepavyko sukurti „%description“ replikanto.\n%error -About AboutWindow Apie Copy TextView Kopijuoti %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d B diff --git a/data/catalogs/kits/pl.catkeys b/data/catalogs/kits/pl.catkeys index d15aad5cf1..8dcba2c0cc 100644 --- a/data/catalogs/kits/pl.catkeys +++ b/data/catalogs/kits/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-libbe 1916257017 +1 polish x-vnd.Haiku-libbe 1921499696 gamma AboutWindow gamma beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem O %app% Cut TextView Wytnij Version AboutWindow Wersja Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nie można stworzyć replikanta dla \"%description\".\n%error -About AboutWindow O Copy TextView Kopiuj %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bajtów diff --git a/data/catalogs/kits/pt_BR.catkeys b/data/catalogs/kits/pt_BR.catkeys index 829c5cb434..fc1d39d260 100644 --- a/data/catalogs/kits/pt_BR.catkeys +++ b/data/catalogs/kits/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-libbe 672385853 +1 portuguese (brazil) x-vnd.Haiku-libbe 3504008668 gamma AboutWindow gama beta AboutWindow beta %3.2f GiB StringForSize %3.2f GB @@ -7,7 +7,6 @@ About %app% AboutMenuItem Sobre %app% Cut TextView Cortar Version AboutWindow Versão Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Não é possível criar o replicante para \"%description\".\n%error -About AboutWindow Sobre Copy TextView Copiar %3.2f KiB StringForSize %3.2f KB %d bytes StringForSize %d bytes @@ -15,9 +14,11 @@ alpha AboutWindow alfa Error PrintJob Erro No Pages to print! PrintJob Nenhuma Página para imprimir! All Rights Reserved. AboutWindow Todos os direitos reservados. +About %app% AboutWindow Sobre %app% OK Dragger OK OK PrintJob OK Green: ColorControl Verde: +Ok AboutWindow Ok Version history: AboutWindow Histórico de versões Remove replicant Dragger Remover replicante OK ZombieReplicantView OK diff --git a/data/catalogs/kits/ru.catkeys b/data/catalogs/kits/ru.catkeys index 4b0075d919..b89ce455e2 100644 --- a/data/catalogs/kits/ru.catkeys +++ b/data/catalogs/kits/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-libbe 672385853 +1 russian x-vnd.Haiku-libbe 3504008668 gamma AboutWindow гамма beta AboutWindow бета %3.2f GiB StringForSize %3.2f ГБ @@ -7,7 +7,6 @@ About %app% AboutMenuItem О программе… Cut TextView Вырезать Version AboutWindow Версия Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Невозможно удалить репликант \"%description\".\n%error -About AboutWindow О программе Copy TextView Копировать %3.2f KiB StringForSize %3.2f КБ %d bytes StringForSize %d байт @@ -15,9 +14,11 @@ alpha AboutWindow альфа Error PrintJob Ошибка No Pages to print! PrintJob Нет страниц для печати All Rights Reserved. AboutWindow Все права защищены. +About %app% AboutWindow О программе… OK Dragger ОК OK PrintJob ОК Green: ColorControl Зеленый: +Ok AboutWindow Ок Version history: AboutWindow История версий: Remove replicant Dragger Удалить репликант OK ZombieReplicantView ОК diff --git a/data/catalogs/kits/sk.catkeys b/data/catalogs/kits/sk.catkeys index 1e7d145079..9c3e6f26ef 100644 --- a/data/catalogs/kits/sk.catkeys +++ b/data/catalogs/kits/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libbe 672385853 +1 slovak x-vnd.Haiku-libbe 677628532 gamma AboutWindow gama beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem O aplikácii %app% Cut TextView Vystrihnúť Version AboutWindow Verzia Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Nemožno vytvoriť replikanta pre „%description“.\n%error -About AboutWindow O aplikácii Copy TextView Kopírovať %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bajtov diff --git a/data/catalogs/kits/sv.catkeys b/data/catalogs/kits/sv.catkeys index 60dac3e27f..d8f5b89df6 100644 --- a/data/catalogs/kits/sv.catkeys +++ b/data/catalogs/kits/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libbe 672385853 +1 swedish x-vnd.Haiku-libbe 677628532 gamma AboutWindow gamma beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem Om %app% Cut TextView Klippa ut Version AboutWindow Version Cannot create the replicant for \"%description\".\n%error ZombieReplicantView Kan inte skapa replikanten för "%description".\n%error -About AboutWindow Om Copy TextView Kopiera %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d byte diff --git a/data/catalogs/kits/textencoding/be.catkeys b/data/catalogs/kits/textencoding/be.catkeys index 4a519ac21e..897f187799 100644 --- a/data/catalogs/kits/textencoding/be.catkeys +++ b/data/catalogs/kits/textencoding/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtextencoding 3062073902 +1 belarusian x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO Грэцкая ISO South European textencodings ISO Паўднёва-Еўрапейская Chinese Big5 textencodings Кітайская Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO Арабская ISO Latin 9 textencodings ISO Latin 9 Japanese Shift JIS textencodings Японская Shift JIS DOS Cyrillic textencodings Кірыліца DOS +Windows Central European (CP 1250) textencodings Windows Цэнтральная Эўропа (CP 1250) Windows Cyrillic (CP 1251) textencodings Кірыліца Windows (CP 1251) Japanese EUC textencodings Японская EUC Unicode textencodings Юнікод diff --git a/data/catalogs/kits/textencoding/de.catkeys b/data/catalogs/kits/textencoding/de.catkeys index 7128647750..b1e5ab410f 100644 --- a/data/catalogs/kits/textencoding/de.catkeys +++ b/data/catalogs/kits/textencoding/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libtextencoding 3062073902 +1 german x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO Griechisch ISO South European textencodings ISO Südeuropäisch Chinese Big5 textencodings Chinesisch Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO Arabisch ISO Latin 9 textencodings ISO Latin-9 Japanese Shift JIS textencodings Japanisch (Shift-JIS) DOS Cyrillic textencodings DOS Kyrillisch +Windows Central European (CP 1250) textencodings Windows Zentraleuropäisch (CP 1250) Windows Cyrillic (CP 1251) textencodings Kyrillisch Windows (CP 1251) Japanese EUC textencodings Japanisch EUC Unicode textencodings Unicode diff --git a/data/catalogs/kits/textencoding/fr.catkeys b/data/catalogs/kits/textencoding/fr.catkeys index 7e462996a8..d60f13ddc8 100644 --- a/data/catalogs/kits/textencoding/fr.catkeys +++ b/data/catalogs/kits/textencoding/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-libtextencoding 3062073902 +1 french x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO Grecque ISO South European textencodings ISO Europe du Sud Chinese Big5 textencodings Chinois Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO Arabe ISO Latin 9 textencodings ISO Latin 9 Japanese Shift JIS textencodings Japonais Shift-JIS DOS Cyrillic textencodings DOS Cyrillique +Windows Central European (CP 1250) textencodings Windows Europe Centrale (CP 1250) Windows Cyrillic (CP 1251) textencodings Windows Cyrillique (CP 1251) Japanese EUC textencodings Japonais EUC Unicode textencodings Unicode diff --git a/data/catalogs/kits/textencoding/hu.catkeys b/data/catalogs/kits/textencoding/hu.catkeys index 36cd0d6d6e..ab5708c94a 100644 --- a/data/catalogs/kits/textencoding/hu.catkeys +++ b/data/catalogs/kits/textencoding/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-libtextencoding 3062073902 +1 hungarian x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO görög ISO South European textencodings ISO dél-európai Chinese Big5 textencodings Kínai Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO arab ISO Latin 9 textencodings ISO latin-9 Japanese Shift JIS textencodings Japán Shift JIS DOS Cyrillic textencodings DOS cirill +Windows Central European (CP 1250) textencodings Windows Közép-európai (CP 1250) Windows Cyrillic (CP 1251) textencodings Windows cirill (CP 1251) Japanese EUC textencodings Japán EUC Unicode textencodings Unicode diff --git a/data/catalogs/kits/textencoding/ja.catkeys b/data/catalogs/kits/textencoding/ja.catkeys index 9e77c7f021..6bb54c2a7a 100644 --- a/data/catalogs/kits/textencoding/ja.catkeys +++ b/data/catalogs/kits/textencoding/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-libtextencoding 3062073902 +1 japanese x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ギリシャ語 ISO South European textencodings 南欧 Chinese Big5 textencodings 中国語 @@ -7,6 +7,7 @@ ISO Arabic textencodings アラビア語 ISO Latin 9 textencodings ラテン文字 Japanese Shift JIS textencodings 日本語 DOS Cyrillic textencodings キリル文字 +Windows Central European (CP 1250) textencodings 中央ヨーロッパ (Windows CP 1250) Windows Cyrillic (CP 1251) textencodings キリル文字 (Windows CP 1251) Japanese EUC textencodings 日本語 Unicode textencodings ユニコード diff --git a/data/catalogs/kits/textencoding/pt_BR.catkeys b/data/catalogs/kits/textencoding/pt_BR.catkeys index 6f994abe68..c2a358fe6b 100644 --- a/data/catalogs/kits/textencoding/pt_BR.catkeys +++ b/data/catalogs/kits/textencoding/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-libtextencoding 3062073902 +1 portuguese (brazil) x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings Grego ISO ISO South European textencodings Europeu do Sul ISO Chinese Big5 textencodings Chinês Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings Árabe ISO ISO Latin 9 textencodings Latino 9 ISO Japanese Shift JIS textencodings Japonês Shift JIS DOS Cyrillic textencodings Cirílico DOS +Windows Central European (CP 1250) textencodings Windows Centro-europeu (CP 1250) Windows Cyrillic (CP 1251) textencodings Cirílico Windows (CP 1251) Japanese EUC textencodings Japonês EUC Unicode textencodings Unicode diff --git a/data/catalogs/kits/textencoding/ru.catkeys b/data/catalogs/kits/textencoding/ru.catkeys index 504f1d9dcc..df5cd93b0c 100644 --- a/data/catalogs/kits/textencoding/ru.catkeys +++ b/data/catalogs/kits/textencoding/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-libtextencoding 3062073902 +1 russian x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO Греческая ISO South European textencodings ISO Южноевропейская Chinese Big5 textencodings Китайская Big5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO Арабская ISO Latin 9 textencodings ISO Latin 9 Japanese Shift JIS textencodings Японская Shift JIS DOS Cyrillic textencodings DOS Кириллица +Windows Central European (CP 1250) textencodings Windows Центральная Европа (CP 1250) Windows Cyrillic (CP 1251) textencodings Windows Кириллица (CP 1251) Japanese EUC textencodings Японская EUC Unicode textencodings Юникод diff --git a/data/catalogs/kits/textencoding/sv.catkeys b/data/catalogs/kits/textencoding/sv.catkeys index 3fcbc4f782..13a12729ea 100644 --- a/data/catalogs/kits/textencoding/sv.catkeys +++ b/data/catalogs/kits/textencoding/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libtextencoding 3062073902 +1 swedish x-vnd.Haiku-libtextencoding 1525027211 ISO Greek textencodings ISO Grekisk ISO South European textencodings ISO Sydeuropeisk Chinese Big5 textencodings Kinesisk Stor5 @@ -7,6 +7,7 @@ ISO Arabic textencodings ISO Arabiska ISO Latin 9 textencodings ISO Latin 9 Japanese Shift JIS textencodings Japansk Shift JIS DOS Cyrillic textencodings DOS Kyrillisk +Windows Central European (CP 1250) textencodings Windows centraleuropeisk (CP 1250) Windows Cyrillic (CP 1251) textencodings Windows Kyrillisk (CP 1251) Japanese EUC textencodings Japansk EUC Unicode textencodings Unicode diff --git a/data/catalogs/kits/tracker/be.catkeys b/data/catalogs/kits/tracker/be.catkeys index 4b46d9187a..c356a1e922 100644 --- a/data/catalogs/kits/tracker/be.catkeys +++ b/data/catalogs/kits/tracker/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtracker 3375521561 +1 belarusian x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY агульны OK WidgetAttributeText ОК Icon view VolumeWindow Від іконак @@ -74,6 +74,7 @@ Arrange by ContainerWindow Сартаваць па Mount server error AutoMounterSettings Памылка сервера мантавання Search FindPanel Пошук Preparing to empty Trash… StatusWindow Падрыхтоўка да ачысткі Сметніцы… +You cannot put the selected item(s) into the trash. FSUtils Немагчыма змясціць абраны(я) элемент(ы) ў сметніцу. Disks Model Дыскі Create link ContainerWindow Стварыць спасылку develop B_COMMON_DEVELOP_DIRECTORY распрацоўка @@ -142,6 +143,7 @@ Add-ons ContainerWindow Дапаўненні Edit templates… TemplatesMenu Правіць шаблоны… Finish: %time - Over %finishtime left StatusWindow Завяршэнне: %time - Засталося каля %finishtime An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Элемент \"%name\" у гэтым каталозе ўжо існуе. Ці жадаеце замяніць яго ствараемай спасылкай? +Fewer options FindPanel Менш наладак Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Прабачце, не хапае месца на томе прызначэння для капіявання выбранага. Could not open \"%document\" with application \"%app\" (%error). FSUtils Нельга адкрыць \"%document\" праграмай \"%app\" (%error). Sorry, saving more than one item is not allowed. FilePanelPriv Прабачце, захаванне больш чым аднаго элемента не дазволена. @@ -211,7 +213,6 @@ Resize to fit VolumeWindow Расцягнуць Could not find application \"%appname\" OpenWithWindow Не ўдалося знайсці праграму \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Выбраны элемент нельга адправіць у Сметніцу. Жадаеце выдаліць іх беззваротна? Invert SelectionWindow Інвертаваць -Save Query as template… FindPanel Захаваць Запыт як шаблон… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) перайменуеце Find FindPanel Знайсці Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Перасунуць @@ -236,6 +237,7 @@ Temporary FindPanel Часовы Version OpenWithWindow Версія Default application InfoWindow Прадвызначаная праграма Preparing to copy items… StatusWindow Падрыхтоўка да капіявання… +Save query as template… FindPanel Захаваць запыт як шаблон… Show folder location in title tab SettingsView Паказваць адрас каталога у імені ўкладкі Proceed FSUtils Далей Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Некаторыя элементы ужо існуюць у гэтым каталозе з тымі ж імёнамі, як і ў элементаў, якія вы %verb.\n \nЖадаеце замяніць іх тымі, што вы %verb, або вырашыць асобна для кожнага элемента? @@ -334,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Прыбрацца after FindPanel пасля Select… QueryContainerWindow Выбраць… +More options FindPanel Больш параметраў link FSUtils filename link спасылка At %func \nfind_directory() failed. \nReason: %error TrackerInitialState У %func \nfind_directory() не ўдалося. \nПрычына: %error The specified name is illegal. Please choose another name. FilePanelPriv Пазначанае імя недапушчальна. Калі ласка, выберыце іншае. @@ -445,6 +448,7 @@ contains FindPanel месціць Relation OpenWithWindow Адносіны Open FilePanelPriv Адкрыць Mount DeskWindow Змантаваць +Recent queries FindPanel Папярэднія запыты Mount ContainerWindow Змантаваць %capacity (%used used -- %free free) InfoWindow %capacity (%used выкарыстана -- %free свабодна) Cancel FSClipBoard Адмена diff --git a/data/catalogs/kits/tracker/de.catkeys b/data/catalogs/kits/tracker/de.catkeys index 96eb7df55e..e830192c1c 100644 --- a/data/catalogs/kits/tracker/de.catkeys +++ b/data/catalogs/kits/tracker/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-libtracker 4167158175 +1 german x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY Allgemein OK WidgetAttributeText OK Icon view VolumeWindow Icon-Ansicht @@ -143,6 +143,7 @@ Add-ons ContainerWindow Add-ons Edit templates… TemplatesMenu Vorlagen bearbeiten… Finish: %time - Over %finishtime left StatusWindow Fertig: %time - Noch über %finishtime An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Ein Objekt mit dem Namen \"%name\" existiert bereits in diesem Ordner. Soll es mit der Verknüpfung ersetzt werden, die gerade erstellt werden soll? +Fewer options FindPanel Weniger Optionen Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Es ist nicht genug Speicherplatz auf dem Zieldatenträger frei, um die Auswahl zu kopieren. Could not open \"%document\" with application \"%app\" (%error). FSUtils \"%document\" konnte nicht mit der Anwendung \"%app\" geöffnet werden (%error). Sorry, saving more than one item is not allowed. FilePanelPriv Es kann leider immer nur ein einzelnes Objekt gespeichert werden. @@ -212,7 +213,6 @@ Resize to fit VolumeWindow Optimale Größe Could not find application \"%appname\" OpenWithWindow Die Anwendung \"%appname\" wurde nicht gefunden. The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Das ausgewählte Objekt kann nicht in den Papierkorb verschoben werden. Soll es stattdessen gelöscht werden? (Diese Aktion kann nicht rückgängig gemacht werden.) Invert SelectionWindow Umkehren -Save Query as template… FindPanel Query als Vorlage speichern… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) umbenannt Find FindPanel Suchen Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Verschieben @@ -237,6 +237,7 @@ Temporary FindPanel Temporär Version OpenWithWindow Version Default application InfoWindow Standardanwendung Preparing to copy items… StatusWindow Kopieren wird vorbereitet… +Save query as template… FindPanel Query als Vorlage speichern… Show folder location in title tab SettingsView Ordnerpfad im Fenstertitel zeigen Proceed FSUtils Fortfahren Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Manche Objekte in diesem Ordner heißen genauso wie Objekte, die gerade %verb werden sollen.\n\nSollen sie alle ersetzt werden, oder soll jedes Mal einzeln nachgefragt werden? @@ -335,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Icons ausrichten after FindPanel nach Select… QueryContainerWindow Auswählen… +More options FindPanel Weitere Optionen link FSUtils filename link Verknüpfung At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Bei %func \nfind_directory() fehlgeschlagen \nGrund: %error The specified name is illegal. Please choose another name. FilePanelPriv Der angegebene Name ist nicht gültig. Bitte einen anderen wählen. @@ -446,6 +448,7 @@ contains FindPanel enthält Relation OpenWithWindow Beziehung Open FilePanelPriv Öffnen Mount DeskWindow Einhängen +Recent queries FindPanel Letzte Queries Mount ContainerWindow Einhängen %capacity (%used used -- %free free) InfoWindow %capacity (%used benutzt -- %free frei) Cancel FSClipBoard Abbrechen diff --git a/data/catalogs/kits/tracker/el.catkeys b/data/catalogs/kits/tracker/el.catkeys index 635f8873cf..7be265f80c 100644 --- a/data/catalogs/kits/tracker/el.catkeys +++ b/data/catalogs/kits/tracker/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-libtracker 3015739927 +1 greek, modern (1453-) x-vnd.Haiku-libtracker 487315638 common B_COMMON_DIRECTORY κοινό OK WidgetAttributeText Εντάξει Icon view VolumeWindow Προβολή εικονιδίου @@ -197,7 +197,6 @@ Resize to fit VolumeWindow Αλλαγή μεγέθους για να χωράε Could not find application \"%appname\" OpenWithWindow Αδυναμία εύρεσης της εφαρμογής \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView To επιλεγμένο στοιχείο δε μπορεί να μετακινηθεί στον κάδο απορριμμάτων. Θα θέλατε να το διαγράψετε αντ' αυτού; (Αυτή η λειτουργία δεν μπορεί να επανέλθει.) Invert SelectionWindow Αντιστροφή -Save Query as template… FindPanel Αποθήκευση του ερωτήματος ως πρότυπο... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) μετονομασία Find FindPanel Εύρεση Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Μετακίνηση diff --git a/data/catalogs/kits/tracker/fi.catkeys b/data/catalogs/kits/tracker/fi.catkeys index 2987ff7db6..6e53f69270 100644 --- a/data/catalogs/kits/tracker/fi.catkeys +++ b/data/catalogs/kits/tracker/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-libtracker 4167158175 +1 finnish x-vnd.Haiku-libtracker 1638733886 common B_COMMON_DIRECTORY yhteinen OK WidgetAttributeText Valmis Icon view VolumeWindow Kuvakenäkymä @@ -212,7 +212,6 @@ Resize to fit VolumeWindow Muunna koko sopimaan Could not find application \"%appname\" OpenWithWindow Ei voitu löytää sovellusta ”%appname” The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Valittua kohdetta ei voida siirtää roskakoriin. Haluaisitko sen sijaan poistaa sen? (Tätä toimintoa ei voida palauttaa.) Invert SelectionWindow Käänteinen -Save Query as template… FindPanel Tallenna kysely mallinteena... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) nimeä uudelleen Find FindPanel Haku Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Siirrä diff --git a/data/catalogs/kits/tracker/fr.catkeys b/data/catalogs/kits/tracker/fr.catkeys index d1d68eb7ec..ed3eab3706 100644 --- a/data/catalogs/kits/tracker/fr.catkeys +++ b/data/catalogs/kits/tracker/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-libtracker 4167158175 +1 french x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY commun OK WidgetAttributeText OK Icon view VolumeWindow Vue en icônes @@ -143,6 +143,7 @@ Add-ons ContainerWindow Extensions Edit templates… TemplatesMenu Éditer les modèles… Finish: %time - Over %finishtime left StatusWindow Fin : %time - il reste plus de %finishtime An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Un élément nommé « %name » existe déjà dans ce dossier. Voulez vous le remplacer par le lien symbolique que vous créez ? +Fewer options FindPanel Moins d'options Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Désolé, il n'y a pas assez d'espace libre dans le volume cible pour copier la sélection. Could not open \"%document\" with application \"%app\" (%error). FSUtils Impossible d'ouvrir « %document » avec l'application « %app » (%error). Sorry, saving more than one item is not allowed. FilePanelPriv Désolé, il n'est pas permis de sauvegarder plus d'un élément. @@ -212,7 +213,6 @@ Resize to fit VolumeWindow Ajuster Could not find application \"%appname\" OpenWithWindow Impossible de trouver l'application « %appname » The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView L'élément sélectionné ne peut pas être envoyé à la Corbeille. Voulez vous le supprimer ? (Cette opération est irrémédiable.) Invert SelectionWindow Inverser -Save Query as template… FindPanel Enregistrer le modèle de la requête… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) renommez Find FindPanel Rechercher Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Déplacer @@ -237,6 +237,7 @@ Temporary FindPanel Temporaire Version OpenWithWindow Version Default application InfoWindow Application par défaut Preparing to copy items… StatusWindow Copie des éléments en préparation… +Save query as template… FindPanel Enregistrer le modèle de la requête… Show folder location in title tab SettingsView Afficher l'emplacement du dossier dans la barre de titre Proceed FSUtils Procéder Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Plusieurs éléments de ce dossier portent les mêmes noms que des éléments que vous êtes en train de %verb.\n\nVoulez-vous les remplacer par ceux que vous êtes en train de %verb ou voulez-vous qu'une confirmation vous soit demandée pour chacun d'eux ? @@ -335,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Nettoyer after FindPanel après Select… QueryContainerWindow Sélectionner… +More options FindPanel Plus d'options link FSUtils filename link lien At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Dans %func\nfind_directory() a échoué.\nMotif : %error The specified name is illegal. Please choose another name. FilePanelPriv Le nom indiqué n'est pas valide. Veuillez choisir un autre nom. @@ -446,6 +448,7 @@ contains FindPanel contient Relation OpenWithWindow Relation Open FilePanelPriv Ouvrir Mount DeskWindow Monter +Recent queries FindPanel Requêtes récentes Mount ContainerWindow Monter %capacity (%used used -- %free free) InfoWindow %capacity (%used utilisés -- %free libres) Cancel FSClipBoard Annuler diff --git a/data/catalogs/kits/tracker/hi.catkeys b/data/catalogs/kits/tracker/hi.catkeys index 00fd369d00..b90716a724 100644 --- a/data/catalogs/kits/tracker/hi.catkeys +++ b/data/catalogs/kits/tracker/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-libtracker 1458537919 +1 hindi x-vnd.Haiku-libtracker 3225080926 common B_COMMON_DIRECTORY सामान्य OK WidgetAttributeText ठीक है Icon view VolumeWindow चिह्न दृश्य @@ -197,7 +197,6 @@ Resize to fit VolumeWindow आकार बदलने के फिट कर Could not find application \"%appname\" OpenWithWindow आवेदन नहीं मिला \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView चयनित आइटम को कचरा पेटी में स्थानांतरित नहीं किया जा सकता है. क्या आप इसे इसकी बजाय मिटाना चाहते हैं? (यह आपरेशन किया जाना है. नहीं लौट सकते हैं) Invert SelectionWindow पलटे -Save Query as template… FindPanel टेम्पलेट के रूप में सहेजें क्वेरी... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) फिर से नाम दें Find FindPanel खोजें Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) मूव diff --git a/data/catalogs/kits/tracker/hu.catkeys b/data/catalogs/kits/tracker/hu.catkeys index ae42ac9ffe..eedd9be766 100644 --- a/data/catalogs/kits/tracker/hu.catkeys +++ b/data/catalogs/kits/tracker/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-libtracker 4167158175 +1 hungarian x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY Közös OK WidgetAttributeText Rendben Icon view VolumeWindow Ikon nézet @@ -143,6 +143,7 @@ Add-ons ContainerWindow Kiegészítők Edit templates… TemplatesMenu Sablonok szerkesztése… Finish: %time - Over %finishtime left StatusWindow Befejezés: %time - Több, mint %finishtime van hátra An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Már van ebben a mappában egy elem ezzel a névvel: %name. Szeretné felülírni a most elkészítendő szimbolikus hivatkozást? +Fewer options FindPanel Kevesebb opció Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Sajnáljuk, de nincs elég hely a kiválasztott lemezen a másoláshoz. Could not open \"%document\" with application \"%app\" (%error). FSUtils Nem sikerült megnyitni a dokumentumot (%document) a programmal (%app).\n\t%error Sorry, saving more than one item is not allowed. FilePanelPriv Sajnálom, de egyszerre csak egy elemet lehet elmenteni. @@ -212,7 +213,6 @@ Resize to fit VolumeWindow Átméretezés hogy elférjen Could not find application \"%appname\" OpenWithWindow A program (%appname) nem található The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView A kiválasztott elemet nem lehet a Szemetesbe mozgatni. Szeretné inkább törölni? (Nem vonható vissza.) Invert SelectionWindow Megfordítás -Save Query as template… FindPanel Keresés mentése sablonként… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) átnevezi Find FindPanel Keresés Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Mozgatás @@ -237,6 +237,7 @@ Temporary FindPanel Ideiglenes megőrzés Version OpenWithWindow Verzió Default application InfoWindow Alapértelmezett program Preparing to copy items… StatusWindow Felkészülés az elemek másolására… +Save query as template… FindPanel Keresés mentése sablonként… Show folder location in title tab SettingsView Mappa helyének megjelenítése a fülön Proceed FSUtils Folytatás Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils A mappában már néhány elem neve megyegyezik azzal, amit Ön %verb akar.\n\nSzeretné lecserélni öket azokkal amiket ön szeretne most %verb, vagy minden elemnél kérdezzük meg? @@ -335,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Rendrakás after FindPanel utána Select… QueryContainerWindow Kijelölés… +More options FindPanel További opciók link FSUtils filename link hivatkozás At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Ennél: %func \nsikertelen volt a find_directory(). \nOka: %error The specified name is illegal. Please choose another name. FilePanelPriv A megadott név szabálytalan. Kérjük válasszon egy másik nevet. @@ -446,6 +448,7 @@ contains FindPanel tartalmazza Relation OpenWithWindow Kapcsolat Open FilePanelPriv Megnyitás Mount DeskWindow Csatolás +Recent queries FindPanel Előző keresések Mount ContainerWindow Csatolás %capacity (%used used -- %free free) InfoWindow %capacity (%used használt -- %free szabad) Cancel FSClipBoard Mégse diff --git a/data/catalogs/kits/tracker/ja.catkeys b/data/catalogs/kits/tracker/ja.catkeys index 6499e50dce..885c833543 100644 --- a/data/catalogs/kits/tracker/ja.catkeys +++ b/data/catalogs/kits/tracker/ja.catkeys @@ -1,4 +1,5 @@ -1 japanese x-vnd.Haiku-libtracker 251834432 +1 japanese x-vnd.Haiku-libtracker 1188087477 +common B_COMMON_DIRECTORY 一般 OK WidgetAttributeText OK Icon view VolumeWindow アイコン表示 Add-ons FilePanelPriv アドオン @@ -123,6 +124,7 @@ Create %s clipping PoseView %s クリップを作成 Set new link target InfoWindow リンク先を変更 If you %ifYouDoAction the system folder or its contents, you won't be able to boot %osName!\n\nAre you sure you want to do this?\n\nTo %toDoAction the system folder or its contents anyway, hold down the Shift key and click \"%toConfirmAction\". FSUtils システムフォルダーおよびその中身を%ifYouDoActionした場合、%osName が起動しなくなります!\n\n本当に続けますか?\n\nそれでもシステムフォルダーまたはその中身の%toDoActionを実行するなら、Shift キーを押しながら \"%toConfirmAction\" をクリックしてください。 Save as Query template: FindPanel クエリ雛型として保存する: +preferences B_PREFERENCES_DIRECTORY 設定 Cancel FSUtils 中止 move FSUtils As in 'to move this folder...' (en) Um diesen Ordner zu verschieben...' (de) 移動 Edit name ContainerWindow 名前の編集 @@ -139,6 +141,7 @@ Add-ons ContainerWindow アドオン Edit templates… TemplatesMenu テンプレートを編集… Finish: %time - Over %finishtime left StatusWindow 終了: %time - 残り %finishtime 以上 An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils このフォルダーにすでに \"%name\" という項目があります。作成しようとしているシンボリックリンクと置き換えますか? +Fewer options FindPanel 検索オプションを隠す Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils コピー先ディスクの空き容量が不足しています。コピーができません。 Could not open \"%document\" with application \"%app\" (%error). FSUtils アプリケーション \"%app\" を使って \"%document\" を開けませんでした (%error)。 Sorry, saving more than one item is not allowed. FilePanelPriv 2 項目以上は保存できません。 @@ -208,7 +211,6 @@ Resize to fit VolumeWindow 最適な表示サイズに変更 Could not find application \"%appname\" OpenWithWindow アプリケーション \"%appname\" が見つかりませんでした The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView 選択した項目をごみ箱に移動できません。完全に削除しても良いでしょうか?元は戻せませんので、ご注意ください。 Invert SelectionWindow 反転 -Save Query as template… FindPanel クエリテンプレートとして保存… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) 名前の変更 Find FindPanel 検索 Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) 移動 @@ -233,6 +235,7 @@ Temporary FindPanel 一時的なクエリ Version OpenWithWindow バージョン Default application InfoWindow デフォルトアプリケーション Preparing to copy items… StatusWindow コピーの準備をしています… +Save query as template… FindPanel クエリテンプレートとして保存… Show folder location in title tab SettingsView タイトルタブにフォルダー位置を表示 Proceed FSUtils 続行 Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils %verbしようとしているものと同じ名前の項目がすでにフォルダーの中に存在します。\n \n%verbして置き換えますか?それとも、一つずつ確認しますか? @@ -330,6 +333,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow アイコンの整列 after FindPanel 以降 Select… QueryContainerWindow 選択… +More options FindPanel 検索オプションを表示 link FSUtils filename link リンク At %func \nfind_directory() failed. \nReason: %error TrackerInitialState %func にて\nfind_directory() が失敗。\nエラー: %error The specified name is illegal. Please choose another name. FilePanelPriv 指定された名前は利用できない文字を含んでいます。他の名前を指定してください。 @@ -441,6 +445,7 @@ contains FindPanel 含む Relation OpenWithWindow 関連 Open FilePanelPriv 開く Mount DeskWindow マウント +Recent queries FindPanel 最近のクエリー Mount ContainerWindow マウント %capacity (%used used -- %free free) InfoWindow %capacity (%used 使用中 -- %free 使用可能) Cancel FSClipBoard 中止 diff --git a/data/catalogs/kits/tracker/lt.catkeys b/data/catalogs/kits/tracker/lt.catkeys index cb31d01565..17e8db1417 100644 --- a/data/catalogs/kits/tracker/lt.catkeys +++ b/data/catalogs/kits/tracker/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-libtracker 3375521561 +1 lithuanian x-vnd.Haiku-libtracker 847097272 common B_COMMON_DIRECTORY Bendra OK WidgetAttributeText Gerai Icon view VolumeWindow Rodyti piktogramas @@ -211,7 +211,6 @@ Resize to fit VolumeWindow Pritaikyti dydį prie turinio Could not find application \"%appname\" OpenWithWindow Programos „%appname“ rasti nepavyko The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Pažymėto elemento išmesti Šiukšlinėn negalima. Ar norite vietoje to jį pašalinti? Neužmirškite, jog šis veiksmas negrįžtamas! Invert SelectionWindow Invertuoti -Save Query as template… FindPanel Įrašyti užklausą kaip šabloną… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) pervardinsite Find FindPanel Ieškoti Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Perkelti diff --git a/data/catalogs/kits/tracker/nl.catkeys b/data/catalogs/kits/tracker/nl.catkeys index 18585860b6..87e54cfcb2 100644 --- a/data/catalogs/kits/tracker/nl.catkeys +++ b/data/catalogs/kits/tracker/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-libtracker 720928714 +1 dutch; flemish x-vnd.Haiku-libtracker 2487471721 common B_COMMON_DIRECTORY algemeen OK WidgetAttributeText OK Icon view VolumeWindow Icoonweergave @@ -211,7 +211,6 @@ Resize to fit VolumeWindow Grootte passend maken Could not find application \"%appname\" OpenWithWindow Kon de toepassing \"%appname\" niet vinden The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Het geselecteerde item kon niet naar de prullenbak verplaatst worden. Wilt u het in plaats daarvan verwijderen? (Deze actie kan niet ongedaan gemaakt worden.) Invert SelectionWindow Omkeren -Save Query as template… FindPanel Sla zoekopdracht op als sjabloon... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) hernoemen Find FindPanel Zoeken Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Verplaatsen diff --git a/data/catalogs/kits/tracker/pl.catkeys b/data/catalogs/kits/tracker/pl.catkeys index 12bac5ceab..c40dc89ed2 100644 --- a/data/catalogs/kits/tracker/pl.catkeys +++ b/data/catalogs/kits/tracker/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-libtracker 2345639754 +1 polish x-vnd.Haiku-libtracker 745004356 common B_COMMON_DIRECTORY wspólny OK WidgetAttributeText OK Icon view VolumeWindow Widok ikon @@ -210,7 +210,6 @@ Resize to fit VolumeWindow Zmień rozmiar by dopasować Could not find application \"%appname\" OpenWithWindow Nie można odnaleźć aplikacji \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Zaznaczony plik nie może zostać przeniesiony do kosza. Czy chcesz go usunąć zamiast tego? (Ta operacja nie może zostać cofnięta) Invert SelectionWindow Odwróć -Save Query as template… FindPanel Zapisz zapytanie jako szablon… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) zmienisz nazwę Find FindPanel Znajdź Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Przenieś @@ -235,6 +234,7 @@ Temporary FindPanel Tymczasowy Version OpenWithWindow Wersja Default application InfoWindow Domyślna aplikacja Preparing to copy items… StatusWindow Przygotowanie do kopiowania elementów… +Save query as template… FindPanel Zapisz zapytanie jako szablon… Show folder location in title tab SettingsView Pokaż lokacje folderu na pasku Proceed FSUtils Kontynuuj Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Niektóre obiekty już istnieją w tym folderze o nazwach identycznych co te które probujesz %verb.\n \nCzy chcesz je zamienić z tymi które próbujesz %verb czy wolisz być pytany o każdy z nich? @@ -333,6 +333,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Wyczyść after FindPanel po Select… QueryContainerWindow Wybierz… +More options FindPanel Więcej opcji link FSUtils filename link Skrót At %func \nfind_directory() failed. \nReason: %error TrackerInitialState W %func \nfind_directory() nie powiódł się. \nPowód: %error The specified name is illegal. Please choose another name. FilePanelPriv Podana nazwa jest niedozwolona. Proszę wybrać inną nazwę. @@ -444,6 +445,7 @@ contains FindPanel zawiera Relation OpenWithWindow Relacje Open FilePanelPriv Otwórz Mount DeskWindow Zamontuj +Recent queries FindPanel Ostatnie zapytania Mount ContainerWindow Zamontuj %capacity (%used used -- %free free) InfoWindow %capacity (%used zajęte -- %free wolne) Cancel FSClipBoard Anuluj diff --git a/data/catalogs/kits/tracker/pt_BR.catkeys b/data/catalogs/kits/tracker/pt_BR.catkeys index 8e7cffc9e1..45b1b265ba 100644 --- a/data/catalogs/kits/tracker/pt_BR.catkeys +++ b/data/catalogs/kits/tracker/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-libtracker 4167158175 +1 portuguese (brazil) x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY comum OK WidgetAttributeText OK Icon view VolumeWindow Em ícones @@ -143,6 +143,7 @@ Add-ons ContainerWindow Adicionais Edit templates… TemplatesMenu Editar modelos... Finish: %time - Over %finishtime left StatusWindow Término: %time - Mais de %finishtime restante An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Um item chamado \"%name\" já existe nesta pasta. Gostaria de substituí-lo pelo link simbólico que está sendo criado? +Fewer options FindPanel Menos opções Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Desculpe, não existe espaço livre suficiente no volume de destino para para copiar a seleção. Could not open \"%document\" with application \"%app\" (%error). FSUtils Não foi possível abrir \"%document\" com a aplicativo \"%app\" (%error). Sorry, saving more than one item is not allowed. FilePanelPriv Desculpe, salvar mais de um item não é permitido. @@ -212,7 +213,6 @@ Resize to fit VolumeWindow Reduzir para caber Could not find application \"%appname\" OpenWithWindow Não foi possível encontrar o aplicativo \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView O item selecionado não pode ser movido para a Lixeira. Ao invés disso, você deseja apagá-lo? (Esta operação não pode ser desfeita.) Invert SelectionWindow Inverter -Save Query as template… FindPanel Salvar como modelo de Consulta... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) renomear Find FindPanel Pesquisar Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Mover @@ -237,6 +237,7 @@ Temporary FindPanel Temporário Version OpenWithWindow Versão Default application InfoWindow Aplicativo padrão Preparing to copy items… StatusWindow Preparando para copiar itens... +Save query as template… FindPanel Salvar consulta como modelo… Show folder location in title tab SettingsView Mostrar local da pasta na barra de títulos Proceed FSUtils Prosseguir Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Alguns itens já existem nesta pasta com os mesmos nomes dos itens que você quer %verb.\n \nVocê gostaria de substituí-los com aqueles que você vai %verb ou ser perguntado em cada um? @@ -335,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Limpeza after FindPanel após Select… QueryContainerWindow Selecionar… +More options FindPanel Mais opções link FSUtils filename link vínculo At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Em %func \nfind_directory() falhou. \nRazão: %error The specified name is illegal. Please choose another name. FilePanelPriv O nome especificado é ilegal. Por favor escolha outro nome. @@ -446,6 +448,7 @@ contains FindPanel contém Relation OpenWithWindow Relação Open FilePanelPriv Abrir Mount DeskWindow Montar +Recent queries FindPanel Consultas recentes Mount ContainerWindow Montar %capacity (%used used -- %free free) InfoWindow %capacity (%used utilizados -- %free livres) Cancel FSClipBoard Cancelar diff --git a/data/catalogs/kits/tracker/ro.catkeys b/data/catalogs/kits/tracker/ro.catkeys index 1b6c45b5ec..6953aee60d 100644 --- a/data/catalogs/kits/tracker/ro.catkeys +++ b/data/catalogs/kits/tracker/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-libtracker 2830900562 +1 romanian x-vnd.Haiku-libtracker 302476273 OK WidgetAttributeText OK Icon view VolumeWindow Vizualizare pictogramă Add-ons FilePanelPriv Module @@ -165,7 +165,6 @@ You cannot create a link to the root directory. FSUtils Nu puteți crea o legă Resize to fit VolumeWindow Redimensionează pentru a potrivi The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Elementul selectat nu poate fi mutat la gunoi. Doriți să îl ștergeți în schimb? (Această operație nu poate fi inversată.) Invert SelectionWindow Inversează -Save Query as template… FindPanel Salvează interogare ca șablon... Find FindPanel Găsește Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Mută Get info ContainerWindow Obține info diff --git a/data/catalogs/kits/tracker/ru.catkeys b/data/catalogs/kits/tracker/ru.catkeys index 7e08176757..1cac91d33d 100644 --- a/data/catalogs/kits/tracker/ru.catkeys +++ b/data/catalogs/kits/tracker/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-libtracker 4167158175 +1 russian x-vnd.Haiku-libtracker 1762695842 common B_COMMON_DIRECTORY Общие OK WidgetAttributeText ОК Icon view VolumeWindow Большие значки @@ -143,6 +143,7 @@ Add-ons ContainerWindow Дополнения Edit templates… TemplatesMenu Изменить шаблоны… Finish: %time - Over %finishtime left StatusWindow Окончание: %time - Осталось более %finishtime An item named \"%name\" already exists in this folder. Would you like to replace it with the symbolic link you are creating? FSUtils Объект с именем \"%name\" уже существует в этой папке. Заменить его ссылкой, которую вы создаёте? +Fewer options FindPanel Меньше опций Sorry, there is not enough free space on the destination volume to copy the selection. FSUtils Извините, но на принимающем разделе недостаточно свободного места для копирования выделенных файлов. Could not open \"%document\" with application \"%app\" (%error). FSUtils Невозможно открыть \"%document\" приложением \"%app\" (%error). Sorry, saving more than one item is not allowed. FilePanelPriv Извините, сохранение более одного файла недопустимо. @@ -212,7 +213,6 @@ Resize to fit VolumeWindow Подогнать размер окна Could not find application \"%appname\" OpenWithWindow Невозможно найти приложение \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Выбранный объект не может быть перемещён в корзину. Хотите ли вы вместо этого удалить его? (Эту операцию будет невозможно отменить) Invert SelectionWindow Инвертировать -Save Query as template… FindPanel Сохранить запрос как шаблон… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) переименуете Find FindPanel Найти Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Переместить @@ -237,6 +237,7 @@ Temporary FindPanel Временный запрос Version OpenWithWindow Версия Default application InfoWindow приложении по умолчанию Preparing to copy items… StatusWindow Подготовка к копированию файлов… +Save query as template… FindPanel Сохранить запрос как шаблон… Show folder location in title tab SettingsView Показывать путь папки в заголовке окна Proceed FSUtils Исправить Some items already exist in this folder with the same names as the items you are %verb.\n \nWould you like to replace them with the ones you are %verb or be prompted for each one? FSUtils Некоторые объекты с такими же именами, которые вы %verb, уже существуют в этой папке.\n \nЗаменить их теми, которые вы %verb или спрашивать для каждого объекта? @@ -335,6 +336,7 @@ The specified name is already used as the name of a folder. Please choose anothe Clean up ContainerWindow Выстроить after FindPanel после Select… QueryContainerWindow Выделить… +More options FindPanel Больше опций link FSUtils filename link ссылка At %func \nfind_directory() failed. \nReason: %error TrackerInitialState Не удалось выполнить %func в find_directory(). \nПричина: %error The specified name is illegal. Please choose another name. FilePanelPriv Введённое имя недопустимо. Введите какое-нибудь другое. @@ -446,6 +448,7 @@ contains FindPanel содержит Relation OpenWithWindow Возможности Open FilePanelPriv Открыть Mount DeskWindow Подключить +Recent queries FindPanel Недавние запросы Mount ContainerWindow Подключить %capacity (%used used -- %free free) InfoWindow %capacity (%used занято -- %free свободно) Cancel FSClipBoard Отмена diff --git a/data/catalogs/kits/tracker/sk.catkeys b/data/catalogs/kits/tracker/sk.catkeys index 5aa3be445b..b18dc55d9a 100644 --- a/data/catalogs/kits/tracker/sk.catkeys +++ b/data/catalogs/kits/tracker/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-libtracker 3648639064 +1 slovak x-vnd.Haiku-libtracker 1120214775 common B_COMMON_DIRECTORY spoločné OK WidgetAttributeText OK Icon view VolumeWindow Zobrazenie ikon @@ -210,7 +210,6 @@ Resize to fit VolumeWindow Prispôsobiť veľkosť Could not find application \"%appname\" OpenWithWindow Nepodarilo sa nájsť aplikáciu „%appname“ The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Vybranú položka nemožno presunúť do Koša. Chcete ju namiesto toho zmazať? (Túto operáciu nemožno vrátiť.) Invert SelectionWindow Invertovať -Save Query as template… FindPanel Uložiť Požiadavku ako šablónu… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) premenujete Find FindPanel Nájsť Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Presunúť diff --git a/data/catalogs/kits/tracker/sv.catkeys b/data/catalogs/kits/tracker/sv.catkeys index 70c5d7e570..6aba16bbbd 100644 --- a/data/catalogs/kits/tracker/sv.catkeys +++ b/data/catalogs/kits/tracker/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libtracker 4167158175 +1 swedish x-vnd.Haiku-libtracker 1638733886 common B_COMMON_DIRECTORY gemensam OK WidgetAttributeText OK Icon view VolumeWindow Ikonvy @@ -212,7 +212,6 @@ Resize to fit VolumeWindow Skala till passform Could not find application \"%appname\" OpenWithWindow Kunde inte hitta programmet "%appname" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Det markerade objektet kan inte flyttas till Papperskorgen. Vill du ta bort den istället? (Denna operation kan inte ångras.) Invert SelectionWindow Invertera -Save Query as template… FindPanel Spara sökning som mall... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) byt namn Find FindPanel Sök Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Flytta diff --git a/data/catalogs/kits/tracker/uk.catkeys b/data/catalogs/kits/tracker/uk.catkeys index 1eba4a2c1f..160d1d2311 100644 --- a/data/catalogs/kits/tracker/uk.catkeys +++ b/data/catalogs/kits/tracker/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-libtracker 3100363775 +1 ukrainian x-vnd.Haiku-libtracker 571939486 common B_COMMON_DIRECTORY common OK WidgetAttributeText Гаразд Icon view VolumeWindow У вигляді іконок @@ -199,7 +199,6 @@ Resize to fit VolumeWindow Припасувати Could not find application \"%appname\" OpenWithWindow Невдалось знайти програму \"%appname\" The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView Деякі з вибраних елементів не можуть бути переміщені Кошик . Ви хочете видалити їх все одно? ( Операція необоротна.) Invert SelectionWindow Інвертувати -Save Query as template… FindPanel Зберегти запит як шаблон… rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) перейменуєте Find FindPanel Знайти Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) Перемістити diff --git a/data/catalogs/kits/tracker/zh_Hans.catkeys b/data/catalogs/kits/tracker/zh_Hans.catkeys index bd63ac4602..f595b8927b 100644 --- a/data/catalogs/kits/tracker/zh_Hans.catkeys +++ b/data/catalogs/kits/tracker/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-libtracker 3375521561 +1 english x-vnd.Haiku-libtracker 847097272 common B_COMMON_DIRECTORY 常用 OK WidgetAttributeText 确定 Icon view VolumeWindow 图标视图 @@ -211,7 +211,6 @@ Resize to fit VolumeWindow 合适大小 Could not find application \"%appname\" OpenWithWindow 未找到 \"%appname\" 程序。 The selected item cannot be moved to the Trash. Would you like to delete it instead? (This operation cannot be reverted.) PoseView 选中项目无法移动至垃圾箱。您希望删除它们吗?(该操作将无法恢复。) Invert SelectionWindow 恢复 -Save Query as template… FindPanel 保存查询为模板... rename InfoWindow As in 'if you rename this folder...' (en) 'Wird dieser Ordner umbenannt...' (de) 重命名 Find FindPanel 搜索 Move FSUtils Button label, 'Move' (en), 'Verschieben' (de) 移动 diff --git a/data/catalogs/kits/zh_Hans.catkeys b/data/catalogs/kits/zh_Hans.catkeys index 7e92ed2dbb..771092c0e3 100644 --- a/data/catalogs/kits/zh_Hans.catkeys +++ b/data/catalogs/kits/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-libbe 672385853 +1 english x-vnd.Haiku-libbe 677628532 gamma AboutWindow 伽马 beta AboutWindow beta %3.2f GiB StringForSize %3.2f GiB @@ -7,7 +7,6 @@ About %app% AboutMenuItem 关于 %app% Cut TextView 剪切 Version AboutWindow 版本 Cannot create the replicant for \"%description\".\n%error ZombieReplicantView 无法为 \"%description\" 创建克隆控件。\n%error -About AboutWindow 关于 Copy TextView 复制 %3.2f KiB StringForSize %3.2f KiB %d bytes StringForSize %d bytes diff --git a/data/catalogs/preferences/appearance/be.catkeys b/data/catalogs/preferences/appearance/be.catkeys index bb295b4e35..0b8102293b 100644 --- a/data/catalogs/preferences/appearance/be.catkeys +++ b/data/catalogs/preferences/appearance/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Appearance 76206318 +1 belarusian x-vnd.Haiku-Appearance 727801787 Plain font: Font view Просты шрыфт: Control highlight Colors tab Выдзяленне кнопак Control border Colors tab Аблямоўка кнопак @@ -9,12 +9,14 @@ Defaults APRWindow Прадвызначаныя Grayscale AntialiasingSettingsView Адценні шэрага Shine Colors tab Ззянне About DecorSettingsView Пра Праграму +About decorator DecorSettingsView Пра дэкаратар Off AntialiasingSettingsView Выкл. Choose Decorator DecorSettingsView Абраць Дэкаратар Success Colors tab Паспяхова Inactive window tab text Colors tab Тэкст неактыўнай укладкі вакна Failure Colors tab Непаспяхова Hinting menu AntialiasingSettingsView Меню хінтынгу +Scroll bar: DecorSettingsView Пракрутка: Document background Colors tab Фон дакумента Revert APRWindow Вярнуць Window tab Colors tab Ўкладка вакна @@ -34,6 +36,7 @@ List background Colors tab Фон радкоў OK DecorSettingsView Так Control mark Colors tab Адзнакі кнопак Size: Font Selection view Памер: +Decorator: DecorSettingsView Дэкаратар: Selected list item background Colors tab Фон пазначанага радку спіса Panel background Colors tab Фон панэлі Menu font: Font view Шрыфт меню: @@ -44,8 +47,10 @@ List item text Colors tab Тэкст радку спіса Appearance System name Афармленне Fixed font: Font view Роўнашырокі шрыфт: The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. У рудога вераб’я ў сховішчы пад фатэлем ляжаць нейкія гаючыя зёлкі. +%decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nАўтары:\n\t%decorAuthors\n\nURL: %decorURL\nЛіцэнзія: %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Паменьшыць інтэнсіўнасць фільтру каляровых краёў: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Субпіксельнае згладжванне ў камбінацыі з хінтынгам сімвалаў недаступнае ў гэтай зборцы Haiku з-за магчымых канфліктаў з патэнтамі. Каб уключыць гэтую функцыю, вы павінны сабрать Haiku самастойна і уключыць канкрэтныя опцыі ў канфігурацыйным загалоўку libfreetype. +Scroll bar thumb Colors tab Гузік пракруткі Control text Colors tab Тэкст кнопак Single: DecorSettingsView Адзіночны: Tooltip text Colors tab Тэкст падказак diff --git a/data/catalogs/preferences/appearance/de.catkeys b/data/catalogs/preferences/appearance/de.catkeys index 0783140413..99055020de 100644 --- a/data/catalogs/preferences/appearance/de.catkeys +++ b/data/catalogs/preferences/appearance/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Appearance 2993758435 +1 german x-vnd.Haiku-Appearance 727801787 Plain font: Font view Normal: Control highlight Colors tab Steuerelement - Ausgewählt Control border Colors tab Steuerelement - Rahmen @@ -50,6 +50,7 @@ The quick brown fox jumps over the lazy dog. Font Selection view Don't translate %decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nAutoren:\n\t%decorAuthors\n\nURL: %decorURL\nLizens: %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Farbsaumfilter: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Zur Vermeidung von möglichen Patentproblemen ist die Kombination von Subpixel-Kantenglättung und Glyph-Hinting deaktiviert. Um diese Funktion zu aktivieren, müssen spezielle Optionen im Konfigurationsheader der Freetype-Bibliothek freigeschaltet und anschließend Haiku neu kompiliert werden. +Scroll bar thumb Colors tab Scroll-Balken Control text Colors tab Steuerelement - Text Single: DecorSettingsView Einfach: Tooltip text Colors tab Tooltip - Text diff --git a/data/catalogs/preferences/appearance/fr.catkeys b/data/catalogs/preferences/appearance/fr.catkeys index 9ed06dc584..7f0534a98a 100644 --- a/data/catalogs/preferences/appearance/fr.catkeys +++ b/data/catalogs/preferences/appearance/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Appearance 2993758435 +1 french x-vnd.Haiku-Appearance 727801787 Plain font: Font view Police simple : Control highlight Colors tab Mise en valeur de contrôle Control border Colors tab Bordure des contrôles @@ -50,6 +50,7 @@ The quick brown fox jumps over the lazy dog. Font Selection view Don't translate %decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nAuteurs :\n\t%decorAuthors\n\nURL : %decorURL\nLicence : %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Intensité du filtre de réduction des bords de couleurs : Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Le lissage sous-pixel n'est pas disponible en même temps que les consignes de glyphes dans cette version d'Haiku afin d'éviter des problèmes de brevets logiciels. Pour activer cette fonctionnalité, vous devez compiler Haiku vous-même et activer certaines options dans l'en-tête de configuration de libfreetype. +Scroll bar thumb Colors tab Curseur de défilement Control text Colors tab Texte des contrôles Single: DecorSettingsView Simple : Tooltip text Colors tab Texte des bulles d'aide diff --git a/data/catalogs/preferences/appearance/pl.catkeys b/data/catalogs/preferences/appearance/pl.catkeys index ecf1e73628..c865e9c30c 100644 --- a/data/catalogs/preferences/appearance/pl.catkeys +++ b/data/catalogs/preferences/appearance/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Appearance 2464466870 +1 polish x-vnd.Haiku-Appearance 556979190 Plain font: Font view Zwykła czcionka: Control highlight Colors tab Podkreślenie kontrolki Control border Colors tab Obramowanie kontrolki @@ -43,10 +43,11 @@ Inactive window tab Colors tab Nieaktywna zakładka okna Appearance System name Wygląd Fixed font: Font view Czcionka o stałej szerokości: The quick brown fox jumps over the lazy dog. Font Selection view Don't translate this literally ! Use a phrase showing all chars from A to Z. Koń i żółw grali w kości z piękną ćmą u źródła. +%decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nAutorzy:\n\t%decorAuthors\n\nURL: %decorURL\nLicencja: %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Zmniejszenie siły kolorowych filtrów krawędzi: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Antyaliasing podpikselowy w połączeniu z hintowaniem czcionek jest niedostępny w tym buildzie Haiku w celu uniknięcia problemów patentowych. Aby włączyć tę funkcjonalność, musisz zbudować Haiku samemu i włączyć niektóre opcje w pliku nagłówkowym biblioteki libfreetype. Control text Colors tab Tekst kontrolki -Single: DecorSettingsView Pojedynczy: +Single: DecorSettingsView Pojedyncze: Tooltip text Colors tab Tekst podpowiedzi Bold font: Font view Czcionka pogrubiona: Inactive window border Colors tab Nieaktywne obramowanie okna diff --git a/data/catalogs/preferences/appearance/pt_BR.catkeys b/data/catalogs/preferences/appearance/pt_BR.catkeys index d0ddb5ba57..1186e69d8b 100644 --- a/data/catalogs/preferences/appearance/pt_BR.catkeys +++ b/data/catalogs/preferences/appearance/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-Appearance 1457181689 +1 portuguese (brazil) x-vnd.Haiku-Appearance 727801787 Plain font: Font view Fonte plana: Control highlight Colors tab Realce do controle Control border Colors tab Borda do controle @@ -16,6 +16,7 @@ Success Colors tab Sucesso Inactive window tab text Colors tab Texto da aba de janela inativa Failure Colors tab Falha Hinting menu AntialiasingSettingsView Menu de sugestão +Scroll bar: DecorSettingsView Barra de rolagem: Document background Colors tab Plano de fundo do documento Revert APRWindow Reverter Window tab Colors tab Aba da janela @@ -49,6 +50,7 @@ The quick brown fox jumps over the lazy dog. Font Selection view Don't translate %decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nAutores:\n\t %decorAuthors\n\nURL: %decorURL\nLicença: %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Reduzir a força do filtro de bordas coloridas: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView A possibilidade de usar o antiserrilhamento baseado em Subpíxeis juntamente com o alisamento de glifos não está disponível nesta versão do Haiku para evitar possíveis problemas com patentes. Para habilitar esta funcionalidade, você terá que compilar o Haiku e ativar certas opções no cabeçalho de configuração da libfreetype. +Scroll bar thumb Colors tab Botão da barra de rolagem Control text Colors tab Texto do controle Single: DecorSettingsView Único: Tooltip text Colors tab Texto da dica diff --git a/data/catalogs/preferences/appearance/ru.catkeys b/data/catalogs/preferences/appearance/ru.catkeys index 1bb3f6ddbd..ba5eccd9d6 100644 --- a/data/catalogs/preferences/appearance/ru.catkeys +++ b/data/catalogs/preferences/appearance/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Appearance 2993758435 +1 russian x-vnd.Haiku-Appearance 727801787 Plain font: Font view Простой шрифт: Control highlight Colors tab Подсветка элемента Control border Colors tab Граница элемента @@ -50,6 +50,7 @@ The quick brown fox jumps over the lazy dog. Font Selection view Don't translate %decorName\n\nAuthors:\n\t%decorAuthors\n\nURL: %decorURL\nLicense: %decorLic\n\n%decorDesc\n DecorSettingsView %decorName\n\nАвторы:\n\t%decorAuthors\n\nURL: %decorURL\nЛицензия: %decorLic\n\n%decorDesc\n Reduce colored edges filter strength: AntialiasingSettingsView Фильтрация цветных краев: Subpixel based anti-aliasing in combination with glyph hinting is not available in this build of Haiku to avoid possible patent issues. To enable this feature, you have to build Haiku yourself and enable certain options in the libfreetype configuration header. AntialiasingSettingsView Субпиксельное сглаживание в комбинации с уточнением глифов недоступно в этой сборке Haiku во избежание возможных патентных проблем. Для включения этой возможности вам придется собрать Haiku самостоятельно, включив особые опции в заголовке конфигурации libfreetype. +Scroll bar thumb Colors tab Ползунок прокрутки Control text Colors tab Текст элемента Single: DecorSettingsView Одинарный: Tooltip text Colors tab Текст подсказки diff --git a/data/catalogs/preferences/bluetooth/be.catkeys b/data/catalogs/preferences/bluetooth/be.catkeys index f8319ff6cd..099ad2da20 100644 --- a/data/catalogs/preferences/bluetooth/be.catkeys +++ b/data/catalogs/preferences/bluetooth/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-BluetoothPrefs 1628593228 +1 belarusian x-vnd.Haiku-BluetoothPrefs 3212620536 About Bluetooth… Window Пра праграму Bluetooth… Handheld Settings view Наладоннік Default inquiry time: Settings view Час стандартнага запыту: @@ -55,6 +55,7 @@ Always ask Settings view Заўсёды пытаць Retrieving name of %1 Inquiry panel Атрымліваем імя %1 Check that the Bluetooth capabilities of your remote device are activated. Press 'Inquiry' to start scanning. The needed time for the retrieval of the names is unknown, although should not take more than 3 seconds per device. Afterwards you will be able to add them to your main list, where you will be able to pair with them. Inquiry panel Праверце, ці актыўныя Bluetooth магчымасці вашай прылады. Націсніце 'Запыт' каб пачаць сканіраванне. Час, патрэбны на атрыманне імёнаў прылад, невядомы, але не павінны перавышаць 3 секунды для кожнай прылады. Пасля вы зможаце дадаць іх да вашага асноўнага спісу, дзе можна задаць іх сапражэнні. Authenticate Extended local device view Аўтэнтыфікаваць +Pick device... Settings view Абраць прыладу... Retrieving names... Inquiry panel Атрыманне іменаў... Help Window Даведка Add… Remote devices Дадаць… diff --git a/data/catalogs/preferences/bluetooth/pl.catkeys b/data/catalogs/preferences/bluetooth/pl.catkeys index ff89c01a8f..f146829731 100644 --- a/data/catalogs/preferences/bluetooth/pl.catkeys +++ b/data/catalogs/preferences/bluetooth/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-BluetoothPrefs 1628593228 +1 polish x-vnd.Haiku-BluetoothPrefs 3212620536 About Bluetooth… Window O aplikacji Bluetooth… Handheld Settings view Handheld Default inquiry time: Settings view Domyślny czas zapytania: @@ -55,6 +55,7 @@ Always ask Settings view Zawsze pytaj Retrieving name of %1 Inquiry panel Odczytywanie nazwy %1 Check that the Bluetooth capabilities of your remote device are activated. Press 'Inquiry' to start scanning. The needed time for the retrieval of the names is unknown, although should not take more than 3 seconds per device. Afterwards you will be able to add them to your main list, where you will be able to pair with them. Inquiry panel Sprawdź czy ustawienia bluetooth zdalnego urządzenia są włączone. Wciśnij 'Zapytaj' aby zacząć skanować. Czas potrzebny na pobranie nazw urządzeń jest nieznany, choć nie powinien trwać dłużej niż 3 sekundy na urządzenie. Po wszystkim będziesz mieć możliwość dodania ich do listy urządzeń, skąd będziesz mógł się z nimi sparować. Authenticate Extended local device view Uwierzytelnianie +Pick device... Settings view Wybierz urządzenie… Retrieving names... Inquiry panel Pobieranie nazw... Help Window Pomoc Add… Remote devices Dodaj… diff --git a/data/catalogs/preferences/mail/fr.catkeys b/data/catalogs/preferences/mail/fr.catkeys index f9d175b53c..e3d51d56bc 100644 --- a/data/catalogs/preferences/mail/fr.catkeys +++ b/data/catalogs/preferences/mail/fr.catkeys @@ -12,7 +12,7 @@ Start mail services on startup Config Window Lancer les services de mail au dé E-mail address: E-Mail Adresse email : Account name: E-Mail Nom du compte : Account name: Config Views Nom du compte : -Create new account AutoConfigWindow Créé un nouveau compte +Create new account AutoConfigWindow Créer un nouveau compte OK Config Views OK The filter could not be moved. Deleting filter. Config Views Le filtre n'a pas pu être déplacé. Suppression du filtre. Revert Config Window Rétablir diff --git a/data/catalogs/preferences/network/be.catkeys b/data/catalogs/preferences/network/be.catkeys index de89352c89..ec36652af8 100644 --- a/data/catalogs/preferences/network/be.catkeys +++ b/data/catalogs/preferences/network/be.catkeys @@ -1,22 +1,27 @@ -1 belarusian x-vnd.Haiku-Network 365183238 +1 belarusian x-vnd.Haiku-Network 1341378870 Choose automatically EthernetSettingsView Выбіраць аўтаматычна Gateway: EthernetSettingsView Шлюз: Netmask: EthernetSettingsView Маска сеткі: DHCP EthernetSettingsView DHCP DNS #2: EthernetSettingsView DNS #2: Apply EthernetSettingsView Ужыць +Netmask is invalid EthernetSettingsView Няслушная маска падсеткі OK EthernetSettingsView ОК DNS #1: EthernetSettingsView DNS #1: IP address: EthernetSettingsView IP адрас: Adapter: EthernetSettingsView Адаптар: Domain: EthernetSettingsView Домен: +Gateway is invalid EthernetSettingsView Шлюз несапраўдны +DNS #1 is invalid EthernetSettingsView DNS #1 некарэктны Revert EthernetSettingsView Вярнуць EthernetSettingsView <не знойдзена бесшнуравых сетак> Network System name Сетка Mode: EthernetSettingsView Рэжым: +IP address is invalid EthernetSettingsView IP адрас некарэктны Network: EthernetSettingsView Сетка: The net_server needs to run for the auto configuration! EthernetSettingsView Неабходна запусціць net_server для аўтаканфігурацыі! Disabled EthernetSettingsView Выключаны Auto-configuring failed: EthernetSettingsView Аўтаканфігурацыі не ўдалася: Static EthernetSettingsView Статычны +DNS #2 is invalid EthernetSettingsView DNS #2 некарэктны EthernetSettingsView <адаптары ня знойдзены> diff --git a/data/catalogs/preferences/notifications/be.catkeys b/data/catalogs/preferences/notifications/be.catkeys index 50b00771b1..d3fc1bf1f9 100644 --- a/data/catalogs/preferences/notifications/be.catkeys +++ b/data/catalogs/preferences/notifications/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Notifications 814394708 +1 belarusian x-vnd.Haiku-Notifications 2177286129 An error occurred saving the preferences.\nIt's possible you are running out of disk space. GeneralView Адбылася памылка пры захаванні наладак.\nМагчыма, не хапае месца на дыску. Notifications GeneralView Паведамленні seconds of inactivity GeneralView секунд прастою @@ -17,6 +17,7 @@ Cannot disable notifications because the server can't be reached. GeneralView Progress NotificationView Прагрэс Last Received NotificationView Апошняе атрыманае General PrefletView Агульныя +Apply PrefletWin Ужыць Display PrefletView Экран Can't enable notifications at startup time, you probably don't have write permission to the boot settings directory. GeneralView Не ўдалося занесці паведамленні ў аўтазапуск, магчыма, вы не маеце правоў на змяненне дырэкторыі аўтазапуску. Search: NotificationView Пошук: diff --git a/data/catalogs/preferences/printers/pl.catkeys b/data/catalogs/preferences/printers/pl.catkeys index 88ce293236..fe83e52700 100644 --- a/data/catalogs/preferences/printers/pl.catkeys +++ b/data/catalogs/preferences/printers/pl.catkeys @@ -2,7 +2,7 @@ Printer: %printer_name%\nDriver: %driver%\n TestPageView Drukarka: %printer_name%\nSterownik: %driver%\n Waiting JobListView Oczekuję Print test page PrintersWindow Wydrukuj stronę testową -Test Page TestPageView Strona testowa +Test Page TestPageView Strona Testowa Test Page PrintersWindow Strona testowa page JobListView strona Cancel AddPrinterDialog Anuluj diff --git a/data/catalogs/preferences/time/be.catkeys b/data/catalogs/preferences/time/be.catkeys index 4294263f31..c91571db10 100644 --- a/data/catalogs/preferences/time/be.catkeys +++ b/data/catalogs/preferences/time/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Time 3544635877 +1 belarusian x-vnd.Haiku-Time 3259467657 GMT (UNIX compatible) Time GMT (як у UNIX) OK Time ОК Asia Time Азія @@ -11,6 +11,7 @@ Preview time: Time Праглядзець час: Synchronize Time Сінхранізаваць Revert Time Адвярнуць Pacific Time Ціхі акіян +Show day of week Time Паказваць дзень тыдню Add Time Дадаць Date and time Time Дата і Час about Time пра праграму @@ -26,6 +27,7 @@ Time Time Час Indian Time Індыя Sending request failed Time Немагчыма адаслаць запыт Arctic Time Арктыка +Display time with seconds Time Паказваць час з секундамі Time System name Дата і Час America Time Амерыка Reset Time Скінуць @@ -33,6 +35,8 @@ Synchronize at boot Time Сінхранізаваць падчас старту Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\tJulun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2012, Haiku. Time Time & Date, распрацавана:\n\n\t Andrew Edward McCall\n\t Mike Berg\n\t Julun\n\t Philippe Saint-Pierre\n\nCopyright 2004-2012, Haiku. Received invalid time Time Атрыманы несапраўдны час Antarctica Time Антарктыка +Show time zone Time Паказаць часавы пояс +Show clock in Deskbar Time Паказваць гадзіннік у Deskbar-ы The following error occured while synchronizing:r\n%s: %s Time Памылка падчас сінхранізацыі:r\n%s: %s Time <Іншае> Current time: Time Сапраўдны час: diff --git a/data/catalogs/preferences/time/pl.catkeys b/data/catalogs/preferences/time/pl.catkeys index cce230eb86..3d83321fc3 100644 --- a/data/catalogs/preferences/time/pl.catkeys +++ b/data/catalogs/preferences/time/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Time 2508143647 +1 polish x-vnd.Haiku-Time 3259467657 GMT (UNIX compatible) Time GMT (kompatybilne z UNIX'em) OK Time OK Asia Time Azja @@ -36,6 +36,7 @@ Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\tJulun\n\tPhil Received invalid time Time Odebrano niepoprawny czas Antarctica Time Antarktyda Show time zone Time Pokaż strefę czasową +Show clock in Deskbar Time Pokaż zegar w Deskbarze The following error occured while synchronizing:r\n%s: %s Time Wystąpił błąd podczas synchronizacji:r\n%s: %s Time Current time: Time Aktualny czas: diff --git a/data/catalogs/servers/print/be.catkeys b/data/catalogs/servers/print/be.catkeys index e9017a9d1c..ad461ee9a9 100644 --- a/data/catalogs/servers/print/be.catkeys +++ b/data/catalogs/servers/print/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Be-PSRV 1761631281 +1 belarusian x-vnd.Be-PSRV 123334776 Undefined ConfigWindow Нявызначаны Return the number of available transports PrintServerApp Scripting Вярнуць колькасць даступных транспортаў Return the number of available printers PrintServerApp Scripting Вярнуць колькасць даступных прынтэраў @@ -9,6 +9,7 @@ Retrieve a specific printer PrintServerApp Scripting Вызначыць аса Page %1 to %2 ConfigWindow Старонкі з %1 па %2 Get name of the printer add-on used for this printer Printer Scripting Вызначыць імя дапаўнення, ужытага для гэтага прынтэра Page setup: ConfigWindow Наладкі старонкі: +B5 (JIS) ConfigWindow JIS P0138 B5, a Japanese paper size B5 (JIS) OK ConfigWindow Так Cancel ConfigWindow Адмена Printer server ConfigWindow Сервер друку diff --git a/data/catalogs/servers/print/pl.catkeys b/data/catalogs/servers/print/pl.catkeys index 98d9fa3d25..770d25acb7 100644 --- a/data/catalogs/servers/print/pl.catkeys +++ b/data/catalogs/servers/print/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Be-PSRV 1761631281 +1 polish x-vnd.Be-PSRV 123334776 Undefined ConfigWindow Nieokreślone Return the number of available transports PrintServerApp Scripting Zwróć liczbę dostępnych transportów Return the number of available printers PrintServerApp Scripting Zwróć liczbę dostępnych drukarek @@ -9,10 +9,11 @@ Retrieve a specific printer PrintServerApp Scripting Odzyskaj konkretną drukar Page %1 to %2 ConfigWindow Strony %1 do %2 Get name of the printer add-on used for this printer Printer Scripting Pokaż nazwę dodatku dla tej drukarki Page setup: ConfigWindow Ustawienia strony: +B5 (JIS) ConfigWindow JIS P0138 B5, a Japanese paper size B5 (JIS) OK ConfigWindow OK Cancel ConfigWindow Anuluj -Printer server ConfigWindow Serwer drukujący -Page %1 to %2, %3 copies ConfigWindow Strony %1 to %2, %3 kopie +Printer server ConfigWindow Serwer druku +Page %1 to %2, %3 copies ConfigWindow Strony %1 do %2, %3 kopie A printer with that name already exists, but its driver could not be found! Replace? PrintServerApp Drukarka o tej nazwie już istnieje, ale sterownik nie może zostać zlokalizowany. Zastąpić? Yes PrintServerApp Tak Ledger ConfigWindow ANSI B (ledger), a North American paper size Rejestr diff --git a/data/catalogs/servers/print/pt_BR.catkeys b/data/catalogs/servers/print/pt_BR.catkeys index ff31ef7bc3..9457d195bf 100644 --- a/data/catalogs/servers/print/pt_BR.catkeys +++ b/data/catalogs/servers/print/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Be-PSRV 1761631281 +1 portuguese (brazil) x-vnd.Be-PSRV 123334776 Undefined ConfigWindow Indefinido Return the number of available transports PrintServerApp Scripting Mostrar o número de transportes disponíveis Return the number of available printers PrintServerApp Scripting Mostrar o número de impressoras disponíveis @@ -9,6 +9,7 @@ Retrieve a specific printer PrintServerApp Scripting Obter uma impressora espec Page %1 to %2 ConfigWindow Página %1 até %2 Get name of the printer add-on used for this printer Printer Scripting Obter o nome de um adicional usado para esta impressora Page setup: ConfigWindow Configurações de página: +B5 (JIS) ConfigWindow JIS P0138 B5, a Japanese paper size B5 (JIS) OK ConfigWindow OK Cancel ConfigWindow Cancelar Printer server ConfigWindow Servidor de impressão diff --git a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/be.catkeys b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/be.catkeys new file mode 100644 index 0000000000..83b4d42b07 --- /dev/null +++ b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/be.catkeys @@ -0,0 +1,33 @@ +1 belarusian x-vnd.Haiku-InterfacesAddOn 160108912 +Interface InterfaceWindow Інтэрфейс +Configure… InterfacesListView Канфігураваць… +Static IntefaceAddressView Статычны +None InterfacesListView Няма +IP: InterfacesListView IPv4 address label IP: +Status: IntefaceHardwareView Стан: +IPv6: InterfacesListView IPv6 address label IPv6: +Save InterfaceWindow Захаваць +Link speed: IntefaceHardwareView Хуткасць злучэння: +Renegotiate InterfacesAddOn Перазлучыць +The method for obtaining an IP address IntefaceAddressView Метад атрыманя IP адрасу +Your gateway IntefaceAddressView Ваш gateway +Enable InterfacesListView Дазволіць +Received: IntefaceHardwareView Атрымана: +Revert InterfaceWindow Вярнуць +connected IntefaceHardwareView злучаны +Gateway: IntefaceAddressView Брама: +Disable InterfacesListView Выключыць +Sent: IntefaceHardwareView Адаслана: +Disable InterfacesAddOn Выключыць +Configure… InterfacesAddOn Канфігураваць… +Renegotiate Address InterfacesListView Перазлучыць адрас +DHCP IntefaceAddressView DHCP +Mode: IntefaceAddressView Рэжым: +Your netmask IntefaceAddressView Маска +IP Address: IntefaceAddressView IP адрас: +Off IntefaceAddressView Адключыць +MAC address: IntefaceHardwareView MAC адрас: +Netmask: IntefaceAddressView Маска: +Your IP address IntefaceAddressView IP адрас +%llu KBytes IntefaceHardwareView %llu КБайт +disconnected IntefaceHardwareView адлучана diff --git a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/fr.catkeys b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/fr.catkeys new file mode 100644 index 0000000000..7ab8dfd585 --- /dev/null +++ b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/fr.catkeys @@ -0,0 +1,33 @@ +1 french x-vnd.Haiku-InterfacesAddOn 160108912 +Interface InterfaceWindow Interface +Configure… InterfacesListView Configurer… +Static IntefaceAddressView Statique +None InterfacesListView Aucune +IP: InterfacesListView IPv4 address label IPv4 : +Status: IntefaceHardwareView État : +IPv6: InterfacesListView IPv6 address label IPv6 : +Save InterfaceWindow Sauvegarder +Link speed: IntefaceHardwareView Vitesse du lien : +Renegotiate InterfacesAddOn Renégocier +The method for obtaining an IP address IntefaceAddressView Méthode d'obtention de l'adresse IP +Your gateway IntefaceAddressView Votre passerelle +Enable InterfacesListView Activer +Received: IntefaceHardwareView Reçu : +Revert InterfaceWindow Rétablir +connected IntefaceHardwareView connecté +Gateway: IntefaceAddressView Passerelle : +Disable InterfacesListView Désactiver +Sent: IntefaceHardwareView Envoyés : +Disable InterfacesAddOn Désactiver +Configure… InterfacesAddOn Configurer… +Renegotiate Address InterfacesListView Renégocier l'adresse +DHCP IntefaceAddressView DHCP +Mode: IntefaceAddressView Mode : +Your netmask IntefaceAddressView Votre masque réseau +IP Address: IntefaceAddressView Adresse IP : +Off IntefaceAddressView Déconnecté +MAC address: IntefaceHardwareView Adresse MAC : +Netmask: IntefaceAddressView Masque réseau : +Your IP address IntefaceAddressView Votre adresse IP +%llu KBytes IntefaceHardwareView %llu KOctets +disconnected IntefaceHardwareView déconnecté diff --git a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pl.catkeys b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pl.catkeys new file mode 100644 index 0000000000..323bf5c2db --- /dev/null +++ b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pl.catkeys @@ -0,0 +1,15 @@ +1 polish x-vnd.Haiku-InterfacesAddOn 34473294 +Interface InterfaceWindow Interfejs +Configure… InterfacesListView Konfiguruj… +Static IntefaceAddressView Statyczny +IP: InterfacesListView IPv4 address label IP: +Link speed: IntefaceHardwareView Szybkość połączenia: +The method for obtaining an IP address IntefaceAddressView Metoda uzyskania adresu IP +Your gateway IntefaceAddressView Brama +Received: IntefaceHardwareView Otrzymano: +Sent: IntefaceHardwareView Wysłano: +Configure… InterfacesAddOn Konfiguruj… +Mode: IntefaceAddressView Tryb: +Your netmask IntefaceAddressView Maska sieci +IP Address: IntefaceAddressView Adres IP: +disconnected IntefaceHardwareView odłączone diff --git a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pt_BR.catkeys b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pt_BR.catkeys new file mode 100644 index 0000000000..6d4884a90f --- /dev/null +++ b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/pt_BR.catkeys @@ -0,0 +1,33 @@ +1 portuguese (brazil) x-vnd.Haiku-InterfacesAddOn 160108912 +Interface InterfaceWindow Interface +Configure… InterfacesListView Configurar… +Static IntefaceAddressView Estático +None InterfacesListView Nenhum +IP: InterfacesListView IPv4 address label IP: +Status: IntefaceHardwareView Estado: +IPv6: InterfacesListView IPv6 address label IPv6: +Save InterfaceWindow Salvar +Link speed: IntefaceHardwareView Velocidade do link: +Renegotiate InterfacesAddOn Renegociar +The method for obtaining an IP address IntefaceAddressView O método para obter um endereço IP +Your gateway IntefaceAddressView Sua rota padrão +Enable InterfacesListView Habilitar +Received: IntefaceHardwareView Recebido: +Revert InterfaceWindow Reverter +connected IntefaceHardwareView conectado +Gateway: IntefaceAddressView Rota padrão: +Disable InterfacesListView Desabilitar +Sent: IntefaceHardwareView Enviado: +Disable InterfacesAddOn Desabilitar +Configure… InterfacesAddOn Configurar… +Renegotiate Address InterfacesListView Endereço de renegociação +DHCP IntefaceAddressView DHCP +Mode: IntefaceAddressView Modo: +Your netmask IntefaceAddressView Sua máscara de rede +IP Address: IntefaceAddressView Endereço IP: +Off IntefaceAddressView Desligar +MAC address: IntefaceHardwareView Endereço MAC: +Netmask: IntefaceAddressView Máscara de rede: +Your IP address IntefaceAddressView Seu endereço IP +%llu KBytes IntefaceHardwareView %llu KBytes +disconnected IntefaceHardwareView desconectado diff --git a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/sv.catkeys b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/sv.catkeys index 65d08d0d2e..be43526354 100644 --- a/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/sv.catkeys +++ b/data/catalogs/tests/kits/net/preflet/InterfacesAddOn/sv.catkeys @@ -1,4 +1,5 @@ -1 swedish x-vnd.Haiku-InterfacesAddOn 1172292901 +1 swedish x-vnd.Haiku-InterfacesAddOn 160108912 +Interface InterfaceWindow Gränssnitt Configure… InterfacesListView Konfigurera... Static IntefaceAddressView Statisk None InterfacesListView Ingen @@ -11,10 +12,12 @@ Renegotiate InterfacesAddOn Omförhandla The method for obtaining an IP address IntefaceAddressView Metoden för att få en IP adress Your gateway IntefaceAddressView Min gateway Enable InterfacesListView Aktivera +Received: IntefaceHardwareView Mottaget: Revert InterfaceWindow Återgå connected IntefaceHardwareView ansluten Gateway: IntefaceAddressView Gateway: Disable InterfacesListView Inaktivera +Sent: IntefaceHardwareView Skickat: Disable InterfacesAddOn Inaktivera Configure… InterfacesAddOn Konfigurera… Renegotiate Address InterfacesListView Omförhandla Adressen @@ -26,4 +29,5 @@ Off IntefaceAddressView Av MAC address: IntefaceHardwareView MAC-adress Netmask: IntefaceAddressView Nätmask: Your IP address IntefaceAddressView Din IP-adress +%llu KBytes IntefaceHardwareView %llu KBytes disconnected IntefaceHardwareView koppla från diff --git a/data/catalogs/tests/servers/app/playground/be.catkeys b/data/catalogs/tests/servers/app/playground/be.catkeys new file mode 100644 index 0000000000..81679b2e76 --- /dev/null +++ b/data/catalogs/tests/servers/app/playground/be.catkeys @@ -0,0 +1,32 @@ +1 belarusian x-vnd.Haiku-Playground 1375574837 +Line Playground Радок +Fill Playground Запоўніць +Over Playground Па над +Quit Playground Выйсці +Rect Playground Прамакутнік +Select Playground Вылучыць +Click and drag to draw an object Playground Націсніце і цягніце каб намаляваць аб'ект +Controls Playground Кіраваньне +Round rect Playground Круглы прамакутнік +Alpha: Playground Альфа: +Mode: Playground Рэжым: +Submenu Playground Падменю +Copy Playground Скапіяваць +Cancel Playground Адмена +Clear Playground Ачысьціць +Min Playground Мін +Blend Playground Змешваць +Invert Playground Інвэртаваць +Clear all drawing objects? Playground Выдаліць усе аб'екты? +Width: Playground Шырыня: +Alpha Playground Альфа +New object Playground Новы аб'ект +Test Playground Тэст +Max Playground Макс +Add Playground Дадаць +Playground System name Пляцоўка для гульняў +Erase Playground Выдаліць +File Playground Файл +Subtract Playground Адняць + Playground <абраць> +Ellipse Playground Эліпс diff --git a/data/develop/Jamfile-engine b/data/develop/Jamfile-engine index bdec959add..86c6c3f9a6 100644 --- a/data/develop/Jamfile-engine +++ b/data/develop/Jamfile-engine @@ -329,7 +329,7 @@ if ( $(OSPLAT) = X86 ) switch $(TYPE) { case APP : LINKFLAGS += -Xlinker -soname=_APP_ ; - case SHARED : LINKFLAGS += -nostart -Xlinker -soname=$(NAME) ; + case SHARED : LINKFLAGS += -shared -Xlinker -soname=$(NAME) ; case DRIVER : LINKFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_ ; } } diff --git a/data/develop/makefile-engine b/data/develop/makefile-engine index 274b0724a7..cf19c7b900 100644 --- a/data/develop/makefile-engine +++ b/data/develop/makefile-engine @@ -93,7 +93,7 @@ endif LDFLAGS += -Xlinker -soname=_APP_ else ifeq ($(strip $(TYPE)), SHARED) - LDFLAGS += -nostart -Xlinker -soname=$(NAME) + LDFLAGS += -shared -Xlinker -soname=$(NAME) else ifeq ($(strip $(TYPE)), DRIVER) LDFLAGS += -nostdlib /boot/develop/lib/x86/_KERNEL_ \ diff --git a/data/system/data/fonts/ttfonts/VL-Gothic-Regular.ttf b/data/system/data/fonts/ttfonts/VL-Gothic-Regular.ttf index 46e1b9063e..d2bb546d21 100644 Binary files a/data/system/data/fonts/ttfonts/VL-Gothic-Regular.ttf and b/data/system/data/fonts/ttfonts/VL-Gothic-Regular.ttf differ diff --git a/data/system/data/fonts/ttfonts/VL-PGothic-Regular.ttf b/data/system/data/fonts/ttfonts/VL-PGothic-Regular.ttf index 64f8934268..07f5bd8f01 100644 Binary files a/data/system/data/fonts/ttfonts/VL-PGothic-Regular.ttf and b/data/system/data/fonts/ttfonts/VL-PGothic-Regular.ttf differ diff --git a/docs/develop/ports/arm/beagleboneblk.md b/docs/develop/ports/arm/beagleboneblk.md new file mode 100644 index 0000000000..01be7ab852 --- /dev/null +++ b/docs/develop/ports/arm/beagleboneblk.md @@ -0,0 +1,52 @@ +# BeagleBone Black +* http://beagleboard.org +* TODO: This is a WIP + +# Hardware information (Rev A5A) + +* ARMv7 Architecture +* Sitara AM3359AZCZ100 Cortex-A8 CPU @ 1 Ghz +* PowerVR SGX530 3D GPU +* eMMC Onboard Storage 2GB (MMC1) +* SD Card Storage (MMC0) +* 512 MB DDR3L RAM +* Video Outputs + * HDMI Video Output (with audio) +* SMSC LAN8710A Ethernet + +# Setting up the Haiku SD card + +The BeagleBone Black supports booting from an microSD card while the boot switch is pressed at power on. A MBR file system layout is normally used as seen below. Partition 1 is all that is required to boot an OS. + +* partition 1 -- FAT32, bootable flag, type 'c' +* partition 2 -- BeFS, Haiku filesystem, type 'eb' + +## Boot Partition + +### Required files + +* MLO +* u-boot.img: u-Boot image +* uEnv.txt: u-Boot Environment settings + +### Optional files + +* ID.txt: Unknown + +# Compiling + +* Build an ARM toolchain using `./configure --build-cross-tools-gcc4 arm ../buildtools` +* Build our loader using `jam -q -sHAIKU_BOOT_BOARD=beagleboneblk haiku_loader` +* TODO + +# Booting + +1. If the boot switch is not depressed: + MMC1, MMC0, UART0, USB0 +2. If the boot switch is depressed: + SPI0, MMC0, USB0, UART0 + +# Additional information + +* [CircutCo WikiPage](http://circuitco.com/support/index.php?title=BeagleBoneBlack) +* [BeagleBone Black A5A SRM](https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true) diff --git a/docs/develop/ports/arm/raspberry_pi.md b/docs/develop/ports/arm/raspberry_pi.md new file mode 100644 index 0000000000..c5fef5162d --- /dev/null +++ b/docs/develop/ports/arm/raspberry_pi.md @@ -0,0 +1,63 @@ +# Raspberry Pi +* http://raspberrypi.org + +# Hardware Information + +* ARMv6 Architecture +* Broadcom BCM2835 (SoC) + * Includes ARM1176JZF-S CPU @ 700 MHz + * Includes VideoCore IV GPU +* SD Card Storage +* 256 or 512 MB RAM (depending on revision) +* Video Outputs + * HDMI Video Output + * Composite Video Output +* Ethernet + +# Setting up the Haiku SD card + +The Raspberry Pi SD card generally uses the MBR file system layout below. Partition 1 is all that is required to boot an OS. + +* partition 1 -- FAT32, bootable flag, type 'c' +* partition 2 -- BeFS, Haiku filesystem, type 'eb' + +## Boot Partition + +### Required Files + +* bootcode.bin : 2nd stage bootloader +* start.elf: The GPU binary firmware image +* haiku_loader: Haiku Loader +* haiku-floppyboot.tgz: Compressed image with Haiku kernel +* config.txt: A configuration file read by the GPU. + +### Optional Files + +* vlls directory: Additional GPU code, e.g. extra codecs. + +# Compiling + +* Build an ARM toolchain using `./configure --build-cross-tools-gcc4 arm ../buildtools` +* Build our loader using `jam -q -sHAIKU_BOOT_BOARD=raspberry_pi -sHAIKU_BOOT_PLATFORM=raspberrypi_arm haiku_loader` +* Build our file system using `jam -q -sHAIKU_BOOT_BOARD=raspberry_pi -sHAIKU_BOOT_PLATFORM=raspberrypi_arm haiku-floppyboot.tgz` + +# Booting + +1. SOC finds bootcode.bin +2. bootcode.bin runs start.elf +2. start.elf reads config.txt and cmdline.txt +3. start.elf runs specified binary at specified address + +## config.txt Options + + kernel=haiku_loader + kernel_address=0x0 + disable_commandline_tags=1 + ramfsfile=haiku-floppyboot.tgz + ramfsaddr=0x04000000 + +# Additional Information + +* [Latest Raspberry Pi firmware](http://github.com/raspberrypi/firmware/tree/master/boot) +* [config.txt options](http://www.elinux.org/RPiconfig) + diff --git a/docs/user/interface/ListItem.dox b/docs/user/interface/ListItem.dox new file mode 100644 index 0000000000..0c6319e6a8 --- /dev/null +++ b/docs/user/interface/ListItem.dox @@ -0,0 +1,205 @@ +/* + * Copyright 2013 Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * headers/os/interface/ListItem.h hrev45555 + * src/kits/interface/ListItem.cpp hrev45555 + */ + + +/*! + \file ListItem.h + \ingroup interface + \ingroup libbe + \brief ListItem class definition. +*/ + + +/*! + \class BListItem + \ingroup interface + \ingroup libbe + \brief A list item, a member of a BListView or BOutlineListView. +*/ + + +/*! + \fn BListItem::BListItem(uint32 level, bool expanded) + \brief Create a new list item with the specified \a level. + + The \a level and \a expanded arguments are only used if the item is added to + a BOutlineListView. + + \param level The level to create the list item on, default level is 0. + \param expanded Whether or not the item is expanded. + + \see BOutlineListView::AddItem() +*/ + + +/*! + \fn BListItem::BListItem(BMessage* data) + \brief Create a new list item from archived message. + + \param data The message to create the list item from. +*/ + + +/*! + \fn BListItem::~BListItem() + \brief Destroy the list item freeing any memory used. + + The default destructor is empty. +*/ + + +/*! + \fn status_t BListItem::Archive(BMessage* archive, bool deep) const + \brief Archive the list item to a message. + + \param archive The message to archive the list item to. + \param deep If \c true also archive child views. +*/ + + +/*! + \fn void DrawItem(BView* owner, BRect frame, bool complete) + \brief Hook method called when the item is drawn. + + \param owner The view that the list item is a child of. + \param frame The frame of the item. + \param complete Whether or not to draw the background in addition to the + item's contents. +*/ + + +/*! + \fn float BListItem::Height() const + \brief Return the height of the list item. + + \return The height of the list item as a float. +*/ + + +/*! + \fn float BListItem::Width() const + \brief Return the width of the list item. + + \return The width of the list item as a float. +*/ + + +/*! + \fn bool BListItem::IsSelected() const + \brief Return whether or not the list item is currently selected. + + \return \c true if the list item is selected, \c false otherwise. +*/ + + +/*! + \fn void BListItem::Select() + \brief Select the list item. +*/ + + +/*! + \fn void BListItem::Deselect() + \brief Unselect the list item. +*/ + + +/*! + \fn void BListItem::SetEnabled(bool on) + \brief Enable or disable the list item. + + \param on Set \c true to enable, \c false to disable the list item. +*/ + + +/*! + \fn bool BListItem::IsEnabled() const + \brief Returns whether or not the list item is currently enabled. + + \return \c true if the list item is enabled, \c false if it is disabled. +*/ + + +/*! + \fn void BListItem::SetHeight(float height) + \brief Set the height of the list item to \a height. + + \param height The height to set the list item to. +*/ + + +/*! + \fn void BListItem::SetWidth(float width) + \brief Set the width of the list item to \a width. + + \param width The width to set the list item to. +*/ + + +/*! + \fn void BListItem::Update(BView* owner, const BFont* font) + \brief Hook method that's called with the list item's \a owner changes. + + This method gets called when the list item is added to the list view. + + The default implementation sets the width of the list item to the width of + \a owner and sets the height to fit \a font. + + \param owner The list item's new \a owner. + \param font The font set to the list item's current \a owner. +*/ + + +/*! + \fn status_t BListItem::Perform(perform_code d, void* arg) + \brief Performs an action give a perform_code and arg. (Internal Method) + + \param d The perform code. + \param arg A pointer to some data to perform on. + + \return A status code. +*/ + + +/*! + \fn void BListItem::SetExpanded(bool expanded) + \brief Set the expanded state of the list item. This only makes sense if the + list item is part of a BOutlineListView. + + \param expanded \c true to expand the list item, \c false to un-expand the + list item. +*/ + + +/*! + \fn bool BListItem::IsExpanded() const + \brief Returns whether or not the list item is currently expanded. + + \return \c true if the list item is expanded, \c false if it is not expanded. +*/ + + +/*! + \fn uint32 BListItem::OutlineLevel() const + \brief Returns the current outline level of the list item. This only makes + sense if the list item is part of a BOutlineListView. + + \return The current outline level of the list item. +*/ + + +/*! + \fn void BListItem::SetOutlineLevel(uint32 level) + \brief Set the outline level of the list item. + + \param level The outline level to set the list item to. +*/ diff --git a/docs/user/interface/ListView.dox b/docs/user/interface/ListView.dox new file mode 100644 index 0000000000..69475e312f --- /dev/null +++ b/docs/user/interface/ListView.dox @@ -0,0 +1,943 @@ +/* + * Copyright 2013 Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * headers/os/interface/ListView.h hrev45555 + * src/kits/interface/ListView.cpp hrev45555 + */ + + +/*! + \file ListView.h + \ingroup interface + \ingroup libbe + \brief ListView class definition. +*/ + + +/*! + \class BListView + \ingroup interface + \ingroup libbe + \brief Displays a list of items that the user can select and invoke. + + BListView's can be one of two types set by the type parameter of the constructor: + - \c B_SINGLE_SELECTION_LIST Can select only one item in the list at a time. + This is the default. + - \c B_MULTIPLE_SELECTION_LIST Can select any number of items by holding down + Option for a discontinuous selection, or Shift for a contiguous selection. + + An example of a BListView looks like this: + \image html BListView_example.png + + Click on an item to select it and double-click an item to invoke it. The + BListView doesn't define what it means to "invoke" an item. See + BListView::SetSelectionMessage() and BListView::SetInvocationMessage() to set + a message to be set when these actions occur. You can also select and invoke + items with keyboard keys such as the up and down arrow keys, Page Up and Page + Down and the Enter key or Space key to invoke the item. + + This class is based on the BList class from the Support Kit and many of the + methods it uses behave similarly. + + Although a BListView is scrollable, it doesn't provide scroll bars by itself. + You should add the BListView as a child of a BScrollView to make it scrollable. + + The code to add a BListView to a BScrollView looks something like this: + +\code + BListView* list = new BListView(frame, "List", B_SINGLE_SELECTION_LIST); + list->AddItem(new BStringItem("Item 1")); + list->AddItem(new BStringItem("Item 2")); + ... + view->AddChild(new BScrollView("scroll_view", list, + B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)); +\endcode + + \see BScrollView for more information on scrolling views. + \see BList in the Support Kit. + \see BOutlineListView + \see BListItem +*/ + + +/*! + \fn BListView::BListView(BRect frame, const char* name, list_view_type type, + uint32 resizingMode, uint32 flags) + \brief Creates a new list view. This is the non-layout constructor. + + \param frame The frame rectangle of the view. + \param name The name of the view. + \param type Whether the list view supports a single selection or multiple + selections. + \param resizingMode The resizing mode flags. + \param flags The view flags. +*/ + + +/*! + \fn BListView::BListView(const char* name, list_view_type type, uint32 flags) + \brief Creates a new list view suitable as part of a layout with the specified + \a name, \a type, and \a flags. + + \param name The name of the view. + \param type Whether the list view supports a single selection or multiple + selections. + \param flags The view flags. +*/ + + +/*! + \fn BListView::BListView(list_view_type type) + \brief Creates a new list view suitable as part of a layout. + + \param type Whether the list view supports a single selection or multiple + selections. +*/ + + +/*! + \fn BListView::BListView(BMessage* archive) + \brief Creates a list view from an \a archive message. + + \param archive The message to create the list view from. +*/ + + +/*! + \fn BListView::~BListView() + \brief Delete the list view and free the memory used. + + This method does not free the list items. +*/ + + +/*! + \name Archiving +*/ + + +//! @{ + + +/*! + \fn BArchivable* BListView::Instantiate(BMessage* archive) + \brief Create a new list view from the message \a archive. + + \param archive The message to create the list view from. +*/ + + +/*! + \fn status_t BListView::Archive(BMessage* archive, bool deep) const + \brief Archive the list view to a message. + + \param archive The message to archive the list view to. + \param deep \c true to archive child views. +*/ + + +//! @} + + +/*! + \name Hook methods +*/ + + +//! @{ + + +/*! + \fn void BListView::Draw(BRect updateRect) + \brief Hook method called to draw the contents of the text view. + + You should not have to call this method directly, use Invalidate() instead. + + \param updateRect The rectangular area to draw. + + \see BView::Draw() +*/ + + +/*! + \fn void BListView::AttachedToWindow() + \brief Hook method called when the list view is added to the view hierarchy. + + \see BView::AttachedToWindow() +*/ + + +/*! + \fn void BListView::DetachedFromWindow() + \brief Hook method that is called when the list view is removed from the + view hierarchy. + + \see BView::DetachedFromWindow() +*/ + + +/*! + \fn void BListView::AllAttached() + \brief Hook method called once all views are attached to the view. + + \see BView::AllAttached() +*/ + + +/*! + \fn void BListView::AllDetached() + \brief Hook method called once all views are detached from the view. + + \see BView::AllDetached() +*/ + + +/*! + \fn void BListView::FrameResized(float width, float height) + \brief Hook method called when the list view is resized. + + \param width The new \a width of the list view. + \param height The new \a height of the list view. + + \see BView::FrameResized() +*/ + + +/*! + \fn void BListView::FrameMoved(BPoint new_position) + \brief Hook method called when the list view is moved. + + \param new_position The list view's new position. +*/ + + +/*! + \fn void BListView::TargetedByScrollView(BScrollView *view) + \brief Hook method called when the list view is attached to a BScrollView. + + \param view The BScrollView the list view is attached to. +*/ + + +/*! + \fn void BListView::WindowActivated(bool state) + \brief Hook method that is called when the window becomes the active window + or gives up that status. + + \param state If \c true, window has just been activated. If \c false the + window has just been deactivated. + + \see BView::WindowActivated() +*/ + + +/*! + \fn void BListView::MessageReceived(BMessage* message) + \brief Hook method called with a message is received by the list view. + + \param message The message received by the list view. + + \see BView::MessageReceived() +*/ + + +/*! + \fn void BListView::KeyDown(const char* bytes, int32 numBytes) + \brief Hook method that is called when a key is pressed while the view is + the focus view of the active window. + + The following keys are used by the list view by default: + - Up Arrow Selects the previous item. + - Down Arrow Selects the next item. + - Page Up Selects the item one view height above the current item. + - Page Down Selects the item one view height below the current item. + - Home Selects the first item in the list. + - End Select the last item in the list. + - Enter and Spacebar Invokes the currently selected item. + + \param bytes The \a bytes representing the keys pushed down. + \param numBytes The size of \a bytes. + + \see BView::KeyDown() +*/ + + +/*! + \fn void BListView::KeyUp(const char* bytes, int32 numBytes) + \brief Hook method that is called when a keyboard key is released. + + \param bytes The \a bytes representing the keys released. + \param numBytes The size of \a bytes. + + \see BView::KeyUp() +*/ + + +/*! + \fn void BListView::MouseDown(BPoint point) + \brief Hook method that is called when a mouse button is pushed down while + the cursor is contained in the view. + + By default this method selects items on a single click, and invokes them on a + double click. This method calls InitiateDrag() to allow derived classes the + opportunity to drag and drop items from the list. + + \param point The \a point where the mouse button was pushed down. + + \see BView::MouseDown() +*/ + + +/*! + \fn void BListView::MouseUp(BPoint where) + \brief Hook method that is called when a mouse button is released while + the cursor is contained in the view. + + \param where The location that the mouse button was released. + + \see BView::MouseUp() +*/ + + +/*! + \fn void BListView::MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage) + \brief Hook method that is called whenever the mouse cursor enters, exits + or moves inside the list view. + + \param where The point where the mouse cursor has moved to. + \param code A code which indicating if the mouse entered or exited the view. + \param dragMessage A message containing drag and drop information. + + \see BView::MouseMoved() +*/ + + +/*! + \fn bool BListView::InitiateDrag(BPoint point, int32 index, bool wasSelected) + \brief Hook method called when a drag and drop operation is initiated. + + This method is used by derived classes to implement drag and drop. This method + is called by the MouseDown() method. If the derived class initiates the drag & + drop operation you should return \c true, otherwise return \c false. By default + this method returns \c false. + + \param point Where the drag & drop operation started. + \param index + \param wasSelected Indicates whether or not the item was selected. + + \returns \c true if a drag & drop operation was initiated, \c false if not. +*/ + + +/*! + \fn void BListView::SelectionChanged() + \brief Hook method that is called when the selection changes. + + This method should be implemented by derived classes, the default + implementation does nothing. +*/ + + +//! @} + + +/*! + \name Resize methods +*/ + + +//! @{ + + +/*! + \fn void BListView::ResizeToPreferred() + \brief Resize the view to it's preferred size. + + \see BView::ResizeToPreferred() +*/ + + +/*! + \fn void BListView::GetPreferredSize(float *_width, float *_height) + \brief Fill out the \a _width and \a _height parameters with the preferred + width and height of the list view. + + \param _width The list view's preferred width is written to \a _width. + \param _height The list view's preferred height is written to \a _height. + + \see BView::GetPreferredSize() +*/ + + +/*! + \fn BSize BListView::MinSize() + \brief Returns the minimum size of the list view. + + \return The minimum size of the list view as a BSize. + + \see BView::MinSize() +*/ + + +/*! + \fn BSize BListView::MaxSize() + \brief Returns the maximum size of the list view. + + \return The maximum size of the list view as a BSize. + + \see BView::MaxSize() +*/ + + +/*! + \fn BSize BListView::PreferredSize() + \brief Returns the preferred size of the list view. + + \return The preferred size of the list view as a BSize. + + \see BView::PreferredSize() +*/ + + +//! @} + + +/*! + \fn void BListView::MakeFocus(bool focused) + \brief Highlight or unhighlight the selection when the list view acquires + or loses its focus state. + + \param focused \c true to receive focus or \c false to lose it. + + \see BView::MakeFocus() +*/ + + +/*! + \fn void BListView::SetFont(const BFont* font, uint32 mask) + \brief Sets the font of the list view to \a font with the font parameters set + by \a mask. + + \param font The \a font to set the list view to. + \param mask A \a mask indicating which properties of \a font to set. + + \see BView::SetFont() +*/ + + +/*! + \fn void BListView::ScrollTo(BPoint point) + \brief Scroll the view to the specified \a point. + + \param point The location to scroll the list view to. + + \see BView::ScrollTo() +*/ + + +/*! + \name Add and remove item methods +*/ + + +//! @{ + + +/*! + \fn bool BListView::AddItem(BListItem *item, int32 index) + \brief Add an \a item to the list view at the specified \a index. + + \param item The list item to add. + \param index The \a index of where to add the list item, if not specified the + item is added to the end. + + \return \c true if the list item was added, \c false otherwise. +*/ + + +/*! + \fn bool BListView::AddList(BList* list, int32 index) + \brief Add a \a list of list items to the list view at the specified \a index. + + \param list The \a list of list items to add. + \param index The \a index of where to add the list, if not specified the + \a list is added to the end. + + \return \c true if the \a list was added, \c false otherwise. +*/ + + +/*! + \fn bool BListView::AddList(BList* list) + \fn Add a \a list of list items to the end of the list view. + + \param list The \a list of list items to add. + + \return \c true if the \a list was added, \c false otherwise. +*/ + + +/*! + \fn BListItem* BListView::RemoveItem(int32 index) + \brief Remove the item at \a index from the list. + + \param index The \a index of the item to remove. + + \return \c true if the item was removed, \c false otherwise. +*/ + + +/*! + \fn bool BListView::RemoveItem(BListItem* item) + \brief Remove the specified list item. + + \param item The list item to remove. + + \return \c true if the \a item was removed, \c false otherwise. +*/ + + +/*! + \fn bool BListView::RemoveItems(int32 index, int32 count) + \brief Removes the items from \a index and the next \a count items. + + \param index The location to start removing items from. + \param count The number of items past \a index to remove. + + return \c true if the \a items were removed, \c false otherwise. +*/ + + +//! @} + + +/*! + \name Selection and Invocation message methods +*/ + + +//! @{ + + +/*! + \fn void BListView::SetSelectionMessage(BMessage* message) + \brief Sets the \a message that the list view sends when a new item is selected. + + \param message The selection \a message to set. +*/ + + +/*! + \fn void BListView::SetInvocationMessage(BMessage* message) + Sets the \a message that the list view sends when an item is invoked. + + \param message The invocation \a message to set. + + \see BInvoker::SetMessage() +*/ + + +/*! + \fn BMessage* BListView::InvocationMessage() const + \brief Returns the message that is send when an item is invoked. + + \return The current invocation method as a BMessage. + + \see BInvoker::Message() +*/ + + +/*! + \fn uint32 BListView::InvocationCommand() const + \brief Returns the what parameter of the current invocation method. + + \returns The what parameter of the currently set invocation method. + + \see BInvoker::Command() +*/ + + +/*! + \fn BMessage* BListView::SelectionMessage() const + \brief Returns the message that is send when an item is selected. + + \return The current selection message as a BMessage. +*/ + + +/*! + \fn uint32 BListView::SelectionCommand() const + \brief Returns the what parameter of the message that is send when an item is + selected. + + \return The what parameter of the current selection message. +*/ + + +//! @} + + +/*! + \name List type methods +*/ + + +//! @{ + + +/*! + \fn void BListView::SetListType(list_view_type type) + \brief Sets the list view \a type. + + \param type The list view \a type to set. +*/ + + +/*! + \fn list_view_type BListView::ListType() const + \brief Returns the current list view type. + + \return The list view type. +*/ + + +//! @} + + +/*! + \name List methods +*/ + + +//! @{ + + +/*! + \fn BListItem* BListView::ItemAt(int32 index) const + \brief Returns the list item at the specified \a index. + + \param index + + \return The list item at the specified \a index. +*/ + + +/*! + \fn int32 BListView::IndexOf(BListItem* item) const + \brief Returns the index of the specified \a item. + + \param item The list item to get the index of. + + \return The index of the specified \a item. +*/ + + +/*! + \fn int32 BListView::IndexOf(BPoint point) const + \brief Returns the index of the item at the specified \a point. + + \param point The location of the list item to get the index of. + + \return The index of the list item at the specified \a point. +*/ + + +/*! + \fn BListItem* BListView::FirstItem() const + \brief Returns the first list item. + + \return The first item in the list. +*/ + + +/*! + \fn BListItem* BListView::LastItem() const + \brief Returns the last list item. + + \return The last item in the list. +*/ + + +/*! + \fn bool BListView::HasItem(BListItem *item) const + \brief Returns whether or not the list contains the specified \a item. + + \param item The list item to check. + + \return \c true if the list item is contained in the list view, \c false + otherwise. +*/ + + +/*! + \fn int32 BListView::CountItems() const + \brief Returns the number of list items contained in the list view. + + \return The number of list items. +*/ + + +/*! + \fn void BListView::MakeEmpty() + \brief Empties the list view of all list items. +*/ + + +/*! + \fn bool BListView::IsEmpty() const + \brief Returns whether or not the list view is empty or not. + + \return \c true if the list view was empty, \c false otherwize. +*/ + + +/*! + \fn void BListView::DoForEach(bool (*func)(BListItem*)) + \brief Calls the specified function on each item in the list. + + The \a func is called on the items in order starting with the item at index 0 + and ending at the last item in the list. This method stops calling the \a func + once it returns \a true or the end of the list is reached. + + The first argument of \a func is a pointer to the list item. + + \param func The function to call on each item. +*/ + + +/*! + \fn void BListView::DoForEach(bool (*func)(BListItem*, void*), void* arg) + \brief Calls the specified function on each item in the list. + + The \a func is called on the items in order starting with the item at index 0 + and ending at the last item in the list. This method stops calling the \a func + once it returns \a true or the end of the list is reached. + + The first argument of \a func is a pointer to the list item, \a arg is passed in + as the second argument. + + \param func The function to call on each item. +*/ + + +/*! + \fn const BListItem** BListView::Items() const + \brief Returns a pointer to the list of list items. + + \returns a pointer to the list of list items. +*/ + + +//! @} + + +/*! + \fn void BListView::InvalidateItem(int32 index) + \brief Draws the list item at the specified \a index. + + \param index The \a index of the list item to draw. +*/ + + +/*! + \name Selection methods +*/ + + +//! @{ + + +/*! + \fn void BListView::ScrollToSelection() + \brief Scrolls to selected list item. +*/ + + +/*! + \fn void BListView::Select(int32 index, bool extend) + \brief Selects the list item at the specified \a index. + + \param index The \a index of the item to select. + \param extend Whether or not to also select child items. +*/ + + +/*! + \fn void BListView::Select(int32 start, int32 finish, bool extend) + \brief Select items from \a start to \a finish. + + \param start The index of the item to start the selection. + \param finish The index of the item to end the selection. + \param extend Whether or not to also select child items. +*/ + + +/*! + \fn bool BListView::IsItemSelected(int32 index) const + \brief Returns whether or not the item at \a index is selected. + + \return \c true if the item was selected, \c false otherwise. +*/ + + +/*! + \fn int32 BListView::CurrentSelection(int32 index) const + \brief Returns the index of a currently selected item relative to the passed + in \a index. + + If the index of the selected item is lower than \a index the value returned + is negative, if the index of the selected item is greater than \a index the + value returned is positive. If the index of the selected item is equal to + \a index then 0 is returned. + + \brief index The \a index of the item to get relative to the selected item's + index. +*/ + + +//! @} + + +/*! + \fn status_t BListView::Invoke(BMessage* message) + \brief Invoke the list view, either with the current invocation message or + \a message if it is specified. + + \param message The message to send or \c NULL to send the current invocation + message. + + \see BControl::Invoke() +*/ + + +/*! + \name Deselection methods +*/ + + +//! @{ + + +/*! + \fn void BListView::DeselectAll() + \brief Deselect all items. +*/ + + +/*! + \fn void BListView::DeselectExcept(int32 exceptFrom, int32 exceptTo) + \brief Deselect all items except the items with index in the range of + \a exceptFrom to \a exceptTo. + + \param exceptFrom The index of the start of the exception list. + \param exceptTo The index of the end of the exception list. +*/ + + +/*! + \fn void BListView::Deselect(int32 index) + \brief Deselect the item at \a index. + + \param index The \a index of the item to deselect. +*/ + + +//! @} + + +/*! + \fn void BListView::SortItems(int (*cmp)(const void *, const void *)) + \brief sort the items according the the passed in \a cmp function. + + \param cmp The compare function to use to sort the items. +*/ + + +/*! + \fn bool BListView::SwapItems(int32 a, int32 b) + \brief Swap item \a a with item \a b. + + \param a The index of the first item to swap. + \param b The index of the second item to swap. + + \return \c true if the items were swapped, \c false otherwise. +*/ + + +/*! + \fn bool BListView::MoveItem(int32 from, int32 to) + \brief Move the item at index \a from to the position in the list at index \a to. + + \param from The index of the item to move. + \param to The index to move the item to. + + \return \c true if the item was moved, \c false otherwise. +*/ + + +/*! + \fn bool BListView::ReplaceItem(int32 index, BListItem* item) + \brief Replace the item at index \a index with \a item. + + \param index The \a index of the item to replace. + \param item The \a item to replace the item at \a index with. + + \return \c true if the item was replaced, \c false otherwise. +*/ + + +/*! + \fn BRect BListView::ItemFrame(int32 index) + \brief Return the frame of the item at the specified \a index. + + \param index The \a index of the item to get the frame of. + + \returns The frame of the item at \a index. +*/ + + +/*! + \fn BHandler* BListView::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char* property); + \brief Returns the proper handler for the passed in scripting \a message. + + \param message The scripting message to determine the handler. + \param index The index of the specifier. + \param specifier The message which contains the specifier. + \param form The 'what' field of the specifier message. + \param property The name of the target property. + + \return The proper BHandler for the passed in scripting \a message. + + \see BView::ResolveSpecifier() +*/ + + +/*! + \fn status_t BListView::GetSupportedSuites(BMessage* data) + \brief Reports the suites of messages and specifiers that derived classes + understand. + + \param data The message to report the suite of messages and specifiers. + + \see BView::GetSupportedSuites() +*/ + + +/*! + \fn status_t BListView::Perform(perform_code code, void* _data) + \brief Performs an action give a perform_code and data. (Internal Method) + + \param code The perform code + \param _data A pointer to some data to perform on + + \return A status code. + + \see BView::Perform() +*/ diff --git a/docs/user/interface/TextView.dox b/docs/user/interface/TextView.dox index 6a5dc83293..67a5626eda 100644 --- a/docs/user/interface/TextView.dox +++ b/docs/user/interface/TextView.dox @@ -113,9 +113,9 @@ uint32 resizeMask, uint32 flags) \brief Creates a new BTextView object. - \param frame The BTextView frame rectangle. - \param name The name of the object. - \param textRect The area of the text within the BTextView object. + \param frame The frame rectangle of the view. + \param name The name of the view. + \param textRect The area of the text within the view. \param resizeMask Resizing mask, passed to BView. \param flags \a flags passed to BView, \c B_FRAME_EVENTS, \c B_PULSE_NEEDED and \c B_INPUT_METHOD_AWARE are always set. @@ -222,25 +222,30 @@ /*! \fn void BTextView::AttachedToWindow() - \brief Hook method that is called when the BTextView is added to the - view hierarchy. + \brief Hook method called when the text view is added to the view hierarchy. Sets the pulse rate to 2 per second and adjust scrollbars if needed. + + \see BView::AttachedToWindow() */ /*! \fn void BTextView::DetachedFromWindow() - \brief Hook method that is called when the BTextView is removed from the + \brief Hook method that is called when the text view is removed from the view hierarchy. + + \see BView::DetachedFromWindow() */ /*! \fn void BTextView::Draw(BRect updateRect) - \brief Hook method that is called to draw the contents of the BTextView. + \brief Hook method called to draw the contents of the text view. - \param updateRect The rectangular area to be redrawn. + \param updateRect The rectangular area to draw. + + \see BView::Draw() */ @@ -250,6 +255,8 @@ the cursor is contained in the view. \param where The location where the mouse button was pushed down. + + \see BView::MouseDown() */ @@ -258,9 +265,11 @@ \brief Hook method that is called when a mouse button is released while the cursor is contained in the view. - \note This method stops asynchronous mouse tracking. + This method stops asynchronous mouse tracking. - \param where The location where the mouse button was released. + \param where The location that the mouse button was released. + + \see BView::MouseUp() */ @@ -273,6 +282,8 @@ \param where The point where the mouse cursor has moved to. \param code A code which indicates if the mouse entered or exited the view. \param message A message containing drag and drop information. + + \see BView::MouseMoved() */ @@ -281,8 +292,10 @@ \brief Hook method that is called when the window becomes the active window or gives up that status. - \param state If \c true, window has just become active. If \c false the - window has just become inactive. + \param state If \c true, window has just been activated. If \c false the + window has just been deactivated. + + \see BView::WindowActivated() */ @@ -290,6 +303,8 @@ \fn void BTextView::KeyDown(const char* bytes, int32 numBytes) \brief Hook method that is called when a key is pressed while the view is the focus view of the active window. + + \see BView::KeyDown() */ @@ -298,6 +313,8 @@ \brief Hook method that is called at a set interval. This method is used to make the I-beam blink. + + \see BView::Pulse() */ @@ -309,15 +326,18 @@ \param width The new view width. \param height The new view height. + + \see BView::FrameResized() */ /*! \fn void BTextView::MessageReceived(BMessage* message) - \brief Hook method that is called each time the BTextView receives - a message. + \brief Hook method called with a message is received by the text view. - \param message The received message. + \param message The message received by the text view. + + \see BView::MessageReceived() */ @@ -326,10 +346,12 @@ /*! \fn void BTextView::MakeFocus(bool focusState) - \brief Highlight or unhighlight the selection when the view gets + \brief Highlight or unhighlight the selection when the text view acquires or loses its focus state. - \param focusState \c true to get focus or \c false to lose it. + \param focusState \c true to receive focus or \c false to lose it. + + \see BView::MakeFocus() */ @@ -345,6 +367,8 @@ \param property The name of the target property. \return The proper BHandler for the passed in scripting \a message. + + \see BView::ResolveSpecifier() */ @@ -407,6 +431,7 @@ \param runs The text styling to use, can be \c NULL. */ + //! @} diff --git a/docs/user/interface/images/BListView_example.png b/docs/user/interface/images/BListView_example.png new file mode 100644 index 0000000000..59ae635cb6 Binary files /dev/null and b/docs/user/interface/images/BListView_example.png differ diff --git a/headers/libs/ncurses/termcap.h b/headers/libs/ncurses/termcap.h new file mode 100644 index 0000000000..ad2d13d1ee --- /dev/null +++ b/headers/libs/ncurses/termcap.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, 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, distribute with modifications, 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 ABOVE 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. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.5" + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST /*nothing*/ + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/headers/libs/termcap/termcap.h b/headers/libs/termcap/termcap.h deleted file mode 100644 index b19fb0a17b..0000000000 --- a/headers/libs/termcap/termcap.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Declarations for termcap library. - Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _TERMCAP_H -#define _TERMCAP_H 1 - -#if __STDC__ - -extern int tgetent (char *buffer, const char *termtype); - -extern int tgetnum (const char *name); -extern int tgetflag (const char *name); -extern char *tgetstr (const char *name, char **area); - -extern char PC; -extern short ospeed; -extern void tputs (const char *string, int nlines, int (*outfun) (int)); - -extern char *tparam (const char *ctlstring, char *buffer, int size, ...); - -extern char *UP; -extern char *BC; - -extern char *tgoto (const char *cstring, int hpos, int vpos); - -#else /* not __STDC__ */ - -extern int tgetent (); - -extern int tgetnum (); -extern int tgetflag (); -extern char *tgetstr (); - -extern char PC; -extern short ospeed; - -extern void tputs (); - -extern char *tparam (); - -extern char *UP; -extern char *BC; - -extern char *tgoto (); - -#endif /* not __STDC__ */ - -#endif /* not _TERMCAP_H */ diff --git a/headers/os/bluetooth/LinkKeyUtils.h b/headers/os/bluetooth/LinkKeyUtils.h index 5009735140..3abbb313d9 100644 --- a/headers/os/bluetooth/LinkKeyUtils.h +++ b/headers/os/bluetooth/LinkKeyUtils.h @@ -41,9 +41,9 @@ public: static linkkey_t FromString(const char *lkstr) { if (lkstr != NULL) { - int l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15; - size_t count = sscanf(lkstr, "%2X:%2X:%2X:%2X:%2X:%2X:%2X:%2X:" - "%2X:%2X:%2X:%2X:%2X:%2X:%2X:%2X", &l0, &l1, &l2, &l3, + uint8 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15; + size_t count = sscanf(lkstr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:" + "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhxs", &l0, &l1, &l2, &l3, &l4, &l5, &l6, &l7, &l8, &l9, &l10, &l11, &l12, &l13, &l14, &l15); diff --git a/headers/os/bluetooth/bdaddrUtils.h b/headers/os/bluetooth/bdaddrUtils.h index cec9fb8a69..9b86c32dd8 100644 --- a/headers/os/bluetooth/bdaddrUtils.h +++ b/headers/os/bluetooth/bdaddrUtils.h @@ -59,10 +59,10 @@ public: static bdaddr_t FromString(const char * addr) { - int b0, b1, b2, b3, b4, b5; + uint8 b0, b1, b2, b3, b4, b5; if (addr != NULL) { - size_t count = sscanf(addr, "%2X:%2X:%2X:%2X:%2X:%2X", + size_t count = sscanf(addr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &b5, &b4, &b3, &b2, &b1, &b0); if (count == 6) diff --git a/headers/os/interface/Menu.h b/headers/os/interface/Menu.h index 4ef27a77f5..bbca5c4d6d 100644 --- a/headers/os/interface/Menu.h +++ b/headers/os/interface/Menu.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Haiku, Inc. All rights reserved. + * Copyright 2007-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _MENU_H @@ -10,6 +10,7 @@ #include #include + class BMenu; class BMenuBar; class BMenuItem; @@ -216,7 +217,7 @@ private: void _ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, BRect* override, BRect& outRect); void _ComputeRowLayout(int32 index, bool bestFit, - bool moveItems, BRect& outRect); + bool moveItems, BRect& outRect); void _ComputeMatrixLayout(BRect& outRect); BRect _CalcFrame(BPoint where, bool* scrollOn); diff --git a/headers/os/interface/MenuField.h b/headers/os/interface/MenuField.h index 2fba75910c..aaf3cdfd5c 100644 --- a/headers/os/interface/MenuField.h +++ b/headers/os/interface/MenuField.h @@ -16,12 +16,14 @@ class BMenuField : public BView { public: BMenuField(BRect frame, const char* name, const char* label, BMenu* menu, - uint32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP, + uint32 resizingMode = B_FOLLOW_LEFT + | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BMenuField(BRect frame, const char* name, const char* label, BMenu* menu, bool fixed_size, - uint32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP, + uint32 resizingMode = B_FOLLOW_LEFT + | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BMenuField(const char* name, const char* label, BMenu* menu, @@ -35,14 +37,14 @@ public: virtual status_t Archive(BMessage* archive, bool deep = true) const; - virtual void Draw(BRect update); + virtual void Draw(BRect updateRect); virtual void AttachedToWindow(); virtual void AllAttached(); virtual void MouseDown(BPoint where); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MakeFocus(bool state); - virtual void MessageReceived(BMessage* message); - virtual void WindowActivated(bool state); + virtual void MessageReceived(BMessage* message); + virtual void WindowActivated(bool state); virtual void MouseUp(BPoint where); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); @@ -58,24 +60,24 @@ public: virtual void SetLabel(const char* label); const char* Label() const; - virtual void SetEnabled(bool on); + virtual void SetEnabled(bool on); bool IsEnabled() const; virtual void SetAlignment(alignment label); alignment Alignment() const; - virtual void SetDivider(float dividing_line); + virtual void SetDivider(float position); float Divider() const; void ShowPopUpMarker(); void HidePopUpMarker(); - virtual BHandler* ResolveSpecifier(BMessage* message, + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 form, const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual status_t GetSupportedSuites(BMessage* data); - virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float* width, float* height); + virtual void ResizeToPreferred(); + virtual void GetPreferredSize(float* width, float* height); virtual BSize MinSize(); virtual BSize MaxSize(); @@ -87,8 +89,8 @@ public: virtual status_t Perform(perform_code d, void* arg); protected: - virtual status_t AllArchived(BMessage* into) const; - virtual status_t AllUnarchived(const BMessage* from); + virtual status_t AllArchived(BMessage* into) const; + virtual status_t AllUnarchived(const BMessage* from); virtual void LayoutInvalidated(bool descendants); virtual void DoLayout(); @@ -121,7 +123,7 @@ private: void InitObject(const char* label); void InitObject2(); - void DrawLabel(BRect bounds, BRect update); + void DrawLabel(BRect updateRect); static void InitMenu(BMenu* menu); int32 _MenuTask(); diff --git a/headers/os/interface/OutlineListView.h b/headers/os/interface/OutlineListView.h index e553bd345e..747183b3d4 100644 --- a/headers/os/interface/OutlineListView.h +++ b/headers/os/interface/OutlineListView.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Copyright 2006-2013, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _OUTLINE_LIST_VIEW_H @@ -8,8 +8,6 @@ #include -class BListItem; - class BOutlineListView : public BListView { public: diff --git a/headers/os/interface/PopUpMenu.h b/headers/os/interface/PopUpMenu.h index 1f10102e2c..3c1a792133 100644 --- a/headers/os/interface/PopUpMenu.h +++ b/headers/os/interface/PopUpMenu.h @@ -43,7 +43,7 @@ public: int32 form, const char* property); virtual status_t GetSupportedSuites(BMessage* data); - virtual status_t Perform(perform_code code, void* data); + virtual status_t Perform(perform_code code, void* _data); virtual void ResizeToPreferred(); virtual void GetPreferredSize(float* _width, @@ -66,13 +66,13 @@ protected: private: BMenuItem* _Go(BPoint where, bool autoInvoke, - bool startOpened, BRect* specialRect, + bool startOpened, BRect* _specialRect, bool async); BMenuItem* _StartTrack(BPoint where, bool autoInvoke, - bool startOpened, BRect* specialRect); - BMenuItem* _WaitMenu(void* data); + bool startOpened, BRect* _specialRect); + BMenuItem* _WaitMenu(void* _data); - static int32 _thread_entry(void* data); + static int32 _thread_entry(void* menuData); private: BPoint fWhere; diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index 59f6c5e560..3be13e99a4 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -166,8 +166,9 @@ public: void ResizeBy(float dx, float dy); void ResizeTo(float width, float height); - void CenterIn(const BRect& rect); - void CenterOnScreen(); + void CenterIn(const BRect& rect); + void CenterOnScreen(); + void CenterOnScreen(screen_id id); virtual void Show(); virtual void Hide(); @@ -283,6 +284,7 @@ private: struct unpack_cookie; class Shortcut; + friend class BAlert; friend class BApplication; friend class BBitmap; friend class BView; @@ -303,6 +305,7 @@ private: virtual void task_looper(); + BPoint AlertPosition(const BRect& frame); virtual BMessage* ConvertToMessage(void* raw, int32 code); void AddShortcut(uint32 key, uint32 modifiers, diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index dc91207136..1b2e7f8849 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -85,6 +85,11 @@ typedef struct area_info { /* area protection */ #define B_READ_AREA 1 #define B_WRITE_AREA 2 +#define B_EXECUTE_AREA 4 +#define B_STACK_AREA 8 + // "stack" protection is not available on most platforms - it's used + // to only commit memory as needed, and have guard pages at the + // bottom of the stack. extern area_id create_area(const char *name, void **startAddress, uint32 addressSpec, size_t size, uint32 lock, diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index e4f0c24e53..7cc5aaf67e 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -137,6 +137,7 @@ typedef generic_addr_t generic_size_t; /* off_t */ #define B_PRIdOFF B_PRId64 #define B_PRIiOFF B_PRIi64 +#define B_PRIxOFF B_PRIx64 /* dev_t */ #define B_PRIdDEV B_PRId32 #define B_PRIiDEV B_PRIi32 @@ -146,6 +147,9 @@ typedef generic_addr_t generic_size_t; /* time_t */ #define B_PRIdTIME B_PRId32 #define B_PRIiTIME B_PRIi32 +/* bigtime_t */ +#define B_PRIdBIGTIME B_PRId64 +#define B_PRIiBIGTIME B_PRIi64 /* Printed width of a pointer with the %p format (minus 0x prefix). */ diff --git a/headers/private/debug/debug_support.h b/headers/private/debug/debug_support.h index aa8165228d..d7676af9e7 100644 --- a/headers/private/debug/debug_support.h +++ b/headers/private/debug/debug_support.h @@ -1,5 +1,6 @@ /* - * Copyright 2005-2009, Ingo Weinhold, bonefish@users.sf.net. + * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com * Distributed under the terms of the MIT License. */ #ifndef _DEBUG_SUPPORT_H @@ -61,8 +62,11 @@ status_t debug_get_stack_frame(debug_context *context, typedef struct debug_symbol_lookup_context debug_symbol_lookup_context; typedef struct debug_symbol_iterator debug_symbol_iterator; -status_t debug_create_symbol_lookup_context(team_id team, +status_t debug_create_symbol_lookup_context(team_id team, image_id image, debug_symbol_lookup_context **lookupContext); + // imageID can be -1 if all images in the target team are + // desired, otherwise a valid image id is expected. + void debug_delete_symbol_lookup_context( debug_symbol_lookup_context *lookupContext); @@ -77,6 +81,7 @@ status_t debug_lookup_symbol_address(debug_symbol_lookup_context *lookupContext, status_t debug_create_image_symbol_iterator( debug_symbol_lookup_context* lookupContext, image_id imageID, debug_symbol_iterator** _iterator); + status_t debug_create_file_symbol_iterator(const char* path, debug_symbol_iterator** _iterator); void debug_delete_symbol_iterator(debug_symbol_iterator* iterator); diff --git a/headers/private/graphics/intel_extreme/AreaKeeper.h b/headers/private/graphics/intel_extreme/AreaKeeper.h index 8e17dec24a..83861397f2 100644 --- a/headers/private/graphics/intel_extreme/AreaKeeper.h +++ b/headers/private/graphics/intel_extreme/AreaKeeper.h @@ -22,8 +22,9 @@ class AreaKeeper { area_id Create(const char *name, void **_virtualAddress, uint32 spec, size_t size, uint32 lock, uint32 protection); - area_id Map(const char *name, void *physicalAddress, size_t numBytes, - uint32 spec, uint32 protection, void **_virtualAddress); + area_id Map(const char *name, phys_addr_t physicalAddress, + size_t numBytes, uint32 spec, uint32 protection, + void **_virtualAddress); status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; } void Detach(); @@ -57,10 +58,10 @@ AreaKeeper::Create(const char *name, void **_virtualAddress, uint32 spec, area_id -AreaKeeper::Map(const char *name, void *physicalAddress, size_t numBytes, +AreaKeeper::Map(const char *name, phys_addr_t physicalAddress, size_t numBytes, uint32 spec, uint32 protection, void **_virtualAddress) { - fArea = map_physical_memory(name, (addr_t)physicalAddress, numBytes, spec, + fArea = map_physical_memory(name, physicalAddress, numBytes, spec, protection, _virtualAddress); return fArea; } diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index f7e7d22d5a..b8e969fba7 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -226,13 +226,13 @@ struct intel_allocate_graphics_memory { uint32 size; uint32 alignment; uint32 flags; - uint32 buffer_base; + addr_t buffer_base; }; // free graphics memory struct intel_free_graphics_memory { uint32 magic; - uint32 buffer_base; + addr_t buffer_base; }; //---------------------------------------------------------- diff --git a/headers/private/graphics/radeon_hd/AreaKeeper.h b/headers/private/graphics/radeon_hd/AreaKeeper.h index 8e17dec24a..d604bb45cb 100644 --- a/headers/private/graphics/radeon_hd/AreaKeeper.h +++ b/headers/private/graphics/radeon_hd/AreaKeeper.h @@ -22,7 +22,7 @@ class AreaKeeper { area_id Create(const char *name, void **_virtualAddress, uint32 spec, size_t size, uint32 lock, uint32 protection); - area_id Map(const char *name, void *physicalAddress, size_t numBytes, + area_id Map(const char *name, addr_t physicalAddress, size_t numBytes, uint32 spec, uint32 protection, void **_virtualAddress); status_t InitCheck() { return fArea < B_OK ? (status_t)fArea : B_OK; } @@ -57,10 +57,10 @@ AreaKeeper::Create(const char *name, void **_virtualAddress, uint32 spec, area_id -AreaKeeper::Map(const char *name, void *physicalAddress, size_t numBytes, +AreaKeeper::Map(const char *name, addr_t physicalAddress, size_t numBytes, uint32 spec, uint32 protection, void **_virtualAddress) { - fArea = map_physical_memory(name, (addr_t)physicalAddress, numBytes, spec, + fArea = map_physical_memory(name, physicalAddress, numBytes, spec, protection, _virtualAddress); return fArea; } diff --git a/headers/private/graphics/video_overlay.h b/headers/private/graphics/video_overlay.h index ff7669dfe7..556b3635d0 100644 --- a/headers/private/graphics/video_overlay.h +++ b/headers/private/graphics/video_overlay.h @@ -14,7 +14,7 @@ extern "C" { #endif enum { - B_SUPPORTS_OVERLAYS = 1 << 31 // part of display_mode.flags + B_SUPPORTS_OVERLAYS = 1U << 31 // part of display_mode.flags }; enum { diff --git a/headers/private/interface/BMCPrivate.h b/headers/private/interface/BMCPrivate.h index f8ff7036ff..5c9678c388 100644 --- a/headers/private/interface/BMCPrivate.h +++ b/headers/private/interface/BMCPrivate.h @@ -1,10 +1,11 @@ /* - * Copyright 2001-2009 Haiku, Inc. All rights reserved. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * Marc Flerackers (mflerackers@androme.be) - * Stephan Aßmus + * Stephan Aßmus, superstippi@gmx.de + * Marc Flerackers, mflerackers@androme.be + * John Scipione, jscipione@gmail.com */ #ifndef _BMC_PRIVATE_H #define _BMC_PRIVATE_H @@ -12,9 +13,9 @@ #include #include -#include #include + class BMessageRunner; @@ -36,8 +37,7 @@ class _BMCMenuBar_ : public BMenuBar { public: _BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField); - _BMCMenuBar_(bool fixedSize, - BMenuField* menuField); + _BMCMenuBar_(BMenuField* menuField); _BMCMenuBar_(BMessage* data); virtual ~_BMCMenuBar_(); @@ -54,7 +54,7 @@ public: bool IsPopUpMarkerShown() const { return fShowPopUpMarker; } - virtual BSize MinSize(); + virtual BSize MinSize(); virtual BSize MaxSize(); private: diff --git a/headers/private/interface/ColumnTypes.h b/headers/private/interface/ColumnTypes.h index c9fc5882df..6e581fd7ba 100644 --- a/headers/private/interface/ColumnTypes.h +++ b/headers/private/interface/ColumnTypes.h @@ -60,10 +60,11 @@ class BStringField : public BField void SetString (const char* string); const char* String () const; void SetClippedString (const char* string); + bool HasClippedString () const; const char* ClippedString (); void SetWidth (float); float Width (); - + private: float fWidth; BString fString; @@ -109,7 +110,7 @@ class BDateField : public BField time_t Seconds (); time_t UnixTime (); - private: + private: struct tm fTime; time_t fUnixTime; time_t fSeconds; @@ -235,7 +236,7 @@ class BBitmapColumn : public BTitledColumn virtual int CompareFields (BField* field1, BField* field2); virtual bool AcceptsField (const BField* field) const; }; - + //===================================================================== // Column to display BIntegerField objects as a graph. diff --git a/headers/private/interface/MenuWindow.h b/headers/private/interface/MenuWindow.h index 80c03716d7..eb1b943c9d 100644 --- a/headers/private/interface/MenuWindow.h +++ b/headers/private/interface/MenuWindow.h @@ -40,6 +40,7 @@ public: bool HasScrollers() const; bool CheckForScrolling(const BPoint& cursor); bool TryScrollBy(const float& step); + bool TryScrollTo(const float& where); private: bool _Scroll(const BPoint& cursor); diff --git a/headers/private/kernel/Notifications.h b/headers/private/kernel/Notifications.h index 78497afc90..728bbfa35b 100644 --- a/headers/private/kernel/Notifications.h +++ b/headers/private/kernel/Notifications.h @@ -152,6 +152,9 @@ public: virtual const char* Name() { return fName; } + status_t Register(); + void Unregister(); + protected: virtual status_t ToEventMask(const KMessage& eventSpecifier, uint32& eventMask); diff --git a/headers/private/kernel/util/OpenHashTable.h b/headers/private/kernel/util/OpenHashTable.h index be711c4ac8..a2af3aaf37 100644 --- a/headers/private/kernel/util/OpenHashTable.h +++ b/headers/private/kernel/util/OpenHashTable.h @@ -230,7 +230,7 @@ public: */ ValueType* Clear(bool returnElements = false) { - if (this->fItemCount == 0) + if (fItemCount == 0) return NULL; ValueType* result = NULL; @@ -256,6 +256,7 @@ public: } memset(this->fTable, 0, sizeof(ValueType*) * this->fTableSize); + fItemCount = 0; return result; } diff --git a/headers/private/libroot/libroot_private.h b/headers/private/libroot/libroot_private.h index 593ffd3526..85bc14d11f 100644 --- a/headers/private/libroot/libroot_private.h +++ b/headers/private/libroot/libroot_private.h @@ -18,6 +18,8 @@ struct real_time_data; extern "C" { #endif +extern int __gABIVersion; + extern char _single_threaded; /* This determines if a process runs single threaded or not */ @@ -31,7 +33,7 @@ status_t __flatten_process_args(const char* const* args, int32 argCount, size_t* _flatSize); void _call_atexit_hooks_for_range(addr_t start, addr_t size); void __init_env(const struct user_space_program_args *args); -void __init_heap(void); +status_t __init_heap(void); void __init_heap_post_env(void); void __init_time(addr_t commPageTable); @@ -42,6 +44,8 @@ void __init_pwd_backend(void); void __reinit_pwd_backend_after_fork(void); void* __arch_get_caller(void); +void __set_stack_protection(void); + #ifdef __cplusplus } diff --git a/headers/private/net/ProtocolUtilities.h b/headers/private/net/ProtocolUtilities.h index fd4280f740..0423d0565f 100644 --- a/headers/private/net/ProtocolUtilities.h +++ b/headers/private/net/ProtocolUtilities.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2010, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -37,6 +37,7 @@ public: extern net_buffer_module_info* gBufferModule; extern net_stack_module_info* gStackModule; + class NetModuleBundleGetter { public: static net_stack_module_info* Stack() { return gStackModule; } @@ -294,7 +295,7 @@ DECL_DATAGRAM_SOCKET(inline status_t)::SocketStatus(bool peek) const { if (peek) return fSocket->error; - + status_t status = fSocket->error; fSocket->error = B_OK; @@ -345,7 +346,7 @@ DECL_DATAGRAM_SOCKET(inline status_t)::_Wait(bigtime_t timeout) { LockingBase::Unlock(&fLock); status_t status = acquire_sem_etc(fNotify, 1, B_CAN_INTERRUPT - | B_ABSOLUTE_TIMEOUT, timeout); + | (timeout != 0 ? B_ABSOLUTE_TIMEOUT : B_RELATIVE_TIMEOUT), timeout); LockingBase::Lock(&fLock); return status; @@ -366,18 +367,16 @@ DECL_DATAGRAM_SOCKET(inline void)::_NotifyOneReader(bool notifySocket) DECL_DATAGRAM_SOCKET(inline bigtime_t)::_SocketTimeout(uint32 flags) const { - bigtime_t timeout = fSocket->receive.timeout; + if (ModuleBundle::Stack()->is_restarted_syscall()) + return ModuleBundle::Stack()->restore_syscall_restart_timeout(); + bigtime_t timeout = fSocket->receive.timeout; if ((flags & MSG_DONTWAIT) != 0) timeout = 0; else if (timeout != 0 && timeout != B_INFINITE_TIMEOUT) timeout += system_time(); - if (ModuleBundle::Stack()->is_restarted_syscall()) - timeout = ModuleBundle::Stack()->restore_syscall_restart_timeout(); - else - ModuleBundle::Stack()->store_syscall_restart_timeout(timeout); - + ModuleBundle::Stack()->store_syscall_restart_timeout(timeout); return timeout; } diff --git a/headers/private/runtime_loader/runtime_loader.h b/headers/private/runtime_loader/runtime_loader.h index 39e675f8a9..4d328414e2 100644 --- a/headers/private/runtime_loader/runtime_loader.h +++ b/headers/private/runtime_loader/runtime_loader.h @@ -52,6 +52,7 @@ struct rld_export { const struct user_space_program_args *program_args; const void* commpage_address; + int abi_version; }; extern struct rld_export *__gRuntimeLoader; diff --git a/headers/private/shared/AboutWindow.h b/headers/private/shared/AboutWindow.h index 16a9f429c2..9a3cc60576 100644 --- a/headers/private/shared/AboutWindow.h +++ b/headers/private/shared/AboutWindow.h @@ -18,7 +18,6 @@ class AboutView; class BBitmap; class BPoint; -class BHandler; class BAboutWindow : public BWindow { public: @@ -26,7 +25,6 @@ class BAboutWindow : public BWindow { const char* signature); virtual ~BAboutWindow(); - virtual bool QuitRequested(); virtual void Show(); BPoint AboutPosition(float width, float height); @@ -39,6 +37,9 @@ class BAboutWindow : public BWindow { void AddVersionHistory(const char** history); void AddExtraInfo(const char* extraInfo); + void AddText(const char* header, + const char** contents = NULL); + BBitmap* Icon(); void SetIcon(BBitmap* icon); @@ -47,10 +48,8 @@ class BAboutWindow : public BWindow { const char* Version(); void SetVersion(const char* version); - private: AboutView* fAboutView; - BHandler* fCaller; }; #endif // B_ABOUT_WINDOW_H diff --git a/headers/private/shared/PromptWindow.h b/headers/private/shared/PromptWindow.h index 80d376fd26..3ab547a2b9 100644 --- a/headers/private/shared/PromptWindow.h +++ b/headers/private/shared/PromptWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef PROMPT_WINDOW_H_ @@ -10,6 +10,7 @@ #include +class BStringView; class BTextControl; @@ -17,8 +18,9 @@ class PromptWindow : public BWindow { public: // PromptWindow takes ownership of message - PromptWindow(const char* title, const char* label, BMessenger target, - BMessage* message = NULL); + PromptWindow(const char* title, + const char* label, const char* info, + BMessenger target, BMessage* message = NULL); ~PromptWindow(); virtual void MessageReceived(BMessage* message); @@ -27,6 +29,7 @@ public: status_t SetMessage(BMessage* message); private: BTextControl* fTextControl; + BStringView* fInfoView; BMessenger fTarget; BMessage* fMessage; }; diff --git a/headers/private/system/vm_defs.h b/headers/private/system/vm_defs.h index 53643a9082..c5f405014b 100644 --- a/headers/private/system/vm_defs.h +++ b/headers/private/system/vm_defs.h @@ -15,13 +15,6 @@ // Note: the VM probably won't support all combinations - it will try // its best, but create_area() will fail if it has to. // Of course, the exact behaviour will be documented somewhere... -#define B_EXECUTE_AREA 0x04 -#define B_STACK_AREA 0x08 - // "stack" protection is not available on most platforms - it's used - // to only commit memory as needed, and have guard pages at the - // bottom of the stack. - // "execute" protection is currently ignored, but nevertheless, you - // should use it if you require to execute code in that area. #define B_KERNEL_EXECUTE_AREA 0x40 #define B_KERNEL_STACK_AREA 0x80 diff --git a/headers/private/virtio/virtio.h b/headers/private/virtio/virtio.h new file mode 100644 index 0000000000..8e446f5ed0 --- /dev/null +++ b/headers/private/virtio/virtio.h @@ -0,0 +1,120 @@ +/* + * Copyright 2013, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _VIRTIO_H_ +#define _VIRTIO_H_ + + +#include +#include + + +#define VIRTIO_DEVICE_ID_NETWORK 0x01 +#define VIRTIO_DEVICE_ID_BLOCK 0x02 +#define VIRTIO_DEVICE_ID_CONSOLE 0x03 +#define VIRTIO_DEVICE_ID_ENTROPY 0x04 +#define VIRTIO_DEVICE_ID_BALLOON 0x05 +#define VIRTIO_DEVICE_ID_IOMEMORY 0x06 +#define VIRTIO_DEVICE_ID_SCSI 0x08 +#define VIRTIO_DEVICE_ID_9P 0x09 + +#define VIRTIO_FEATURE_TRANSPORT_MASK ((1 << 28) - 1) + +#define VIRTIO_FEATURE_NOTIFY_ON_EMPTY (1 << 24) +#define VIRTIO_FEATURE_RING_INDIRECT_DESC (1 << 28) +#define VIRTIO_FEATURE_RING_EVENT_IDX (1 << 29) +#define VIRTIO_FEATURE_BAD_FEATURE (1 << 30) + +#define VIRTIO_VIRTQUEUES_MAX_COUNT 8 + +#define VIRTIO_CONFIG_STATUS_RESET 0x00 +#define VIRTIO_CONFIG_STATUS_ACK 0x01 +#define VIRTIO_CONFIG_STATUS_DRIVER 0x02 +#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04 +#define VIRTIO_CONFIG_STATUS_FAILED 0x80 + +// attributes: + +// node type +#define VIRTIO_BUS_TYPE_NAME "bus/virtio/v1" +// device type (uint16) +#define VIRTIO_DEVICE_TYPE_ITEM "virtio/type" +// alignment (uint16) +#define VIRTIO_VRING_ALIGNMENT_ITEM "virtio/vring_alignment" + +// sim cookie, issued by virtio bus manager +typedef void* virtio_sim; +// device cookie, issued by virtio bus manager +typedef void* virtio_device; +// queue cookie, issued by virtio bus manager +typedef void* virtio_queue; +// callback function for requests +typedef void (*virtio_callback_func)(void *cookie); +// callback function for interrupts +typedef void (*virtio_intr_func)(void *cookie); + +#define VIRTIO_DEVICE_MODULE_NAME "bus_managers/virtio/device/v1" + +typedef struct { + driver_module_info info; + + status_t (*queue_interrupt_handler)(virtio_sim sim, uint16 queue); + status_t (*config_interrupt_handler)(virtio_sim sim); +} virtio_for_controller_interface; + +#define VIRTIO_FOR_CONTROLLER_MODULE_NAME "bus_managers/virtio/controller/driver_v1" + +// Bus manager interface used by Virtio controller drivers. +typedef struct { + driver_module_info info; + + void (*set_sim)(void* cookie, virtio_sim sim); + status_t (*read_host_features)(void* cookie, uint32* features); + status_t (*write_guest_features)(void* cookie, uint32 features); + uint8 (*get_status)(void* cookie); + void (*set_status)(void* cookie, uint8 status); + status_t (*read_device_config)(void* cookie, uint8 offset, void* buffer, + size_t bufferSize); + status_t (*write_device_config)(void* cookie, uint8 offset, + const void* buffer, size_t bufferSize); + + uint16 (*get_queue_ring_size)(void* cookie, uint16 queue); + status_t (*setup_queue)(void* cookie, uint16 queue, phys_addr_t phy); + status_t (*setup_interrupt)(void* cookie); + void (*notify_queue)(void* cookie, uint16 queue); +} virtio_sim_interface; + + +// bus manager device interface for peripheral driver +typedef struct { + driver_module_info info; + + status_t (*negociate_features)(virtio_device cookie, uint32 supported, + uint32* negociated, const char* (*get_feature_name)(uint32)); + + status_t (*read_device_config)(virtio_device cookie, uint8 offset, + void* buffer, size_t bufferSize); + status_t (*write_device_config)(virtio_device cookie, uint8 offset, + const void* buffer, size_t bufferSize); + + status_t (*alloc_queues)(virtio_device cookie, size_t count, + virtio_queue *queues); + + status_t (*setup_interrupt)(virtio_device cookie, + virtio_intr_func config_handler, void* configCookie); + + status_t (*queue_request)(virtio_queue queue, + const physical_entry *readEntry, + const physical_entry *writtenEntry, virtio_callback_func callback, + void *callbackCookie); + + status_t (*queue_request_v)(virtio_queue queue, + const physical_entry* vector, + size_t readVectorCount, size_t writtenVectorCount, + virtio_callback_func callback, void *callbackCookie); + +} virtio_device_interface; + + +#endif /* _VIRTIO_H_ */ diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.h b/src/add-ons/accelerants/intel_extreme/accelerant.h index 1f8aa4523c..df5e274859 100644 --- a/src/add-ons/accelerants/intel_extreme/accelerant.h +++ b/src/add-ons/accelerants/intel_extreme/accelerant.h @@ -105,7 +105,7 @@ extern void save_lvds_mode(void); extern status_t create_mode_list(void); // memory.cpp -extern void intel_free_memory(uint32 base); -extern status_t intel_allocate_memory(size_t size, uint32 flags, uint32 &base); +extern void intel_free_memory(addr_t base); +extern status_t intel_allocate_memory(size_t size, uint32 flags, addr_t &base); #endif /* INTEL_EXTREME_ACCELERANT_H */ diff --git a/src/add-ons/accelerants/intel_extreme/memory.cpp b/src/add-ons/accelerants/intel_extreme/memory.cpp index 6ab8422266..731b972b72 100644 --- a/src/add-ons/accelerants/intel_extreme/memory.cpp +++ b/src/add-ons/accelerants/intel_extreme/memory.cpp @@ -27,7 +27,7 @@ void -intel_free_memory(uint32 base) +intel_free_memory(addr_t base) { if (base == 0) return; @@ -42,7 +42,7 @@ intel_free_memory(uint32 base) status_t -intel_allocate_memory(size_t size, uint32 flags, uint32 &base) +intel_allocate_memory(size_t size, uint32 flags, addr_t &base) { intel_allocate_graphics_memory allocMemory; allocMemory.magic = INTEL_PRIVATE_DATA_MAGIC; diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 2727a16df0..4e87f10f78 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -77,7 +77,7 @@ struct pll_limits { static status_t get_i2c_signals(void* cookie, int* _clock, int* _data) { - uint32 ioRegister = (uint32)cookie; + uint32 ioRegister = (uint32)(addr_t)cookie; uint32 value = read32(ioRegister); *_clock = (value & I2C_CLOCK_VALUE_IN) != 0; @@ -90,7 +90,7 @@ get_i2c_signals(void* cookie, int* _clock, int* _data) static status_t set_i2c_signals(void* cookie, int clock, int data) { - uint32 ioRegister = (uint32)cookie; + uint32 ioRegister = (uint32)(addr_t)cookie; uint32 value; if (gInfo->shared_info->device_type.InGroup(INTEL_TYPE_83x)) { @@ -488,17 +488,20 @@ sanitize_display_mode(display_mode& mode) // TODO: verify constraints - these are more or less taken from the // radeon driver! - const display_constraints constraints = { + display_constraints constraints = { // resolution 320, 8192, 200, 4096, // pixel clock gInfo->shared_info->pll_info.min_frequency, gInfo->shared_info->pll_info.max_frequency, // horizontal - {olderCard ? 2 : 1, 0, 8160, 32, 8192, 0, 8192}, + {1, 0, 8160, 32, 8192, 0, 8192}, {1, 1, 4092, 2, 63, 1, 4096} }; + if (olderCard) + constraints.horizontal_timing.resolution = 2; + return sanitize_display_mode(mode, constraints, gInfo->has_edid ? &gInfo->edid_info : NULL); } @@ -563,7 +566,7 @@ status_t create_mode_list(void) { i2c_bus bus; - bus.cookie = (void*)INTEL_I2C_IO_A; + bus.cookie = (void*)(addr_t)INTEL_I2C_IO_A; bus.set_signals = &set_i2c_signals; bus.get_signals = &get_i2c_signals; ddc2_init_timing(&bus); @@ -762,7 +765,7 @@ if (first) { intel_free_memory(sharedInfo.frame_buffer); - uint32 base; + addr_t base; if (intel_allocate_memory(bytesPerRow * target.virtual_height, 0, base) < B_OK) { // oh, how did that happen? Unfortunately, there is no really good way diff --git a/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp b/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp index 84d63c5c97..eae5dad29e 100644 --- a/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp +++ b/src/add-ons/input_server/filters/shortcut_catcher/CommandActuators.cpp @@ -609,10 +609,10 @@ KeyStrokeSequenceCommandActuator::KeyStrokeSequenceCommandActuator(int32 argc, BString newStr = fSequence; newStr.Truncate(nextStart); - fOverrides.AddItem((void*)unicodeVal); - fOverrideOffsets.AddItem((void*)newStr.Length()); - fOverrideModifiers.AddItem((void*)customMods); - fOverrideKeyCodes.AddItem((void*)customKey); + fOverrides.AddItem((void*)(addr_t)unicodeVal); + fOverrideOffsets.AddItem((void*)(addr_t)newStr.Length()); + fOverrideModifiers.AddItem((void*)(addr_t)customMods); + fOverrideKeyCodes.AddItem((void*)(addr_t)customKey); newStr.Append(((unicodeVal > 0) && (unicodeVal < 127)) ? ((char)unicodeVal): ' ',1); newStr.Append(&fSequence.String()[nextEnd + 2]); @@ -636,22 +636,22 @@ KeyStrokeSequenceCommandActuator::KeyStrokeSequenceCommandActuator( int32 temp; for (int32 i = 0; from->FindInt32("ooffsets", i, &temp) == B_NO_ERROR; i++) { - fOverrideOffsets.AddItem((void*)temp); + fOverrideOffsets.AddItem((void*)(addr_t)temp); if (from->FindInt32("overrides", i, &temp) != B_NO_ERROR) temp = ' '; - fOverrides.AddItem((void*)temp); + fOverrides.AddItem((void*)(addr_t)temp); if (from->FindInt32("omods", i, &temp) != B_NO_ERROR) temp = -1; - fOverrideModifiers.AddItem((void*)temp); + fOverrideModifiers.AddItem((void*)(addr_t)temp); if (from->FindInt32("okeys", i, &temp) != B_NO_ERROR) temp = 0; - fOverrideKeyCodes.AddItem((void*)temp); + fOverrideKeyCodes.AddItem((void*)(addr_t)temp); } _GenerateKeyCodes(); } @@ -682,9 +682,9 @@ KeyStrokeSequenceCommandActuator::_GenerateKeyCodes() uint32 overrideKey= 0; uint32 overrideMods = (uint32)-1; for (int32 j = fOverrideOffsets.CountItems()-1; j >= 0; j--) { - if ((int32)fOverrideOffsets.ItemAt(j) == i) { - overrideKey= (uint32) fOverrideKeyCodes.ItemAt(j); - overrideMods = (uint32) fOverrideModifiers.ItemAt(j); + if ((int32)(addr_t)fOverrideOffsets.ItemAt(j) == i) { + overrideKey= (uint32)(addr_t) fOverrideKeyCodes.ItemAt(j); + overrideMods = (uint32)(addr_t) fOverrideModifiers.ItemAt(j); break; } } @@ -853,19 +853,23 @@ KeyStrokeSequenceCommandActuator::Archive(BMessage* into, bool deep) const int32 numOverrides = fOverrideOffsets.CountItems(); status_t tmp = B_OK; for (int32 i = 0; i < numOverrides; i++) { - ret = into->AddInt32("ooffsets", (int32)fOverrideOffsets.ItemAt(i)); + ret = into->AddInt32("ooffsets", + (int32)(addr_t)fOverrideOffsets.ItemAt(i)); if (ret != B_NO_ERROR) tmp = B_ERROR; - ret = into->AddInt32("overrides", (int32)fOverrides.ItemAt(i)); + ret = into->AddInt32("overrides", + (int32)(addr_t)fOverrides.ItemAt(i)); if (ret != B_NO_ERROR) tmp = B_ERROR; - ret = into->AddInt32("omods", (int32)fOverrideModifiers.ItemAt(i)); + ret = into->AddInt32("omods", + (int32)(addr_t)fOverrideModifiers.ItemAt(i)); if (ret != B_NO_ERROR) tmp = B_ERROR; - ret = into->AddInt32("okeys", (int32)fOverrideKeyCodes.ItemAt(i)); + ret = into->AddInt32("okeys", + (int32)(addr_t)fOverrideKeyCodes.ItemAt(i)); } if (tmp == B_ERROR) @@ -895,9 +899,9 @@ KeyStrokeSequenceCommandActuator::KeyEvent(const BMessage* keyMsg, int32 override = -1; for (int32 j = fOverrideOffsets.CountItems()-1; j >= 0; j--) { - int32 offset = (int32) fOverrideOffsets.ItemAt(j); + int32 offset = (int32)(addr_t) fOverrideOffsets.ItemAt(j); if (offset == i) { - override = (int32) fOverrides.ItemAt(j); + override = (int32)(addr_t) fOverrides.ItemAt(j); break; } } diff --git a/src/add-ons/input_server/methods/canna/lib/kctrl.c b/src/add-ons/input_server/methods/canna/lib/kctrl.c index fe0a7ab6f7..60e3f4f888 100644 --- a/src/add-ons/input_server/methods/canna/lib/kctrl.c +++ b/src/add-ons/input_server/methods/canna/lib/kctrl.c @@ -2039,7 +2039,7 @@ KC_changeServer(uiContext d, char *arg) return 0; } } - return (int)RkwGetServerName(); + return (int)(addr_t)RkwGetServerName(); } static int @@ -2103,7 +2103,7 @@ KC_setUserInfo(uiContext d, jrUserInfoStruct *arg) sprintf(buf, "%s/%s", uinfo->topdir ? uinfo->topdir : "", "default.can"); } - wcKanjiControl((int)d, KC_SETINITFILENAME, buf); + wcKanjiControl((int)(addr_t)d, KC_SETINITFILENAME, buf); RkwSetUserInfo(uinfo->uname, uinfo->gname, uinfo->topdir); ret = 1; goto return_ret; diff --git a/src/add-ons/input_server/methods/canna/rk/dd.c b/src/add-ons/input_server/methods/canna/rk/dd.c index 128cd49ec7..8b84d9b36d 100644 --- a/src/add-ons/input_server/methods/canna/rk/dd.c +++ b/src/add-ons/input_server/methods/canna/rk/dd.c @@ -688,7 +688,7 @@ _RkRealizeDD(struct DD *dd) int ret = -1; int tmpres; int fdes; - long tloc; + time_t tloc; char *whattime, *header, *dicsdir, *backup; whattime = (char *)malloc(RK_LINE_BMAX); diff --git a/src/add-ons/kernel/bus_managers/Jamfile b/src/add-ons/kernel/bus_managers/Jamfile index 319c6317a4..f1de07bb5b 100644 --- a/src/add-ons/kernel/bus_managers/Jamfile +++ b/src/add-ons/kernel/bus_managers/Jamfile @@ -12,3 +12,4 @@ SubInclude HAIKU_TOP src add-ons kernel bus_managers ps2 ; SubInclude HAIKU_TOP src add-ons kernel bus_managers scsi ; SubInclude HAIKU_TOP src add-ons kernel bus_managers tty ; SubInclude HAIKU_TOP src add-ons kernel bus_managers usb ; +SubInclude HAIKU_TOP src add-ons kernel bus_managers virtio ; diff --git a/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp b/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp index cc43abb9ec..da9234efea 100644 --- a/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp +++ b/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp @@ -248,7 +248,7 @@ check_capabilities(agp_device_info &deviceInfo, uint32 &command) agpStatus = fix_rate_support(agpStatus); } - TRACE("device %u.%u.%u has AGP capabilities %lx\n", deviceInfo.info.bus, + TRACE("device %u.%u.%u has AGP capabilities %" B_PRIx32 "\n", deviceInfo.info.bus, deviceInfo.info.device, deviceInfo.info.function, agpStatus); // block non-supported AGP modes @@ -482,8 +482,8 @@ Aperture::CreateMemory(size_t size, size_t alignment, uint32 flags) return NULL; } - TRACE("create memory %p, base %lx, size %lx, flags %lx\n", memory, - memory->base, memory->size, flags); + TRACE("create memory %p, base %" B_PRIxADDR ", size %" B_PRIxSIZE + ", flags %" B_PRIx32 "\n", memory, memory->base, memory->size, flags); memory->flags = flags; #if defined(__HAIKU__) && !defined(GART_TEST) @@ -852,7 +852,7 @@ Aperture::_Insert(aperture_memory *memory, size_t size, size_t alignment, status_t get_nth_agp_info(uint32 index, agp_info *info) { - TRACE("get_nth_agp_info(index %lu)\n", index); + TRACE("get_nth_agp_info(index %" B_PRIu32 ")\n", index); if (index >= sDeviceCount) return B_BAD_VALUE; @@ -888,7 +888,7 @@ release_agp(void) uint32 set_agp_mode(uint32 command) { - TRACE("set_agp_mode(command %lx)\n", command); + TRACE("set_agp_mode(command %" B_PRIx32 ")\n", command); if ((command & AGP_ENABLE) == 0) { set_pci_mode(); @@ -912,7 +912,7 @@ set_agp_mode(uint32 command) } command = fix_rate_command(command); - TRACE("set AGP command %lx on all capable devices.\n", command); + TRACE("set AGP command %" B_PRIx32 " on all capable devices.\n", command); // The order of programming differs for enabling/disabling AGP mode // (see AGP specification) @@ -1213,7 +1213,7 @@ agp_init(void) sDeviceCount++; } - TRACE("found %ld AGP devices\n", sDeviceCount); + TRACE("found %" B_PRId32 " AGP devices\n", sDeviceCount); // Since there can be custom aperture modules (for memory management only), // we always succeed if we could get the resources we need. diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp index 719c490760..cbfe5efb04 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp @@ -21,7 +21,7 @@ pci_get_msi_count(uint8 virtualBus, uint8 _device, uint8 function) return 0; uint8 bus; - int domain; + uint8 domain; if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) return 0; @@ -48,7 +48,7 @@ pci_configure_msi(uint8 virtualBus, uint8 _device, uint8 function, return B_BAD_VALUE; uint8 bus; - int domain; + uint8 domain; status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); if (result != B_OK) return result; @@ -102,7 +102,7 @@ pci_unconfigure_msi(uint8 virtualBus, uint8 _device, uint8 function) return B_UNSUPPORTED; uint8 bus; - int domain; + uint8 domain; status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); if (result != B_OK) return result; @@ -138,7 +138,7 @@ pci_enable_msi(uint8 virtualBus, uint8 _device, uint8 function) return B_UNSUPPORTED; uint8 bus; - int domain; + uint8 domain; status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); if (result != B_OK) return result; @@ -176,7 +176,7 @@ pci_disable_msi(uint8 virtualBus, uint8 _device, uint8 function) return B_UNSUPPORTED; uint8 bus; - int domain; + uint8 domain; status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); if (result != B_OK) return result; diff --git a/src/add-ons/kernel/bus_managers/pci/pci.cpp b/src/add-ons/kernel/bus_managers/pci/pci.cpp index 081b2fb097..03658b0f66 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci.cpp @@ -47,7 +47,7 @@ pci_read_config(uint8 virtualBus, uint8 device, uint8 function, uint8 offset, uint8 size) { uint8 bus; - int domain; + uint8 domain; uint32 value; if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) @@ -66,7 +66,7 @@ pci_write_config(uint8 virtualBus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value) { uint8 bus; - int domain; + uint8 domain; if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) return; @@ -79,7 +79,7 @@ pci_find_capability(uchar virtualBus, uchar device, uchar function, uchar capID, uchar *offset) { uint8 bus; - int domain; + uint8 domain; if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) return B_ERROR; @@ -93,7 +93,7 @@ pci_reserve_device(uchar virtualBus, uchar device, uchar function, { status_t status; uint8 bus; - int domain; + uint8 domain; TRACE(("pci_reserve_device(%d, %d, %d, %s)\n", virtualBus, device, function, driverName)); @@ -118,7 +118,7 @@ pci_reserve_device(uchar virtualBus, uchar device, uchar function, {B_DEVICE_BUS, B_STRING_TYPE, {string: "pci"}}, // location on PCI bus - {B_PCI_DEVICE_DOMAIN, B_UINT32_TYPE, {ui32: domain}}, + {B_PCI_DEVICE_DOMAIN, B_UINT8_TYPE, {ui8: domain}}, {B_PCI_DEVICE_BUS, B_UINT8_TYPE, {ui8: bus}}, {B_PCI_DEVICE_DEVICE, B_UINT8_TYPE, {ui8: device}}, {B_PCI_DEVICE_FUNCTION, B_UINT8_TYPE, {ui8: function}}, @@ -191,7 +191,7 @@ pci_unreserve_device(uchar virtualBus, uchar device, uchar function, { status_t status; uint8 bus; - int domain; + uint8 domain; TRACE(("pci_unreserve_device(%d, %d, %d, %s)\n", virtualBus, device, function, driverName)); @@ -210,7 +210,7 @@ pci_unreserve_device(uchar virtualBus, uchar device, uchar function, {B_DEVICE_BUS, B_STRING_TYPE, {string: "pci"}}, // location on PCI bus - {B_PCI_DEVICE_DOMAIN, B_UINT32_TYPE, {ui32: domain}}, + {B_PCI_DEVICE_DOMAIN, B_UINT8_TYPE, {ui8: domain}}, {B_PCI_DEVICE_BUS, B_UINT8_TYPE, {ui8: bus}}, {B_PCI_DEVICE_DEVICE, B_UINT8_TYPE, {ui8: device}}, {B_PCI_DEVICE_FUNCTION, B_UINT8_TYPE, {ui8: function}}, @@ -288,7 +288,7 @@ pci_update_interrupt_line(uchar virtualBus, uchar device, uchar function, uchar newInterruptLineValue) { uint8 bus; - int domain; + uint8 domain; if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) return B_ERROR; @@ -299,7 +299,7 @@ pci_update_interrupt_line(uchar virtualBus, uchar device, uchar function, // used by pci_info.cpp print_info_basic() void -__pci_resolve_virtual_bus(uint8 virtualBus, int *domain, uint8 *bus) +__pci_resolve_virtual_bus(uint8 virtualBus, uint8 *domain, uint8 *bus) { if (gPCI->ResolveVirtualBus(virtualBus, domain, bus) < B_OK) panic("ResolveVirtualBus failed"); @@ -532,7 +532,7 @@ void PCI::InitBus() { PCIBus **nextBus = &fRootBus; - for (int i = 0; i < fDomainCount; i++) { + for (uint8 i = 0; i < fDomainCount; i++) { PCIBus *bus = new PCIBus; bus->next = NULL; bus->parent = NULL; @@ -544,13 +544,13 @@ PCI::InitBus() } if (fBusEnumeration) { - for (int i = 0; i < fDomainCount; i++) { + for (uint8 i = 0; i < fDomainCount; i++) { _EnumerateBus(i, 0); } } if (1) { - for (int i = 0; i < fDomainCount; i++) { + for (uint8 i = 0; i < fDomainCount; i++) { _FixupDevices(i, 0); } } @@ -570,7 +570,7 @@ PCI::~PCI() status_t -PCI::_CreateVirtualBus(int domain, uint8 bus, uint8 *virtualBus) +PCI::_CreateVirtualBus(uint8 domain, uint8 bus, uint8 *virtualBus) { #if defined(__INTEL__) || defined(__x86_64__) @@ -584,22 +584,23 @@ PCI::_CreateVirtualBus(int domain, uint8 bus, uint8 *virtualBus) if (fNextVirtualBus > 0xff) panic("PCI::CreateVirtualBus: virtual bus number space exhausted"); - if (unsigned(domain) > 0xff) - panic("PCI::CreateVirtualBus: domain %d too large", domain); uint16 value = domain << 8 | bus; - for (VirtualBusMap::Iterator it = fVirtualBusMap.Begin(); it != fVirtualBusMap.End(); ++it) { + for (VirtualBusMap::Iterator it = fVirtualBusMap.Begin(); + it != fVirtualBusMap.End(); ++it) { if (it->Value() == value) { *virtualBus = it->Key(); - FLOW("PCI::CreateVirtualBus: domain %d, bus %d already in map => virtualBus %d\n", domain, bus, *virtualBus); + FLOW("PCI::CreateVirtualBus: domain %d, bus %d already in map => " + "virtualBus %d\n", domain, bus, *virtualBus); return B_OK; } } *virtualBus = fNextVirtualBus++; - FLOW("PCI::CreateVirtualBus: domain %d, bus %d => virtualBus %d\n", domain, bus, *virtualBus); + FLOW("PCI::CreateVirtualBus: domain %d, bus %d => virtualBus %d\n", domain, + bus, *virtualBus); return fVirtualBusMap.Insert(*virtualBus, value); @@ -608,7 +609,7 @@ PCI::_CreateVirtualBus(int domain, uint8 bus, uint8 *virtualBus) status_t -PCI::ResolveVirtualBus(uint8 virtualBus, int *domain, uint8 *bus) +PCI::ResolveVirtualBus(uint8 virtualBus, uint8 *domain, uint8 *bus) { #if defined(__INTEL__) || defined(__x86_64__) @@ -650,20 +651,21 @@ PCI::AddController(pci_controller *controller, void *controller_cookie) void PCI::InitDomainData() { - for (int i = 0; i < fDomainCount; i++) { + for (uint8 i = 0; i < fDomainCount; i++) { int32 count; status_t status; - status = (*fDomainData[i].controller->get_max_bus_devices)(fDomainData[i].controller_cookie, &count); + status = (*fDomainData[i].controller->get_max_bus_devices)( + fDomainData[i].controller_cookie, &count); fDomainData[i].max_bus_devices = (status == B_OK) ? count : 0; } } domain_data * -PCI::_GetDomainData(int domain) +PCI::_GetDomainData(uint8 domain) { - if (domain < 0 || domain >= fDomainCount) + if (domain >= fDomainCount) return NULL; return &fDomainData[domain]; @@ -671,7 +673,7 @@ PCI::_GetDomainData(int domain) inline int -PCI::_NumFunctions(int domain, uint8 bus, uint8 device) +PCI::_NumFunctions(uint8 domain, uint8 bus, uint8 device) { uint8 type = ReadConfig(domain, bus, device, 0, PCI_header_type, 1); @@ -716,7 +718,7 @@ PCI::_GetNthInfo(PCIBus *bus, long *currentIndex, long wantIndex, void -PCI::_EnumerateBus(int domain, uint8 bus, uint8 *subordinateBus) +PCI::_EnumerateBus(uint8 domain, uint8 bus, uint8 *subordinateBus) { TRACE(("PCI: EnumerateBus: domain %u, bus %u\n", domain, bus)); @@ -854,7 +856,7 @@ PCI::_EnumerateBus(int domain, uint8 bus, uint8 *subordinateBus) void -PCI::_FixupDevices(int domain, uint8 bus) +PCI::_FixupDevices(uint8 domain, uint8 bus) { FLOW("PCI: FixupDevices domain %u, bus %u\n", domain, bus); @@ -1100,7 +1102,7 @@ PCI::_DiscoverDevice(PCIBus *bus, uint8 dev, uint8 function) PCIBus * -PCI::_CreateBus(PCIDev *parent, int domain, uint8 bus) +PCI::_CreateBus(PCIDev *parent, uint8 domain, uint8 bus) { PCIBus *newBus = new(std::nothrow) PCIBus; if (newBus == NULL) @@ -1122,7 +1124,8 @@ PCI::_CreateBus(PCIDev *parent, int domain, uint8 bus) PCIDev * PCI::_CreateDevice(PCIBus *parent, uint8 device, uint8 function) { - FLOW("PCI: CreateDevice, domain %u, bus %u, dev %u, func %u:\n", parent->domain, parent->bus, device, function); + FLOW("PCI: CreateDevice, domain %u, bus %u, dev %u, func %u:\n", parent->domain, + parent->bus, device, function); PCIDev *newDev = new(std::nothrow) PCIDev; if (newDev == NULL) @@ -1138,8 +1141,9 @@ PCI::_CreateDevice(PCIBus *parent, uint8 device, uint8 function) _ReadBasicInfo(newDev); - FLOW("PCI: CreateDevice, vendor 0x%04x, device 0x%04x, class_base 0x%02x, class_sub 0x%02x\n", - newDev->info.vendor_id, newDev->info.device_id, newDev->info.class_base, newDev->info.class_sub); + FLOW("PCI: CreateDevice, vendor 0x%04x, device 0x%04x, class_base 0x%02x, " + "class_sub 0x%02x\n", newDev->info.vendor_id, newDev->info.device_id, + newDev->info.class_base, newDev->info.class_sub); // append if (parent->child == NULL) { @@ -1451,7 +1455,7 @@ PCI::_RefreshDeviceInfo(PCIBus *bus) status_t -PCI::ReadConfig(int domain, uint8 bus, uint8 device, uint8 function, +PCI::ReadConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 *value) { domain_data *info = _GetDomainData(domain); @@ -1474,7 +1478,7 @@ PCI::ReadConfig(int domain, uint8 bus, uint8 device, uint8 function, uint32 -PCI::ReadConfig(int domain, uint8 bus, uint8 device, uint8 function, +PCI::ReadConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size) { uint32 value; @@ -1499,7 +1503,7 @@ PCI::ReadConfig(PCIDev *device, uint8 offset, uint8 size) status_t -PCI::WriteConfig(int domain, uint8 bus, uint8 device, uint8 function, +PCI::WriteConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value) { domain_data *info = _GetDomainData(domain); @@ -1530,7 +1534,7 @@ PCI::WriteConfig(PCIDev *device, uint8 offset, uint8 size, uint32 value) status_t -PCI::FindCapability(int domain, uint8 bus, uint8 device, uint8 function, +PCI::FindCapability(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 capID, uint8 *offset) { if (offset == NULL) { @@ -1597,14 +1601,14 @@ PCI::FindCapability(PCIDev *device, uint8 capID, uint8 *offset) PCIDev * -PCI::FindDevice(int domain, uint8 bus, uint8 device, uint8 function) +PCI::FindDevice(uint8 domain, uint8 bus, uint8 device, uint8 function) { return _FindDevice(fRootBus, domain, bus, device, function); } PCIDev * -PCI::_FindDevice(PCIBus *current, int domain, uint8 bus, uint8 device, +PCI::_FindDevice(PCIBus *current, uint8 domain, uint8 bus, uint8 device, uint8 function) { if (current->domain == domain) { @@ -1635,7 +1639,7 @@ PCI::_FindDevice(PCIBus *current, int domain, uint8 bus, uint8 device, status_t -PCI::UpdateInterruptLine(int domain, uint8 bus, uint8 _device, uint8 function, +PCI::UpdateInterruptLine(uint8 domain, uint8 bus, uint8 _device, uint8 function, uint8 newInterruptLineValue) { PCIDev *device = FindDevice(domain, bus, _device, function); diff --git a/src/add-ons/kernel/bus_managers/pci/pci.h b/src/add-ons/kernel/bus_managers/pci/pci.h index a75fcfed8e..921aebc9ec 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.h +++ b/src/add-ons/kernel/bus_managers/pci/pci.h @@ -34,7 +34,7 @@ struct PCIBus { PCIBus * next; PCIDev * parent; PCIDev * child; - int domain; + uint8 domain; uint8 bus; }; @@ -42,7 +42,7 @@ struct PCIDev { PCIDev * next; PCIBus * parent; PCIBus * child; - int domain; + uint8 domain; uint8 bus; uint8 device; uint8 function; @@ -76,44 +76,45 @@ public: status_t GetNthInfo(long index, pci_info *outInfo); - status_t ReadConfig(int domain, uint8 bus, uint8 device, + status_t ReadConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 *value); - uint32 ReadConfig(int domain, uint8 bus, uint8 device, + uint32 ReadConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size); uint32 ReadConfig(PCIDev *device, uint8 offset, uint8 size); - status_t WriteConfig(int domain, uint8 bus, uint8 device, + status_t WriteConfig(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value); status_t WriteConfig(PCIDev *device, uint8 offset, uint8 size, uint32 value); - status_t FindCapability(int domain, uint8 bus, uint8 device, - uint8 function, uint8 capID, uint8 *offset); + status_t FindCapability(uint8 domain, uint8 bus, + uint8 device, uint8 function, uint8 capID, + uint8 *offset); status_t FindCapability(PCIDev *device, uint8 capID, uint8 *offset); - status_t ResolveVirtualBus(uint8 virtualBus, int *domain, + status_t ResolveVirtualBus(uint8 virtualBus, uint8 *domain, uint8 *bus); - PCIDev * FindDevice(int domain, uint8 bus, uint8 device, + PCIDev * FindDevice(uint8 domain, uint8 bus, uint8 device, uint8 function); void ClearDeviceStatus(PCIBus *bus, bool dumpStatus); void RefreshDeviceInfo(); - status_t UpdateInterruptLine(int domain, uint8 bus, + status_t UpdateInterruptLine(uint8 domain, uint8 bus, uint8 device, uint8 function, uint8 newInterruptLineValue); private: - void _EnumerateBus(int domain, uint8 bus, + void _EnumerateBus(uint8 domain, uint8 bus, uint8 *subordinateBus = NULL); - void _FixupDevices(int domain, uint8 bus); + void _FixupDevices(uint8 domain, uint8 bus); void _DiscoverBus(PCIBus *bus); void _DiscoverDevice(PCIBus *bus, uint8 dev, @@ -121,7 +122,8 @@ private: PCIDev * _CreateDevice(PCIBus *parent, uint8 dev, uint8 function); - PCIBus * _CreateBus(PCIDev *parent, int domain, uint8 bus); + PCIBus * _CreateBus(PCIDev *parent, uint8 domain, + uint8 bus); status_t _GetNthInfo(PCIBus *bus, long *currentIndex, long wantIndex, pci_info *outInfo); @@ -139,14 +141,15 @@ private: uint32 *address, uint32 *size = 0, uint8 *flags = 0); - domain_data * _GetDomainData(int domain); + domain_data * _GetDomainData(uint8 domain); - status_t _CreateVirtualBus(int domain, uint8 bus, + status_t _CreateVirtualBus(uint8 domain, uint8 bus, uint8 *virtualBus); - int _NumFunctions(int domain, uint8 bus, uint8 device); - PCIDev * _FindDevice(PCIBus *current, int domain, uint8 bus, - uint8 device, uint8 function); + int _NumFunctions(uint8 domain, uint8 bus, + uint8 device); + PCIDev * _FindDevice(PCIBus *current, uint8 domain, + uint8 bus, uint8 device, uint8 function); private: PCIBus * fRootBus; @@ -154,7 +157,7 @@ private: enum { MAX_PCI_DOMAINS = 8 }; domain_data fDomainData[MAX_PCI_DOMAINS]; - int fDomainCount; + uint8 fDomainCount; bool fBusEnumeration; typedef VectorMap VirtualBusMap; @@ -182,7 +185,7 @@ uint32 pci_read_config(uint8 virtualBus, uint8 device, uint8 function, void pci_write_config(uint8 virtualBus, uint8 device, uint8 function, uint8 offset, uint8 size, uint32 value); -void __pci_resolve_virtual_bus(uint8 virtualBus, int *domain, uint8 *bus); +void __pci_resolve_virtual_bus(uint8 virtualBus, uint8 *domain, uint8 *bus); #ifdef __cplusplus } diff --git a/src/add-ons/kernel/bus_managers/pci/pci_device.cpp b/src/add-ons/kernel/bus_managers/pci/pci_device.cpp index 15c45662cd..32a885de71 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_device.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_device.cpp @@ -107,9 +107,9 @@ pci_device_get_pci_info(pci_device* device, struct pci_info* info) static status_t pci_device_init_driver(device_node* node, void** _cookie) { - uint32 domain; + uint8 domain; uint8 bus, deviceNumber, function; - if (gDeviceManager->get_attr_uint32(node, B_PCI_DEVICE_DOMAIN, &domain, + if (gDeviceManager->get_attr_uint8(node, B_PCI_DEVICE_DOMAIN, &domain, false) != B_OK || gDeviceManager->get_attr_uint8(node, B_PCI_DEVICE_BUS, &bus, false) != B_OK diff --git a/src/add-ons/kernel/bus_managers/pci/pci_fixup.cpp b/src/add-ons/kernel/bus_managers/pci/pci_fixup.cpp index 7ab20f61be..d25e96f9e1 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_fixup.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_fixup.cpp @@ -22,7 +22,7 @@ * the IDE driver for the AHCI controller for some reason). */ static void -jmicron_fixup_ahci(PCI *pci, int domain, uint8 bus, uint8 device, +jmicron_fixup_ahci(PCI *pci, uint8 domain, uint8 bus, uint8 device, uint8 function, uint16 deviceId) { // We only care about function 0. @@ -80,8 +80,8 @@ jmicron_fixup_ahci(PCI *pci, int domain, uint8 bus, uint8 device, static void -intel_fixup_ahci(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function, - uint16 deviceId) +intel_fixup_ahci(PCI *pci, uint8 domain, uint8 bus, uint8 device, + uint8 function, uint16 deviceId) { // TODO(bga): disabled until the PCI manager can assign new resources. return; @@ -156,7 +156,8 @@ intel_fixup_ahci(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function, static void -ati_fixup_ixp(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function, uint16 deviceId) +ati_fixup_ixp(PCI *pci, uint8 domain, uint8 bus, uint8 device, uint8 function, + uint16 deviceId) { #if defined(__INTEL__) || defined(__x86_64__) /* ATI Technologies Inc, IXP chipset: @@ -187,7 +188,8 @@ ati_fixup_ixp(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function, uin void -pci_fixup_device(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function) +pci_fixup_device(PCI *pci, uint8 domain, uint8 bus, uint8 device, + uint8 function) { uint16 vendorId = pci->ReadConfig(domain, bus, device, function, PCI_vendor_id, 2); diff --git a/src/add-ons/kernel/bus_managers/pci/pci_fixup.h b/src/add-ons/kernel/bus_managers/pci/pci_fixup.h index 9b6d1fb122..418c7de2a3 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_fixup.h +++ b/src/add-ons/kernel/bus_managers/pci/pci_fixup.h @@ -8,7 +8,8 @@ class PCI; -void -pci_fixup_device(PCI *pci, int domain, uint8 bus, uint8 device, uint8 function); + +void pci_fixup_device(PCI *pci, uint8 domain, uint8 bus, uint8 device, + uint8 function); #endif diff --git a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp index ba748a0fa8..ccc7ecfa1d 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp @@ -179,7 +179,7 @@ print_capabilities(const pci_info *info) static void print_info_basic(const pci_info *info, bool verbose) { - int domain; + uint8 domain; uint8 bus; __pci_resolve_virtual_bus(info->bus, &domain, &bus); diff --git a/src/add-ons/kernel/bus_managers/pci/pci_root.cpp b/src/add-ons/kernel/bus_managers/pci/pci_root.cpp index fdb953081d..84382fb6db 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_root.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_root.cpp @@ -63,7 +63,7 @@ pci_root_register_child_devices(void* cookie) pci_info info; for (int32 i = 0; pci_get_nth_pci_info(i, &info) == B_OK; i++) { - int domain; + uint8 domain; uint8 bus; if (gPCI->ResolveVirtualBus(info.bus, &domain, &bus) != B_OK) { dprintf("FAILED!!!!\n"); @@ -75,7 +75,7 @@ dprintf("FAILED!!!!\n"); {B_DEVICE_BUS, B_STRING_TYPE, {string: "pci"}}, // location on PCI bus - {B_PCI_DEVICE_DOMAIN, B_UINT32_TYPE, {ui32: domain}}, + {B_PCI_DEVICE_DOMAIN, B_UINT8_TYPE, {ui8: domain}}, {B_PCI_DEVICE_BUS, B_UINT8_TYPE, {ui8: bus}}, {B_PCI_DEVICE_DEVICE, B_UINT8_TYPE, {ui8: info.device}}, {B_PCI_DEVICE_FUNCTION, B_UINT8_TYPE, {ui8: info.function}}, diff --git a/src/add-ons/kernel/bus_managers/scsi/sim_interface.cpp b/src/add-ons/kernel/bus_managers/scsi/sim_interface.cpp index bb4fa08c83..30b3fcc7fd 100644 --- a/src/add-ons/kernel/bus_managers/scsi/sim_interface.cpp +++ b/src/add-ons/kernel/bus_managers/scsi/sim_interface.cpp @@ -27,7 +27,7 @@ static status_t scsi_controller_added(device_node *parent) { const char *controller_name; - int pathID; + int32 pathID; SHOW_FLOW0(4, ""); @@ -48,7 +48,8 @@ scsi_controller_added(device_node *parent) device_attr attrs[] = { // remember who we are // (could use the controller name, but probably some software would choke) - { SCSI_BUS_PATH_ID_ITEM, B_UINT8_TYPE, { ui8: pathID }}, + // TODO create_id() generates a 32 bit ranged integer but we need only 8 bits + { SCSI_BUS_PATH_ID_ITEM, B_UINT8_TYPE, { ui8: (uint8)pathID }}, // tell PnP manager to clean up ID // { PNP_MANAGER_ID_GENERATOR, B_STRING_TYPE, { string: SCSI_PATHID_GENERATOR }}, diff --git a/src/add-ons/kernel/bus_managers/usb/Hub.cpp b/src/add-ons/kernel/bus_managers/usb/Hub.cpp index 271efaffe4..38f01a9878 100644 --- a/src/add-ons/kernel/bus_managers/usb/Hub.cpp +++ b/src/add-ons/kernel/bus_managers/usb/Hub.cpp @@ -221,8 +221,13 @@ Hub::Explore(change_item **changeList) int32 retry = 2; while (retry--) { - // wait some time for the device to power up - snooze(USB_DELAY_DEVICE_POWER_UP); + // wait for stable device power + result = _DebouncePort(i); + if (result != B_OK) { + TRACE_ERROR("debouncing port %" B_PRId32 + " failed: %s\n", i, strerror(result)); + break; + } // reset the port, this will also enable it result = ResetPort(i); @@ -433,3 +438,38 @@ Hub::BuildDeviceName(char *string, uint32 *index, size_t bufferSize, return B_OK; } + + +status_t +Hub::_DebouncePort(uint8 index) +{ + uint32 timeout = 0; + uint32 stableTime = 0; + while (timeout < USB_DEBOUNCE_TIMEOUT) { + snooze(USB_DEBOUNCE_CHECK_INTERVAL); + timeout += USB_DEBOUNCE_CHECK_INTERVAL; + + status_t result = UpdatePortStatus(index); + if (result != B_OK) + return result; + + if ((fPortStatus[index].change & PORT_STATUS_CONNECTION) == 0) { + stableTime += USB_DEBOUNCE_CHECK_INTERVAL; + if (stableTime >= USB_DEBOUNCE_STABLE_TIME) + return B_OK; + continue; + } + + // clear the connection change and reset stable time + result = DefaultPipe()->SendRequest(USB_REQTYPE_CLASS + | USB_REQTYPE_OTHER_OUT, USB_REQUEST_CLEAR_FEATURE, + C_PORT_CONNECTION, index + 1, 0, NULL, 0, NULL); + if (result != B_OK) + return result; + + TRACE("got connection change during debounce, resetting stable time\n"); + stableTime = 0; + } + + return B_TIMED_OUT; +} diff --git a/src/add-ons/kernel/bus_managers/usb/Stack.cpp b/src/add-ons/kernel/bus_managers/usb/Stack.cpp index 6c815161a2..fbad834985 100644 --- a/src/add-ons/kernel/bus_managers/usb/Stack.cpp +++ b/src/add-ons/kernel/bus_managers/usb/Stack.cpp @@ -97,7 +97,7 @@ Stack::Stack() // is opening the module does not get rescanned while or before installing // its hooks. while (!fFirstExploreDone) - snooze(100000); + snooze(10000); } diff --git a/src/add-ons/kernel/bus_managers/usb/usb_private.h b/src/add-ons/kernel/bus_managers/usb/usb_private.h index be8b3215ea..4f0ffc6936 100644 --- a/src/add-ons/kernel/bus_managers/usb/usb_private.h +++ b/src/add-ons/kernel/bus_managers/usb/usb_private.h @@ -610,6 +610,8 @@ virtual status_t BuildDeviceName(char *string, Device *device); private: + status_t _DebouncePort(uint8 index); + InterruptPipe * fInterruptPipe; usb_hub_descriptor fHubDescriptor; diff --git a/src/add-ons/kernel/bus_managers/usb/usbspec_private.h b/src/add-ons/kernel/bus_managers/usb/usbspec_private.h index 2103994f74..8d6f1c4d16 100644 --- a/src/add-ons/kernel/bus_managers/usb/usbspec_private.h +++ b/src/add-ons/kernel/bus_managers/usb/usbspec_private.h @@ -19,15 +19,18 @@ #define USB_MAX_PORT_COUNT 16 #define USB_DELAY_BUS_RESET 100000 -#define USB_DELAY_DEVICE_POWER_UP 300000 #define USB_DELAY_HUB_POWER_UP 200000 #define USB_DELAY_PORT_RESET 50000 -#define USB_DELAY_PORT_RESET_RECOVERY 250000 +#define USB_DELAY_PORT_RESET_RECOVERY 50000 #define USB_DELAY_SET_ADDRESS_RETRY 200000 #define USB_DELAY_SET_ADDRESS 10000 #define USB_DELAY_SET_CONFIGURATION 50000 #define USB_DELAY_HUB_EXPLORE 1000000 +#define USB_DEBOUNCE_TIMEOUT 1500000 +#define USB_DEBOUNCE_CHECK_INTERVAL 25000 +#define USB_DEBOUNCE_STABLE_TIME 100000 + // For bandwidth calculation #define USB_BW_HOST_DELAY 1000 #define USB_BW_SETUP_LOW_SPEED_PORT_DELAY 333 diff --git a/src/add-ons/kernel/bus_managers/virtio/Jamfile b/src/add-ons/kernel/bus_managers/virtio/Jamfile new file mode 100644 index 0000000000..ef44b0043a --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/Jamfile @@ -0,0 +1,10 @@ +SubDir HAIKU_TOP src add-ons kernel bus_managers virtio ; + +UsePrivateHeaders virtio ; +UsePrivateKernelHeaders ; + +KernelAddon virtio : + VirtioDevice.cpp + VirtioModule.cpp + VirtioQueue.cpp + ; diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioDevice.cpp b/src/add-ons/kernel/bus_managers/virtio/VirtioDevice.cpp new file mode 100644 index 0000000000..606c77ef48 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioDevice.cpp @@ -0,0 +1,255 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ + + +#include "VirtioPrivate.h" + + +const char * +virtio_get_feature_name(uint32 feature) +{ + switch (feature) { + case VIRTIO_FEATURE_NOTIFY_ON_EMPTY: + return "notify on empty"; + case VIRTIO_FEATURE_RING_INDIRECT_DESC: + return "ring indirect"; + case VIRTIO_FEATURE_RING_EVENT_IDX: + return "ring event index"; + case VIRTIO_FEATURE_BAD_FEATURE: + return "bad feature"; + } + return NULL; +} + + +const char * +virtio_get_device_type_name(uint16 type) +{ + switch (type) { + case VIRTIO_DEVICE_ID_NETWORK: + return "network"; + case VIRTIO_DEVICE_ID_BLOCK: + return "block"; + case VIRTIO_DEVICE_ID_CONSOLE: + return "console"; + case VIRTIO_DEVICE_ID_ENTROPY: + return "entropy"; + case VIRTIO_DEVICE_ID_BALLOON: + return "balloon"; + case VIRTIO_DEVICE_ID_IOMEMORY: + return "io_memory"; + case VIRTIO_DEVICE_ID_SCSI: + return "scsi"; + case VIRTIO_DEVICE_ID_9P: + return "9p transport"; + default: + return "unknown"; + } +} + + +VirtioDevice::VirtioDevice(device_node *node) + : + fNode(node), + fID(0), + fController(NULL), + fCookie(NULL), + fStatus(B_NO_INIT), + fQueues(NULL), + fFeatures(0) +{ + device_node *parent = gDeviceManager->get_parent_node(node); + fStatus = gDeviceManager->get_driver(parent, + (driver_module_info **)&fController, &fCookie); + gDeviceManager->put_node(parent); + + if (fStatus != B_OK) + return; + + fStatus = gDeviceManager->get_attr_uint16(fNode, + VIRTIO_VRING_ALIGNMENT_ITEM, &fAlignment, true); + if (fStatus != B_OK) { + ERROR("alignment missing\n"); + return; + } + + fController->set_sim(fCookie, this); + + fController->set_status(fCookie, VIRTIO_CONFIG_STATUS_DRIVER); +} + + +VirtioDevice::~VirtioDevice() +{ + for (size_t index = 0; index < fQueueCount; index++) { + delete fQueues[index]; + } + delete fQueues; +} + + +status_t +VirtioDevice::InitCheck() +{ + return fStatus; +} + + +status_t +VirtioDevice::NegociateFeatures(uint32 supported, uint32* negociated, + const char* (*get_feature_name)(uint32)) +{ + fFeatures = 0; + status_t status = fController->read_host_features(fCookie, &fFeatures); + if (status != B_OK) + return status; + + DumpFeatures("read features", fFeatures, get_feature_name); + + fFeatures &= supported; + + // filter our own features + fFeatures &= (VIRTIO_FEATURE_TRANSPORT_MASK + /*| VIRTIO_FEATURE_RING_INDIRECT_DESC*/ | VIRTIO_FEATURE_RING_EVENT_IDX); + + *negociated = fFeatures; + + DumpFeatures("negociated features", fFeatures, get_feature_name); + + return fController->write_guest_features(fCookie, fFeatures); +} + + +status_t +VirtioDevice::ReadDeviceConfig(uint8 offset, void* buffer, size_t bufferSize) +{ + return fController->read_device_config(fCookie, offset, buffer, + bufferSize); +} + + +status_t +VirtioDevice::WriteDeviceConfig(uint8 offset, const void* buffer, + size_t bufferSize) +{ + return fController->write_device_config(fCookie, offset, buffer, + bufferSize); +} + + +status_t +VirtioDevice::AllocateQueues(size_t count, virtio_queue *queues) +{ + if (count > VIRTIO_VIRTQUEUES_MAX_COUNT || queues == NULL) + return B_BAD_VALUE; + + status_t status = B_OK; + fQueues = new(std::nothrow) VirtioQueue*[count]; + if (fQueues == NULL) { + status = B_NO_MEMORY; + goto err; + } + + fQueueCount = count; + for (size_t index = 0; index < count; index++) { + uint16 size = fController->get_queue_ring_size(fCookie, index); + fQueues[index] = new(std::nothrow) VirtioQueue(this, index, size); + queues[index] = fQueues[index]; + status = B_NO_MEMORY; + if (fQueues[index] != NULL) + status = fQueues[index]->InitCheck(); + if (status != B_OK) + goto err; + } + + return B_OK; + +err: + return status; +} + + +status_t +VirtioDevice::SetupInterrupt(virtio_intr_func configHandler, + void* configCookie) +{ + fConfigHandler = configHandler; + fConfigCookie = configCookie; + status_t status = fController->setup_interrupt(fCookie); + if (status != B_OK) + return status; + + // ready to go + fController->set_status(fCookie, VIRTIO_CONFIG_STATUS_DRIVER_OK); + + for (size_t index = 0; index < fQueueCount; index++) + fQueues[index]->EnableInterrupt(); + return B_OK; +} + + +status_t +VirtioDevice::SetupQueue(uint16 queueNumber, phys_addr_t physAddr) +{ + return fController->setup_queue(fCookie, queueNumber, physAddr); +} + + +void +VirtioDevice::NotifyQueue(uint16 queueNumber) +{ + fController->notify_queue(fCookie, queueNumber); +} + + +status_t +VirtioDevice::QueueInterrupt(uint16 queueNumber) +{ + if (queueNumber != INT16_MAX) { + if (queueNumber >= fQueueCount) + return B_BAD_VALUE; + return fQueues[queueNumber]->Interrupt(); + } + + status_t status = B_OK; + for (uint16 i = 0; i < fQueueCount; i++) { + status = fQueues[i]->Interrupt(); + if (status != B_OK) + break; + } + + return status; +} + + +status_t +VirtioDevice::ConfigInterrupt() +{ + if (fConfigHandler != NULL) + fConfigHandler(fConfigCookie); + return B_OK; +} + + +void +VirtioDevice::DumpFeatures(const char* title, uint32 features, + const char* (*get_feature_name)(uint32)) +{ + char features_string[512] = ""; + for (uint32 i = 0; i < 32; i++) { + uint32 feature = features & (1 << i); + if (feature == 0) + continue; + const char* name = virtio_get_feature_name(feature); + if (name == NULL) + name = get_feature_name(feature); + if (name != NULL) { + snprintf(features_string, sizeof(features_string), "%s[%s] ", + features_string, name); + } + } + TRACE("%s: %s\n", title, features_string); +} + diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp b/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp new file mode 100644 index 0000000000..8229fc7e8c --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioModule.cpp @@ -0,0 +1,258 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ + + +#include "VirtioPrivate.h" + + +device_manager_info *gDeviceManager = NULL; + + +// #pragma mark - + + +static status_t +virtio_device_init(device_node *node, void **cookie) +{ + CALLED(); + VirtioDevice *device = new(std::nothrow) VirtioDevice(node); + if (device == NULL) + return B_NO_MEMORY; + + status_t result = device->InitCheck(); + if (result != B_OK) { + ERROR("failed to set up virtio device object\n"); + return result; + } + + *cookie = device; + return B_OK; +} + + +static void +virtio_device_uninit(void *cookie) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + delete device; +} + + +static void +virtio_device_removed(void *cookie) +{ + CALLED(); + //VirtioDevice *device = (VirtioDevice *)cookie; +} + + +// #pragma mark - + + +status_t +virtio_negociate_features(void* cookie, uint32 supported, + uint32* negociated, const char* (*get_feature_name)(uint32)) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + + return device->NegociateFeatures(supported, negociated, get_feature_name); +} + + +status_t +virtio_read_device_config(void* cookie, uint8 offset, void* buffer, + size_t bufferSize) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + + return device->ReadDeviceConfig(offset, buffer, bufferSize); +} + + +status_t +virtio_write_device_config(void* cookie, uint8 offset, + const void* buffer, size_t bufferSize) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + + return device->WriteDeviceConfig(offset, buffer, bufferSize); +} + + +status_t +virtio_alloc_queues(virtio_device cookie, size_t count, virtio_queue *queues) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + return device->AllocateQueues(count, queues); +} + + +status_t +virtio_setup_interrupt(virtio_device cookie, virtio_intr_func config_handler, + void* configCookie) +{ + CALLED(); + VirtioDevice *device = (VirtioDevice *)cookie; + return device->SetupInterrupt(config_handler, configCookie); +} + + +status_t +virtio_queue_request_v(virtio_queue cookie, const physical_entry* vector, + size_t readVectorCount, size_t writtenVectorCount, + virtio_callback_func callback, void *callbackCookie) +{ + CALLED(); + VirtioQueue *queue = (VirtioQueue *)cookie; + return queue->QueueRequest(vector, readVectorCount, writtenVectorCount, + callback, callbackCookie); +} + + +status_t +virtio_queue_request(virtio_queue cookie, const physical_entry *readEntry, + const physical_entry *writtenEntry, virtio_callback_func callback, + void *callbackCookie) +{ + physical_entry entries[2]; + if (readEntry != NULL) { + entries[0] = *readEntry; + if (writtenEntry != NULL) + entries[1] = *writtenEntry; + } else if (writtenEntry != NULL) + entries[0] = *writtenEntry; + + return virtio_queue_request_v(cookie, entries, readEntry != NULL ? 1 : 0, + writtenEntry != NULL? 1 : 0, callback, callbackCookie); +} + + +// #pragma mark - + + +status_t +virtio_added_device(device_node *parent) +{ + CALLED(); + + uint16 deviceType; + if (gDeviceManager->get_attr_uint16(parent, + VIRTIO_DEVICE_TYPE_ITEM, &deviceType, true) != B_OK) { + ERROR("device type missing\n"); + return B_ERROR; + } + + device_attr attributes[] = { + // info about device + { B_DEVICE_BUS, B_STRING_TYPE, { string: "virtio" }}, + { VIRTIO_DEVICE_TYPE_ITEM, B_UINT16_TYPE, + { ui16: deviceType }}, + { NULL } + }; + + return gDeviceManager->register_node(parent, VIRTIO_DEVICE_MODULE_NAME, + attributes, NULL, NULL); +} + + +status_t +virtio_queue_interrupt_handler(virtio_sim sim, uint16 queue) +{ + VirtioDevice* device = (VirtioDevice*)sim; + return device->QueueInterrupt(queue); +} + + +status_t +virtio_config_interrupt_handler(virtio_sim sim) +{ + VirtioDevice* device = (VirtioDevice*)sim; + return device->ConfigInterrupt(); +} + + +static status_t +std_ops(int32 op, ...) +{ + switch (op) { + case B_MODULE_INIT: + case B_MODULE_UNINIT: + return B_OK; + + default: + break; + } + + return B_ERROR; +} + + +// #pragma mark - + + +virtio_device_interface virtio_device_module = { + { + { + VIRTIO_DEVICE_MODULE_NAME, + 0, + std_ops + }, + + NULL, // supported devices + NULL, // register node + virtio_device_init, + virtio_device_uninit, + NULL, // register child devices + NULL, // rescan + virtio_device_removed, + NULL, // suspend + NULL, // resume + }, + + virtio_negociate_features, + virtio_read_device_config, + virtio_write_device_config, + virtio_alloc_queues, + virtio_setup_interrupt, + virtio_queue_request, + virtio_queue_request_v +}; + +virtio_for_controller_interface virtio_for_controller_module = { + { + { + VIRTIO_FOR_CONTROLLER_MODULE_NAME, + 0, + &std_ops + }, + + NULL, // supported devices + virtio_added_device, + NULL, + NULL, + NULL + }, + + virtio_queue_interrupt_handler, + virtio_config_interrupt_handler +}; + + +module_dependency module_dependencies[] = { + { B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager }, + {} +}; + +module_info *modules[] = { + (module_info *)&virtio_for_controller_module, + (module_info *)&virtio_device_module, + NULL +}; + diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h b/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h new file mode 100644 index 0000000000..1b312015f9 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioPrivate.h @@ -0,0 +1,146 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ +#ifndef VIRTIO_PRIVATE_H +#define VIRTIO_PRIVATE_H + + +#include +#include +#include + +#include +#include +#include + +#include "virtio_ring.h" + + +//#define VIRTIO_TRACE +#ifdef VIRTIO_TRACE +# define TRACE(x...) dprintf("\33[33mvirtio:\33[0m " x) +#else +# define TRACE(x...) +#endif +#define ERROR(x...) dprintf("\33[33mvirtio:\33[0m " x) +#define CALLED() TRACE("CALLED %s\n", __PRETTY_FUNCTION__) + + +#define VIRTIO_SIM_MODULE_NAME "bus_managers/virtio/sim/driver_v1" + + +class VirtioDevice; +class VirtioQueue; + +extern device_manager_info *gDeviceManager; + + +class VirtioDevice { +public: + VirtioDevice(device_node *node); + ~VirtioDevice(); + + status_t InitCheck(); + uint32 ID() const { return fID; } + + status_t NegociateFeatures(uint32 supported, + uint32* negociated, + const char* (*get_feature_name)(uint32)); + + status_t ReadDeviceConfig(uint8 offset, void* buffer, + size_t bufferSize); + status_t WriteDeviceConfig(uint8 offset, + const void* buffer, size_t bufferSize); + + status_t AllocateQueues(size_t count, + virtio_queue *queues); + status_t SetupInterrupt(virtio_intr_func config_handler, + void* configCookie); + + uint16 Alignment() { return fAlignment; } + uint32 Features() { return fFeatures; } + + status_t SetupQueue(uint16 queueNumber, + phys_addr_t physAddr); + void NotifyQueue(uint16 queueNumber); + + status_t QueueInterrupt(uint16 queueNumber); + status_t ConfigInterrupt(); + +private: + void DumpFeatures(const char* title, + uint32 features, + const char* (*get_feature_name)(uint32)); + + + device_node * fNode; + uint32 fID; + virtio_sim_interface *fController; + void * fCookie; + status_t fStatus; + VirtioQueue** fQueues; + size_t fQueueCount; + uint32 fFeatures; + uint16 fAlignment; + + virtio_intr_func fConfigHandler; + void* fConfigCookie; +}; + + +class TransferDescriptor; + + +class VirtioQueue { +public: + VirtioQueue(VirtioDevice *device, + uint16 queueNumber, uint16 ringSize); + ~VirtioQueue(); + status_t InitCheck() { return fStatus; } + + void NotifyHost(); + status_t Interrupt(); + + bool IsFull() { return fRingFree == 0; } + bool IsEmpty() { return fRingFree == fRingSize; } + + status_t QueueRequest(const physical_entry* vector, + size_t readVectorCount, + size_t writtenVectorCount, + virtio_callback_func callback, + void *callbackCookie); + status_t QueueRequestIndirect( + const physical_entry* vector, + size_t readVectorCount, + size_t writtenVectorCount, + virtio_callback_func callback, + void *callbackCookie); + void EnableInterrupt(); + void DisableInterrupt(); + +private: + void UpdateAvailable(uint16 index); + uint16 QueueVector(uint16 insertIndex, + struct vring_desc *desc, + const physical_entry* vector, + size_t readVectorCount, + size_t writtenVectorCount); + void Finish(); + + VirtioDevice* fDevice; + uint16 fQueueNumber; + uint16 fRingSize; + uint16 fRingFree; + + struct vring fRing; + uint16 fRingHeadIndex; + uint16 fRingUsedIndex; + status_t fStatus; + size_t fAreaSize; + area_id fArea; + + TransferDescriptor** fDescriptors; +}; + +#endif // VIRTIO_PRIVATE_H diff --git a/src/add-ons/kernel/bus_managers/virtio/VirtioQueue.cpp b/src/add-ons/kernel/bus_managers/virtio/VirtioQueue.cpp new file mode 100644 index 0000000000..6cff71d68b --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/VirtioQueue.cpp @@ -0,0 +1,288 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ + + +#include "VirtioPrivate.h" + + +static inline uint32 +round_to_pagesize(uint32 size) +{ + return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); +} + + +area_id +alloc_mem(void **virt, phys_addr_t *phy, size_t size, uint32 protection, + const char *name) +{ + physical_entry pe; + void * virtadr; + area_id areaid; + status_t rv; + + TRACE("allocating %ld bytes for %s\n", size, name); + + size = round_to_pagesize(size); + areaid = create_area(name, &virtadr, B_ANY_KERNEL_ADDRESS, size, + B_CONTIGUOUS, protection); + if (areaid < B_OK) { + ERROR("couldn't allocate area %s\n", name); + return B_ERROR; + } + rv = get_memory_map(virtadr, size, &pe, 1); + if (rv < B_OK) { + delete_area(areaid); + ERROR("couldn't get mapping for %s\n", name); + return B_ERROR; + } + if (virt) + *virt = virtadr; + if (phy) + *phy = pe.address; + TRACE("area = %" B_PRId32 ", size = %ld, virt = %p, phy = %#" B_PRIxPHYSADDR "\n", + areaid, size, virtadr, pe.address); + return areaid; +} + + +class TransferDescriptor { +public: + TransferDescriptor(uint16 size, + virtio_callback_func callback, + void *callbackCookie); + ~TransferDescriptor(); + + void Callback(); + uint16 Size() { return fDescriptorCount; } +private: + void* fCookie; + virtio_callback_func fCallback; + struct vring_desc* fIndirect; + size_t fAreaSize; + area_id fArea; + uint16 fDescriptorCount; +}; + + +TransferDescriptor::TransferDescriptor(uint16 size, + virtio_callback_func callback, void *callbackCookie) + : fCookie(callbackCookie), + fCallback(callback), + fDescriptorCount(size) +{ +} + + +TransferDescriptor::~TransferDescriptor() +{ +} + + +void +TransferDescriptor::Callback() +{ + if (fCallback != NULL) + fCallback(fCookie); +} + + +// #pragma mark - + + +VirtioQueue::VirtioQueue(VirtioDevice* device, uint16 queueNumber, + uint16 ringSize) + : + fDevice(device), + fQueueNumber(queueNumber), + fRingSize(ringSize), + fRingFree(ringSize), + fRingHeadIndex(0), + fRingUsedIndex(0), + fStatus(B_OK) +{ + fDescriptors = new(std::nothrow) TransferDescriptor*[fRingSize]; + if (fDescriptors == NULL) { + fStatus = B_NO_MEMORY; + return; + } + + uint8* virtAddr; + phys_addr_t physAddr; + fAreaSize = vring_size(fRingSize, device->Alignment()); + fArea = alloc_mem((void **)&virtAddr, &physAddr, fAreaSize, 0, + "virtqueue"); + if (fArea < B_OK) { + fStatus = fArea; + return; + } + memset(virtAddr, 0, fAreaSize); + vring_init(&fRing, fRingSize, virtAddr, device->Alignment()); + + for (uint16 i = 0; i < fRingSize - 1; i++) + fRing.desc[i].next = i + 1; + fRing.desc[fRingSize - 1].next = UINT16_MAX; + + DisableInterrupt(); + + device->SetupQueue(fQueueNumber, physAddr); +} + + +VirtioQueue::~VirtioQueue() +{ + delete_area(fArea); +} + + +void +VirtioQueue::DisableInterrupt() +{ + /*if ((fDevice->Features() & VIRTIO_FEATURE_RING_EVENT_IDX) == 0) + fRing.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;*/ +} + + +void +VirtioQueue::EnableInterrupt() +{ + /*if ((fDevice->Features() & VIRTIO_FEATURE_RING_EVENT_IDX) == 0) + fRing.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;*/ +} + + +void +VirtioQueue::NotifyHost() +{ + fDevice->NotifyQueue(fQueueNumber); +} + + +status_t +VirtioQueue::Interrupt() +{ + CALLED(); + DisableInterrupt(); + + while (fRingUsedIndex != fRing.used->idx) + Finish(); + + EnableInterrupt(); + return B_OK; +} + + +void +VirtioQueue::Finish() +{ + TRACE("Finish() fRingUsedIndex: %u\n", fRingUsedIndex); + + uint16 usedIndex = fRingUsedIndex++ & (fRingSize - 1); + TRACE("Finish() usedIndex: %u\n", usedIndex); + struct vring_used_elem *element = &fRing.used->ring[usedIndex]; + uint16 descriptorIndex = element->id; + // uint32 length = element->len; + + fDescriptors[descriptorIndex]->Callback(); + uint16 size = fDescriptors[descriptorIndex]->Size(); + fRingFree += size; + size--; + + uint16 index = descriptorIndex; + while ((fRing.desc[index].flags & VRING_DESC_F_NEXT) != 0) { + index = fRing.desc[index].next; + size--; + } + + if (size > 0) + panic("VirtioQueue::Finish() descriptors left %d\n", size); + + // TODO TransferDescriptors are leaked, can't delete in interrupt handler. + + fRing.desc[index].next = fRingHeadIndex; + fRingHeadIndex = descriptorIndex; + TRACE("Finish() fRingHeadIndex: %u\n", fRingHeadIndex); +} + + +status_t +VirtioQueue::QueueRequest(const physical_entry* vector, size_t readVectorCount, + size_t writtenVectorCount, virtio_callback_func callback, + void *callbackCookie) +{ + CALLED(); + size_t count = readVectorCount + writtenVectorCount; + if (count < 1) + return B_BAD_VALUE; + if ((fDevice->Features() & VIRTIO_FEATURE_RING_INDIRECT_DESC) != 0) { + return QueueRequestIndirect(vector, readVectorCount, + writtenVectorCount, callback, callbackCookie); + } + + if (count > fRingFree) + return B_BUSY; + + uint16 insertIndex = fRingHeadIndex; + fDescriptors[insertIndex] = new(std::nothrow) TransferDescriptor(count, + callback, callbackCookie); + if (fDescriptors[insertIndex] == NULL) + return B_NO_MEMORY; + + // enqueue + uint16 index = QueueVector(insertIndex, fRing.desc, vector, + readVectorCount, writtenVectorCount); + + fRingHeadIndex = index; + fRingFree -= count; + + UpdateAvailable(insertIndex); + + NotifyHost(); + + return B_OK; +} + + +status_t +VirtioQueue::QueueRequestIndirect(const physical_entry* vector, + size_t readVectorCount, size_t writtenVectorCount, + virtio_callback_func callback, void *callbackCookie) +{ + // TODO + return B_OK; +} + + +void +VirtioQueue::UpdateAvailable(uint16 index) +{ + CALLED(); + uint16 available = fRing.avail->idx & (fRingSize - 1); + fRing.avail->ring[available] = index; + fRing.avail->idx++; +} + + +uint16 +VirtioQueue::QueueVector(uint16 insertIndex, struct vring_desc *desc, + const physical_entry* vector, size_t readVectorCount, + size_t writtenVectorCount) +{ + CALLED(); + uint16 index = insertIndex; + size_t total = readVectorCount + writtenVectorCount; + for (size_t i = 0; i < total; i++) { + desc[index].addr = vector[i].address; + desc[index].len = vector[i].size; + desc[index].flags = 0; + if (i >= readVectorCount) + desc[index].flags |= VRING_DESC_F_WRITE; + if (i < total - 1) + desc[index].flags |= VRING_DESC_F_NEXT; + index = desc[index].next; + } + + return index; +} diff --git a/src/add-ons/kernel/bus_managers/virtio/virtio_ring.h b/src/add-ons/kernel/bus_managers/virtio/virtio_ring.h new file mode 100644 index 0000000000..c4f2b7313a --- /dev/null +++ b/src/add-ons/kernel/bus_managers/virtio/virtio_ring.h @@ -0,0 +1,165 @@ +/*- + * Copyright Rusty Russell IBM Corporation 2007. + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef VIRTIO_RING_H +#define VIRTIO_RING_H + +/* This marks a buffer as continuing via the next field. */ +#define VRING_DESC_F_NEXT 1 +/* This marks a buffer as write-only (otherwise read-only). */ +#define VRING_DESC_F_WRITE 2 +/* This means the buffer contains a list of buffer descriptors. */ +#define VRING_DESC_F_INDIRECT 4 + +/* The Host uses this in used->flags to advise the Guest: don't kick me + * when you add a buffer. It's unreliable, so it's simply an + * optimization. Guest will still kick if it's out of buffers. */ +#define VRING_USED_F_NO_NOTIFY 1 +/* The Guest uses this in avail->flags to advise the Host: don't + * interrupt me when you consume a buffer. It's unreliable, so it's + * simply an optimization. */ +#define VRING_AVAIL_F_NO_INTERRUPT 1 + +/* VirtIO ring descriptors: 16 bytes. + * These can chain together via "next". */ +struct vring_desc { + /* Address (guest-physical). */ + uint64_t addr; + /* Length. */ + uint32_t len; + /* The flags as indicated above. */ + uint16_t flags; + /* We chain unused descriptors via this, too. */ + uint16_t next; +}; + +struct vring_avail { + uint16_t flags; + uint16_t idx; + uint16_t ring[0]; +}; + +/* uint32_t is used here for ids for padding reasons. */ +struct vring_used_elem { + /* Index of start of used descriptor chain. */ + uint32_t id; + /* Total length of the descriptor chain which was written to. */ + uint32_t len; +}; + +struct vring_used { + uint16_t flags; + uint16_t idx; + struct vring_used_elem ring[0]; +}; + +struct vring { + unsigned int num; + + struct vring_desc *desc; + struct vring_avail *avail; + struct vring_used *used; +}; + +/* The standard layout for the ring is a continuous chunk of memory which + * looks like this. We assume num is a power of 2. + * + * struct vring { + * // The actual descriptors (16 bytes each) + * struct vring_desc desc[num]; + * + * // A ring of available descriptor heads with free-running index. + * __u16 avail_flags; + * __u16 avail_idx; + * __u16 available[num]; + * __u16 used_event_idx; + * + * // Padding to the next align boundary. + * char pad[]; + * + * // A ring of used descriptor heads with free-running index. + * __u16 used_flags; + * __u16 used_idx; + * struct vring_used_elem used[num]; + * __u16 avail_event_idx; + * }; + * + * NOTE: for VirtIO PCI, align is 4096. + */ + +/* + * We publish the used event index at the end of the available ring, and vice + * versa. They are at the end for backwards compatibility. + */ +#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num]) +#define vring_avail_event(vr) (*(uint16_t *)&(vr)->used->ring[(vr)->num]) + +static inline int +vring_size(unsigned int num, unsigned long align) +{ + int size; + + size = num * sizeof(struct vring_desc); + size += sizeof(struct vring_avail) + (num * sizeof(uint16_t)) + + sizeof(uint16_t); + size = (size + align - 1) & ~(align - 1); + size += sizeof(struct vring_used) + + (num * sizeof(struct vring_used_elem)) + sizeof(uint16_t); + return (size); +} + +static inline void +vring_init(struct vring *vr, unsigned int num, uint8_t *p, + unsigned long align) +{ + vr->num = num; + vr->desc = (struct vring_desc *) p; + vr->avail = (struct vring_avail *) (p + + num * sizeof(struct vring_desc)); + vr->used = (struct vring_used *) + (((addr_t) &vr->avail->ring[num] + align-1) & ~(align-1)); +} + +/* + * The following is used with VIRTIO_RING_F_EVENT_IDX. + * + * Assuming a given event_idx value from the other size, if we have + * just incremented index from old to new_idx, should we trigger an + * event? + */ +static inline int +vring_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old) +{ + + return (uint16_t)(new_idx - event_idx - 1) < (uint16_t)(new_idx - old); +} +#endif /* VIRTIO_RING_H */ diff --git a/src/add-ons/kernel/busses/Jamfile b/src/add-ons/kernel/busses/Jamfile index 7f3e607e7b..2c9ee48853 100644 --- a/src/add-ons/kernel/busses/Jamfile +++ b/src/add-ons/kernel/busses/Jamfile @@ -10,3 +10,4 @@ if $(HAIKU_ATA_STACK) = 1 { SubInclude HAIKU_TOP src add-ons kernel busses agp_gart ; SubInclude HAIKU_TOP src add-ons kernel busses scsi ; SubInclude HAIKU_TOP src add-ons kernel busses usb ; +SubInclude HAIKU_TOP src add-ons kernel busses virtio ; diff --git a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp index 7a358d653b..5865b9edba 100644 --- a/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp +++ b/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp @@ -108,7 +108,7 @@ struct intel_info { uint32 type; uint32 *gtt_base; - addr_t gtt_physical_base; + phys_addr_t gtt_physical_base; area_id gtt_area; size_t gtt_entries; size_t gtt_stolen_entries; @@ -117,7 +117,7 @@ struct intel_info { area_id registers_area; addr_t aperture_base; - addr_t aperture_physical_base; + phys_addr_t aperture_physical_base; area_id aperture_area; size_t aperture_size; size_t aperture_stolen_size; @@ -385,7 +385,7 @@ intel_map(intel_info &info) AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("intel GMCH mmio", - (void*)info.display.u.h0.base_registers[mmioIndex], + info.display.u.h0.base_registers[mmioIndex], info.display.u.h0.base_register_sizes[mmioIndex], B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.registers); if (mmioMapper.InitCheck() < B_OK) { @@ -439,12 +439,12 @@ intel_map(intel_info &info) info.gtt_entries = gttSize / 4096; info.gtt_stolen_entries = stolenSize / 4096; - TRACE("GTT base %lx, size %lu, entries %lu, stolen %lu\n", + TRACE("GTT base %" B_PRIxPHYSADDR ", size %lu, entries %lu, stolen %lu\n", info.gtt_physical_base, gttSize, info.gtt_entries, stolenSize); AreaKeeper gttMapper; info.gtt_area = gttMapper.Map("intel GMCH gtt", - (void*)info.gtt_physical_base, gttSize, B_ANY_KERNEL_ADDRESS, + info.gtt_physical_base, gttSize, B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.gtt_base); if (gttMapper.InitCheck() < B_OK) { dprintf("intel_gart: could not map GTT!\n"); @@ -460,14 +460,16 @@ intel_map(intel_info &info) "size %ld MB, GTT size %ld KB\n", (stolenSize + (1023 << 10)) >> 20, info.aperture_size >> 20, gttSize >> 10); - dprintf("intel_gart: GTT base = 0x%lx\n", info.gtt_physical_base); - dprintf("intel_gart: MMIO base = 0x%lx\n", + dprintf("intel_gart: GTT base = 0x%" B_PRIxPHYSADDR "\n", + info.gtt_physical_base); + dprintf("intel_gart: MMIO base = 0x%" B_PRIx32 "\n", info.display.u.h0.base_registers[mmioIndex]); - dprintf("intel_gart: GMR base = 0x%lx\n", info.aperture_physical_base); + dprintf("intel_gart: GMR base = 0x%" B_PRIxPHYSADDR "\n", + info.aperture_physical_base); AreaKeeper apertureMapper; info.aperture_area = apertureMapper.Map("intel graphics aperture", - (void*)info.aperture_physical_base, info.aperture_size, + info.aperture_physical_base, info.aperture_size, B_ANY_KERNEL_BLOCK_ADDRESS | B_MTR_WC, B_READ_AREA | B_WRITE_AREA, (void**)&info.aperture_base); if (apertureMapper.InitCheck() < B_OK) { @@ -475,7 +477,7 @@ intel_map(intel_info &info) dprintf(DEVICE_NAME ": enabling write combined mode failed.\n"); info.aperture_area = apertureMapper.Map("intel graphics aperture", - (void*)info.aperture_physical_base, info.aperture_size, + info.aperture_physical_base, info.aperture_size, B_ANY_KERNEL_BLOCK_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void**)&info.aperture_base); } diff --git a/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c b/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c index d0037ddc9c..0038c4c842 100644 --- a/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c +++ b/src/add-ons/kernel/busses/ata/silicon_image_3112/silicon_image_3112.c @@ -69,7 +69,7 @@ typedef struct controller_data { uint32 int_num; area_id mmio_area; - uint32 mmio_addr; + addr_t mmio_addr; uint32 lost; // != 0 if device got removed, i.e. if it must not // be accessed anymore @@ -251,7 +251,7 @@ controller_init(device_node *node, void **_controllerCookie) pci_device *device; uint32 asicIndex; uint32 mmioBase; - uint32 mmioAddr; + addr_t mmioAddr; area_id mmioArea; uint32 interruptNumber; status_t res; @@ -286,10 +286,10 @@ controller_init(device_node *node, void **_controllerCookie) sDeviceManager->get_driver(parent, (driver_module_info **)&pci, (void **)&device); sDeviceManager->put_node(parent); - TRACE("asic index %ld\n", asicIndex); + TRACE("asic index %" B_PRId32 "\n", asicIndex); TRACE("asic name %s\n", kASICData[asicIndex].asic_name); - TRACE("int num %ld\n", interruptNumber); - TRACE("mmio addr %p\n", (void *)mmioAddr); + TRACE("int num %" B_PRId32 "\n", interruptNumber); + TRACE("mmio addr %" B_PRIxADDR"\n", mmioAddr); controller->pci = pci; controller->device = device; @@ -437,7 +437,7 @@ channel_init(device_node *node, void **_channelCookie) } #endif - TRACE("channel_index %ld\n", channelIndex); + TRACE("channel_index %" B_PRId32 "\n", channelIndex); TRACE("channel name: %s\n", kControllerChannelData[channelIndex].name); TRACE("channel %p\n", channel); @@ -685,19 +685,19 @@ dma_prepare(void *channelCookie, const physical_entry *sg_list, for (i = sg_list_count - 1, prd = channel->prdt; i >= 0; --i, ++prd, ++sg_list ) { - prd->address = B_HOST_TO_LENDIAN_INT32((uint32)pci->ram_address(device, + prd->address = B_HOST_TO_LENDIAN_INT32((uint32)(addr_t)pci->ram_address(device, (void*)(addr_t)sg_list->address)); // 0 means 64K - this is done automatically by discarding upper 16 bits prd->count = B_HOST_TO_LENDIAN_INT16((uint16)sg_list->size); prd->EOT = i == 0; - FLOW("%x, %x, %d\n", (int)prd->address, prd->count, prd->EOT); + FLOW("%" B_PRIx32", %" B_PRId16", %" B_PRId8"\n", prd->address, prd->count, prd->EOT); } // XXX move this to chan init? temp = (*channel->bm_prdt_address) & 3; - temp |= B_HOST_TO_LENDIAN_INT32((uint32)pci->ram_address(device, + temp |= B_HOST_TO_LENDIAN_INT32((uint32)(addr_t)pci->ram_address(device, (void *)(addr_t)channel->prdt_phys)) & ~3; *channel->bm_prdt_address = temp; diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp b/src/add-ons/kernel/busses/usb/ehci.cpp index 1a93c63a45..0d7c2a83d2 100644 --- a/src/add-ons/kernel/busses/usb/ehci.cpp +++ b/src/add-ons/kernel/busses/usb/ehci.cpp @@ -802,7 +802,8 @@ EHCI::SubmitIsochronous(Transfer *transfer) uint16 pg = 0; itd->buffer_phy[pg] = currentPhy & 0xfffff000; uint32 offset = currentPhy & 0xfff; - TRACE("isochronous created itd, filling it with phy %lx\n", currentPhy); + TRACE("isochronous created itd, filling it with phy %" B_PRIxPHYSADDR + "\n", currentPhy); for (int32 i = 0; i < 8 && dataLength > 0; i++) { size_t length = min_c(dataLength, packetSize); itd->token[i] = (EHCI_ITD_STATUS_ACTIVE << EHCI_ITD_STATUS_SHIFT) diff --git a/src/add-ons/kernel/busses/virtio/Jamfile b/src/add-ons/kernel/busses/virtio/Jamfile new file mode 100644 index 0000000000..934cd688bb --- /dev/null +++ b/src/add-ons/kernel/busses/virtio/Jamfile @@ -0,0 +1,16 @@ +SubDir HAIKU_TOP src add-ons kernel busses virtio ; + +SubDirC++Flags -fno-rtti ; + +UsePrivateHeaders kernel virtio ; + +KernelAddon virtio_pci : + virtio_pci.cpp + + kernel_cpp.cpp + ; + +SEARCH on [ FGristFiles + kernel_cpp.cpp + ] = [ FDirName $(HAIKU_TOP) src system kernel util ] ; + diff --git a/src/add-ons/kernel/busses/virtio/virtio_pci.cpp b/src/add-ons/kernel/busses/virtio/virtio_pci.cpp new file mode 100644 index 0000000000..3c3a641475 --- /dev/null +++ b/src/add-ons/kernel/busses/virtio/virtio_pci.cpp @@ -0,0 +1,480 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + +#include +#include + +#include "virtio_pci.h" + + +//#define TRACE_VIRTIO +#ifdef TRACE_VIRTIO +# define TRACE(x...) dprintf("\33[33mvirtio_pci:\33[0m " x) +#else +# define TRACE(x...) ; +#endif +#define ERROR(x...) dprintf("\33[33mvirtio_pci:\33[0m " x) +#define CALLED() TRACE("CALLED %s\n", __PRETTY_FUNCTION__) + + +#define VIRTIO_PCI_DEVICE_MODULE_NAME "busses/virtio/virtio_pci/driver_v1" +#define VIRTIO_PCI_SIM_MODULE_NAME "busses/virtio/virtio_pci/device/v1" + +#define VIRTIO_PCI_CONTROLLER_TYPE_NAME "virtio pci controller" + + +typedef struct { + pci_device_module_info* pci; + pci_device* device; + uint16 config_base; + addr_t base_addr; + uint8 irq; + virtio_sim sim; + + device_node* node; +} virtio_pci_sim_info; + + +device_manager_info* gDeviceManager; +virtio_for_controller_interface* gVirtio; + + +int32 +virtio_pci_interrupt(void *data) +{ + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)data; + uint8 isr = bus->pci->read_io_8(bus->device, + bus->base_addr + VIRTIO_PCI_ISR); + if (isr == 0) + return B_UNHANDLED_INTERRUPT; + + if (isr & VIRTIO_PCI_ISR_CONFIG) + gVirtio->config_interrupt_handler(bus->sim); + + if (isr & VIRTIO_PCI_ISR_INTR) + gVirtio->queue_interrupt_handler(bus->sim, INT16_MAX); + + return B_HANDLED_INTERRUPT; +} + + +static void +set_sim(void* cookie, virtio_sim sim) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->sim = sim; +} + + +static status_t +read_host_features(void* cookie, uint32 *features) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + + TRACE("read_host_features() %p node %p pci %p device %p\n", bus, + bus->node, bus->pci, bus->device); + + *features = bus->pci->read_io_32(bus->device, + bus->base_addr + VIRTIO_PCI_HOST_FEATURES); + return B_OK; +} + + +static status_t +write_guest_features(void* cookie, uint32 features) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->pci->write_io_32(bus->device, bus->base_addr + + VIRTIO_PCI_GUEST_FEATURES, features); + return B_OK; +} + + +uint8 +get_status(void* cookie) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + return bus->pci->read_io_8(bus->device, bus->base_addr + + VIRTIO_PCI_STATUS); +} + + +void +set_status(void* cookie, uint8 status) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->pci->write_io_8(bus->device, bus->base_addr + VIRTIO_PCI_STATUS, + status); +} + + +status_t +read_device_config(void* cookie, uint8 _offset, void* _buffer, + size_t bufferSize) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + + addr_t offset = bus->base_addr + bus->config_base + _offset; + uint8* buffer = (uint8*)_buffer; + while (bufferSize > 0) { + uint8 size = 4; + if (bufferSize == 1) { + size = 1; + *buffer = bus->pci->read_io_8(bus->device, + offset); + } else if (bufferSize <= 3) { + size = 2; + *(uint16*)buffer = bus->pci->read_io_16(bus->device, + offset); + } else { + *(uint32*)buffer = bus->pci->read_io_32(bus->device, + offset); + } + buffer += size; + bufferSize -= size; + offset += size; + } + + return B_OK; +} + + +status_t +write_device_config(void* cookie, uint8 _offset, const void* _buffer, + size_t bufferSize) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + + addr_t offset = bus->base_addr + bus->config_base + _offset; + const uint8* buffer = (const uint8*)_buffer; + while (bufferSize > 0) { + uint8 size = 4; + if (bufferSize == 1) { + size = 1; + bus->pci->write_pci_config(bus->device, + offset, size, *buffer); + } else if (bufferSize <= 3) { + size = 2; + bus->pci->write_pci_config(bus->device, + offset, size, *(const uint16*)buffer); + } else { + bus->pci->write_pci_config(bus->device, + offset, size, *(const uint32*)buffer); + } + buffer += size; + bufferSize -= size; + offset += size; + } + return B_OK; +} + + +uint16 +get_queue_ring_size(void* cookie, uint16 queue) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->pci->write_io_16(bus->device, bus->base_addr + VIRTIO_PCI_QUEUE_SEL, + queue); + return bus->pci->read_io_16(bus->device, bus->base_addr + + VIRTIO_PCI_QUEUE_NUM); +} + + +status_t +setup_queue(void* cookie, uint16 queue, phys_addr_t phy) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->pci->write_io_16(bus->device, bus->base_addr + VIRTIO_PCI_QUEUE_SEL, + queue); + bus->pci->write_io_32(bus->device, bus->base_addr + VIRTIO_PCI_QUEUE_PFN, + (uint32)phy >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); + return B_OK; +} + + +status_t +setup_interrupt(void* cookie) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + + // setup interrupt handler + status_t status = install_io_interrupt_handler(bus->irq, + virtio_pci_interrupt, bus, 0); + if (status != B_OK) { + ERROR("can't install interrupt handler\n"); + return status; + } + + return B_OK; +} + + +void +notify_queue(void* cookie, uint16 queue) +{ + CALLED(); + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie; + bus->pci->write_io_16(bus->device, bus->base_addr + + VIRTIO_PCI_QUEUE_NOTIFY, queue); +} + + +// #pragma mark - + + +static status_t +init_bus(device_node* node, void** bus_cookie) +{ + CALLED(); + status_t status = B_OK; + + virtio_pci_sim_info* bus = new(std::nothrow) virtio_pci_sim_info; + if (bus == NULL) { + return B_NO_MEMORY; + } + + pci_device_module_info* pci; + pci_device* device; + + { + device_node* parent = gDeviceManager->get_parent_node(node); + device_node* pciParent = gDeviceManager->get_parent_node(parent); + gDeviceManager->get_driver(pciParent, (driver_module_info**)&pci, + (void**)&device); + gDeviceManager->put_node(pciParent); + gDeviceManager->put_node(parent); + } + + bus->node = node; + bus->pci = pci; + bus->device = device; + // TODO MSI implies 24 + bus->config_base = 20; + + pci_info pciInfo; + pci->get_pci_info(device, &pciInfo); + + // legacy interrupt + bus->base_addr = pciInfo.u.h0.base_registers[0]; + bus->irq = pciInfo.u.h0.interrupt_line; + if (bus->irq == 0 || bus->irq == 0xff) { + ERROR("PCI IRQ not assigned\n"); + return B_ERROR; + } + + // enable bus master and io + uint16 pcicmd = pci->read_pci_config(device, PCI_command, 2); + pcicmd &= ~(PCI_command_memory | PCI_command_int_disable); + pcicmd |= PCI_command_master | PCI_command_io; + pci->write_pci_config(device, PCI_command, 2, pcicmd); + + set_status(bus, VIRTIO_CONFIG_STATUS_RESET); + set_status(bus, VIRTIO_CONFIG_STATUS_ACK); + + TRACE("init_bus() %p node %p pci %p device %p\n", bus, node, + bus->pci, bus->device); + + *bus_cookie = bus; + return B_OK; +} + + +static void +uninit_bus(void* bus_cookie) +{ + virtio_pci_sim_info* bus = (virtio_pci_sim_info*)bus_cookie; + delete bus; +} + + +static void +bus_removed(void* bus_cookie) +{ + return; +} + + +// #pragma mark - + + +static status_t +register_child_devices(void* cookie) +{ + CALLED(); + device_node* node = (device_node*)cookie; + device_node* parent = gDeviceManager->get_parent_node(node); + pci_device_module_info* pci; + pci_device* device; + gDeviceManager->get_driver(parent, (driver_module_info**)&pci, + (void**)&device); + + uint16 pciSubDeviceId = pci->read_pci_config(device, PCI_subsystem_id, + 2); + + char prettyName[25]; + sprintf(prettyName, "Virtio Device %" B_PRIu16, pciSubDeviceId); + + device_attr attrs[] = { + // properties of this controller for virtio bus manager + { B_DEVICE_PRETTY_NAME, B_STRING_TYPE, + { string: prettyName }}, + { B_DEVICE_FIXED_CHILD, B_STRING_TYPE, + { string: VIRTIO_FOR_CONTROLLER_MODULE_NAME }}, + + // private data to identify the device + { VIRTIO_DEVICE_TYPE_ITEM, B_UINT16_TYPE, + { ui16: pciSubDeviceId }}, + { VIRTIO_VRING_ALIGNMENT_ITEM, B_UINT16_TYPE, + { ui16: VIRTIO_PCI_VRING_ALIGN }}, + { NULL } + }; + + return gDeviceManager->register_node(node, VIRTIO_PCI_SIM_MODULE_NAME, + attrs, NULL, &node); +} + + +static status_t +init_device(device_node* node, void** device_cookie) +{ + CALLED(); + *device_cookie = node; + return B_OK; +} + + +static status_t +register_device(device_node* parent) +{ + device_attr attrs[] = { + {B_DEVICE_PRETTY_NAME, B_STRING_TYPE, {string: "Virtio PCI"}}, + {} + }; + + return gDeviceManager->register_node(parent, VIRTIO_PCI_DEVICE_MODULE_NAME, + attrs, NULL, NULL); +} + + +static float +supports_device(device_node* parent) +{ + CALLED(); + const char* bus; + uint16 vendorID, deviceID; + + // make sure parent is a PCI Virtio device node + if (gDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false) != B_OK + || gDeviceManager->get_attr_uint16(parent, B_DEVICE_VENDOR_ID, + &vendorID, false) < B_OK + || gDeviceManager->get_attr_uint16(parent, B_DEVICE_ID, &deviceID, + false) < B_OK) + return -1; + + if (strcmp(bus, "pci") != 0) + return 0.0f; + + if (vendorID == VIRTIO_PCI_VENDORID) { + if (deviceID < VIRTIO_PCI_DEVICEID_MIN + && deviceID > VIRTIO_PCI_DEVICEID_MAX) { + return 0.0f; + } + + pci_device_module_info* pci; + pci_device* device; + gDeviceManager->get_driver(parent, (driver_module_info**)&pci, + (void**)&device); + uint8 pciSubDeviceId = pci->read_pci_config(device, PCI_revision, + 1); + if (pciSubDeviceId != VIRTIO_PCI_ABI_VERSION) + return 0.0f; + + TRACE("Virtio device found! vendor 0x%04x, device 0x%04x\n", vendorID, + deviceID); + return 0.8f; + } + + return 0.0f; +} + + +// #pragma mark - + + +module_dependency module_dependencies[] = { + { VIRTIO_FOR_CONTROLLER_MODULE_NAME, (module_info**)&gVirtio }, + { B_DEVICE_MANAGER_MODULE_NAME, (module_info**)&gDeviceManager }, + {} +}; + + +static virtio_sim_interface gVirtioPCIDeviceModule = { + { + { + VIRTIO_PCI_SIM_MODULE_NAME, + 0, + NULL + }, + + NULL, // supports device + NULL, // register device + init_bus, + uninit_bus, + NULL, // register child devices + NULL, // rescan + bus_removed, + }, + + set_sim, + read_host_features, + write_guest_features, + get_status, + set_status, + read_device_config, + write_device_config, + get_queue_ring_size, + setup_queue, + setup_interrupt, + notify_queue +}; + + +static driver_module_info sVirtioDevice = { + { + VIRTIO_PCI_DEVICE_MODULE_NAME, + 0, + NULL + }, + + supports_device, + register_device, + init_device, + NULL, // uninit + register_child_devices, + NULL, // rescan + NULL, // device removed +}; + +module_info* modules[] = { + (module_info* )&sVirtioDevice, + (module_info* )&gVirtioPCIDeviceModule, + NULL +}; + diff --git a/src/add-ons/kernel/busses/virtio/virtio_pci.h b/src/add-ons/kernel/busses/virtio/virtio_pci.h new file mode 100644 index 0000000000..485cf4ff5b --- /dev/null +++ b/src/add-ons/kernel/busses/virtio/virtio_pci.h @@ -0,0 +1,87 @@ +/*- + * Copyright IBM Corp. 2007 + * + * Authors: + * Anthony Liguori + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VIRTIO_PCI_H +#define _VIRTIO_PCI_H + +/* VirtIO PCI vendor/device ID. */ +#define VIRTIO_PCI_VENDORID 0x1AF4 +#define VIRTIO_PCI_DEVICEID_MIN 0x1000 +#define VIRTIO_PCI_DEVICEID_MAX 0x103F + +/* VirtIO ABI version, this must match exactly. */ +#define VIRTIO_PCI_ABI_VERSION 0 + +/* + * VirtIO Header, located in BAR 0. + */ +#define VIRTIO_PCI_HOST_FEATURES 0 /* host's supported features (32bit, RO)*/ +#define VIRTIO_PCI_GUEST_FEATURES 4 /* guest's supported features (32, RW) */ +#define VIRTIO_PCI_QUEUE_PFN 8 /* physical address of VQ (32, RW) */ +#define VIRTIO_PCI_QUEUE_NUM 12 /* number of ring entries (16, RO) */ +#define VIRTIO_PCI_QUEUE_SEL 14 /* current VQ selection (16, RW) */ +#define VIRTIO_PCI_QUEUE_NOTIFY 16 /* notify host regarding VQ (16, RW) */ +#define VIRTIO_PCI_STATUS 18 /* device status register (8, RW) */ +#define VIRTIO_PCI_ISR 19 /* interrupt status register, reading + * also clears the register (8, RO) */ +/* Only if MSIX is enabled: */ +#define VIRTIO_MSI_CONFIG_VECTOR 20 /* configuration change vector (16, RW) */ +#define VIRTIO_MSI_QUEUE_VECTOR 22 /* vector for selected VQ notifications + (16, RW) */ + +/* The bit of the ISR which indicates a device has an interrupt. */ +#define VIRTIO_PCI_ISR_INTR 0x1 +/* The bit of the ISR which indicates a device configuration change. */ +#define VIRTIO_PCI_ISR_CONFIG 0x2 +/* Vector value used to disable MSI for queue. */ +#define VIRTIO_MSI_NO_VECTOR 0xFFFF + +/* + * The remaining space is defined by each driver as the per-driver + * configuration space. + */ +#define VIRTIO_PCI_CONFIG(sc) \ + (((sc)->vtpci_flags & VTPCI_FLAG_MSIX) ? 24 : 20) + +/* + * How many bits to shift physical queue address written to QUEUE_PFN. + * 12 is historical, and due to x86 page size. + */ +#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 + +/* The alignment to use between consumer and producer parts of vring. */ +#define VIRTIO_PCI_VRING_ALIGN 4096 + +#endif /* _VIRTIO_PCI_H */ diff --git a/src/add-ons/kernel/drivers/audio/echo/midi.cpp b/src/add-ons/kernel/drivers/audio/echo/midi.cpp index d10d16dd55..f90302f56a 100644 --- a/src/add-ons/kernel/drivers/audio/echo/midi.cpp +++ b/src/add-ons/kernel/drivers/audio/echo/midi.cpp @@ -131,13 +131,15 @@ midi_read(void* cookie, off_t pos, void* ptr, size_t* nread) static status_t -midi_write(void* cookie, off_t pos, const void* ptr, size_t* nwritten) +midi_write(void* cookie, off_t pos, const void* ptr, size_t* _nwritten) { echo_dev *card = (echo_dev *) cookie; ECHOSTATUS err; + DWORD nwritten = *_nwritten; LOG(("midi_write()\n")); - err = card->pEG->WriteMidi(*nwritten, (PBYTE)ptr, nwritten); + err = card->pEG->WriteMidi(nwritten, (PBYTE)ptr, &nwritten); + *_nwritten = nwritten; return (err != ECHOSTATUS_OK) ? B_ERROR : B_OK; } diff --git a/src/add-ons/kernel/drivers/audio/echo/multi.cpp b/src/add-ons/kernel/drivers/audio/echo/multi.cpp index ffd364c897..9388550161 100644 --- a/src/add-ons/kernel/drivers/audio/echo/multi.cpp +++ b/src/add-ons/kernel/drivers/audio/echo/multi.cpp @@ -97,8 +97,8 @@ echo_channel_get_mix(void *card, MIXER_AUDIO_CHANNEL channel, int32 type, float } else { values[0] = function[0].Data.iNominal == 4 ? 1.0 : 0.0; } - PRINT(("echo_channel_get_mix iLevel: %ld, %d, %ld\n", function[0].Data.iLevel, - channel.wChannel, channel.dwType)); + PRINT(("echo_channel_get_mix iLevel: %" B_PRId32 ", %d, %" B_PRIu32 + "\n", function[0].Data.iLevel, channel.wChannel, channel.dwType)); } } @@ -134,8 +134,8 @@ echo_channel_set_mix(void *card, MIXER_AUDIO_CHANNEL channel, int32 type, float dev->pEG->ProcessMixerMultiFunction(multi_function, size); if (function[0].RtnStatus == ECHOSTATUS_OK) { - PRINT(("echo_channel_set_mix OK: %ld, %d, %ld\n", function[0].Data.iLevel, - channel.wChannel, channel.dwType)); + PRINT(("echo_channel_set_mix OK: %" B_PRId32 ", %d, %" B_PRIu32 "\n", + function[0].Data.iLevel, channel.wChannel, channel.dwType)); } } @@ -242,7 +242,7 @@ echo_create_controls_list(multi_dev *multi) } multi->control_count = index; - PRINT(("multi->control_count %lu\n", multi->control_count)); + PRINT(("multi->control_count %" B_PRIu32 "\n", multi->control_count)); return B_OK; } @@ -256,7 +256,8 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi) for (i = 0; i < mmvi->item_count; i++) { id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { - PRINT(("echo_get_mix : invalid control id requested : %li\n", id)); + PRINT(("echo_get_mix : invalid control id requested : %" B_PRIu32 + "\n", id)); continue; } control = &card->multi.controls[id]; @@ -297,7 +298,8 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi) for (i = 0; i < mmvi->item_count; i++) { id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { - PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); + PRINT(("echo_set_mix : invalid control id requested : %" B_PRIu32 + "\n", id)); continue; } control = &card->multi.controls[id]; @@ -307,7 +309,8 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi) if (i + 1 < mmvi->item_count) { id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { - PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); + PRINT(("echo_set_mix : invalid control id requested : %" + B_PRIu32 "\n", id)); } else { control2 = &card->multi.controls[id]; if (control2->mix_control.master != control->mix_control.id) @@ -995,21 +998,21 @@ echo_open(const char *name, uint32 flags, void** cookie) value = strtoul (item, &end, 0); if (*end == '\0') current_settings.sample_rate = value; } - PRINT(("sample_rate %lu\n", current_settings.sample_rate)); + PRINT(("sample_rate %" B_PRIu32 "\n", current_settings.sample_rate)); item = get_driver_parameter (settings_handle, "buffer_frames", NULL, NULL); if (item) { value = strtoul (item, &end, 0); if (*end == '\0') current_settings.buffer_frames = value; } - PRINT(("buffer_frames %lu\n", current_settings.buffer_frames)); + PRINT(("buffer_frames %" B_PRIu32 "\n", current_settings.buffer_frames)); item = get_driver_parameter (settings_handle, "buffer_count", NULL, NULL); if (item) { value = strtoul (item, &end, 0); if (*end == '\0') current_settings.buffer_count = value; } - PRINT(("buffer_count %lu\n", current_settings.buffer_count)); + PRINT(("buffer_count %" B_PRId32 "\n", current_settings.buffer_count)); unload_driver_settings (settings_handle); } diff --git a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c index c69a304382..713554615d 100644 --- a/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c +++ b/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c @@ -353,12 +353,12 @@ emuxki_mem_free(emuxki_dev *card, void *ptr) static void emuxki_chanparms_set_defaults(emuxki_channel *chan) { - chan->fxsend.a.level = chan->fxsend.b.level = - chan->fxsend.c.level = chan->fxsend.d.level = + chan->fxsend.a.level = chan->fxsend.b.level + = chan->fxsend.c.level = chan->fxsend.d.level /* for audigy */ - chan->fxsend.e.level = chan->fxsend.f.level = - chan->fxsend.g.level = chan->fxsend.h.level = - IS_AUDIGY(&chan->voice->stream->card->config) ? 0xc0 : 0xff; /* not max */ + = chan->fxsend.e.level = chan->fxsend.f.level + = chan->fxsend.g.level = chan->fxsend.h.level + = IS_AUDIGY(&chan->voice->stream->card->config) ? 0xc0 : 0xff; /* not max */ chan->fxsend.a.dest = 0x0; chan->fxsend.b.dest = 0x1; diff --git a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp index d430080f19..3199d03d02 100644 --- a/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp +++ b/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp @@ -49,7 +49,7 @@ static char **gDeviceNames = NULL; static status_t usb_raw_device_added(usb_device newDevice, void **cookie) { - TRACE((DRIVER_NAME": device_added(0x%08lx)\n", newDevice)); + TRACE((DRIVER_NAME": device_added(0x%08" B_PRIx32 ")\n", newDevice)); raw_device *device = (raw_device *)malloc(sizeof(raw_device)); mutex_init(&device->lock, "usb_raw device lock"); @@ -66,7 +66,7 @@ usb_raw_device_added(usb_device newDevice, void **cookie) if (gUSBModule->usb_ioctl('DNAM', deviceName, sizeof(deviceName)) >= B_OK) { snprintf(device->name, sizeof(device->name), "bus/usb/%s", deviceName); } else { - snprintf(device->name, sizeof(device->name), "bus/usb/%08lx", + snprintf(device->name, sizeof(device->name), "bus/usb/%08" B_PRIx32, newDevice); } @@ -79,7 +79,7 @@ usb_raw_device_added(usb_device newDevice, void **cookie) gDeviceCount++; mutex_unlock(&gDeviceListLock); - TRACE((DRIVER_NAME": new device: 0x%08lx\n", (uint32)device)); + TRACE((DRIVER_NAME": new device: 0x%p\n", device)); *cookie = (void *)device; return B_OK; } @@ -88,7 +88,7 @@ usb_raw_device_added(usb_device newDevice, void **cookie) static status_t usb_raw_device_removed(void *cookie) { - TRACE((DRIVER_NAME": device_removed(0x%08lx)\n", (uint32)cookie)); + TRACE((DRIVER_NAME": device_removed(0x%p)\n", cookie)); raw_device *device = (raw_device *)cookie; mutex_lock(&gDeviceListLock); @@ -825,7 +825,8 @@ init_driver() status_t result = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); if (result < B_OK) { - TRACE((DRIVER_NAME": getting module failed 0x%08lx\n", result)); + TRACE((DRIVER_NAME": getting module failed 0x%08" B_PRIx32 "\n", + result)); mutex_destroy(&gDeviceListLock); return result; } diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp index 0f19f99826..b24a77ce04 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp @@ -18,7 +18,7 @@ #define DRIVER_NAME "usb_floppy" #define DEVICE_NAME_BASE "disk/ufi/" -#define DEVICE_NAME DEVICE_NAME_BASE"%ld/%d/raw" +#define DEVICE_NAME DEVICE_NAME_BASE "%" B_PRId32 "/%d/raw" //#define TRACE_USB_DISK @@ -113,7 +113,7 @@ status_t usb_disk_transfer_data(disk_device *device, bool directionIn, status_t usb_disk_receive_csw(disk_device *device, command_status_wrapper *status); status_t usb_disk_operation(device_lun *lun, uint8* operation, - void *data, uint32 *dataLength, + void *data, size_t *dataLength, bool directionIn); status_t usb_disk_send_diagnostic(device_lun *lun); @@ -194,7 +194,7 @@ usb_disk_transfer_data(disk_device *device, bool directionIn, void *data, void -usb_disk_interrupt(void* cookie, int32 status, void* data, uint32 length) +usb_disk_interrupt(void* cookie, int32 status, void* data, size_t length) { disk_device* dev = (disk_device*)cookie; // We release the lock even if the interrupt is invalid. This way there @@ -202,7 +202,8 @@ usb_disk_interrupt(void* cookie, int32 status, void* data, uint32 length) release_sem(dev->interruptLock); if (length != 2) { - TRACE_ALWAYS("interrupt of length %ld! (expected 2)\n", length); + TRACE_ALWAYS("interrupt of length %" B_PRIuSIZE "! (expected 2)\n", + length); // In this case we do not reschedule the interrupt. This means the // driver will be locked. The interrupt should perhaps be scheduled // when starting a transfer instead. But getting there means something @@ -234,7 +235,7 @@ usb_disk_receive_csw(disk_device *device, command_status_wrapper *status) status_t usb_disk_operation(device_lun *lun, uint8* operation, - void *data, uint32 *dataLength, bool directionIn) + void *data, size_t *dataLength, bool directionIn) { // TODO: remove transferLength TRACE("operation: lun: %u; op: 0x%x; data: %p; dlen: %p (%lu); in: %c\n", @@ -342,7 +343,7 @@ usb_disk_send_diagnostic(device_lun *lun) status_t usb_disk_request_sense(device_lun *lun) { - uint32 dataLength = sizeof(scsi_request_sense_6_parameter); + size_t dataLength = sizeof(scsi_request_sense_6_parameter); uint8 commandBlock[12]; memset(commandBlock, 0, sizeof(commandBlock)); @@ -413,7 +414,7 @@ usb_disk_request_sense(device_lun *lun) status_t usb_disk_mode_sense(device_lun *lun) { - uint32 dataLength = sizeof(scsi_mode_sense_6_parameter); + size_t dataLength = sizeof(scsi_mode_sense_6_parameter); uint8 commandBlock[12]; memset(commandBlock, 0, sizeof(commandBlock)); @@ -459,7 +460,7 @@ usb_disk_test_unit_ready(device_lun *lun) status_t usb_disk_inquiry(device_lun *lun) { - uint32 dataLength = sizeof(scsi_inquiry_6_parameter); + size_t dataLength = sizeof(scsi_inquiry_6_parameter); uint8 commandBlock[12]; memset(commandBlock, 0, sizeof(commandBlock)); @@ -526,7 +527,7 @@ usb_disk_reset_capacity(device_lun *lun) status_t usb_disk_update_capacity(device_lun *lun) { - uint32 dataLength = sizeof(scsi_read_capacity_10_parameter); + size_t dataLength = sizeof(scsi_read_capacity_10_parameter); scsi_read_capacity_10_parameter parameter; status_t result = B_ERROR; @@ -668,8 +669,8 @@ usb_disk_device_added(usb_device newDevice, void **cookie) mutex_init(&device->lock, "usb_disk device lock"); - status_t result = device->notify = - create_sem(0, "usb_disk callback notify"); + status_t result = device->notify + = create_sem(0, "usb_disk callback notify"); if (result < B_OK) { mutex_destroy(&device->lock); @@ -1172,7 +1173,7 @@ usb_disk_ioctl(void *cookie, uint32 op, void *buffer, size_t length) #endif default: - TRACE_ALWAYS("unhandled ioctl %ld\n", op); + TRACE_ALWAYS("unhandled ioctl %" B_PRIu32 "\n", op); break; } @@ -1223,7 +1224,7 @@ usb_disk_read(void *cookie, off_t position, void *buffer, size_t *length) } *length = 0; - TRACE_ALWAYS("read fails with 0x%08lx\n", result); + TRACE_ALWAYS("read fails with 0x%08" B_PRIx32 "\n", result); return result; } @@ -1274,7 +1275,7 @@ usb_disk_write(void *cookie, off_t position, const void *buffer, } *length = 0; - TRACE_ALWAYS("write fails with 0x%08lx\n", result); + TRACE_ALWAYS("write fails with 0x%08" B_PRIx32 "\n", result); return result; } @@ -1314,7 +1315,7 @@ init_driver() status_t result = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); if (result < B_OK) { - TRACE_ALWAYS("getting module failed 0x%08lx\n", result); + TRACE_ALWAYS("getting module failed 0x%08" B_PRIx32 "\n", result); mutex_destroy(&gDeviceListLock); return result; } diff --git a/src/add-ons/kernel/drivers/disk/virtual/Jamfile b/src/add-ons/kernel/drivers/disk/virtual/Jamfile index 7952c77f19..6165da530d 100644 --- a/src/add-ons/kernel/drivers/disk/virtual/Jamfile +++ b/src/add-ons/kernel/drivers/disk/virtual/Jamfile @@ -3,3 +3,4 @@ SubDir HAIKU_TOP src add-ons kernel drivers disk virtual ; #SubInclude HAIKU_TOP src add-ons kernel drivers disk virtual fmap ; SubInclude HAIKU_TOP src add-ons kernel drivers disk virtual nbd ; SubInclude HAIKU_TOP src add-ons kernel drivers disk virtual remote_disk ; +SubInclude HAIKU_TOP src add-ons kernel drivers disk virtual virtio_block ; diff --git a/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c b/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c index f3cc5e8dbe..21068357dd 100644 --- a/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c +++ b/src/add-ons/kernel/drivers/disk/virtual/nbd/nbd.c @@ -174,7 +174,8 @@ status_t nbd_alloc_request(struct nbd_device *dev, struct nbd_request_entry **re struct nbd_request_entry *r; status_t err = EINVAL; uint64 handle; - PRINT((DP ">%s(%ld, %Ld, %ld)\n", __FUNCTION__, type, from, len)); + PRINT((DP ">%s(%" B_PRIu32 ", %" B_PRIdOFF ", %ld)\n", __FUNCTION__, type, + from, len)); if (type != NBD_CMD_READ && type != NBD_CMD_WRITE && type != NBD_CMD_DISC) return err; @@ -223,14 +224,14 @@ status_t nbd_alloc_request(struct nbd_device *dev, struct nbd_request_entry **re err1: free(r); err0: - dprintf(DP " %s: error 0x%08lx\n", __FUNCTION__, err); + dprintf(DP " %s: error 0x%08" B_PRIx32 "\n", __FUNCTION__, err); return err; } status_t nbd_queue_request(struct nbd_device *dev, struct nbd_request_entry *req) { - PRINT((DP ">%s(handle:%Ld)\n", __FUNCTION__, req->handle)); + PRINT((DP ">%s(handle:%" B_PRIu64 ")\n", __FUNCTION__, req->handle)); req->next = dev->reqs; dev->reqs = req; return B_OK; @@ -240,7 +241,7 @@ status_t nbd_queue_request(struct nbd_device *dev, struct nbd_request_entry *req status_t nbd_dequeue_request(struct nbd_device *dev, uint64 handle, struct nbd_request_entry **req) { struct nbd_request_entry *r, *prev; - PRINT((DP ">%s(handle:%Ld)\n", __FUNCTION__, handle)); + PRINT((DP ">%s(handle:%" B_PRIu64 ")\n", __FUNCTION__, handle)); r = dev->reqs; prev = NULL; while (r && r->handle != handle) { @@ -262,7 +263,7 @@ status_t nbd_dequeue_request(struct nbd_device *dev, uint64 handle, struct nbd_r status_t nbd_free_request(struct nbd_device *dev, struct nbd_request_entry *req) { - PRINT((DP ">%s(handle:%Ld)\n", __FUNCTION__, req->handle)); + PRINT((DP ">%s(handle:%" B_PRIu64 ")\n", __FUNCTION__, req->handle)); delete_sem(req->sem); free(req); return B_OK; @@ -354,7 +355,7 @@ int32 nbd_postoffice(void *arg) return 0; err: - dprintf(DP "%s: %s: error 0x%08lx\n", __FUNCTION__, reason, err); + dprintf(DP "%s: %s: error 0x%08" B_PRIx32 "\n", __FUNCTION__, reason, err); return err; } @@ -397,7 +398,8 @@ status_t nbd_connect(struct nbd_device *dev) dev->size = B_BENDIAN_TO_HOST_INT64(initpkt.device_size); - dprintf(DP " %s: connected, device size %Ld bytes.\n", __FUNCTION__, dev->size); + dprintf(DP " %s: connected, device size %" B_PRIu64 " bytes.\n", + __FUNCTION__, dev->size); err = dev->postoffice = spawn_kernel_thread(nbd_postoffice, "nbd postoffice", B_REAL_TIME_PRIORITY, dev); if (err < B_OK) @@ -415,7 +417,7 @@ err1: kclosesocket(dev->sock); dev->sock = -1; err0: - dprintf(DP "<%s: error 0x%08lx\n", __FUNCTION__, err); + dprintf(DP "<%s: error 0x%08" B_PRIx32 "\n", __FUNCTION__, err); return err; } @@ -435,7 +437,7 @@ status_t nbd_teardown(struct nbd_device *dev) status_t nbd_post_request(struct nbd_device *dev, struct nbd_request_entry *req) { status_t err; - PRINT((DP ">%s(handle:%Ld)\n", __FUNCTION__, req->handle)); + PRINT((DP ">%s(handle:%" B_PRIu64 ")\n", __FUNCTION__, req->handle)); err = ksend(dev->sock, &req->req, sizeof(req->req), 0); if (err < 0) @@ -466,7 +468,7 @@ status_t nbd_open(const char *name, uint32 flags, cookie_t **cookie) { int kfd; #endif struct nbd_device *dev = NULL; - PRINT((DP ">%s(%s, %lx, )\n", __FUNCTION__, name, flags)); + PRINT((DP ">%s(%s, %" B_PRIx32 ", )\n", __FUNCTION__, name, flags)); (void)name; (void)flags; dev = nbd_find_device(name); if (!dev || !dev->valid) @@ -509,7 +511,7 @@ err2: err1: free(*cookie); err0: - dprintf(DP " %s: error 0x%08lx\n", __FUNCTION__, err); + dprintf(DP " %s: error 0x%08" B_PRIx32 "\n", __FUNCTION__, err); return err; } @@ -564,7 +566,8 @@ status_t nbd_free(cookie_t *cookie) { status_t nbd_control(cookie_t *cookie, uint32 op, void *data, size_t len) { - PRINT((DP ">%s(%d, %lu, , %ld)\n", __FUNCTION__, WHICH(cookie->dev), op, len)); + PRINT((DP ">%s(%d, %" B_PRIu32 ", , %ld)\n", __FUNCTION__, + WHICH(cookie->dev), op, len)); switch (op) { case B_GET_DEVICE_SIZE: /* this one is broken anyway... */ if (data) { @@ -623,7 +626,8 @@ status_t nbd_read(cookie_t *cookie, off_t position, void *data, size_t *numbytes struct nbd_device *dev = cookie->dev; struct nbd_request_entry *req; status_t err, semerr; - PRINT((DP ">%s(%d, %Ld, , )\n", __FUNCTION__, WHICH(cookie->dev), position)); + PRINT((DP ">%s(%d, %" B_PRIdOFF ", , )\n", __FUNCTION__, + WHICH(cookie->dev), position)); if (position < 0) return EINVAL; @@ -692,7 +696,8 @@ status_t nbd_write(cookie_t *cookie, off_t position, const void *data, size_t *n struct nbd_device *dev = cookie->dev; struct nbd_request_entry *req; status_t err, semerr; - PRINT((DP ">%s(%d, %Ld, %ld, )\n", __FUNCTION__, WHICH(cookie->dev), position, *numbytes)); + PRINT((DP ">%s(%d, %" B_PRIdOFF ", %ld, )\n", __FUNCTION__, + WHICH(cookie->dev), position, *numbytes)); if (position < 0) return EINVAL; diff --git a/src/add-ons/kernel/drivers/disk/virtual/virtio_block/Jamfile b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/Jamfile new file mode 100644 index 0000000000..9bfba08da9 --- /dev/null +++ b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/Jamfile @@ -0,0 +1,9 @@ +SubDir HAIKU_TOP src add-ons kernel drivers disk virtual virtio_block ; + +UsePrivateKernelHeaders ; +UsePrivateHeaders drivers virtio ; +SubDirHdrs $(HAIKU_TOP) src system kernel device_manager ; + +KernelAddon virtio_block : + virtio_block.cpp +; diff --git a/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_blk.h b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_blk.h new file mode 100644 index 0000000000..fdac9e5e5f --- /dev/null +++ b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_blk.h @@ -0,0 +1,117 @@ +/*- + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VIRTIO_BLK_H +#define _VIRTIO_BLK_H + +/* Feature bits */ +#define VIRTIO_BLK_F_BARRIER 0x0001 /* Does host support barriers? */ +#define VIRTIO_BLK_F_SIZE_MAX 0x0002 /* Indicates maximum segment size */ +#define VIRTIO_BLK_F_SEG_MAX 0x0004 /* Indicates maximum # of segments */ +#define VIRTIO_BLK_F_GEOMETRY 0x0010 /* Legacy geometry available */ +#define VIRTIO_BLK_F_RO 0x0020 /* Disk is read-only */ +#define VIRTIO_BLK_F_BLK_SIZE 0x0040 /* Block size of disk is available*/ +#define VIRTIO_BLK_F_SCSI 0x0080 /* Supports scsi command passthru */ +#define VIRTIO_BLK_F_FLUSH 0x0200 /* Cache flush command support */ +#define VIRTIO_BLK_F_TOPOLOGY 0x0400 /* Topology information is available */ + +#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ + +struct virtio_blk_config { + /* The capacity (in 512-byte sectors). */ + uint64_t capacity; + /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ + uint32_t size_max; + /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ + uint32_t seg_max; + /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ + struct virtio_blk_geometry { + uint16_t cylinders; + uint8_t heads; + uint8_t sectors; + } geometry; + + /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ + uint32_t blk_size; +} __packed; + +/* + * Command types + * + * Usage is a bit tricky as some bits are used as flags and some are not. + * + * Rules: + * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or + * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own + * and may not be combined with any of the other flags. + */ + +/* These two define direction. */ +#define VIRTIO_BLK_T_IN 0 +#define VIRTIO_BLK_T_OUT 1 + +/* This bit says it's a scsi command, not an actual read or write. */ +#define VIRTIO_BLK_T_SCSI_CMD 2 + +/* Cache flush command */ +#define VIRTIO_BLK_T_FLUSH 4 + +/* Get device ID command */ +#define VIRTIO_BLK_T_GET_ID 8 + +/* Barrier before this op. */ +#define VIRTIO_BLK_T_BARRIER 0x80000000 + +/* ID string length */ +#define VIRTIO_BLK_ID_BYTES 20 + +/* This is the first element of the read scatter-gather list. */ +struct virtio_blk_outhdr { + /* VIRTIO_BLK_T* */ + uint32_t type; + /* io priority. */ + uint32_t ioprio; + /* Sector (ie. 512 byte offset) */ + uint64_t sector; +}; + +struct virtio_scsi_inhdr { + uint32_t errors; + uint32_t data_len; + uint32_t sense_len; + uint32_t residual; +}; + +/* And this is the final byte of the write scatter-gather list. */ +#define VIRTIO_BLK_S_OK 0 +#define VIRTIO_BLK_S_IOERR 1 +#define VIRTIO_BLK_S_UNSUPP 2 + +#endif /* _VIRTIO_BLK_H */ diff --git a/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_block.cpp b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_block.cpp new file mode 100644 index 0000000000..9198214b47 --- /dev/null +++ b/src/add-ons/kernel/drivers/disk/virtual/virtio_block/virtio_block.cpp @@ -0,0 +1,662 @@ +/* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include "virtio_blk.h" + + +struct DMAResource; +struct IOScheduler; + + +static const uint8 kDriveIcon[] = { + 0x6e, 0x63, 0x69, 0x66, 0x08, 0x03, 0x01, 0x00, 0x00, 0x02, 0x00, 0x16, + 0x02, 0x3c, 0xc7, 0xee, 0x38, 0x9b, 0xc0, 0xba, 0x16, 0x57, 0x3e, 0x39, + 0xb0, 0x49, 0x77, 0xc8, 0x42, 0xad, 0xc7, 0x00, 0xff, 0xff, 0xd3, 0x02, + 0x00, 0x06, 0x02, 0x3c, 0x96, 0x32, 0x3a, 0x4d, 0x3f, 0xba, 0xfc, 0x01, + 0x3d, 0x5a, 0x97, 0x4b, 0x57, 0xa5, 0x49, 0x84, 0x4d, 0x00, 0x47, 0x47, + 0x47, 0xff, 0xa5, 0xa0, 0xa0, 0x02, 0x00, 0x16, 0x02, 0xbc, 0x59, 0x2f, + 0xbb, 0x29, 0xa7, 0x3c, 0x0c, 0xe4, 0xbd, 0x0b, 0x7c, 0x48, 0x92, 0xc0, + 0x4b, 0x79, 0x66, 0x00, 0x7d, 0xff, 0xd4, 0x02, 0x00, 0x06, 0x02, 0x38, + 0xdb, 0xb4, 0x39, 0x97, 0x33, 0xbc, 0x4a, 0x33, 0x3b, 0xa5, 0x42, 0x48, + 0x6e, 0x66, 0x49, 0xee, 0x7b, 0x00, 0x59, 0x67, 0x56, 0xff, 0xeb, 0xb2, + 0xb2, 0x03, 0xa7, 0xff, 0x00, 0x03, 0xff, 0x00, 0x00, 0x04, 0x01, 0x80, + 0x07, 0x0a, 0x06, 0x22, 0x3c, 0x22, 0x49, 0x44, 0x5b, 0x5a, 0x3e, 0x5a, + 0x31, 0x39, 0x25, 0x0a, 0x04, 0x22, 0x3c, 0x44, 0x4b, 0x5a, 0x31, 0x39, + 0x25, 0x0a, 0x04, 0x44, 0x4b, 0x44, 0x5b, 0x5a, 0x3e, 0x5a, 0x31, 0x0a, + 0x04, 0x22, 0x3c, 0x22, 0x49, 0x44, 0x5b, 0x44, 0x4b, 0x08, 0x02, 0x27, + 0x43, 0xb8, 0x14, 0xc1, 0xf1, 0x08, 0x02, 0x26, 0x43, 0x29, 0x44, 0x0a, + 0x05, 0x44, 0x5d, 0x49, 0x5d, 0x60, 0x3e, 0x5a, 0x3b, 0x5b, 0x3f, 0x08, + 0x0a, 0x07, 0x01, 0x06, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x10, 0x01, 0x17, + 0x84, 0x00, 0x04, 0x0a, 0x01, 0x01, 0x01, 0x00, 0x0a, 0x02, 0x01, 0x02, + 0x00, 0x0a, 0x03, 0x01, 0x03, 0x00, 0x0a, 0x04, 0x01, 0x04, 0x10, 0x01, + 0x17, 0x85, 0x20, 0x04, 0x0a, 0x06, 0x01, 0x05, 0x30, 0x24, 0xb3, 0x99, + 0x01, 0x17, 0x82, 0x00, 0x04, 0x0a, 0x05, 0x01, 0x05, 0x30, 0x20, 0xb2, + 0xe6, 0x01, 0x17, 0x82, 0x00, 0x04 +}; + + +#define VIRTIO_BLOCK_DRIVER_MODULE_NAME "drivers/disk/virtual/virtio_block/driver_v1" +#define VIRTIO_BLOCK_DEVICE_MODULE_NAME "drivers/disk/virtual/virtio_block/device_v1" +#define VIRTIO_BLOCK_DEVICE_ID_GENERATOR "virtio_block/device_id" + + +typedef struct { + device_node* node; + ::virtio_device virtio_device; + virtio_device_interface* virtio; + ::virtio_queue virtio_queue; + IOScheduler* io_scheduler; + DMAResource* dma_resource; + + struct virtio_blk_config config; + + uint32 features; + uint64 capacity; + uint32 block_size; + + sem_id sem_cb; +} virtio_block_driver_info; + + +typedef struct { + virtio_block_driver_info* info; +} virtio_block_handle; + + +#include +#include +#include + +#include + +#include "dma_resources.h" +#include "IORequest.h" +#include "IOSchedulerSimple.h" + + +//#define TRACE_VIRTIO_BLOCK +#ifdef TRACE_VIRTIO_BLOCK +# define TRACE(x...) dprintf("virtio_block: " x) +#else +# define TRACE(x...) ; +#endif +#define ERROR(x...) dprintf("\33[33mvirtio_block:\33[0m " x) +#define CALLED() TRACE("CALLED %s\n", __PRETTY_FUNCTION__) + + +static device_manager_info* sDeviceManager; + + +void virtio_block_set_capacity(virtio_block_driver_info* info, uint64 capacity, + uint32 blockSize); + + +const char * +get_feature_name(uint32 feature) +{ + switch (feature) { + case VIRTIO_BLK_F_BARRIER: + return "host barrier"; + case VIRTIO_BLK_F_SIZE_MAX: + return "maximum segment size"; + case VIRTIO_BLK_F_SEG_MAX: + return "maximum segment count"; + case VIRTIO_BLK_F_GEOMETRY: + return "disk geometry"; + case VIRTIO_BLK_F_RO: + return "read only"; + case VIRTIO_BLK_F_BLK_SIZE: + return "block size"; + case VIRTIO_BLK_F_SCSI: + return "scsi commands"; + case VIRTIO_BLK_F_FLUSH: + return "flush command"; + case VIRTIO_BLK_F_TOPOLOGY: + return "topology"; + } + return NULL; +} + + +static status_t +get_geometry(virtio_block_handle* handle, device_geometry* geometry) +{ + virtio_block_driver_info* info = handle->info; + + devfs_compute_geometry_size(geometry, info->capacity, info->block_size); + + geometry->device_type = B_DISK; + geometry->removable = false; + + geometry->read_only = ((info->features & VIRTIO_BLK_F_RO) != 0); + geometry->write_once = false; + + TRACE("virtio_block: get_geometry(): %ld, %ld, %ld, %ld, %d, %d, %d, %d\n", + geometry->bytes_per_sector, geometry->sectors_per_track, + geometry->cylinder_count, geometry->head_count, geometry->device_type, + geometry->removable, geometry->read_only, geometry->write_once); + + return B_OK; +} + + +static int +log2(uint32 x) +{ + int y; + + for (y = 31; y >= 0; --y) { + if (x == ((uint32)1 << y)) + break; + } + + return y; +} + + +static void +virtio_block_callback(void* cookie) +{ + virtio_block_driver_info* info = (virtio_block_driver_info*)cookie; + + release_sem(info->sem_cb); +} + + +static status_t +do_io(void* cookie, IOOperation* operation) +{ + virtio_block_driver_info* info = (virtio_block_driver_info*)cookie; + + size_t bytesTransferred = 0; + status_t status = B_OK; + + physical_entry entries[operation->VecCount() + 2]; + + void *buffer = malloc(sizeof(struct virtio_blk_outhdr) + sizeof(uint8)); + struct virtio_blk_outhdr *header = (struct virtio_blk_outhdr*)buffer; + header->type = operation->IsWrite() ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN; + header->sector = operation->Offset() / 512; + header->ioprio = 1; + + uint8* ack = (uint8*)buffer + sizeof(struct virtio_blk_outhdr); + *ack = 0xff; + + get_memory_map(buffer, sizeof(struct virtio_blk_outhdr) + sizeof(uint8), + &entries[0], 1); + entries[operation->VecCount() + 1].address = entries[0].address + + sizeof(struct virtio_blk_outhdr); + entries[operation->VecCount() + 1].size = sizeof(uint8); + entries[0].size = sizeof(struct virtio_blk_outhdr); + + memcpy(entries + 1, operation->Vecs(), operation->VecCount() + * sizeof(physical_entry)); + + info->virtio->queue_request_v(info->virtio_queue, entries, + 1 + (operation->IsWrite() ? operation->VecCount() : 0 ), + 1 + (operation->IsWrite() ? 0 : operation->VecCount()), + virtio_block_callback, info); + + acquire_sem(info->sem_cb); + + switch (*ack) { + case VIRTIO_BLK_S_OK: + status = B_OK; + bytesTransferred = operation->Length(); + break; + case VIRTIO_BLK_S_UNSUPP: + status = ENOTSUP; + break; + default: + status = EIO; + break; + } + free(buffer); + + info->io_scheduler->OperationCompleted(operation, status, + bytesTransferred); + return status; +} + + +// #pragma mark - device module API + + +static status_t +virtio_block_init_device(void* _info, void** _cookie) +{ + CALLED(); + virtio_block_driver_info* info = (virtio_block_driver_info*)_info; + + device_node* parent = sDeviceManager->get_parent_node(info->node); + sDeviceManager->get_driver(parent, (driver_module_info **)&info->virtio, + (void **)&info->virtio_device); + sDeviceManager->put_node(parent); + + info->virtio->negociate_features(info->virtio_device, + VIRTIO_BLK_F_BARRIER | VIRTIO_BLK_F_SIZE_MAX + | VIRTIO_BLK_F_SEG_MAX | VIRTIO_BLK_F_GEOMETRY + | VIRTIO_BLK_F_RO | VIRTIO_BLK_F_BLK_SIZE + | VIRTIO_BLK_F_FLUSH | VIRTIO_FEATURE_RING_INDIRECT_DESC, + &info->features, &get_feature_name); + + status_t status = info->virtio->read_device_config( + info->virtio_device, 0, &info->config, + sizeof(struct virtio_blk_config)); + if (status != B_OK) + return status; + + // and get (initial) capacity + uint32 block_size = 512; + if ((info->features & VIRTIO_BLK_F_BLK_SIZE) != 0) + block_size = info->config.blk_size; + uint64 capacity = info->config.capacity * 512 / block_size; + + virtio_block_set_capacity(info, capacity, block_size); + + TRACE("virtio_block: capacity: %" B_PRIu64 ", block_size %" B_PRIu32 "\n", + info->capacity, info->block_size); + + status = info->virtio->alloc_queues(info->virtio_device, 1, + &info->virtio_queue); + if (status != B_OK) { + ERROR("queue allocation failed (%s)\n", strerror(status)); + return status; + } + status = info->virtio->setup_interrupt(info->virtio_device, NULL, NULL); + + *_cookie = info; + return status; +} + + +static void +virtio_block_uninit_device(void* _cookie) +{ + CALLED(); + virtio_block_driver_info* info = (virtio_block_driver_info*)_cookie; + + delete info->io_scheduler; + delete info->dma_resource; +} + + +static status_t +virtio_block_open(void* _info, const char* path, int openMode, void** _cookie) +{ + CALLED(); + virtio_block_driver_info* info = (virtio_block_driver_info*)_info; + + virtio_block_handle* handle = (virtio_block_handle*)malloc( + sizeof(virtio_block_handle)); + if (handle == NULL) + return B_NO_MEMORY; + + handle->info = info; + + *_cookie = handle; + return B_OK; +} + + +static status_t +virtio_block_close(void* cookie) +{ + //virtio_block_handle* handle = (virtio_block_handle*)cookie; + CALLED(); + + return B_OK; +} + + +static status_t +virtio_block_free(void* cookie) +{ + CALLED(); + virtio_block_handle* handle = (virtio_block_handle*)cookie; + + free(handle); + return B_OK; +} + + +static status_t +virtio_block_read(void* cookie, off_t pos, void* buffer, size_t* _length) +{ + CALLED(); + virtio_block_handle* handle = (virtio_block_handle*)cookie; + size_t length = *_length; + + IORequest request; + status_t status = request.Init(pos, (addr_t)buffer, length, false, 0); + if (status != B_OK) + return status; + + status = handle->info->io_scheduler->ScheduleRequest(&request); + if (status != B_OK) + return status; + + status = request.Wait(0, 0); + if (status == B_OK) + *_length = length; + else + dprintf("read(): request.Wait() returned: %s\n", strerror(status)); + + return status; +} + + +static status_t +virtio_block_write(void* cookie, off_t pos, const void* buffer, + size_t* _length) +{ + CALLED(); + virtio_block_handle* handle = (virtio_block_handle*)cookie; + size_t length = *_length; + + IORequest request; + status_t status = request.Init(pos, (addr_t)buffer, length, true, 0); + if (status != B_OK) + return status; + + status = handle->info->io_scheduler->ScheduleRequest(&request); + if (status != B_OK) + return status; + + status = request.Wait(0, 0); + if (status == B_OK) + *_length = length; + else + dprintf("write(): request.Wait() returned: %s\n", strerror(status)); + + return status; +} + + +static status_t +virtio_block_io(void *cookie, io_request *request) +{ + CALLED(); + virtio_block_handle* handle = (virtio_block_handle*)cookie; + + return handle->info->io_scheduler->ScheduleRequest(request); +} + + +static status_t +virtio_block_ioctl(void* cookie, uint32 op, void* buffer, size_t length) +{ + CALLED(); + virtio_block_handle* handle = (virtio_block_handle*)cookie; + virtio_block_driver_info* info = handle->info; + + TRACE("ioctl(op = %ld)\n", op); + + switch (op) { + case B_GET_DEVICE_SIZE: + { + size_t size = info->capacity * info->block_size; + return user_memcpy(buffer, &size, sizeof(size_t)); + } + + case B_GET_GEOMETRY: + { + if (buffer == NULL /*|| length != sizeof(device_geometry)*/) + return B_BAD_VALUE; + + device_geometry geometry; + status_t status = get_geometry(handle, &geometry); + if (status != B_OK) + return status; + + return user_memcpy(buffer, &geometry, sizeof(device_geometry)); + } + + case B_GET_ICON_NAME: + return user_strlcpy((char*)buffer, "devices/drive-harddisk", + B_FILE_NAME_LENGTH); + + case B_GET_VECTOR_ICON: + { + // TODO: take device type into account! + device_icon iconData; + if (length != sizeof(device_icon)) + return B_BAD_VALUE; + if (user_memcpy(&iconData, buffer, sizeof(device_icon)) != B_OK) + return B_BAD_ADDRESS; + + if (iconData.icon_size >= (int32)sizeof(kDriveIcon)) { + if (user_memcpy(iconData.icon_data, kDriveIcon, + sizeof(kDriveIcon)) != B_OK) + return B_BAD_ADDRESS; + } + + iconData.icon_size = sizeof(kDriveIcon); + return user_memcpy(buffer, &iconData, sizeof(device_icon)); + } + + /*case B_FLUSH_DRIVE_CACHE: + return synchronize_cache(info);*/ + } + + return B_DEV_INVALID_IOCTL; +} + + +void +virtio_block_set_capacity(virtio_block_driver_info* info, uint64 capacity, + uint32 blockSize) +{ + TRACE("set_capacity(device = %p, capacity = %Ld, blockSize = %ld)\n", + info, capacity, blockSize); + + // get log2, if possible + uint32 blockShift = log2(blockSize); + + if ((1UL << blockShift) != blockSize) + blockShift = 0; + + info->capacity = capacity; + + if (info->block_size != blockSize) { + if (info->block_size != 0) { + ERROR("old %" B_PRId32 ", new %" B_PRId32 "\n", info->block_size, + blockSize); + panic("updating DMAResource not yet implemented..."); + } + + dma_restrictions restrictions; + memset(&restrictions, 0, sizeof(restrictions)); + if ((info->features & VIRTIO_BLK_F_SIZE_MAX) != 0) + restrictions.max_segment_size = info->config.size_max; + if ((info->features & VIRTIO_BLK_F_SEG_MAX) != 0) + restrictions.max_segment_count = info->config.seg_max; + + // TODO: we need to replace the DMAResource in our IOScheduler + status_t status = info->dma_resource->Init(restrictions, blockSize, + 1024, 32); + if (status != B_OK) + panic("initializing DMAResource failed: %s", strerror(status)); + + info->io_scheduler = new(std::nothrow) IOSchedulerSimple( + info->dma_resource); + if (info->io_scheduler == NULL) + panic("allocating IOScheduler failed."); + + // TODO: use whole device name here + status = info->io_scheduler->Init("virtio"); + if (status != B_OK) + panic("initializing IOScheduler failed: %s", strerror(status)); + + info->io_scheduler->SetCallback(do_io, info); + } + + info->block_size = blockSize; +} + + +// #pragma mark - driver module API + + +static float +virtio_block_supports_device(device_node *parent) +{ + CALLED(); + const char *bus; + uint16 deviceType; + + // make sure parent is really the Virtio bus manager + if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) + return -1; + + if (strcmp(bus, "virtio")) + return 0.0; + + // check whether it's really a Direct Access Device + if (sDeviceManager->get_attr_uint16(parent, VIRTIO_DEVICE_TYPE_ITEM, + &deviceType, true) != B_OK || deviceType != VIRTIO_DEVICE_ID_BLOCK) + return 0.0; + + TRACE("Virtio block device found!\n"); + + return 0.6; +} + + +static status_t +virtio_block_register_device(device_node *node) +{ + CALLED(); + + // ready to register + device_attr attrs[] = { + { NULL } + }; + + return sDeviceManager->register_node(node, VIRTIO_BLOCK_DRIVER_MODULE_NAME, + attrs, NULL, NULL); +} + + +static status_t +virtio_block_init_driver(device_node *node, void **cookie) +{ + CALLED(); + + virtio_block_driver_info* info = (virtio_block_driver_info*)malloc( + sizeof(virtio_block_driver_info)); + if (info == NULL) + return B_NO_MEMORY; + + memset(info, 0, sizeof(*info)); + + info->dma_resource = new(std::nothrow) DMAResource; + if (info->dma_resource == NULL) { + free(info); + return B_NO_MEMORY; + } + + info->sem_cb = create_sem(0, "virtio_block_cb"); + if (info->sem_cb < 0) { + delete info->dma_resource; + status_t status = info->sem_cb; + free(info); + return status; + } + info->node = node; + + *cookie = info; + return B_OK; +} + + +static void +virtio_block_uninit_driver(void *_cookie) +{ + CALLED(); + virtio_block_driver_info* info = (virtio_block_driver_info*)_cookie; + delete_sem(info->sem_cb); + free(info); +} + + +static status_t +virtio_block_register_child_devices(void* _cookie) +{ + CALLED(); + virtio_block_driver_info* info = (virtio_block_driver_info*)_cookie; + status_t status; + + int32 id = sDeviceManager->create_id(VIRTIO_BLOCK_DEVICE_ID_GENERATOR); + if (id < 0) + return id; + + char name[64]; + snprintf(name, sizeof(name), "disk/virtual/virtio_block/%" B_PRId32 "/raw", + id); + + status = sDeviceManager->publish_device(info->node, name, + VIRTIO_BLOCK_DEVICE_MODULE_NAME); + + return status; +} + + +// #pragma mark - + + +module_dependency module_dependencies[] = { + {B_DEVICE_MANAGER_MODULE_NAME, (module_info**)&sDeviceManager}, + {} +}; + +struct device_module_info sVirtioBlockDevice = { + { + VIRTIO_BLOCK_DEVICE_MODULE_NAME, + 0, + NULL + }, + + virtio_block_init_device, + virtio_block_uninit_device, + NULL, // remove, + + virtio_block_open, + virtio_block_close, + virtio_block_free, + virtio_block_read, + virtio_block_write, + virtio_block_io, + virtio_block_ioctl, + + NULL, // select + NULL, // deselect +}; + +struct driver_module_info sVirtioBlockDriver = { + { + VIRTIO_BLOCK_DRIVER_MODULE_NAME, + 0, + NULL + }, + + virtio_block_supports_device, + virtio_block_register_device, + virtio_block_init_driver, + virtio_block_uninit_driver, + virtio_block_register_child_devices, + NULL, // rescan + NULL, // removed +}; + +module_info* modules[] = { + (module_info*)&sVirtioBlockDriver, + (module_info*)&sVirtioBlockDevice, + NULL +}; + diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.c b/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.c index dcba84cc35..b0d33e5c50 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.c +++ b/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.c @@ -244,7 +244,9 @@ cx23882_int(void *data) if (mstat & (PCI_INT_STAT_HST_INT | PCI_INT_STAT_VIP_INT | PCI_INT_STAT_AUD_INT | PCI_INT_STAT_VID_INT)) { // serious error, these bits should not be set - dprintf("cx23882_int error: msk 0x%08lx, stat 0x%08lx, mstat 0x%08lx\n", reg_read32(REG_PCI_INT_MSK), reg_read32(REG_PCI_INT_STAT), mstat); + dprintf("cx23882_int error: msk 0x%08" B_PRIx32 ", stat 0x%08" B_PRIx32 + ", mstat 0x%08" B_PRIx32 "\n", reg_read32(REG_PCI_INT_MSK), + reg_read32(REG_PCI_INT_STAT), mstat); reg_write32(REG_PCI_INT_MSK, 0); return B_HANDLED_INTERRUPT; } @@ -254,7 +256,7 @@ cx23882_int(void *data) reg_write32(REG_PCI_INT_STAT, wmstat); if (wmstat) - dprintf("cx23882_int got 0x%08lx\n", wmstat); + dprintf("cx23882_int got 0x%08" B_PRIx32 "\n", wmstat); if (mstat & PCI_INT_STAT_TS_INT) { cx23882_mpegts_int(device); diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.h b/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.h index 0204c6cb79..56b7f4f4a5 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.h +++ b/src/add-ons/kernel/drivers/dvb/cx23882/cx23882.h @@ -40,10 +40,10 @@ typedef struct { area_id dma_buf1_area; void * dma_buf1_virt; - void * dma_buf1_phys; + phys_addr_t dma_buf1_phys; area_id dma_buf2_area; void * dma_buf2_virt; - void * dma_buf2_phys; + phys_addr_t dma_buf2_phys; sem_id capture_sem; void * capture_data; diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/dtt7592.c b/src/add-ons/kernel/drivers/dvb/cx23882/dtt7592.c index 06a36ad8c4..8940641e5e 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/dtt7592.c +++ b/src/add-ons/kernel/drivers/dvb/cx23882/dtt7592.c @@ -68,7 +68,8 @@ dtt7592_set_frequency(i2c_bus *bus, uint32 frequency, dvb_bandwidth_t bandwidth) if (divider > 0x7fff) divider = 0x7fff; - TRACE("dtt7592_set_frequency frequency %ld, divider 0x%lx (%ld)\n", frequency, divider, divider); + TRACE("dtt7592_set_frequency frequency %" B_PRId32 ", divider 0x%" + B_PRIx32 " (%" B_PRId32 ")\n", frequency, divider, divider); data[0] = divider >> 8; data[1] = (uint8)divider; diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/dvb_interface.c b/src/add-ons/kernel/drivers/dvb/cx23882/dvb_interface.c index 2213c77acb..2d3415eea3 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/dvb_interface.c +++ b/src/add-ons/kernel/drivers/dvb/cx23882/dvb_interface.c @@ -95,7 +95,8 @@ interface_attach(void **cookie, const pci_info *info) // adjust PCI latency timer val = gPci->read_pci_config(device->pci_info->bus, device->pci_info->device, device->pci_info->function, PCI_latency, 1); - TRACE("PCI latency is %02lx, changing to %02x\n", val, PCI_LATENCY); + TRACE("PCI latency is %02" B_PRIx32 ", changing to %02x\n", val, + PCI_LATENCY); gPci->write_pci_config(device->pci_info->bus, device->pci_info->device, device->pci_info->function, PCI_latency, 1, PCI_LATENCY); // get IRQ @@ -113,8 +114,9 @@ interface_attach(void **cookie, const pci_info *info) dprintf("cx23882: Error, no memory space assigned\n"); goto err; } - TRACE("hardware register address %p\n", (void *) val); - device->regs_area = map_mem(&device->regs, (void *)val, 16777216 /* 16 MB */, 0, "cx23882 registers"); + TRACE("hardware register address 0x%" B_PRIx32 "\n", val); + device->regs_area = map_mem(&device->regs, (addr_t)val, + 16777216 /* 16 MB */, 0, "cx23882 registers"); if (device->regs_area < B_OK) { dprintf("cx23882: Error, can't map hardware registers\n"); goto err; diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/util.c b/src/add-ons/kernel/drivers/dvb/cx23882/util.c index 77da6534c0..ceb0b623de 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/util.c +++ b/src/add-ons/kernel/drivers/dvb/cx23882/util.c @@ -37,47 +37,49 @@ area_id -map_mem(void **virt, void *phy, size_t size, uint32 protection, +map_mem(void **virt, phys_addr_t phy, size_t size, uint32 protection, const char *name) { uint32 offset; - void *phyadr; + phys_addr_t phyadr; void *mapadr; area_id area; - TRACE("mapping physical address %p with %ld bytes for %s\n", phy, size, - name); + TRACE("mapping physical address %" B_PRIxPHYSADDR " with %ld bytes for %s\n", + phy, size, name); offset = (uint32)phy & (B_PAGE_SIZE - 1); - phyadr = (char *)phy - offset; + phyadr = phy - offset; size = ROUNDUP(size + offset, B_PAGE_SIZE); - area = map_physical_memory(name, (addr_t)phyadr, size, + area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_BLOCK_ADDRESS, protection, &mapadr); if (area < B_OK) { - TRACE("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area)); + TRACE("mapping '%s' failed, error 0x%" B_PRIx32 " (%s)\n", name, area, + strerror(area)); return area; } *virt = (char *)mapadr + offset; - TRACE("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n", - phy, *virt, offset, phyadr, mapadr, size, area); + TRACE("physical = %" B_PRIxPHYSADDR ", virtual = %p, offset = %" B_PRIu32 + ", phyadr = %" B_PRIxPHYSADDR ", mapadr = %p, size = %" B_PRIuSIZE + ", area = 0x%08" B_PRIx32 "\n", phy, *virt, offset, phyadr, mapadr, + size, area); return area; } area_id -alloc_mem(void **virt, void **phy, size_t size, uint32 protection, +alloc_mem(void **virt, phys_addr_t *phy, size_t size, uint32 protection, const char *name) { -// TODO: phy should be phys_addr_t*! physical_entry pe; void * virtadr; area_id areaid; status_t rv; - TRACE("allocating %ld bytes for %s\n", size, name); + TRACE("allocating %" B_PRIuSIZE " bytes for %s\n", size, name); size = ROUNDUP(size, B_PAGE_SIZE); areaid = create_area(name, &virtadr, B_ANY_KERNEL_ADDRESS, size, @@ -97,7 +99,8 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection, if (virt) *virt = virtadr; if (phy) - *phy = (void*)(addr_t)pe.address; - TRACE("area = %ld, size = %ld, virt = %p, phy = %" B_PRIxPHYSADDR "\n", areaid, size, virtadr, pe.address); + *phy = pe.address; + TRACE("area = %" B_PRId32 ", size = %" B_PRIuSIZE ", virt = %p, phy = %" + B_PRIxPHYSADDR "\n", areaid, size, virtadr, pe.address); return areaid; } diff --git a/src/add-ons/kernel/drivers/dvb/cx23882/util.h b/src/add-ons/kernel/drivers/dvb/cx23882/util.h index 8df060ed7c..f6a25f01d1 100644 --- a/src/add-ons/kernel/drivers/dvb/cx23882/util.h +++ b/src/add-ons/kernel/drivers/dvb/cx23882/util.h @@ -27,8 +27,10 @@ #include -area_id map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name); -area_id alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *name); +area_id map_mem(void **virt, phys_addr_t phy, size_t size, uint32 protection, + const char *name); +area_id alloc_mem(void **virt, phys_addr_t *phy, size_t size, uint32 protection, + const char *name); // generic macro for rounding, can only be used for power of 2 blocksize #define ROUNDUP(size, blocksize) (((size) + (blocksize) - 1) & ~((blocksize) - 1)) diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp index 7b95058931..5aa448c08e 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/device.cpp @@ -231,7 +231,7 @@ device_ioctl(void* data, uint32 op, void* buffer, size_t bufferLength) status_t status = intel_allocate_memory(*info, allocMemory.size, allocMemory.alignment, allocMemory.flags, - (addr_t* )&allocMemory.buffer_base); + &allocMemory.buffer_base); if (status == B_OK) { // copy result #ifdef __HAIKU__ diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp index bfbd21302d..2fa2ff48fc 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp @@ -224,7 +224,7 @@ init_driver(void) gDeviceInfo[found]->init_status = B_NO_INIT; gDeviceInfo[found]->id = found; gDeviceInfo[found]->pci = info; - gDeviceInfo[found]->registers = (uint8*)info->u.h0.base_registers[0]; + gDeviceInfo[found]->registers = info->u.h0.base_registers[0]; gDeviceInfo[found]->device_identifier = kSupportedDevices[type].name; gDeviceInfo[found]->device_type = kSupportedDevices[type].type; diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index a6a8c81178..f4d4f7164a 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -239,7 +239,7 @@ intel_extreme_init(intel_info &info) AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("intel extreme mmio", - (void*)info.pci->u.h0.base_registers[mmioIndex], + info.pci->u.h0.base_registers[mmioIndex], info.pci->u.h0.base_register_sizes[mmioIndex], B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.registers); diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h index 8df7837870..4735393620 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme_private.h @@ -25,7 +25,7 @@ struct intel_info { addr_t aperture_base; aperture_id aperture; - uint8* registers; + addr_t registers; area_id registers_area; struct intel_shared_info* shared_info; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index ffb1ddcf46..beb03523be 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -436,7 +436,7 @@ init_driver(void) gDeviceInfo[found]->init_status = B_NO_INIT; gDeviceInfo[found]->id = found; gDeviceInfo[found]->pci = info; - gDeviceInfo[found]->registers = (uint8*)info->u.h0.base_registers[0]; + gDeviceInfo[found]->registers = info->u.h0.base_registers[0]; gDeviceInfo[found]->pciID = kSupportedDevices[type].pciID; gDeviceInfo[found]->deviceName = kSupportedDevices[type].deviceName; gDeviceInfo[found]->chipsetID = kSupportedDevices[type].chipsetID; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp index 1609f9c308..4d048920f0 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp @@ -592,7 +592,7 @@ radeon_hd_init(radeon_info &info) // *** Map Memory mapped IO AreaKeeper mmioMapper; info.registers_area = mmioMapper.Map("radeon hd mmio", - (void*)info.pci->u.h0.base_registers[PCI_BAR_MMIO], + info.pci->u.h0.base_registers[PCI_BAR_MMIO], info.pci->u.h0.base_register_sizes[PCI_BAR_MMIO], B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void**)&info.registers); @@ -665,7 +665,7 @@ radeon_hd_init(radeon_info &info) // *** Framebuffer mapping AreaKeeper frambufferMapper; info.framebuffer_area = frambufferMapper.Map("radeon hd frame buffer", - (void*)info.pci->u.h0.base_registers[PCI_BAR_FB], + info.pci->u.h0.base_registers[PCI_BAR_FB], info.shared_info->frame_buffer_size * 1024, B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void**)&info.shared_info->frame_buffer); diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h index 10135221e8..ad9d2edcb9 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd_private.h @@ -34,7 +34,7 @@ struct radeon_info { status_t init_status; int32 id; pci_info* pci; - uint8* registers; + addr_t registers; uint8* atom_buffer; // buffer for atombios diff --git a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp index 40f58eb0e6..eebaff2ede 100644 --- a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp +++ b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.cpp @@ -2,7 +2,7 @@ * midi usb driver * usb_midi.c * - * Copyright 2006-2011 Haiku Inc. All rights reserved. + * Copyright 2006-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT Licence. * * Authors: @@ -17,7 +17,7 @@ */ -/* #define DEBUG 1 */ /* Define this to enable DPRINTF_DEBUG statements */ +/* #define DEBUG 1 */ /* Define this to enable DPRINTF_DEBUG statements */ /* (Other categories of printout set in usb_midi.h) */ #include "usb_midi.h" @@ -94,7 +94,7 @@ create_device(const usb_device* dev, uint16 ifno) midiDevice->sem_lock = sem = create_sem(1, DRIVER_NAME "_lock"); if (sem < 0) { - DPRINTF_ERR((MY_ID "create_sem() failed 0x%lx\n", sem)); + DPRINTF_ERR((MY_ID "create_sem() failed 0x%" B_PRIx32 "\n", sem)); free(midiDevice); return NULL; } @@ -104,7 +104,7 @@ create_device(const usb_device* dev, uint16 ifno) (void**)&midiDevice->buffer, B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE, B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA); if (area < 0) { - DPRINTF_ERR((MY_ID "create_area() failed 0x%lx\n", area)); + DPRINTF_ERR((MY_ID "create_area() failed 0x%" B_PRIx32 "\n", area)); delete_sem(midiDevice->sem_lock); free(midiDevice); return NULL; @@ -114,7 +114,7 @@ create_device(const usb_device* dev, uint16 ifno) (usb_midi_event_packet*)((uint8*)midiDevice->buffer + B_PAGE_SIZE / 2); midiDevice->sem_send = sem = create_sem(1, DRIVER_NAME "_send"); if (sem < 0) { - DPRINTF_ERR((MY_ID "create_sem() failed 0x%lx\n", sem)); + DPRINTF_ERR((MY_ID "create_sem() failed 0x%" B_PRIx32 "\n", sem)); delete_sem(midiDevice->sem_lock); delete_area(area); free(midiDevice); @@ -134,7 +134,8 @@ create_device(const usb_device* dev, uint16 ifno) midiDevice->active = true; midiDevice->flags = 0; memset(midiDevice->ports, 0, sizeof(midiDevice->ports)); - midiDevice->buffer_size = B_PAGE_SIZE / 2; + midiDevice->inMaxPkt = midiDevice->outMaxPkt = B_PAGE_SIZE / 2; + /* Initially -- will get reduced */ DPRINTF_INFO((MY_ID "Created device %p\n", midiDevice)); return midiDevice; @@ -234,8 +235,10 @@ midi_usb_read_callback(void* cookie, status_t status, usbmidi_device_info* midiDevice = (usbmidi_device_info*)cookie; assert(cookie != NULL); - DPRINTF_DEBUG((MY_ID "midi_usb_read_callback() -- packet length %ld\n", - actual_len)); + if (actual_len > 0) { + DPRINTF_DEBUG((MY_ID "midi_usb_read_callback() -- packet length %ld\n", + actual_len)); + } acquire_sem(midiDevice->sem_lock); midiDevice->actual_length = actual_len; @@ -271,11 +274,11 @@ midi_usb_read_callback(void* cookie, status_t status, /* issue next request */ st = usb->queue_bulk(midiDevice->ept_in->handle, - midiDevice->buffer, midiDevice->buffer_size, + midiDevice->buffer, midiDevice->inMaxPkt, (usb_callback_func)midi_usb_read_callback, midiDevice); if (st != B_OK) { /* probably endpoint stall */ - DPRINTF_ERR((MY_ID "queue_bulk() error 0x%lx\n", st)); + DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", st)); } } @@ -355,7 +358,8 @@ usb_midi_added(const usb_device* dev, void** cookie) got_one: if ((status = usb->set_configuration(dev, conf)) != B_OK) { - DPRINTF_ERR((MY_ID "set_configuration() failed 0x%lx\n", status)); + DPRINTF_ERR((MY_ID "set_configuration() failed 0x%" B_PRIx32 "\n", + status)); return B_ERROR; } @@ -383,18 +387,26 @@ got_one: for (uint16 i = 0; i < intf->endpoint_count && i < 2; i++) { /* we are actually assuming max one IN, one OUT endpoint... */ - DPRINTF_INFO((MY_ID "endpoint %d = %p %s\n", + DPRINTF_INFO((MY_ID "endpoint %d = %p %s maxPkt=%d\n", i, &intf->endpoint[i], (intf->endpoint[i].descr->endpoint_address & 0x80) != 0 - ? "IN" : "OUT")); + ? "IN" : "OUT", intf->endpoint[i].descr->max_packet_size)); if ((intf->endpoint[i].descr->endpoint_address & 0x80) != 0) { if (midiDevice->ept_in == NULL) { midiDevice->ept_in = &intf->endpoint[i]; in_cables = cable_count[i]; + if (intf->endpoint[i].descr->max_packet_size + < midiDevice->inMaxPkt) + midiDevice->inMaxPkt = intf->endpoint[i].descr->max_packet_size; + } + } else { + if (midiDevice->ept_out == NULL) { + midiDevice->ept_out = &intf->endpoint[i]; + out_cables = cable_count[i]; + if (intf->endpoint[i].descr->max_packet_size + < midiDevice->outMaxPkt) + midiDevice->outMaxPkt = intf->endpoint[i].descr->max_packet_size; } - } else if (midiDevice->ept_out == NULL) { - midiDevice->ept_out = &intf->endpoint[i]; - out_cables = cable_count[i]; } } @@ -416,10 +428,10 @@ got_one: /* issue bulk transfer */ DPRINTF_DEBUG((MY_ID "queueing bulk xfer IN endpoint\n")); status = usb->queue_bulk(midiDevice->ept_in->handle, midiDevice->buffer, - midiDevice->buffer_size, + midiDevice->inMaxPkt, (usb_callback_func)midi_usb_read_callback, midiDevice); if (status != B_OK) { - DPRINTF_ERR((MY_ID "queue_bulk() error 0x%lx\n", status)); + DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", status)); return B_ERROR; } @@ -493,14 +505,15 @@ usb_midi_open(const char* name, uint32 flags, assert(name != NULL); assert(out_cookie != NULL); - DPRINTF_INFO((MY_ID "usb_midi_open(%s) flags=%lx\n", name, flags)); + DPRINTF_INFO((MY_ID "usb_midi_open(%s) flags=%" B_PRIx32 "\n", name, + flags)); if ((port = search_port_info(name)) == NULL) return B_ENTRY_NOT_FOUND; - if (!port->has_in && mode != O_RDONLY) + if (!port->has_in && mode != O_WRONLY) return B_PERMISSION_DENIED; /* == EACCES */ - else if (!port->has_out && mode != O_WRONLY) + else if (!port->has_out && mode != O_RDONLY) return B_PERMISSION_DENIED; if ((cookie = (driver_cookie*)malloc(sizeof(driver_cookie))) == NULL) @@ -508,7 +521,8 @@ usb_midi_open(const char* name, uint32 flags, cookie->sem_cb = create_sem(0, DRIVER_NAME "_cb"); if (cookie->sem_cb < 0) { - DPRINTF_ERR((MY_ID "create_sem() failed 0x%lx\n", cookie->sem_cb)); + DPRINTF_ERR((MY_ID "create_sem() failed 0x%" B_PRIx32 "\n", + cookie->sem_cb)); free(cookie); return B_ERROR; } @@ -550,11 +564,11 @@ usb_midi_read(driver_cookie* cookie, off_t position, DPRINTF_DEBUG((MY_ID "usb_midi_read: (%ld byte buffer at %lld cookie %p)" "\n", *num_bytes, position, cookie)); while (midiDevice && midiDevice->active) { - DPRINTF_DEBUG((MY_ID "waiting on acquire_sem_etc\n")); + ZDPRINTF_DEBUG((MY_ID "waiting on acquire_sem_etc\n")); err = acquire_sem_etc(cookie->sem_cb, 1, B_RELATIVE_TIMEOUT, 1000000); if (err == B_TIMED_OUT) { - DPRINTF_DEBUG((MY_ID "acquire_sem_etc timed out\n")); + ZDPRINTF_DEBUG((MY_ID "acquire_sem_etc timed out\n")); continue; /* see if we're still active */ } if (err != B_OK) { @@ -616,7 +630,7 @@ usb_midi_write(driver_cookie* cookie, off_t position, if (!midiDevice || !midiDevice->active) return B_ERROR; /* already unplugged */ - buff_lim = midiDevice->buffer_size * 3 / 4; + buff_lim = midiDevice->outMaxPkt * 3 / 4; /* max MIDI bytes buffer space */ DPRINTF_DEBUG((MY_ID "MIDI write (%ld bytes at %lld)\n", @@ -663,8 +677,8 @@ usb_midi_write(driver_cookie* cookie, off_t position, * packet_count, (usb_callback_func)midi_usb_write_callback, midiDevice); if (status != B_OK) { - DPRINTF_ERR((MY_ID "midi write queue_bulk() error 0x%lx\n", - status)); + DPRINTF_ERR((MY_ID "midi write queue_bulk() error 0x%" B_PRIx32 + "\n", status)); return B_ERROR; } } diff --git a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.h b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.h index f3e91e3e92..1784d3f3e9 100644 --- a/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.h +++ b/src/add-ons/kernel/drivers/midi/usb_midi/usb_midi.h @@ -2,7 +2,7 @@ * midi usb driver * usb_midi.h * - * Copyright 2006-2011 Haiku Inc. All rights reserved. + * Copyright 2006-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT Licence. * * Authors: @@ -51,6 +51,9 @@ #define DPRINTF_DEBUG(x) #endif +/* a convenient way of suppressing some printouts: */ +#define ZDPRINTF_DEBUG(x) + /* driver specific definitions */ @@ -82,7 +85,7 @@ typedef struct usbmidi_device_info area_id buffer_area; usb_midi_event_packet* buffer; /* input buffer & base of area */ usb_midi_event_packet* out_buffer; /* above input buffer */ - size_t buffer_size; /* for each of in and out buffers */ + size_t inMaxPkt, outMaxPkt; /* for each of in and out buffers */ const usb_device* dev; uint16 ifno; diff --git a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp index 49cd5803d2..19eb3580bd 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.cpp @@ -700,7 +700,7 @@ ASIXDevice::ModifyMulticastTable(bool join, ether_address_t* group) void ASIXDevice::_ReadCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_FLOW("ReadCB: %d bytes; status:%#010x\n", actualLength, status); ASIXDevice *device = (ASIXDevice *)cookie; @@ -712,7 +712,7 @@ ASIXDevice::_ReadCallback(void *cookie, int32 status, void *data, void ASIXDevice::_WriteCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_FLOW("WriteCB: %d bytes; status:%#010x\n", actualLength, status); ASIXDevice *device = (ASIXDevice *)cookie; @@ -724,7 +724,7 @@ ASIXDevice::_WriteCallback(void *cookie, int32 status, void *data, void ASIXDevice::_NotifyCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { ASIXDevice *device = (ASIXDevice *)cookie; atomic_add(&device->fInsideNotify, 1); diff --git a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h index e932a377ab..0bccbbfb68 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_asix/ASIXDevice.h @@ -64,11 +64,11 @@ virtual status_t SetupDevice(bool deviceReplugged); private: static void _ReadCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _WriteCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _NotifyCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); status_t _SetupEndpoints(); diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp index a1f9ec95a3..1c3317dd4c 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88172Device.cpp @@ -276,8 +276,8 @@ AX88172Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= mediumStatus & (ANLPAR_TX_FD | ANLPAR_10_FD) ? - IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; + linkState->media |= mediumStatus & (ANLPAR_TX_FD | ANLPAR_10_FD) + ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; linkState->speed = mediumStatus & (ANLPAR_TX_FD | ANLPAR_TX_HD) ? 100000000 : 10000000; @@ -288,4 +288,3 @@ AX88172Device::GetLinkState(ether_link_state *linkState) (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } - diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp index 99959d76a5..ee6497419e 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88178Device.cpp @@ -348,7 +348,7 @@ AX88178Device::OnNotify(uint32 actualLength) return B_BAD_DATA; } - AX88178_Notify *notification = (AX88178_Notify *)fNotifyBuffer; + AX88178_Notify *notification = (AX88178_Notify *)fNotifyBuffer; if (notification->btA1 != 0xa1) { TRACE_ALWAYS("Notify magic byte is invalid: %#02x\n", @@ -414,13 +414,13 @@ AX88178Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? - IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; + linkState->media |= (mediumStatus & MEDIUM_STATE_FD) + ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) ? 100000000 : 10000000; - linkState->speed = (mediumStatus & MEDIUM_STATE_GM) ? - 1000000000 : linkState->speed; + linkState->speed = (mediumStatus & MEDIUM_STATE_GM) + ? 1000000000 : linkState->speed; TRACE_FLOW("Medium state: %s, %lld MBit/s, %s duplex.\n", (linkState->media & IFM_ACTIVE) ? "active" : "inactive", @@ -428,4 +428,3 @@ AX88178Device::GetLinkState(ether_link_state *linkState) (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } - diff --git a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp index d05980337a..ec9c9a247a 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/AX88772Device.cpp @@ -242,9 +242,8 @@ AX88772Device::ReadMACAddress(ether_address_t *address) size_t actual_length = 0; uint16 addr = 0; status_t result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - READ_SROM, EEPROM_772B_NODE_ID + i, 0, - sizeof(addr), &addr, &actual_length); + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, READ_SROM, + EEPROM_772B_NODE_ID + i, 0, sizeof(addr), &addr, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error reading MAC[%d] address:%#010x\n", i, result); return result; @@ -506,11 +505,9 @@ AX88772Device::StartDevice() // AX88772B uses different maximum frame burst configuration. if (fDeviceInfo.fType == DeviceInfo::AX88772B) { result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - WRITE_RXCONTROL_CFG, - AX88772B_MFBTable[AX88772B_MFB_2K].ByteCount, - AX88772B_MFBTable[AX88772B_MFB_2K].Threshold, - 0, 0, &actualLength); + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, WRITE_RXCONTROL_CFG, + AX88772B_MFBTable[AX88772B_MFB_2K].ByteCount, + AX88772B_MFBTable[AX88772B_MFB_2K].Threshold, 0, 0, &actualLength); if (result != B_OK) { TRACE_ALWAYS("Error of writing frame burst:%#010x\n", result); @@ -527,7 +524,7 @@ AX88772Device::StartDevice() result = WriteRXControlRegister(rxcontrol); if (result != B_OK) { TRACE_ALWAYS("Error of writing %#04x RX Control:%#010x\n", - rxcontrol, result); + rxcontrol, result); } TRACE_RET(result); @@ -610,8 +607,8 @@ AX88772Device::GetLinkState(ether_link_state *linkState) linkState->quality = 1000; linkState->media = IFM_ETHER | (fHasConnection ? IFM_ACTIVE : 0); - linkState->media |= (mediumStatus & MEDIUM_STATE_FD) ? - IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; + linkState->media |= (mediumStatus & MEDIUM_STATE_FD) + ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX; linkState->speed = (mediumStatus & MEDIUM_STATE_PS_100) ? 100000000 : 10000000; @@ -622,4 +619,3 @@ AX88772Device::GetLinkState(ether_link_state *linkState) (linkState->media & IFM_FULL_DUPLEX) ? "full" : "half"); return B_OK; } - diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp index 2d4bc4b10d..1a67009d7d 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/Driver.cpp @@ -65,7 +65,8 @@ DeviceInfo gSupportedDevices[] = { { { 0x1631, 0x6200 }, DeviceInfo::AX88172, "GoodWay USB2Ethernet" }, { { 0x1737, 0x0039 }, DeviceInfo::AX88178, "LinkSys 1000" }, { { 0x17ef, 0x7203 }, DeviceInfo::AX88772, "Lenovo U2L100P 10/100" }, - { { 0x2001, 0x1A00 }, DeviceInfo::AX88172, "D-Link DUB-E100" }, + { { 0x2001, 0x1a00 }, DeviceInfo::AX88172, "D-Link DUB-E100" }, + { { 0x2001, 0x1a02 }, DeviceInfo::AX88772B, "D-Link DUB-E100 rev.C1" }, { { 0x2001, 0x3c05 }, DeviceInfo::AX88772, "D-Link DUB-E100 rev.B1" }, { { 0x6189, 0x182d }, DeviceInfo::AX88172, "Sitecom LN-029" }, }; @@ -107,7 +108,7 @@ lookup_and_create_device(usb_device device) return new AX88178Device(device, gSupportedDevices[right]); default: TRACE_ALWAYS("Unknown device type:%#x ignored.\n", - static_cast(gSupportedDevices[right].fType)); + static_cast(gSupportedDevices[right].fType)); break; } } else { @@ -362,7 +363,8 @@ publish_devices() gDeviceNames[deviceCount] = (char *)malloc(strlen(sDeviceBaseName) + 4); if (gDeviceNames[deviceCount]) { - sprintf(gDeviceNames[deviceCount], "%s%ld", sDeviceBaseName, i); + sprintf(gDeviceNames[deviceCount], "%s%" B_PRId32, sDeviceBaseName, + i); TRACE("publishing %s\n", gDeviceNames[deviceCount]); deviceCount++; } else @@ -390,4 +392,3 @@ find_device(const char *name) return &deviceHooks; } - diff --git a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp index 0906be8e37..2832a5e05e 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/MIIBus.cpp @@ -24,10 +24,10 @@ MIIBus::MIIBus() - : - fStatus(B_NO_INIT), - fDevice(0), - fSelectedPHY(CurrentPHY) + : + fStatus(B_NO_INIT), + fDevice(0), + fSelectedPHY(CurrentPHY) { for (size_t i = 0; i < PHYsCount; i++) { fPHYs[i] = PHYNotInstalled; @@ -47,8 +47,8 @@ MIIBus::Init(usb_device device) size_t actual_length = 0; status_t result = gUSBModule->send_request(device, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - READ_PHYID, 0, 0, sizeof(fPHYs), fPHYs, &actual_length); + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, READ_PHYID, 0, 0, + sizeof(fPHYs), fPHYs, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Request of the PHYIDs failed:%#010x\n", result); @@ -57,7 +57,7 @@ MIIBus::Init(usb_device device) if (sizeof(fPHYs) != actual_length) { TRACE_ALWAYS("Mismatch of reading %d PHYIDs bytes instead of %d.\n", - actual_length, sizeof(fPHYs)); + actual_length, sizeof(fPHYs)); } TRACE("PHYIDs are:%#02x:%#02x\n", fPHYs[0], fPHYs[1]); @@ -71,7 +71,7 @@ MIIBus::Init(usb_device device) } TRACE("PHYs are configured: Selected:%#02x; Primary:%#02x; 2ndary:%#02x\n", - PHYID(CurrentPHY), PHYID(PrimaryPHY), PHYID(SecondaryPHY)); + PHYID(CurrentPHY), PHYID(PrimaryPHY), PHYID(SecondaryPHY)); if (fSelectedPHY == CurrentPHY) { TRACE_ALWAYS("No PHYs found!\n"); return B_ENTRY_NOT_FOUND; @@ -100,7 +100,7 @@ MIIBus::SetupPHY() result = Write(MII_BMCR, control); if (result != B_OK) { TRACE_ALWAYS("Error of writing control word %#04x:%#010x.\n", - control, result); + control, result); } result = Write(MII_BMCR, BMCR_Reset); @@ -120,7 +120,7 @@ MIIBus::SetupPHY() } TRACE("MII Info: OUI:%04x; Model:%04x; rev:%02x.\n", - MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); + MII_OUI(id01, id02), MII_MODEL(id02), MII_REV(id02)); // Dump(); @@ -144,7 +144,7 @@ MIIBus::PHYID(PHYIndex phyIndex /*= CurrentPHY*/) { if (phyIndex == CurrentPHY) { return (fSelectedPHY == CurrentPHY - ? 0 : fPHYs[fSelectedPHY]) & PHYIDMask; + ? 0 : fPHYs[fSelectedPHY]) & PHYIDMask; } return fPHYs[phyIndex] & PHYIDMask; @@ -156,7 +156,7 @@ MIIBus::PHYType(PHYIndex phyIndex /*= CurrentPHY*/) { if (phyIndex == CurrentPHY) { return (fSelectedPHY == CurrentPHY - ? PHYNotInstalled : fPHYs[fSelectedPHY]) & PHYTypeMask; + ? PHYNotInstalled : fPHYs[fSelectedPHY]) & PHYTypeMask; } return fPHYs[phyIndex] & PHYTypeMask; @@ -181,9 +181,8 @@ MIIBus::Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex /*= CurrPHY*/) size_t actual_length = 0; // switch to SW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - SW_MII_OP, 0, 0, 0, 0, &actual_length); + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, SW_MII_OP, 0, 0, 0, 0, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to SW op.mode: %#010x\n", result); @@ -191,26 +190,24 @@ MIIBus::Read(uint16 miiRegister, uint16 *value, PHYIndex phyIndex /*= CurrPHY*/) } // read register value - status_t op_result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - READ_MII, phyId, miiRegister, - sizeof(*value), value, &actual_length); + status_t op_result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_IN, READ_MII, phyId, miiRegister, sizeof(*value), + value, &actual_length); if (op_result != B_OK) { TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", - miiRegister, phyId, op_result); + miiRegister, phyId, op_result); } if (sizeof(*value) != actual_length) { TRACE_ALWAYS("Mismatch of reading MII reg.%d at PHY %d. " - "Read %d bytes instead of %d.\n", - miiRegister, phyId, actual_length, sizeof(*value)); + "Read %d bytes instead of %d.\n", miiRegister, phyId, + actual_length, sizeof(*value)); } // switch to HW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - HW_MII_OP, 0, 0, 0, 0, &actual_length); + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, HW_MII_OP, 0, 0, 0, 0, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); @@ -239,9 +236,8 @@ MIIBus::Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex /*= CurrPHY*/) uint16 phyId = PHYID(phyIndex); // switch to SW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - SW_MII_OP, 0, 0, 0, 0, &actual_length); + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, SW_MII_OP, 0, 0, 0, 0, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to SW op.mode: %#010x\n", result); @@ -249,26 +245,24 @@ MIIBus::Write(uint16 miiRegister, uint16 value, PHYIndex phyIndex /*= CurrPHY*/) } // write register value - status_t op_result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - WRITE_MII, phyId, miiRegister, - sizeof(value), &value, &actual_length); + status_t op_result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, WRITE_MII, phyId, miiRegister, sizeof(value), + &value, &actual_length); if (op_result != B_OK) { TRACE_ALWAYS("Error of writing MII reg.%d at PHY %d:%#010x.\n", - miiRegister, phyId, op_result); + miiRegister, phyId, op_result); } if (sizeof(value) != actual_length) { TRACE_ALWAYS("Mismatch of writing MII reg.%d at PHY %d." - "Write %d bytes instead of %d.\n", - miiRegister, phyId, actual_length, sizeof(value)); + "Write %d bytes instead of %d.\n", miiRegister, phyId, + actual_length, sizeof(value)); } // switch to HW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - HW_MII_OP, 0, 0, 0, 0, &actual_length); + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, HW_MII_OP, 0, 0, 0, 0, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); @@ -312,36 +306,33 @@ MIIBus::Dump() return result; } - uint8 regs[] = { MII_BMCR, MII_BMSR, - MII_PHYID0, MII_PHYID1, - MII_ANAR, MII_ANLPAR/*, MII_ANER*/}; + uint8 regs[] = { MII_BMCR, MII_BMSR, MII_PHYID0, + MII_PHYID1, MII_ANAR, MII_ANLPAR/*, MII_ANER*/}; uint16 value = 0; for (size_t i = 0; i < sizeof(regs)/ sizeof(regs[0]); i++) { // read register value status_t op_result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, - READ_MII, phyId, regs[i], - sizeof(value), &value, &actual_length); + USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_IN, READ_MII, phyId, + regs[i], sizeof(value), &value, &actual_length); if (op_result != B_OK) { TRACE_ALWAYS("Error of reading MII reg.%d at PHY%d:%#010x.\n", - regs[i], phyId, op_result); + regs[i], phyId, op_result); } if (sizeof(value) != actual_length) { TRACE_ALWAYS("Mismatch of reading MII reg.%d at PHY%d." - " Read %d bytes instead of %d.\n", - regs[i], phyId, actual_length, sizeof(value)); + " Read %d bytes instead of %d.\n", regs[i], phyId, + actual_length, sizeof(value)); } TRACE_ALWAYS("MII reg: %d has %#04x\n", regs[i], value); } // switch to HW operation mode - result = gUSBModule->send_request(fDevice, - USB_REQTYPE_VENDOR | USB_REQTYPE_DEVICE_OUT, - HW_MII_OP, 0, 0, 0, 0, &actual_length); + result = gUSBModule->send_request(fDevice, USB_REQTYPE_VENDOR + | USB_REQTYPE_DEVICE_OUT, HW_MII_OP, 0, 0, 0, 0, &actual_length); if (result != B_OK) { TRACE_ALWAYS("Error of switching MII to HW op.mode: %#010x\n", result); @@ -350,4 +341,3 @@ MIIBus::Dump() return result; } - diff --git a/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp b/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp index d5f179117e..5ac346e771 100644 --- a/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp +++ b/src/add-ons/kernel/drivers/network/usb_asix/Settings.cpp @@ -51,13 +51,13 @@ void load_settings() gTraceOn = get_driver_boolean_parameter(handle, "trace", gTraceOn, true); gTraceFlow = get_driver_boolean_parameter(handle, "trace_flow", - gTraceFlow, true); + gTraceFlow, true); gTruncateLogFile = get_driver_boolean_parameter(handle, "truncate_logfile", - gTruncateLogFile, true); + gTruncateLogFile, true); gAddTimeStamp = get_driver_boolean_parameter(handle, "add_timestamp", - gAddTimeStamp, true); + gAddTimeStamp, true); const char * logFilePath = get_driver_parameter(handle, "logfile", - NULL, "/var/log/"DRIVER_NAME".log"); + NULL, "/var/log/"DRIVER_NAME".log"); if (logFilePath != NULL) { gLogFilePath = strdup(logFilePath); } @@ -96,8 +96,8 @@ void usb_asix_trace(bool force, const char* func, const char *fmt, ...) bigtime_t time = system_time(); uint32 msec = time / 1000; uint32 sec = msec / 1000; - sprintf(buf_ptr, "%02ld.%02ld.%03ld:", - sec / 60, sec % 60, msec % 1000); + sprintf(buf_ptr, "%02" B_PRId32 ".%02" B_PRId32 ".%03" B_PRId32 ":", + sec / 60, sec % 60, msec % 1000); buf_ptr += strlen(buf_ptr); } @@ -123,4 +123,3 @@ void usb_asix_trace(bool force, const char* func, const char *fmt, ...) } mutex_unlock(&gLogLock); } - diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp index 8cff098f32..9ceb5f987a 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.cpp @@ -346,11 +346,12 @@ DavicomDevice::Write(const uint8 *buffer, size_t *numBytes) } struct _TXHeader { - uint countLow :8; - uint countHigh :8; + uint8 countLow; + uint8 countHigh; } __attribute__((__packed__)); - _TXHeader header = { length & 0xff, length >> 8 & 0xff }; + _TXHeader header = { (uint8)(length & 0xff), + (uint8)((length >> 8) & 0xff) }; uint8 padding = 0; @@ -821,7 +822,7 @@ DavicomDevice::_ModifyMulticastTable(bool join, ether_address_t *group) void DavicomDevice::_ReadCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_RX("ReadCB: %d bytes; status:%#010x\n", actualLength, status); DavicomDevice *device = (DavicomDevice *)cookie; @@ -834,7 +835,7 @@ DavicomDevice::_ReadCallback(void *cookie, int32 status, void *data, void DavicomDevice::_WriteCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_TX("WriteCB: %d bytes; status:%#010x\n", actualLength, status); DavicomDevice *device = (DavicomDevice *)cookie; @@ -847,7 +848,7 @@ DavicomDevice::_WriteCallback(void *cookie, int32 status, void *data, void DavicomDevice::_NotifyCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { DavicomDevice *device = (DavicomDevice *)cookie; atomic_add(&device->fInsideNotify, 1); @@ -1117,7 +1118,7 @@ DavicomDevice::_WriteMII(uint8 reg, uint16 data) } // put the value to data register - uint8 values[] = { data & 0xff, ( data >> 8 ) & 0xff }; + uint8 values[] = { (uint8)(data & 0xff), (uint8)((data >> 8) & 0xff) }; result = _WriteRegister(RegEPDRL, sizeof(uint16), values); if (result != B_OK) { TRACE_ALWAYS("Failed to put data %#x. Error:%#x\n", data, result); diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h index 4d94f5fb75..af0ce0e0de 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_davicom/DavicomDevice.h @@ -123,11 +123,11 @@ public: private: static void _ReadCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _WriteCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _NotifyCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); status_t _SetupEndpoints(); diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp index 1e85b40af7..cbbe356758 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Driver.cpp @@ -321,7 +321,7 @@ publish_devices() gDeviceNames[deviceCount] = (char *)malloc(strlen(sDeviceBaseName) + 4); if (gDeviceNames[deviceCount]) { - sprintf(gDeviceNames[deviceCount], "%s%ld", sDeviceBaseName, i); + sprintf(gDeviceNames[deviceCount], "%s%" B_PRId32, sDeviceBaseName, i); TRACE("publishing %s\n", gDeviceNames[deviceCount]); deviceCount++; } else diff --git a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp index 3aaf213087..3e46e946e1 100644 --- a/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp +++ b/src/add-ons/kernel/drivers/network/usb_davicom/Settings.cpp @@ -103,7 +103,7 @@ void usb_davicom_trace(bool force, const char* func, const char *fmt, ...) bigtime_t time = system_time(); uint32 msec = time / 1000; uint32 sec = msec / 1000; - sprintf(buf_ptr, "%02ld.%02ld.%03ld:", + sprintf(buf_ptr, "%02" B_PRId32 ".%02" B_PRId32 ".%03" B_PRId32 ":", sec / 60, sec % 60, msec % 1000); buf_ptr += strlen(buf_ptr); } diff --git a/src/add-ons/kernel/drivers/network/usb_ecm/Driver.cpp b/src/add-ons/kernel/drivers/network/usb_ecm/Driver.cpp index b56daf0bcb..ac25820d04 100644 --- a/src/add-ons/kernel/drivers/network/usb_ecm/Driver.cpp +++ b/src/add-ons/kernel/drivers/network/usb_ecm/Driver.cpp @@ -38,7 +38,7 @@ usb_ecm_device_added(usb_device device, void **cookie) if (gECMDevices[i]->CompareAndReattach(device) != B_OK) continue; - TRACE_ALWAYS("ecm device %ld replugged\n", i); + TRACE_ALWAYS("ecm device %" B_PRId32 " replugged\n", i); *cookie = gECMDevices[i]; mutex_unlock(&gDriverLock); return B_OK; @@ -60,7 +60,7 @@ usb_ecm_device_added(usb_device device, void **cookie) gECMDevices[i] = ecmDevice; *cookie = ecmDevice; - TRACE_ALWAYS("ecm device %ld added\n", i); + TRACE_ALWAYS("ecm device %" B_PRId32 " added\n", i); mutex_unlock(&gDriverLock); return B_OK; } @@ -258,7 +258,8 @@ publish_devices() gDeviceNames[deviceCount] = (char *)malloc(strlen(sDeviceBaseName) + 4); if (gDeviceNames[deviceCount]) { - sprintf(gDeviceNames[deviceCount], "%s%ld", sDeviceBaseName, i); + sprintf(gDeviceNames[deviceCount], "%s%" B_PRId32, sDeviceBaseName, + i); TRACE("publishing %s\n", gDeviceNames[deviceCount]); deviceCount++; } else diff --git a/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.cpp b/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.cpp index 04c7adaa11..f9f00928ed 100644 --- a/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.cpp +++ b/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.cpp @@ -195,7 +195,7 @@ ECMDevice::Read(uint8 *buffer, size_t *numBytes) } if (fStatusRead != B_OK && fStatusRead != B_CANCELED && !fRemoved) { - TRACE_ALWAYS("device status error 0x%08lx\n", fStatusRead); + TRACE_ALWAYS("device status error 0x%08" B_PRIx32 "\n", fStatusRead); result = gUSBModule->clear_feature(fReadEndpoint, USB_FEATURE_ENDPOINT_HALT); if (result != B_OK) { @@ -232,7 +232,7 @@ ECMDevice::Write(const uint8 *buffer, size_t *numBytes) } if (fStatusWrite != B_OK && fStatusWrite != B_CANCELED && !fRemoved) { - TRACE_ALWAYS("device status error 0x%08lx\n", fStatusWrite); + TRACE_ALWAYS("device status error 0x%08" B_PRIx32 "\n", fStatusWrite); result = gUSBModule->clear_feature(fWriteEndpoint, USB_FEATURE_ENDPOINT_HALT); if (result != B_OK) { @@ -279,7 +279,7 @@ ECMDevice::Control(uint32 op, void *buffer, size_t length) #endif default: - TRACE_ALWAYS("unsupported ioctl %lu\n", op); + TRACE_ALWAYS("unsupported ioctl %" B_PRIu32 "\n", op); } return B_DEV_INVALID_IOCTL; @@ -506,7 +506,7 @@ ECMDevice::_ReadMACAddress(usb_device device, uint8 *buffer) void ECMDevice::_ReadCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { ECMDevice *device = (ECMDevice *)cookie; device->fActualLengthRead = actualLength; @@ -517,7 +517,7 @@ ECMDevice::_ReadCallback(void *cookie, int32 status, void *data, void ECMDevice::_WriteCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { ECMDevice *device = (ECMDevice *)cookie; device->fActualLengthWrite = actualLength; @@ -528,7 +528,7 @@ ECMDevice::_WriteCallback(void *cookie, int32 status, void *data, void ECMDevice::_NotifyCallback(void *cookie, int32 status, void *data, - uint32 actualLength) + size_t actualLength) { ECMDevice *device = (ECMDevice *)cookie; atomic_add(&device->fInsideNotify, 1); @@ -580,7 +580,7 @@ ECMDevice::_NotifyCallback(void *cookie, int32 status, void *data, } if (status != B_OK) { - TRACE_ALWAYS("device status error 0x%08lx\n", status); + TRACE_ALWAYS("device status error 0x%08" B_PRIx32 "\n", status); if (gUSBModule->clear_feature(device->fNotifyEndpoint, USB_FEATURE_ENDPOINT_HALT) != B_OK) TRACE_ALWAYS("failed to clear halt state in notify hook\n"); diff --git a/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.h b/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.h index 3a6801a4ea..2cc5b266d0 100644 --- a/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.h +++ b/src/add-ons/kernel/drivers/network/usb_ecm/ECMDevice.h @@ -32,11 +32,11 @@ public: private: static void _ReadCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _WriteCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); static void _NotifyCallback(void *cookie, int32 status, - void *data, uint32 actualLength); + void *data, size_t actualLength); status_t _SetupDevice(); status_t _ReadMACAddress(usb_device device, uint8 *buffer); diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp index 77f9f74643..fb88813c9e 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp @@ -351,7 +351,7 @@ publish_devices() if (gSerialDevices[i]) { gDeviceNames[j] = (char *)malloc(strlen(sDeviceBaseName) + 4); if (gDeviceNames[j]) { - sprintf(gDeviceNames[j], "%s%ld", sDeviceBaseName, i); + sprintf(gDeviceNames[j], "%s%" B_PRId32, sDeviceBaseName, i); j++; } else TRACE_ALWAYS("publish_devices - no memory to allocate device names\n"); diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index e8bb192c35..4af8c16a30 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -669,7 +669,7 @@ SerialDevice::_WriteToDevice() void SerialDevice::_ReadCallbackFunction(void *cookie, status_t status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_FUNCALLS("read callback: cookie: 0x%08x status: 0x%08x data: 0x%08x " "length: %lu\n", cookie, status, data, actualLength); @@ -683,7 +683,7 @@ SerialDevice::_ReadCallbackFunction(void *cookie, status_t status, void *data, void SerialDevice::_WriteCallbackFunction(void *cookie, status_t status, void *data, - uint32 actualLength) + size_t actualLength) { TRACE_FUNCALLS("write callback: cookie: 0x%08x status: 0x%08x data: 0x%08x " "length: %lu\n", cookie, status, data, actualLength); @@ -697,7 +697,7 @@ SerialDevice::_WriteCallbackFunction(void *cookie, status_t status, void *data, void SerialDevice::_InterruptCallbackFunction(void *cookie, status_t status, - void *data, uint32 actualLength) + void *data, size_t actualLength) { TRACE_FUNCALLS("interrupt callback: cookie: 0x%08x status: 0x%08x data: " "0x%08x len: %lu\n", cookie, status, data, actualLength); diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h index 57afc10cb7..213e2556d8 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h @@ -95,13 +95,13 @@ static int32 _InputThread(void *data); static void _ReadCallbackFunction(void *cookie, int32 status, void *data, - uint32 actualLength); + size_t actualLength); static void _WriteCallbackFunction(void *cookie, int32 status, void *data, - uint32 actualLength); + size_t actualLength); static void _InterruptCallbackFunction(void *cookie, int32 status, void *data, - uint32 actualLength); + size_t actualLength); usb_device fDevice; // USB device handle uint16 fVendorID; diff --git a/src/add-ons/kernel/drivers/power/x86_cpuidle/acpi_cpuidle.cpp b/src/add-ons/kernel/drivers/power/x86_cpuidle/acpi_cpuidle.cpp index dbce64caa5..dc4ce67ef7 100644 --- a/src/add-ons/kernel/drivers/power/x86_cpuidle/acpi_cpuidle.cpp +++ b/src/add-ons/kernel/drivers/power/x86_cpuidle/acpi_cpuidle.cpp @@ -7,22 +7,24 @@ * Yongcong Du */ -#include -#include -#include -#include -#include -#include #include #include #include #include +#include +#include +#include + +#include +#include #include +#include #include "x86_cpuidle.h" + #define ACPI_PDC_REVID 0x1 #define ACPI_OSC_QUERY (1 << 0) @@ -65,6 +67,7 @@ #define ACPI_CPUIDLE_MODULE_NAME "drivers/power/x86_cpuidle/acpi/driver_v1" + struct acpicpu_reg { uint8 reg_desc; uint16 reg_reslen; @@ -80,6 +83,7 @@ struct acpi_cpuidle_driver_info { acpi_device_module_info *acpi; acpi_device acpi_cookie; uint32 flags; + int32 cpuIndex; }; struct acpi_cstate_info { @@ -89,10 +93,12 @@ struct acpi_cstate_info { uint8 type; }; -static acpi_cpuidle_driver_info *acpi_processor[B_MAX_CPU_COUNT]; + +static acpi_cpuidle_driver_info *sAcpiProcessor[B_MAX_CPU_COUNT]; static CpuidleDevice sAcpiDevice; static device_manager_info *sDeviceManager; static acpi_module_info *sAcpi; + CpuidleModuleInfo *gIdle; @@ -110,11 +116,13 @@ acpi_eval_pdc(acpi_cpuidle_driver_info *device) cap[2] = ACPI_PDC_C_C1_HALT | ACPI_PDC_SMP_C1PT | ACPI_PDC_SMP_C2C3; cap[2] |= ACPI_PDC_SMP_P_SW | ACPI_PDC_SMP_C_SW | ACPI_PDC_SMP_T_SW; cap[2] |= ACPI_PDC_C_C1_FFH | ACPI_PDC_C_C2C3_FFH; - cap[2] |= ACPI_PDC_SMP_T_SW | ACPI_PDC_P_FFH | ACPI_PDC_P_HWCOORD | ACPI_PDC_T_FFH; + cap[2] |= ACPI_PDC_SMP_T_SW | ACPI_PDC_P_FFH | ACPI_PDC_P_HWCOORD + | ACPI_PDC_T_FFH; obj.object_type = ACPI_TYPE_BUFFER; obj.data.buffer.length = sizeof(cap); obj.data.buffer.buffer = cap; - status_t status = device->acpi->evaluate_method(device->acpi_cookie, "_PDC", &arg, NULL); + status_t status = device->acpi->evaluate_method(device->acpi_cookie, "_PDC", + &arg, NULL); return status; } @@ -133,7 +141,8 @@ acpi_eval_osc(acpi_cpuidle_driver_info *device) cap[1] = ACPI_PDC_C_C1_HALT | ACPI_PDC_SMP_C1PT | ACPI_PDC_SMP_C2C3; cap[1] |= ACPI_PDC_SMP_P_SW | ACPI_PDC_SMP_C_SW | ACPI_PDC_SMP_T_SW; cap[1] |= ACPI_PDC_C_C1_FFH | ACPI_PDC_C_C2C3_FFH; - cap[1] |= ACPI_PDC_SMP_T_SW | ACPI_PDC_P_FFH | ACPI_PDC_P_HWCOORD | ACPI_PDC_T_FFH; + cap[1] |= ACPI_PDC_SMP_T_SW | ACPI_PDC_P_FFH | ACPI_PDC_P_HWCOORD + | ACPI_PDC_T_FFH; acpi_objects arg; acpi_object_type obj[4]; @@ -155,7 +164,8 @@ acpi_eval_osc(acpi_cpuidle_driver_info *device) acpi_data buf; buf.pointer = NULL; buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status_t status = device->acpi->evaluate_method(device->acpi_cookie, "_OSC", &arg, &buf); + status_t status = device->acpi->evaluate_method(device->acpi_cookie, "_OSC", + &arg, &buf); if (status != B_OK) return status; acpi_object_type *osc = (acpi_object_type *)buf.pointer; @@ -232,7 +242,7 @@ acpi_cstate_idle(int32 state, CpuidleDevice *device) // set BM_RLD for Bus Master to activity to wake the system from C3 // With Newer chipsets BM_RLD is a NOP Since DMA is automatically handled // during C3 State - acpi_cpuidle_driver_info *pi = acpi_processor[smp_get_current_cpu()]; + acpi_cpuidle_driver_info *pi = sAcpiProcessor[smp_get_current_cpu()]; if (pi->flags & ACPI_FLAG_C_BM) sAcpi->write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, 1); @@ -283,7 +293,7 @@ acpi_cstate_add(acpi_object_type *object, CpuidleCstate *cState) } ci->type = n; dprintf("C%" B_PRId32 "\n", n); - snprintf(cState->name, sizeof(cState->name), "C%"B_PRId32, n); + snprintf(cState->name, sizeof(cState->name), "C%" B_PRId32, n); // Latency pointer = &object->data.package.objects[2]; @@ -378,7 +388,7 @@ acpi_cpuidle_setup(acpi_cpuidle_driver_info *device) if (status != B_OK) status = acpi_eval_pdc(device); if (status != B_OK) { - dprintf("faile to eval _OSC and _PDC\n"); + dprintf("failed to eval _OSC and _PDC\n"); return status; } @@ -433,7 +443,7 @@ acpi_cpuidle_init(void) dprintf("acpi_cpuidle_init\n"); for (int32 i = 0; i < smp_get_num_cpus(); i++) - if (acpi_cpuidle_setup(acpi_processor[i]) != B_OK) + if (acpi_cpuidle_setup(sAcpiProcessor[i]) != B_OK) return B_ERROR; status_t status = gIdle->AddDevice(&sAcpiDevice); @@ -446,39 +456,48 @@ acpi_cpuidle_init(void) static status_t acpi_processor_init(acpi_cpuidle_driver_info *device) { - status_t status = B_ERROR; + // get the CPU index + dprintf("get acpi processor @%p\n", device->acpi_cookie); acpi_data buffer; buffer.pointer = NULL; buffer.length = ACPI_ALLOCATE_BUFFER; - dprintf("get acpi processor @%p\n", device->acpi_cookie); - status = device->acpi->evaluate_method(device->acpi_cookie, NULL, NULL, - &buffer); + status_t status = device->acpi->evaluate_method(device->acpi_cookie, NULL, + NULL, &buffer); if (status != B_OK) { dprintf("failed to get processor obj\n"); - return B_IO_ERROR; + return status; } + acpi_object_type *object = (acpi_object_type *)buffer.pointer; - dprintf("acpi cpu%"B_PRId32": P_BLK at %#x/%lu\n", - object->data.processor.cpu_id, - object->data.processor.pblk_address, - object->data.processor.pblk_length); - int32 cpuid = object->data.processor.cpu_id; + dprintf("acpi cpu%" B_PRId32 ": P_BLK at %#x/%lu\n", + object->data.processor.cpu_id, + object->data.processor.pblk_address, + object->data.processor.pblk_length); + + int32 cpuIndex = object->data.processor.cpu_id; free(buffer.pointer); - if (cpuid > smp_get_num_cpus()) + + if (cpuIndex < 0 || cpuIndex >= smp_get_num_cpus()) return B_ERROR; - if (smp_get_num_cpus() == 1) - cpuid = 1; + device->cpuIndex = cpuIndex; + sAcpiProcessor[cpuIndex] = device; - acpi_processor[cpuid-1] = device; - - if (cpuid == 1) { - if (intel_cpuidle_init() != B_OK) - return acpi_cpuidle_init(); + // If nodes for all processors have been registered, init the idle callback. + for (int32 i = smp_get_num_cpus() - 1; i >= 0; i--) { + if (sAcpiProcessor[i] == NULL) + return B_OK; } - return B_OK; + if (intel_cpuidle_init() == B_OK) + return B_OK; + + status = acpi_cpuidle_init(); + if (status != B_OK) + sAcpiProcessor[cpuIndex] = NULL; + + return status; } @@ -493,11 +512,12 @@ acpi_cpuidle_support(device_node *parent) if (sDeviceManager->get_attr_string(parent, B_DEVICE_BUS, &bus, false)) return -1; - if (strcmp(bus, "acpi")) + if (strcmp(bus, "acpi") != 0) return 0.0; // check whether it's really a cpu Device - if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, &device_type, false) != B_OK + if (sDeviceManager->get_attr_uint32(parent, ACPI_DEVICE_TYPE_ITEM, + &device_type, false) != B_OK || device_type != ACPI_TYPE_PROCESSOR) { return 0.0; } @@ -529,8 +549,6 @@ acpi_cpuidle_init_driver(device_node *node, void **driverCookie) if (device == NULL) return B_NO_MEMORY; - *driverCookie = device; - device->node = node; device_node *parent; @@ -539,7 +557,14 @@ acpi_cpuidle_init_driver(device_node *node, void **driverCookie) (void **)&device->acpi_cookie); sDeviceManager->put_node(parent); - return acpi_processor_init(device); + status_t status = acpi_processor_init(device); + if (status != B_OK) { + free(device); + return status; + } + + *driverCookie = device; + return B_OK; } @@ -548,6 +573,9 @@ acpi_cpuidle_uninit_driver(void *driverCookie) { dprintf("acpi_cpuidle_uninit_driver"); acpi_cpuidle_driver_info *device = (acpi_cpuidle_driver_info *)driverCookie; + // TODO: When the first device to be unregistered, we'd need to balance the + // gIdle->AddDevice() call, but ATM isn't any API for that. + sAcpiProcessor[device->cpuIndex] = NULL; free(device); } diff --git a/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp b/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp index be475d884e..c690db3339 100644 --- a/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp +++ b/src/add-ons/kernel/drivers/printer/usb/usb_printer.cpp @@ -18,7 +18,7 @@ #define DRIVER_NAME "usb_printer" #define DEVICE_NAME_BASE "printer/usb/" -#define DEVICE_NAME DEVICE_NAME_BASE"%ld" +#define DEVICE_NAME DEVICE_NAME_BASE "%" B_PRId32 #define SECONDS ((bigtime_t)1000 * 1000) #define MINUTES (60 * SECONDS) @@ -142,7 +142,7 @@ usb_printer_callback(void *cookie, status_t status, void *data, static status_t usb_printer_device_added(usb_device newDevice, void **cookie) { - TRACE("device_added(0x%08lx)\n", newDevice); + TRACE("device_added(0x%08" B_PRIx32 ")\n", newDevice); printer_device *device = (printer_device *)malloc(sizeof(printer_device)); device->device = newDevice; device->removed = false; @@ -261,7 +261,7 @@ usb_printer_device_added(usb_device newDevice, void **cookie) sprintf(device->name, DEVICE_NAME, deviceNumber); mutex_unlock(&gDeviceListLock); - TRACE("new device: 0x%08lx\n", (uint32)device); + TRACE("new device: 0x%p\n", device); *cookie = (void *)device; return B_OK; } @@ -270,7 +270,7 @@ usb_printer_device_added(usb_device newDevice, void **cookie) static status_t usb_printer_device_removed(void *cookie) { - TRACE("device_removed(0x%08lx)\n", (uint32)cookie); + TRACE("device_removed(0x%p)\n", cookie); printer_device *device = (printer_device *)cookie; mutex_lock(&gDeviceListLock); @@ -412,7 +412,7 @@ usb_printer_ioctl(void *cookie, uint32 op, void *buffer, size_t length) } default: - TRACE_ALWAYS("unhandled ioctl %ld\n", op); + TRACE_ALWAYS("unhandled ioctl %" B_PRIu32 "\n", op); break; } @@ -459,7 +459,7 @@ usb_printer_read(void *cookie, off_t position, void *buffer, size_t *length) if (buffer == NULL || length == NULL) return B_BAD_VALUE; - TRACE("read(%lld, %ld)\n", position, *length); + TRACE("read(%" B_PRIdOFF ", %" B_PRIuSIZE ")\n", position, *length); printer_device *device = (printer_device *)cookie; mutex_lock(&device->lock); if (device->removed) { @@ -472,12 +472,12 @@ usb_printer_read(void *cookie, off_t position, void *buffer, size_t *length) mutex_unlock(&device->lock); if (result == B_OK) { - TRACE("read successful with %ld bytes\n", *length); + TRACE("read successful with %" B_PRIuSIZE " bytes\n", *length); return B_OK; } *length = 0; - TRACE_ALWAYS("read fails with 0x%08lx\n", result); + TRACE_ALWAYS("read fails with 0x%08" B_PRIx32 "\n", result); return result; } @@ -489,7 +489,7 @@ usb_printer_write(void *cookie, off_t position, const void *buffer, if (buffer == NULL || length == NULL) return B_BAD_VALUE; - TRACE("write(%lld, %ld)\n", position, *length); + TRACE("write(%" B_PRIdOFF ", %" B_PRIuSIZE ")\n", position, *length); printer_device *device = (printer_device *)cookie; mutex_lock(&device->lock); if (device->removed) { @@ -503,12 +503,12 @@ usb_printer_write(void *cookie, off_t position, const void *buffer, mutex_unlock(&device->lock); if (result == B_OK) { - TRACE("write successful with %ld bytes\n", *length); + TRACE("write successful with %" B_PRIuSIZE " bytes\n", *length); return B_OK; } *length = 0; - TRACE_ALWAYS("write fails with 0x%08lx\n", result); + TRACE_ALWAYS("write fails with 0x%08" B_PRIx32 "\n", result); return result; } @@ -551,7 +551,7 @@ init_driver() status_t result = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); if (result < B_OK) { - TRACE_ALWAYS("getting module failed 0x%08lx\n", result); + TRACE_ALWAYS("getting module failed 0x%08" B_PRIx32 "\n", result); mutex_destroy(&gDeviceListLock); return result; } diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp index df5d999206..ba82408f47 100644 --- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp @@ -12,9 +12,21 @@ #include "Debug.h" #include "BPlusTree.h" -#include "Inode.h" #include "Utility.h" +#if !_BOOT_MODE +#include "Inode.h" +#else +#include "Stream.h" + +// BFS::Stream from the bootloader has the same API as Inode. +#define Inode BFS::Stream + +#define strerror(x) "error message unavailable" + +namespace BFS { +#endif + /*! Simple array used for the duplicate handling in the B+Tree. This is an on disk structure. @@ -88,9 +100,10 @@ private: int32 fSize; const char* fText; }; -#endif +#endif // DEBUG +#if !_BOOT_MODE class BitmapArray { public: BitmapArray(size_t numBits); @@ -243,6 +256,7 @@ CachedNode::UnsetUnchanged(Transaction& transaction) fNode = NULL; } } +#endif // !_BOOT_MODE void @@ -252,6 +266,7 @@ CachedNode::Unset() return; if (fNode != NULL) { +#if !_BOOT_MODE if (fWritable && fOffset == 0) { // The B+tree header has been updated - we need to update the // BPlusTrees copy of it, as well. @@ -260,6 +275,8 @@ CachedNode::Unset() block_cache_put(fTree->fStream->GetVolume()->BlockCache(), fBlockNumber); +#endif // !_BOOT_MODE + fNode = NULL; } } @@ -289,8 +306,9 @@ CachedNode::SetTo(off_t offset, const bplustree_node** _node, bool check) // instead) if (offset > fTree->fHeader.MaximumSize() - fTree->fNodeSize || offset <= 0 - || (offset % fTree->fNodeSize) != 0) + || (offset % fTree->fNodeSize) != 0) { RETURN_ERROR(B_BAD_VALUE); + } if (InternalSetTo(NULL, offset) != NULL && check) { // sanity checks (links, all_key_count) @@ -307,6 +325,7 @@ CachedNode::SetTo(off_t offset, const bplustree_node** _node, bool check) } +#if !_BOOT_MODE bplustree_node* CachedNode::SetToWritable(Transaction& transaction, off_t offset, bool check) { @@ -345,11 +364,13 @@ CachedNode::MakeWritable(Transaction& transaction) return NULL; if (block_cache_make_writable(transaction.GetVolume()->BlockCache(), - fBlockNumber, transaction.ID()) == B_OK) + fBlockNumber, transaction.ID()) == B_OK) { return fNode; + } return NULL; } +#endif // !_BOOT_MODE const bplustree_header* @@ -367,6 +388,7 @@ CachedNode::SetToHeader() } +#if !_BOOT_MODE bplustree_header* CachedNode::SetToWritableHeader(Transaction& transaction) { @@ -391,6 +413,7 @@ CachedNode::SetToWritableHeader(Transaction& transaction) return (bplustree_header*)fNode; } +#endif // !_BOOT_MODE bplustree_node* @@ -403,12 +426,18 @@ CachedNode::InternalSetTo(Transaction* transaction, off_t offset) block_run run; if (offset < fTree->fStream->Size() && fTree->fStream->FindBlockRun(offset, run, fileOffset) == B_OK) { + +#if !_BOOT_MODE Volume* volume = fTree->fStream->GetVolume(); +#else + Volume* volume = &fTree->fStream->GetVolume(); +#endif int32 blockOffset = (offset - fileOffset) / volume->BlockSize(); fBlockNumber = volume->ToBlock(run) + blockOffset; - uint8* block; + uint8* block = NULL; +#if !_BOOT_MODE if (transaction != NULL) { block = (uint8*)block_cache_get_writable(volume->BlockCache(), fBlockNumber, transaction->ID()); @@ -417,6 +446,20 @@ CachedNode::InternalSetTo(Transaction* transaction, off_t offset) block = (uint8*)block_cache_get(volume->BlockCache(), fBlockNumber); fWritable = false; } +#else // !_BOOT_MODE + if (fBlock == NULL) { + fBlock = (uint8*)malloc(volume->BlockSize()); + if (fBlock == NULL) + return NULL; + } + + if (read_pos(volume->Device(), fBlockNumber << volume->BlockShift(), + fBlock, volume->BlockSize()) == (ssize_t)volume->BlockSize()) { + block = fBlock; + } + + fWritable = false; +#endif // _BOOT_MODE if (block != NULL) { // The node is somewhere in that block... @@ -430,6 +473,7 @@ CachedNode::InternalSetTo(Transaction* transaction, off_t offset) } +#if !_BOOT_MODE status_t CachedNode::Free(Transaction& transaction, off_t offset) { @@ -540,6 +584,7 @@ BPlusTree::BPlusTree(Transaction& transaction, Inode* stream, int32 nodeSize) mutex_init(&fIteratorLock, "bfs b+tree iterator"); SetTo(transaction, stream); } +#endif // !_BOOT_MODE BPlusTree::BPlusTree(Inode* stream) @@ -547,7 +592,10 @@ BPlusTree::BPlusTree(Inode* stream) fStream(NULL), fInTransaction(false) { +#if !_BOOT_MODE mutex_init(&fIteratorLock, "bfs b+tree iterator"); +#endif + SetTo(stream); } @@ -560,12 +608,15 @@ BPlusTree::BPlusTree() fInTransaction(false), fStatus(B_NO_INIT) { +#if !_BOOT_MODE mutex_init(&fIteratorLock, "bfs b+tree iterator"); +#endif } BPlusTree::~BPlusTree() { +#if !_BOOT_MODE // if there are any TreeIterators left, we need to stop them // (can happen when the tree's inode gets deleted while // traversing the tree - a TreeIterator doesn't lock the inode) @@ -579,9 +630,11 @@ BPlusTree::~BPlusTree() mutex_destroy(&fIteratorLock); ASSERT(!fInTransaction); +#endif // !_BOOT_MODE } +#if !_BOOT_MODE /*! Create a new B+Tree on the specified stream */ status_t BPlusTree::SetTo(Transaction& transaction, Inode* stream, int32 nodeSize) @@ -629,6 +682,7 @@ BPlusTree::SetTo(Transaction& transaction, Inode* stream, int32 nodeSize) return fStatus = B_OK; } +#endif // !_BOOT_MODE status_t @@ -701,6 +755,7 @@ BPlusTree::InitCheck() } +#if !_BOOT_MODE status_t BPlusTree::Validate(bool repair, bool& _errorsFound) { @@ -883,11 +938,13 @@ BPlusTree::ModeToKeyType(mode_t mode) return BPLUSTREE_STRING_TYPE; } } +#endif // !_BOOT_MODE // #pragma mark - TransactionListener implementation +#if !_BOOT_MODE void BPlusTree::TransactionDone(bool success) { @@ -944,6 +1001,7 @@ BPlusTree::_RemoveIterator(TreeIterator* iterator) MutexLocker _(fIteratorLock); fIterators.Remove(iterator); } +#endif // !_BOOT_MODE int32 @@ -1006,7 +1064,9 @@ BPlusTree::_FindKey(const bplustree_node* node, const uint8* key, if (searchKey + searchLength + sizeof(off_t) + sizeof(uint16) > (uint8*)node + fNodeSize || searchLength > BPLUSTREE_MAX_KEY_LENGTH) { +#if !_BOOT_MODE fStream->GetVolume()->Panic(); +#endif RETURN_ERROR(B_BAD_DATA); } @@ -1037,6 +1097,7 @@ BPlusTree::_FindKey(const bplustree_node* node, const uint8* key, } +#if !_BOOT_MODE /*! Prepares the stack to contain all nodes that were passed while following the key, from the root node to the leaf node that could or should contain that key. @@ -2196,6 +2257,7 @@ BPlusTree::Replace(Transaction& transaction, const uint8* key, uint16 keyLength, } RETURN_ERROR(B_ERROR); } +#endif // !_BOOT_MODE /*! Searches the key in the tree, and stores the offset found in _value, @@ -2220,7 +2282,9 @@ BPlusTree::Find(const uint8* key, uint16 keyLength, off_t* _value) if (fAllowDuplicates) RETURN_ERROR(B_BAD_TYPE); +#if !_BOOT_MODE ASSERT_READ_LOCKED_INODE(fStream); +#endif off_t nodeOffset = fHeader.RootNode(); CachedNode cached(this); @@ -2259,6 +2323,7 @@ BPlusTree::Find(const uint8* key, uint16 keyLength, off_t* _value) } +#if !_BOOT_MODE status_t BPlusTree::_ValidateChildren(TreeCheck& check, uint32 level, off_t offset, const uint8* largestKey, uint16 largestKeyLength, @@ -2482,6 +2547,7 @@ BPlusTree::_ValidateChild(TreeCheck& check, CachedNode& cached, uint32 level, return _ValidateChildren(check, level + 1, offset, key, keyLength, node); } +#endif // !_BOOT_MODE // #pragma mark - @@ -2492,14 +2558,18 @@ TreeIterator::TreeIterator(BPlusTree* tree) fTree(tree), fCurrentNodeOffset(BPLUSTREE_NULL) { +#if !_BOOT_MODE tree->_AddIterator(this); +#endif } TreeIterator::~TreeIterator() { +#if !_BOOT_MODE if (fTree) fTree->_RemoveIterator(this); +#endif } @@ -2509,8 +2579,10 @@ TreeIterator::Goto(int8 to) if (fTree == NULL || fTree->fStream == NULL) RETURN_ERROR(B_BAD_VALUE); +#if !_BOOT_MODE // lock access to stream InodeReadLocker locker(fTree->fStream); +#endif off_t nodeOffset = fTree->fHeader.RootNode(); CachedNode cached(fTree); @@ -2578,8 +2650,10 @@ TreeIterator::Traverse(int8 direction, void* key, uint16* keyLength, if (fCurrentNodeOffset == BPLUSTREE_FREE) return B_ENTRY_NOT_FOUND; +#if !_BOOT_MODE // lock access to stream InodeReadLocker locker(fTree->fStream); +#endif CachedNode cached(fTree); const bplustree_node* node; @@ -2641,7 +2715,7 @@ TreeIterator::Traverse(int8 direction, void* key, uint16* keyLength, RETURN_ERROR(B_ERROR); // reset current key - fCurrentKey = forward ? 0 : node->NumKeys(); + fCurrentKey = forward ? 0 : node->NumKeys() - 1; } else { // there are no nodes left, so turn back to the last key fCurrentNodeOffset = savedNodeOffset; @@ -2659,19 +2733,26 @@ TreeIterator::Traverse(int8 direction, void* key, uint16* keyLength, if (keyStart + length + sizeof(off_t) + sizeof(uint16) > (uint8*)node + fTree->fNodeSize || length > BPLUSTREE_MAX_KEY_LENGTH) { +#if !_BOOT_MODE fTree->fStream->GetVolume()->Panic(); +#endif RETURN_ERROR(B_BAD_DATA); } - length = min_c(length, maxLength); + // include the termination for string types + bool needsTermination = fTree->fHeader.DataType() == BPLUSTREE_STRING_TYPE; + if (length + (needsTermination ? 1 : 0) > maxLength) { + // the buffer is too small, restore the last key and return an error + fCurrentNodeOffset = savedNodeOffset; + fCurrentKey = savedKey; + return B_BUFFER_OVERFLOW; + } + memcpy(key, keyStart, length); - if (fTree->fHeader.DataType() == BPLUSTREE_STRING_TYPE) { - // terminate string type - if (length == maxLength) - length--; + if (needsTermination) ((char*)key)[length] = '\0'; - } + *keyLength = length; off_t offset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[fCurrentKey]); @@ -2722,8 +2803,10 @@ TreeIterator::Find(const uint8* key, uint16 keyLength) || key == NULL) RETURN_ERROR(B_BAD_VALUE); +#if !_BOOT_MODE // lock access to stream InodeReadLocker locker(fTree->fStream); +#endif off_t nodeOffset = fTree->fHeader.RootNode(); @@ -2925,6 +3008,7 @@ bplustree_node::CheckIntegrity(uint32 nodeSize) const // #pragma mark - +#if !_BOOT_MODE BitmapArray::BitmapArray(size_t numBits) { fSize = (numBits + 7) / 8; @@ -2972,6 +3056,7 @@ BitmapArray::Set(size_t index, bool set) fCountSet--; } } +#endif // !_BOOT_MODE // #pragma mark - @@ -3004,7 +3089,7 @@ duplicate_array::Insert(off_t value) // binary search, if not, just iterate linearly to find // the insertion point int32 size = Count(); - int32 i; + int32 i = 0; if (size > 8 ) { if (!_FindInternal(value, i) && ValueAt(i) <= value) i++; @@ -3127,3 +3212,7 @@ compareKeys(type_code type, const void* key1, int keyLength1, return -1; } + +#if _BOOT_MODE +} // namespace BFS +#endif diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.h b/src/add-ons/kernel/file_systems/bfs/BPlusTree.h index c1e1ad24e0..cfc4aac9a1 100644 --- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.h +++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.h @@ -7,8 +7,21 @@ #include "bfs.h" -#include "Journal.h" +#include "Utility.h" + +#if !_BOOT_MODE +#include "Journal.h" +class Inode; +#else +#define Inode BFS::Stream + +namespace BFS { + +class Stream; +class Transaction; +class TransactionListener {}; +#endif // _BOOT_MODE // #pragma mark - on-disk structures @@ -132,18 +145,21 @@ enum bplustree_traversing { // #pragma mark - in-memory structures -template class Stack; + class BPlusTree; -class TreeIterator; -class CachedNode; -class Inode; struct TreeCheck; +class TreeIterator; + + +#if !_BOOT_MODE +template class Stack; // needed for searching (utilizing a stack) struct node_and_key { off_t nodeOffset; uint16 keyIndex; }; +#endif // !_BOOT_MODE class CachedNode { @@ -153,6 +169,9 @@ public: fTree(tree), fNode(NULL) { +#if _BOOT_MODE + fBlock = NULL; +#endif } CachedNode(BPlusTree* tree, off_t offset, bool check = true) @@ -160,30 +179,40 @@ public: fTree(tree), fNode(NULL) { +#if _BOOT_MODE + fBlock = NULL; +#endif SetTo(offset, check); } ~CachedNode() { Unset(); +#if _BOOT_MODE + free(fBlock); +#endif } const bplustree_node* SetTo(off_t offset, bool check = true); status_t SetTo(off_t offset, const bplustree_node** _node, bool check = true); + + const bplustree_header* SetToHeader(); + void Unset(); + +#if !_BOOT_MODE bplustree_node* SetToWritable(Transaction& transaction, off_t offset, bool check = true); bplustree_node* MakeWritable(Transaction& transaction); - const bplustree_header* SetToHeader(); bplustree_header* SetToWritableHeader(Transaction& transaction); void UnsetUnchanged(Transaction& transaction); - void Unset(); status_t Free(Transaction& transaction, off_t offset); status_t Allocate(Transaction& transaction, bplustree_node** _node, off_t* _offset); +#endif // !_BOOT_MODE bool IsWritable() const { return fWritable; } bplustree_node* Node() const { return fNode; } @@ -197,20 +226,27 @@ protected: off_t fOffset; off_t fBlockNumber; bool fWritable; +#if _BOOT_MODE + uint8* fBlock; +#endif }; class BPlusTree : public TransactionListener { public: +#if !_BOOT_MODE BPlusTree(Transaction& transaction, Inode* stream, int32 nodeSize = BPLUSTREE_NODE_SIZE); +#endif BPlusTree(Inode* stream); BPlusTree(); ~BPlusTree(); +#if !_BOOT_MODE status_t SetTo(Transaction& transaction, Inode* stream, int32 nodeSize = BPLUSTREE_NODE_SIZE); +#endif status_t SetTo(Inode* stream); status_t SetStream(Inode* stream); @@ -219,6 +255,7 @@ public: size_t NodeSize() const { return fNodeSize; } Inode* Stream() const { return fStream; } +#if !_BOOT_MODE status_t Validate(bool repair, bool& _errorsFound); status_t MakeEmpty(); @@ -249,15 +286,19 @@ public: status_t Replace(Transaction& transaction, const uint8* key, uint16 keyLength, off_t value); +#endif // !_BOOT_MODE + status_t Find(const uint8* key, uint16 keyLength, off_t* value); +#if !_BOOT_MODE static int32 TypeCodeToKeyType(type_code code); static int32 ModeToKeyType(mode_t mode); protected: virtual void TransactionDone(bool success); virtual void RemovedFromTransaction(); +#endif // !_BOOT_MODE private: BPlusTree(const BPlusTree& other); @@ -269,6 +310,7 @@ private: status_t _FindKey(const bplustree_node* node, const uint8* key, uint16 keyLength, uint16* index = NULL, off_t* next = NULL); +#if !_BOOT_MODE status_t _SeekDown(Stack& stack, const uint8* key, uint16 keyLength); @@ -310,6 +352,7 @@ private: off_t offset, off_t lastOffset, off_t nextOffset, const uint8* key, uint16 keyLength); +#endif // !_BOOT_MODE private: friend class TreeIterator; @@ -322,8 +365,11 @@ private: bool fAllowDuplicates; bool fInTransaction; status_t fStatus; + +#if !_BOOT_MODE mutex fIteratorLock; SinglyLinkedList fIterators; +#endif }; @@ -385,6 +431,7 @@ private: // (most of them may not be needed) +#if !_BOOT_MODE inline status_t BPlusTree::Remove(Transaction& transaction, const char* key, off_t value) { @@ -455,6 +502,7 @@ BPlusTree::Insert(Transaction& transaction, double key, off_t value) return B_BAD_TYPE; return Insert(transaction, (uint8*)&key, sizeof(key), value); } +#endif // !_BOOT_MODE // #pragma mark - TreeIterator inline functions @@ -606,4 +654,10 @@ bplustree_node::MaxFragments(uint32 nodeSize) } +#if _BOOT_MODE +} // namespace BFS + +#undef Inode +#endif + #endif // B_PLUS_TREE_H diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 68c4e0353b..a6aceca9ce 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -2013,7 +2013,7 @@ BlockAllocator::_CheckInodeBlocks(Inode* inode, const char* name) fCheckCookie->control.stats.double_indirect_block_runs++; fCheckCookie->control.stats.blocks_in_double_indirect += runs[index % runsPerBlock].Length(); - } while ((++index % runsPerArray) != 0); + } while ((++index % runsPerBlock) != 0); } fCheckCookie->control.stats.double_indirect_array_blocks++; diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index c5e92c2949..d33970a614 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2012, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -206,7 +206,8 @@ InodeAllocator::New(block_run* parentRun, mode_t mode, block_run& run, } run = fRun; - fInode = new Inode(volume, *fTransaction, volume->ToVnode(run), mode, run); + fInode = new(std::nothrow) Inode(volume, *fTransaction, + volume->ToVnode(run), mode, run); if (fInode == NULL) RETURN_ERROR(B_NO_MEMORY); @@ -235,7 +236,8 @@ InodeAllocator::CreateTree() if ((fInode->Mode() & S_INDEX_TYPES) == 0) fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX); - BPlusTree* tree = fInode->fTree = new BPlusTree(*fTransaction, fInode); + BPlusTree* tree = fInode->fTree + = new(std::nothrow) BPlusTree(*fTransaction, fInode); if (tree == NULL || tree->InitCheck() < B_OK) return B_ERROR; @@ -347,7 +349,7 @@ Inode::Inode(Volume* volume, ino_t id) fOldLastModified = LastModified(); if (IsContainer()) - fTree = new BPlusTree(this); + fTree = new(std::nothrow) BPlusTree(this); if (NeedsFileCache()) { SetFileCache(file_cache_create(fVolume->ID(), ID(), Size())); SetMap(file_map_create(volume->ID(), ID(), Size())); @@ -2881,7 +2883,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type, BPlusTree* tree = fAttributes->Tree(); if (tree == NULL - || (fIterator = new TreeIterator(tree)) == NULL) { + || (fIterator = new(std::nothrow) TreeIterator(tree)) == NULL) { FATAL(("could not get tree in AttributeIterator::GetNext(ino_t" " = %" B_PRIdINO ",name = \"%s\")\n", fInode->ID(), name)); return B_ENTRY_NOT_FOUND; @@ -2892,7 +2894,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type, ino_t id; status_t status = fIterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id); - if (status < B_OK) + if (status != B_OK) return status; Vnode vnode(volume, id); diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.cpp b/src/add-ons/kernel/file_systems/bfs/Journal.cpp index fa62b52afe..bac5a4342a 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Journal.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -853,7 +853,7 @@ Journal::_WriteTransactionToLog() free(vecs); - LogEntry* logEntry = new LogEntry(this, fVolume->LogEnd(), + LogEntry* logEntry = new(std::nothrow) LogEntry(this, fVolume->LogEnd(), runArrays.LogEntryLength()); if (logEntry == NULL) { FATAL(("no memory to allocate log entries!")); diff --git a/src/add-ons/kernel/file_systems/bfs/Query.cpp b/src/add-ons/kernel/file_systems/bfs/Query.cpp index d6f213cd14..a5e593af34 100644 --- a/src/add-ons/kernel/file_systems/bfs/Query.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Query.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2001-2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2010, Clemens Zeidler * This file may be used under the terms of the MIT License. */ @@ -971,7 +971,7 @@ Equation::PrepareQuery(Volume* /*volume*/, Index& index, if (tree == NULL) return B_ERROR; - *iterator = new TreeIterator(tree); + *iterator = new(std::nothrow) TreeIterator(tree); if (*iterator == NULL) return B_NO_MEMORY; @@ -1249,11 +1249,11 @@ Term* Operator::Copy() const { if (fEquation != NULL) { - Equation* equation = new Equation(*fEquation); + Equation* equation = new(std::nothrow) Equation(*fEquation); if (equation == NULL) return NULL; - Term* term = new Term(equation); + Term* term = new(std::nothrow) Term(equation); if (term == NULL) delete equation; @@ -1270,7 +1270,7 @@ Operator::Copy() const return NULL; } - Term* term = new Term(left, fOp, right); + Term* term = new(std::nothrow) Term(left, fOp, right); if (term == NULL) { delete left; delete right; @@ -1393,7 +1393,7 @@ Expression::ParseEquation(char** expr) return term; } - Equation* equation = new Equation(expr); + Equation* equation = new(std::nothrow) Equation(expr); if (equation == NULL || equation->InitCheck() < B_OK) { delete equation; return NULL; @@ -1413,8 +1413,8 @@ Expression::ParseAnd(char** expr) Term* right = ParseAnd(expr); Term* newParent = NULL; - if (right == NULL - || (newParent = new Operator(left, OP_AND, right)) == NULL) { + if (right == NULL || (newParent = new(std::nothrow) Operator(left, + OP_AND, right)) == NULL) { delete left; delete right; @@ -1438,8 +1438,8 @@ Expression::ParseOr(char** expr) Term* right = ParseAnd(expr); Term* newParent = NULL; - if (right == NULL - || (newParent = new Operator(left, OP_OR, right)) == NULL) { + if (right == NULL || (newParent = new(std::nothrow) Operator(left, + OP_OR, right)) == NULL) { delete left; delete right; diff --git a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp index ad9b88774d..6504c9915c 100644 --- a/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp @@ -1634,25 +1634,44 @@ bfs_read_dir(fs_volume* _volume, fs_vnode* _node, void* _cookie, FUNCTION(); TreeIterator* iterator = (TreeIterator*)_cookie; - - uint16 length; - ino_t id; - status_t status = iterator->GetNextEntry(dirent->d_name, &length, - bufferSize, &id); - if (status == B_ENTRY_NOT_FOUND) { - *_num = 0; - return B_OK; - } else if (status != B_OK) - RETURN_ERROR(status); - Volume* volume = (Volume*)_volume->private_volume; - dirent->d_dev = volume->ID(); - dirent->d_ino = id; + uint32 maxCount = *_num; + uint32 count = 0; - dirent->d_reclen = sizeof(struct dirent) + length; + while (count < maxCount && bufferSize > sizeof(struct dirent)) { + ino_t id; + uint16 length; + size_t nameBufferSize = bufferSize - sizeof(struct dirent) + 1; - *_num = 1; + status_t status = iterator->GetNextEntry(dirent->d_name, &length, + nameBufferSize, &id); + + if (status == B_ENTRY_NOT_FOUND) + break; + + if (status == B_BUFFER_OVERFLOW) { + // the remaining name buffer length was too small + if (count == 0) + RETURN_ERROR(B_BUFFER_OVERFLOW); + break; + } + + if (status != B_OK) + RETURN_ERROR(status); + + ASSERT(length < nameBufferSize); + + dirent->d_dev = volume->ID(); + dirent->d_ino = id; + dirent->d_reclen = sizeof(struct dirent) + length; + + bufferSize -= dirent->d_reclen; + dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen); + count++; + } + + *_num = count; return B_OK; } diff --git a/src/add-ons/kernel/file_systems/bfs/system_dependencies.h b/src/add-ons/kernel/file_systems/bfs/system_dependencies.h index 6e8989670a..aa0773d1aa 100644 --- a/src/add-ons/kernel/file_systems/bfs/system_dependencies.h +++ b/src/add-ons/kernel/file_systems/bfs/system_dependencies.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp b/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp index abc0fc51f0..d6be6d3fcb 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Attribute.cpp @@ -162,8 +162,8 @@ Attribute::_Lookup(const char* name, size_t nameLength, status_t status = fInode->GetVolume()->FSTree()->FindExact(key, (void**)&entries, &length); if (status != B_OK) { - TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %lu " - "\"%s\"\n", hash, name); + TRACE("AttributeIterator::Lookup(): Couldn't find entry with hash %" + B_PRIu32 " \"%s\"\n", hash, name); return status; } diff --git a/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp index 04609624af..0f1bf0115d 100644 --- a/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/BPlusTree.cpp @@ -89,14 +89,14 @@ status_t BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, bplustree_traversing type) { - TRACE("Find() objectid %lld type %d offset %lld \n", key.ObjectID(), - key.Type(), key.Offset()); + TRACE("Find() objectid %" B_PRId64 " type %d offset %" B_PRId64 " \n", + key.ObjectID(), key.Type(), key.Offset()); btrfs_stream *stream = fStream; CachedBlock cached(fVolume); fsblock_t physical; if (stream == NULL) { if (fVolume->FindBlock(fRootBlock, physical) != B_OK) { - ERROR("Find() unmapped block %lld\n", fRootBlock); + ERROR("Find() unmapped block %" B_PRId64 "\n", fRootBlock); return B_ERROR; } stream = (btrfs_stream *)cached.SetTo(physical); @@ -107,19 +107,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, uint32 i = 1; for (; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(stream->index[i].key, key); - TRACE("Find() found index %ld at %lld comp %ld\n", i, - stream->index[i].BlockNum(), comp); + TRACE("Find() found index %" B_PRIu32 " at %" B_PRId64 " comp %" + B_PRId32 "\n", i, stream->index[i].BlockNum(), comp); if (comp < 0) continue; if (comp > 0 || type == BPLUSTREE_BACKWARD) break; } - TRACE("Find() getting index %ld at %lld\n", i - 1, + TRACE("Find() getting index %" B_PRIu32 " at %" B_PRId64 "\n", i - 1, stream->index[i - 1].BlockNum()); if (fVolume->FindBlock(stream->index[i - 1].BlockNum(), physical) != B_OK) { - ERROR("Find() unmapped block %lld\n", + ERROR("Find() unmapped block %" B_PRId64 "\n", stream->index[i - 1].BlockNum()); return B_ERROR; } @@ -128,18 +128,19 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, uint32 i; #ifdef TRACE_BTRFS - TRACE("Find() dump count %ld\n", stream->header.ItemCount()); + TRACE("Find() dump count %" B_PRId32 "\n", stream->header.ItemCount()); for (i = 0; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(key, stream->entries[i].key); - TRACE("Find() dump %ld %ld offset %lld comp %ld\n", - stream->entries[i].Offset(), + TRACE("Find() dump %" B_PRIu32 " %" B_PRIu32 " offset %" B_PRId64 + " comp %" B_PRId32 "\n", stream->entries[i].Offset(), stream->entries[i].Size(), stream->entries[i].key.Offset(), comp); } #endif for (i = 0; i < stream->header.ItemCount(); i++) { int32 comp = _CompareKeys(key, stream->entries[i].key); - TRACE("Find() found %ld %ld oid %lld type %d offset %lld comp %ld\n", + TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 " oid %" B_PRId64 + " type %d offset %" B_PRId64 " comp %" B_PRId32 "\n", stream->entries[i].Offset(), stream->entries[i].Size(), stream->entries[i].key.ObjectID(), stream->entries[i].key.Type(), stream->entries[i].key.Offset(), comp); @@ -163,8 +164,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, if (i < stream->header.ItemCount() && stream->entries[i].key.Type() == key.Type()) { - TRACE("Find() found %ld %ld\n", stream->entries[i].Offset(), - stream->entries[i].Size()); + TRACE("Find() found %" B_PRIu32 " %" B_PRIu32 "\n", + stream->entries[i].Offset(), stream->entries[i].Size()); if (_value != NULL) { *_value = malloc(stream->entries[i].Size()); memcpy(*_value, ((uint8 *)&stream->entries[0] @@ -178,7 +179,8 @@ BPlusTree::_Find(struct btrfs_key &key, void** _value, size_t* _size, } - TRACE("Find() not found %lld %lld\n", key.Offset(), key.ObjectID()); + TRACE("Find() not found %" B_PRId64 " %" B_PRId64 "\n", key.Offset(), + key.ObjectID()); return B_ENTRY_NOT_FOUND; } diff --git a/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp b/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp index d9b39e21a7..95d82a4b5b 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp @@ -35,13 +35,15 @@ Chunk::Chunk(struct btrfs_chunk* chunk, fsblock_t offset) memcpy(fChunk, chunk, sizeof(struct btrfs_chunk) + chunk->StripeCount() * sizeof(struct btrfs_stripe)); - TRACE("chunk[0] length %llu owner %llu stripe_length %llu type %llu " - "stripe_count %u sub_stripes %u sector_size %lu\n", chunk->Length(), - chunk->Owner(), chunk->StripeLength(), chunk->Type(), - chunk->StripeCount(), chunk->SubStripes(), chunk->SectorSize()); + TRACE("chunk[0] length %" B_PRIu64 " owner %" B_PRIu64 " stripe_length %" + B_PRIu64 " type %" B_PRIu64 " stripe_count %u sub_stripes %u " + "sector_size %" B_PRIu32 "\n", chunk->Length(), chunk->Owner(), + chunk->StripeLength(), chunk->Type(), chunk->StripeCount(), + chunk->SubStripes(), chunk->SectorSize()); for(int32 i = 0; i < chunk->StripeCount(); i++) { - TRACE("chunk.stripe[%ld].physical %lld deviceid %lld\n", i, - chunk->stripes[i].Offset(), chunk->stripes[i].DeviceID()); + TRACE("chunk.stripe[%" B_PRId32 "].physical %" B_PRId64 " deviceid %" + B_PRId64 "\n", i, chunk->stripes[i].Offset(), + chunk->stripes[i].DeviceID()); } } @@ -66,8 +68,8 @@ Chunk::FindBlock(off_t logical, off_t &physical) if (fChunk == NULL) return B_NO_INIT; - if (logical < fChunkOffset - || logical > (fChunkOffset + fChunk->Length())) + if (logical < (off_t)fChunkOffset + || logical > (off_t)(fChunkOffset + fChunk->Length())) return B_BAD_VALUE; // only one stripe diff --git a/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp b/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp index 0803f55425..01eb9884eb 100644 --- a/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/DirectoryIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Jérôme Duval, korli@users.berlios.de. + * Copyright 2011-2013, Jérôme Duval, korli@users.berlios.de. * This file may be used under the terms of the MIT License. */ @@ -52,14 +52,18 @@ status_t DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id) { if (fOffset == 0) { - *_nameLength = 3; - strlcpy(name, "..", *_nameLength); + if (*_nameLength < 3) + return B_BUFFER_OVERFLOW; + *_nameLength = 2; + strlcpy(name, "..", *_nameLength + 1); *_id = fInode->ID(); fOffset = 1; return B_OK; } else if (fOffset == 1) { - *_nameLength = 2; - strlcpy(name, ".", *_nameLength); + if (*_nameLength < 2) + return B_BUFFER_OVERFLOW; + *_nameLength = 1; + strlcpy(name, ".", *_nameLength + 1); fOffset = 2; if (fInode->ID() == BTRFS_OBJECT_ID_CHUNK_TREE) { *_id = fInode->ID(); @@ -85,12 +89,19 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id) entry = (btrfs_dir_entry *)((uint8*)entry + entry->Length()); } + size_t length = entry->NameLength(); + TRACE("DirectoryIterator::GetNext() entries_length %ld name_length %d\n", entries_length, entry->NameLength()); - memcpy(name, entry + 1, entry->NameLength()); - name[entry->NameLength()] = '\0'; - *_nameLength = entry->NameLength(); + if (length + 1 > *_nameLength) { + free(entries); + return B_BUFFER_OVERFLOW; + } + + memcpy(name, entry + 1, length); + name[length] = '\0'; + *_nameLength = length; *_id = entry->InodeID(); free(entries); @@ -121,8 +132,8 @@ DirectoryIterator::Lookup(const char* name, size_t nameLength, ino_t* _id) status_t status = fInode->GetVolume()->FSTree()->FindExact(key, (void**)&entries, &length); if (status != B_OK) { - TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %lu " - "\"%s\"\n", hash, name); + TRACE("DirectoryIterator::Lookup(): Couldn't find entry with hash %" B_PRIu32 + " \"%s\"\n", hash, name); return status; } diff --git a/src/add-ons/kernel/file_systems/btrfs/Inode.cpp b/src/add-ons/kernel/file_systems/btrfs/Inode.cpp index 6c231f0160..757353f2a0 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Inode.cpp @@ -133,7 +133,6 @@ Inode::CheckPermissions(int accessMode) const } return (accessMode & ~permissions) == 0 ? B_OK : B_NOT_ALLOWED; - return B_OK; } @@ -149,12 +148,13 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length) status_t status = fVolume->FSTree()->FindPrevious(search_key, (void**)&extent_data); if (status != B_OK) { - ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status); + ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32 + "\n", status); return status; } - TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %lld\n", ID(), - search_key.Offset()); + TRACE("Inode::FindBlock(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n", + ID(), search_key.Offset()); off_t diff = pos - search_key.Offset(); off_t logical = 0; @@ -165,8 +165,8 @@ Inode::FindBlock(off_t pos, off_t& physical, off_t *_length) status = fVolume->FindBlock(logical, physical); if (_length != NULL) *_length = extent_data->Size() - diff; - TRACE("Inode::FindBlock(%" B_PRIdINO ") %lld physical %lld\n", ID(), - pos, physical); + TRACE("Inode::FindBlock(%" B_PRIdINO ") %" B_PRIdOFF " physical %" + B_PRIdOFF "\n", ID(), pos, physical); free(extent_data); return status; @@ -180,14 +180,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) // set/check boundaries for pos/length if (pos < 0) { - ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n", - ID(), pos, length); + ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF + ", length %lu)\n", ID(), pos, length); return B_BAD_VALUE; } if (pos >= Size() || length == 0) { - TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n", - ID(), pos, length); + TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF + ", length %lu)\n", ID(), pos, length); *_length = 0; return B_NO_ERROR; } @@ -204,14 +204,15 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) status_t status = fVolume->FSTree()->FindPrevious(search_key, (void**)&extent_data, &item_size); if (status != B_OK) { - ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%lx\n", status); + ERROR("Inode::FindBlock(): Couldn't find extent_data 0x%" B_PRIx32 + "\n", status); return status; } uint8 compression = extent_data->Compression(); if (FileCache() != NULL && extent_data->Type() == BTRFS_EXTENT_DATA_REGULAR) { - TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %lld, length %lu)\n", + TRACE("inode %" B_PRIdINO ": ReadAt cache (pos %" B_PRIdOFF ", length %lu)\n", ID(), pos, length); free(extent_data); if (compression == BTRFS_EXTENT_COMPRESS_NONE) @@ -222,7 +223,7 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) panic("unknown extent compression; %d\n", compression); } - TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %lld\n", ID(), + TRACE("Inode::ReadAt(%" B_PRIdINO ") key.Offset() %" B_PRId64 "\n", ID(), search_key.Offset()); off_t diff = pos - search_key.Offset(); @@ -256,8 +257,8 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) size_t inline_size = item_size - 13; bool headerRead = false; - TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %lld size %ld\n", ID(), - diff, item_size); + TRACE("Inode::ReadAt(%" B_PRIdINO ") diff %" B_PRIdOFF " size %" + B_PRIuSIZE "\n", ID(), diff, item_size); do { ssize_t bytesRead = min_c(sizeof(in), inline_size - offset); diff --git a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp index 0afac4c96f..5b994474d1 100644 --- a/src/add-ons/kernel/file_systems/btrfs/Volume.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/Volume.cpp @@ -278,14 +278,15 @@ Volume::Mount(const char* deviceName, uint32 flags) } fBlockSize = fSuperBlock.BlockSize(); - TRACE("block size %ld\n", fBlockSize); + TRACE("block size %" B_PRIu32 "\n", fBlockSize); uint8* start = (uint8*)&fSuperBlock.system_chunk_array[0]; uint8* end = (uint8*)&fSuperBlock.system_chunk_array[2048]; while (start < end) { struct btrfs_key* key = (struct btrfs_key*)start; - TRACE("system_chunk_array object_id 0x%llx offset 0x%llx type 0x%x\n", - key->ObjectID(), key->Offset(), key->Type()); + TRACE("system_chunk_array object_id 0x%" B_PRIx64 " offset 0x%" + B_PRIx64 " type 0x%x\n", key->ObjectID(), key->Offset(), + key->Type()); if (key->Type() != BTRFS_KEY_TYPE_CHUNK_ITEM) { break; } @@ -297,16 +298,17 @@ Volume::Mount(const char* deviceName, uint32 flags) start += sizeof(struct btrfs_key) + fChunk->Size(); } - TRACE("Volume::Mount() generation: %lld\n", fSuperBlock.Generation()); + TRACE("Volume::Mount() generation: %" B_PRIu64 "\n", + fSuperBlock.Generation()); fsblock_t physical = 0; FindBlock(fSuperBlock.Root(), physical); - TRACE("Volume::Mount() root: %lld (physical %lld)\n", + TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.Root(), physical); FindBlock(fSuperBlock.ChunkRoot(), physical); - TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n", - fSuperBlock.ChunkRoot(), physical); + TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64 + ")\n", fSuperBlock.ChunkRoot(), physical); FindBlock(fSuperBlock.LogRoot(), physical); - TRACE("Volume::Mount() log_root: %lld (physical %lld)\n", + TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.LogRoot(), physical); // check if the device size is large enough to hold the file system @@ -329,13 +331,13 @@ Volume::Mount(const char* deviceName, uint32 flags) return B_NO_MEMORY; FindBlock(fSuperBlock.Root(), physical); - TRACE("Volume::Mount() root: %lld (physical %lld)\n", + TRACE("Volume::Mount() root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.Root(), physical); FindBlock(fSuperBlock.ChunkRoot(), physical); - TRACE("Volume::Mount() chunk_root: %lld (physical %lld)\n", - fSuperBlock.ChunkRoot(), physical); + TRACE("Volume::Mount() chunk_root: %" B_PRIu64 " (physical %" B_PRIu64 + ")\n", fSuperBlock.ChunkRoot(), physical); FindBlock(fSuperBlock.LogRoot(), physical); - TRACE("Volume::Mount() log_root: %lld (physical %lld)\n", + TRACE("Volume::Mount() log_root: %" B_PRIu64 " (physical %" B_PRIu64 ")\n", fSuperBlock.LogRoot(), physical); fRootTree = new(std::nothrow) BPlusTree(this, fSuperBlock.Root()); @@ -351,7 +353,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find extent root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found extent root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found extent root: %" B_PRIu64 "\n", + root->BlockNum()); fExtentTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fExtentTree == NULL) @@ -363,7 +366,7 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find fs root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found fs root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found fs root: %" B_PRIu64 "\n", root->BlockNum()); fFSTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fFSTree == NULL) @@ -375,7 +378,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find dev root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found dev root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found dev root: %" B_PRIu64 "\n", + root->BlockNum()); fDevTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fDevTree == NULL) @@ -387,7 +391,8 @@ Volume::Mount(const char* deviceName, uint32 flags) ERROR("Volume::Mount(): Couldn't find checksum root\n"); return B_ERROR; } - TRACE("Volume::Mount(): Found checksum root: %lld\n", root->BlockNum()); + TRACE("Volume::Mount(): Found checksum root: %" B_PRIu64 "\n", + root->BlockNum()); fChecksumTree = new(std::nothrow) BPlusTree(this, root->BlockNum()); free(root); if (fChecksumTree == NULL) @@ -401,8 +406,8 @@ Volume::Mount(const char* deviceName, uint32 flags) return status; } - TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(), - strerror(fRootNode->InitCheck())); + TRACE("Volume::Mount(): Found root node: %" B_PRIu64 " (%s)\n", + fRootNode->ID(), strerror(fRootNode->InitCheck())); // all went fine opener.Keep(); @@ -488,7 +493,8 @@ status_t Volume::FindBlock(off_t logical, off_t &physical) { if (fChunkTree == NULL - || (logical >= fChunk->Offset() && logical < fChunk->End())) { + || (logical >= (off_t)fChunk->Offset() + && logical < (off_t)fChunk->End())) { // try with fChunk return fChunk->FindBlock(logical, physical); } @@ -509,8 +515,8 @@ Volume::FindBlock(off_t logical, off_t &physical) status = _chunk.FindBlock(logical, physical); if (status != B_OK) return status; - TRACE("Volume::FindBlock(): logical: %lld, physical: %lld\n", logical, - physical); + TRACE("Volume::FindBlock(): logical: %" B_PRIdOFF ", physical: %" B_PRIdOFF + "\n", logical, physical); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp index 5c6905b5f5..1de0f486d8 100644 --- a/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/btrfs/kernel_interface.cpp @@ -235,7 +235,7 @@ btrfs_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, while (true) { file_io_vec fileVecs[8]; - uint32 fileVecCount = 8; + size_t fileVecCount = 8; status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs, &fileVecCount, 0); @@ -321,10 +321,10 @@ btrfs_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, offset += blockLength; size -= blockLength; - if (size <= vecs[index - 1].length || offset >= inode->Size()) { + if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) { // We're done! *_count = index; - TRACE("btrfs_get_file_map for inode %lld\n", inode->ID()); + TRACE("btrfs_get_file_map for inode %" B_PRIdINO "\n", inode->ID()); return B_OK; } } @@ -362,7 +362,7 @@ static status_t btrfs_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, void* buffer, size_t bufferLength) { - TRACE("ioctl: %lu\n", cmd); + TRACE("ioctl: %" B_PRIu32 "\n", cmd); /*Volume* volume = (Volume*)_volume->private_volume;*/ return B_DEV_INVALID_IOCTL; @@ -520,22 +520,41 @@ btrfs_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { DirectoryIterator* iterator = (DirectoryIterator*)_cookie; - - size_t length = bufferSize; - ino_t id; - status_t status = iterator->GetNext(dirent->d_name, &length, &id); - if (status == B_ENTRY_NOT_FOUND) { - *_num = 0; - return B_OK; - } else if (status != B_OK) - return status; - Volume* volume = (Volume*)_volume->private_volume; - dirent->d_dev = volume->ID(); - dirent->d_ino = id; - dirent->d_reclen = sizeof(struct dirent) + length; - *_num = 1; + uint32 maxCount = *_num; + uint32 count = 0; + + while (count < maxCount && bufferSize > sizeof(struct dirent)) { + ino_t id; + size_t length = bufferSize - sizeof(struct dirent) + 1; + + status_t status = iterator->GetNext(dirent->d_name, &length, + &id); + + if (status == B_ENTRY_NOT_FOUND) + break; + + if (status == B_BUFFER_OVERFLOW) { + // the remaining name buffer length was too small + if (count == 0) + return B_BUFFER_OVERFLOW; + break; + } + + if (status != B_OK) + return status; + + dirent->d_dev = volume->ID(); + dirent->d_ino = id; + dirent->d_reclen = sizeof(struct dirent) + length; + + bufferSize -= dirent->d_reclen; + dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen); + count++; + } + + *_num = count; return B_OK; } diff --git a/src/add-ons/kernel/file_systems/cdda/cdda.cpp b/src/add-ons/kernel/file_systems/cdda/cdda.cpp index 77320a9c8f..605b5ca099 100644 --- a/src/add-ons/kernel/file_systems/cdda/cdda.cpp +++ b/src/add-ons/kernel/file_systems/cdda/cdda.cpp @@ -557,7 +557,7 @@ read_cdtext(int fd, struct cdtext &cdtext) scsi_toc_general *header = (scsi_toc_general *)buffer; - size_t packLength = B_BENDIAN_TO_HOST_INT16(header->data_length) - 2; + uint32 packLength = B_BENDIAN_TO_HOST_INT16(header->data_length) - 2; cdtext_pack_data *pack = (cdtext_pack_data *)(header + 1); cdtext_pack_data *lastPack = NULL; uint8 state = 0; @@ -656,8 +656,8 @@ status_t read_cdda_data(int fd, off_t endFrame, off_t offset, void *data, size_t length, off_t bufferOffset, void *buffer, size_t bufferSize) { - if (bufferOffset >= 0 && bufferOffset <= offset + length - && bufferOffset + bufferSize > offset) { + if (bufferOffset >= 0 && bufferOffset <= offset + (off_t)length + && bufferOffset + (off_t)bufferSize > offset) { if (offset >= bufferOffset) { // buffer reaches into the beginning of the request off_t dataOffset = offset - bufferOffset; diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp index 1a78ad4b66..fafd3a635d 100644 --- a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp @@ -153,7 +153,7 @@ public: status_t SetSize(off_t size); const char* Name() const { return fName; } - size_t Size() const { return fSize; } + off_t Size() const { return fSize; } type_code Type() const { return fType; } uint8* Data() const { return fData; } @@ -164,7 +164,7 @@ private: char* fName; type_code fType; uint8* fData; - size_t fSize; + off_t fSize; }; class Inode { @@ -473,7 +473,7 @@ open_attributes(uint32 cddbID, int deviceFD, int mode, if (attrMode == kDiscIDAttributes) { char id[64]; - snprintf(id, sizeof(id), "/%08lx", cddbID); + snprintf(id, sizeof(id), "/%08" B_PRIx32, cddbID); strlcat(path, id, B_PATH_NAME_LENGTH); } else if (attrMode == kDeviceAttributes) { uint32 length = strlen(path); @@ -528,9 +528,12 @@ fill_stat_buffer(Volume* volume, Inode* inode, Attribute* attribute, stat.st_uid = inode->UserID(); stat.st_gid = inode->GroupID(); - stat.st_atime = time(NULL); - stat.st_mtime = stat.st_ctime = inode->ModificationTime(); - stat.st_crtime = inode->CreationTime(); + stat.st_atim.tv_sec = time(NULL); + stat.st_atim.tv_nsec = 0; + stat.st_mtim.tv_sec = stat.st_ctim.tv_sec = inode->ModificationTime(); + stat.st_ctim.tv_nsec = stat.st_mtim.tv_nsec = 0; + stat.st_crtim.tv_sec = inode->CreationTime(); + stat.st_crtim.tv_nsec = 0; } @@ -690,14 +693,14 @@ Volume::Mount(const char* device) if (text.titles[i] != NULL) { if (text.artists[i] != NULL) { - snprintf(title, sizeof(title), "%02ld. %s - %s.wav", track, - text.artists[i], text.titles[i]); + snprintf(title, sizeof(title), "%02" B_PRId32 ". %s - %s.wav", + track, text.artists[i], text.titles[i]); } else { - snprintf(title, sizeof(title), "%02ld. %s.wav", track, - text.titles[i]); + snprintf(title, sizeof(title), "%02" B_PRId32 ". %s.wav", + track, text.titles[i]); } } else - snprintf(title, sizeof(title), "Track %02ld.wav", track); + snprintf(title, sizeof(title), "Track %02" B_PRId32 ".wav", track); // remove '/' and '\n' from title for (int32 j = 0; title[j]; j++) { @@ -722,7 +725,7 @@ Volume::Mount(const char* device) inode->AddAttribute("Audio:Track", B_INT32_TYPE, (uint32)track); inode->AddAttribute("Audio:Bitrate", B_STRING_TYPE, "1411 kbps"); inode->AddAttribute("Media:Length", B_INT64_TYPE, - inode->FrameCount() * 1000000LL / kFramesPerSecond); + inode->FrameCount() * 1000000L / kFramesPerSecond); inode->AddAttribute("BEOS:TYPE", B_MIME_STRING_TYPE, "audio/x-wav"); } @@ -1044,7 +1047,7 @@ Attribute::ReadAt(off_t offset, uint8* buffer, size_t* _length) *_length = 0; return B_OK; } - if (offset + length > fSize) + if (offset + (off_t)length > fSize) length = fSize - offset; if (user_memcpy(buffer, fData + offset, length) < B_OK) @@ -1710,13 +1713,13 @@ cdda_read(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t offset, } size_t length = *_length; - if (offset + length > maxSize) + if (offset + (off_t)length > maxSize) length = maxSize - offset; status_t status = B_OK; size_t bytesRead = 0; - if (offset < sizeof(wav_header)) { + if (offset < (off_t)sizeof(wav_header)) { // read fake WAV header size_t size = sizeof(wav_header) - offset; size = min_c(size, length); diff --git a/src/add-ons/kernel/file_systems/exfat/DataStream.cpp b/src/add-ons/kernel/file_systems/exfat/DataStream.cpp index 48edf05709..5a9647e7c8 100644 --- a/src/add-ons/kernel/file_systems/exfat/DataStream.cpp +++ b/src/add-ons/kernel/file_systems/exfat/DataStream.cpp @@ -62,8 +62,8 @@ DataStream::FindBlock(off_t pos, off_t& physical, off_t *_length) } *_length = min_c((cluster - clusterIndex + 1) * kClusterSize - offset, fSize - pos); - TRACE("inode %" B_PRIdINO ": cluster %ld, pos %lld, %lld\n", - fInode->ID(), clusterIndex, pos, physical); + TRACE("inode %" B_PRIdINO ": cluster %" B_PRIu32 ", pos %" B_PRIdOFF ", %" + B_PRIdOFF "\n", fInode->ID(), clusterIndex, pos, physical); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp b/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp index ffeaff1bac..2c33bbab3d 100644 --- a/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp +++ b/src/add-ons/kernel/file_systems/exfat/DirectoryIterator.cpp @@ -27,7 +27,7 @@ DirectoryIterator::DirectoryIterator(Inode* inode) fBlock(inode->GetVolume()), fCurrent(NULL) { - TRACE("DirectoryIterator::DirectoryIterator() %ld\n", fCluster); + TRACE("DirectoryIterator::DirectoryIterator() %" B_PRIu32 "\n", fCluster); } @@ -47,9 +47,13 @@ status_t DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id, EntryVisitor* visitor) { + if (fCluster == EXFAT_CLUSTER_END) + return B_ENTRY_NOT_FOUND; if (fOffset == -2) { - *_nameLength = 3; - strlcpy(name, "..", *_nameLength); + if (*_nameLength < 3) + return B_BUFFER_OVERFLOW; + *_nameLength = 2; + strlcpy(name, "..", *_nameLength + 1); if (fInode->ID() == 1) *_id = fInode->ID(); else @@ -58,20 +62,23 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id, TRACE("DirectoryIterator::GetNext() found ..\n"); return B_OK; } else if (fOffset == -1) { - *_nameLength = 2; - strlcpy(name, ".", *_nameLength); + if (*_nameLength < 2) + return B_BUFFER_OVERFLOW; + *_nameLength = 1; + strlcpy(name, ".", *_nameLength + 1); *_id = fInode->ID(); fOffset = 0; TRACE("DirectoryIterator::GetNext() found .\n"); return B_OK; } - uchar unicodeName[EXFAT_FILENAME_MAX_LENGTH]; + uchar unicodeName[EXFAT_FILENAME_MAX_LENGTH + 1]; size_t nameLength = EXFAT_FILENAME_MAX_LENGTH; status_t status = _GetNext(unicodeName, &nameLength, _id, visitor); if (status == B_OK && name != NULL) { - unicode_to_utf8(unicodeName, nameLength, (uint8 *)name , _nameLength); - TRACE("DirectoryIterator::GetNext() %ld %s, %" B_PRIdINO "\n", + status = unicode_to_utf8(unicodeName, nameLength, (uint8 *)name, + _nameLength); + TRACE("DirectoryIterator::GetNext() %" B_PRIu32 " %s, %" B_PRIdINO "\n", fInode->Cluster(), name, *_id); } @@ -96,7 +103,7 @@ DirectoryIterator::Lookup(const char* name, size_t nameLength, ino_t* _id) Rewind(); fOffset = 0; - uchar currentName[EXFAT_FILENAME_MAX_LENGTH]; + uchar currentName[EXFAT_FILENAME_MAX_LENGTH + 1]; size_t currentLength = EXFAT_FILENAME_MAX_LENGTH; while (_GetNext((uchar*)currentName, ¤tLength, _id) == B_OK) { char utfName[EXFAT_FILENAME_MAX_LENGTH]; @@ -122,7 +129,7 @@ DirectoryIterator::LookupEntry(EntryVisitor* visitor) fCluster = fInode->Cluster(); fOffset = fInode->Offset(); - uchar unicodeName[EXFAT_FILENAME_MAX_LENGTH]; + uchar unicodeName[EXFAT_FILENAME_MAX_LENGTH + 1]; size_t nameLength = EXFAT_FILENAME_MAX_LENGTH; return _GetNext(unicodeName, &nameLength, NULL, visitor); } @@ -177,8 +184,9 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id, status_t status; int32 chunkCount = 1; while ((status = _NextEntry()) == B_OK) { - TRACE("DirectoryIterator::_GetNext() %ld/%p, type 0x%x, offset %lld\n", - fInode->Cluster(), fCurrent, fCurrent->type, fOffset); + TRACE("DirectoryIterator::_GetNext() %" B_PRIu32 "/%p, type 0x%x, " + "offset %" B_PRId64 "\n", fInode->Cluster(), fCurrent, + fCurrent->type, fOffset); if (fCurrent->type == EXFAT_ENTRY_TYPE_FILE) { chunkCount = fCurrent->file.chunkCount; if (_id != NULL) { @@ -187,8 +195,8 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id, } if (visitor != NULL) visitor->VisitFile(fCurrent); - TRACE("DirectoryIterator::_GetNext() File chunkCount %ld\n", - chunkCount); + TRACE("DirectoryIterator::_GetNext() File chunkCount %" B_PRId32 + "\n", chunkCount); } else if (fCurrent->type == EXFAT_ENTRY_TYPE_FILEINFO) { chunkCount--; TRACE("DirectoryIterator::_GetNext() Filename length %d\n", @@ -234,7 +242,8 @@ DirectoryIterator::_NextEntry() fInode->GetVolume()->ClusterToBlock(fCluster, block); block += (fOffset / fInode->GetVolume()->EntriesPerBlock()) % (1 << fInode->GetVolume()->SuperBlock().BlocksPerClusterShift()); - TRACE("DirectoryIterator::_NextEntry() init to block %lld\n", block); + TRACE("DirectoryIterator::_NextEntry() init to block %" B_PRIu64 "\n", + block); fCurrent = (struct exfat_entry*)fBlock.SetTo(block) + fOffset % fInode->GetVolume()->EntriesPerBlock(); } else if ((fOffset % fInode->GetVolume()->EntriesPerBlock()) == 0) { @@ -246,7 +255,7 @@ DirectoryIterator::_NextEntry() fInode->GetVolume()->ClusterToBlock(fCluster, block); } else block = fBlock.BlockNumber() + 1; - TRACE("DirectoryIterator::_NextEntry() block %lld\n", block); + TRACE("DirectoryIterator::_NextEntry() block %" B_PRIu64 "\n", block); fCurrent = (struct exfat_entry*)fBlock.SetTo(block); } else fCurrent++; diff --git a/src/add-ons/kernel/file_systems/exfat/Inode.cpp b/src/add-ons/kernel/file_systems/exfat/Inode.cpp index a03c13cceb..c2548437de 100644 --- a/src/add-ons/kernel/file_systems/exfat/Inode.cpp +++ b/src/add-ons/kernel/file_systems/exfat/Inode.cpp @@ -37,8 +37,8 @@ Inode::Inode(Volume* volume, cluster_t cluster, uint32 offset) fCache(NULL), fMap(NULL) { - TRACE("Inode::Inode(%ld, %d) inode %" B_PRIdINO "\n", Cluster(), Offset(), - ID()); + TRACE("Inode::Inode(%" B_PRIu32 ", %" B_PRIu32 ") inode %" B_PRIdINO "\n", + Cluster(), Offset(), ID()); _Init(); if (ID() == 1) { @@ -72,7 +72,8 @@ Inode::Inode(Volume* volume, ino_t ino) fOffset = key->offset; fInitStatus = B_OK; } - TRACE("Inode::Inode(%" B_PRIdINO ") cluster %ld\n", ID(), Cluster()); + TRACE("Inode::Inode(%" B_PRIdINO ") cluster %" B_PRIu32 "\n", ID(), + Cluster()); _Init(); if (fInitStatus == B_OK && ID() != 1) { @@ -204,14 +205,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) // set/check boundaries for pos/length if (pos < 0) { - ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n", - ID(), pos, length); + ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF", length %" + B_PRIuSIZE ")\n", ID(), pos, length); return B_BAD_VALUE; } if (pos >= Size() || length == 0) { - TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n", - ID(), pos, length); + TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF", length %" + B_PRIuSIZE ")\n", ID(), pos, length); *_length = 0; return B_NO_ERROR; } @@ -269,9 +270,11 @@ Inode::_GetTimespec(uint16 date, uint16 time, struct timespec ×pec) const if (tzoffset == -1) tzoffset = get_timezone_offset() / 60; - time_t days = daze[(date>>5)&15] + ((date>>9)+10)*365 + leaps((date>>9)+10,((date>>5)&15)-1)+(date&31)-1; + time_t days = daze[(date >> 5) & 15] + ((date >> 9) + 10) * 365 + + leaps((date >> 9) + 10, ((date >> 5) & 15) - 1) + (date & 31) -1; - timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time>>5)&63) + tzoffset) * 60 + 2*(time&31); + timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time >> 5) & 63) + - tzoffset) * 60 + 2 * (time & 31); timespec.tv_nsec = 0; } diff --git a/src/add-ons/kernel/file_systems/exfat/Inode.h b/src/add-ons/kernel/file_systems/exfat/Inode.h index 9c0ee1628e..26bc92fa0d 100644 --- a/src/add-ons/kernel/file_systems/exfat/Inode.h +++ b/src/add-ons/kernel/file_systems/exfat/Inode.h @@ -40,7 +40,7 @@ public: ino_t ID() const { return fID; } ino_t Parent() const { return fParent; } cluster_t Cluster() const { return fCluster; } - uint32_t Offset() const { return fOffset; } + uint32 Offset() const { return fOffset; } cluster_t StartCluster() const { return fFileInfoEntry.file_info.StartCluster(); } bool IsContiguous() const diff --git a/src/add-ons/kernel/file_systems/exfat/Volume.cpp b/src/add-ons/kernel/file_systems/exfat/Volume.cpp index 1881909751..feea51b48d 100644 --- a/src/add-ons/kernel/file_systems/exfat/Volume.cpp +++ b/src/add-ons/kernel/file_systems/exfat/Volume.cpp @@ -218,7 +218,7 @@ LabelVisitor::LabelVisitor(Volume* volume) bool LabelVisitor::VisitLabel(struct exfat_entry* entry) { - dprintf("LabelVisitor::VisitLabel()\n"); + TRACE("LabelVisitor::VisitLabel()\n"); char utfName[30]; size_t utfLength = 30; unicode_to_utf8((const uchar*)entry->name_label.name, @@ -318,7 +318,7 @@ Volume::Mount(const char* deviceName, uint32 flags) } fBlockSize = 1 << fSuperBlock.BlockShift(); - TRACE("block size %ld\n", fBlockSize); + TRACE("block size %" B_PRIu32 "\n", fBlockSize); fEntriesPerBlock = (fBlockSize / sizeof(struct exfat_entry)); // check if the device size is large enough to hold the file system @@ -348,7 +348,7 @@ Volume::Mount(const char* deviceName, uint32 flags) return status; } - TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(), + TRACE("Volume::Mount(): Found root node: %" B_PRIdINO " (%s)\n", fRootNode->ID(), strerror(fRootNode->InitCheck())); // all went fine @@ -418,9 +418,12 @@ Volume::LoadSuperBlock() status_t Volume::ClusterToBlock(cluster_t cluster, fsblock_t &block) { + if (cluster < 2) + return B_BAD_VALUE; block = ((cluster - 2) << SuperBlock().BlocksPerClusterShift()) + SuperBlock().FirstDataBlock(); - TRACE("Volume::ClusterToBlock() cluster %lu %u %lu: %llu, %lu\n", cluster, + TRACE("Volume::ClusterToBlock() cluster %" B_PRIu32 " %u %" B_PRIu32 ": %" + B_PRIu64 ", %" B_PRIu32 "\n", cluster, SuperBlock().BlocksPerClusterShift(), SuperBlock().FirstDataBlock(), block, SuperBlock().FirstFatBlock()); return B_OK; @@ -436,7 +439,8 @@ Volume::NextCluster(cluster_t _cluster) + _cluster / clusterPerBlock; cluster_t *cluster = (cluster_t *)block.SetTo(blockNum); cluster += _cluster % clusterPerBlock; - TRACE("Volume::NextCluster() cluster %lu next %lu\n", _cluster, *cluster); + TRACE("Volume::NextCluster() cluster %" B_PRIu32 " next %" B_PRIu32 "\n", + _cluster, *cluster); return *cluster; } @@ -463,8 +467,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent) key.offset = offset; struct node* node = fNodeTree.Lookup(key); if (node != NULL) { - TRACE("Volume::GetIno() cached cluster %lu offset %lu ino %" B_PRIdINO - "\n", cluster, offset, node->ino); + TRACE("Volume::GetIno() cached cluster %" B_PRIu32 " offset %" B_PRIu32 + " ino %" B_PRIdINO "\n", cluster, offset, node->ino); return node->ino; } node = new struct node(); @@ -473,8 +477,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent) node->parent = parent; fNodeTree.Insert(node); fInoTree.Insert(node); - TRACE("Volume::GetIno() new cluster %lu offset %lu ino %" B_PRIdINO "\n", - cluster, offset, node->ino); + TRACE("Volume::GetIno() new cluster %" B_PRIu32 " offset %" B_PRIu32 + " ino %" B_PRIdINO "\n", cluster, offset, node->ino); return node->ino; } diff --git a/src/add-ons/kernel/file_systems/exfat/encodings.cpp b/src/add-ons/kernel/file_systems/exfat/encodings.cpp index 53e5b35b95..0393fab255 100644 --- a/src/add-ons/kernel/file_systems/exfat/encodings.cpp +++ b/src/add-ons/kernel/file_systems/exfat/encodings.cpp @@ -98,14 +98,15 @@ static status_t _lendian_unicode_to_utf8( const char *src, - int32 *srcLen, + size_t *srcLen, char *dst, - uint32 *dstLen) + size_t *dstLen) { - int32 srcLimit = *srcLen; - int32 dstLimit = *dstLen; - int32 srcCount = 0; - int32 dstCount = 0; + size_t srcLimit = *srcLen; + size_t dstLimit = *dstLen; + size_t srcCount = 0; + size_t dstCount = 0; + status_t status = B_ERROR; for (srcCount = 0; srcCount < srcLimit; srcCount += 2) { uint16 *UNICODE = (uint16 *)&src[srcCount]; @@ -119,33 +120,37 @@ _lendian_unicode_to_utf8( u_lendian_to_utf8(UTF8, UNICODE); utf8Len = UTF8 - utf8; - if ((dstCount + utf8Len) > dstLimit) + if ((dstCount + utf8Len) > dstLimit) { + status = B_BUFFER_OVERFLOW; break; + } for (j = 0; j < utf8Len; j++) dst[dstCount + j] = utf8[j]; dstCount += utf8Len; + status = B_OK; } *srcLen = srcCount; *dstLen = dstCount; dst[dstCount] = '\0'; - return ((dstCount > 0) ? B_NO_ERROR : B_ERROR); + return status; } // utf8 to LENDIAN unicode static status_t _utf8_to_lendian_unicode( const char *src, - int32 *srcLen, + size_t *srcLen, char *dst, - uint32 *dstLen) + size_t *dstLen) { - int32 srcLimit = *srcLen; - int32 dstLimit = *dstLen - 1; - int32 srcCount = 0; - int32 dstCount = 0; + size_t srcLimit = *srcLen; + size_t dstLimit = *dstLen - 1; + size_t srcCount = 0; + size_t dstCount = 0; + status_t status = B_ERROR; while ((srcCount < srcLimit) && (dstCount < dstLimit)) { uint16 unicode; @@ -157,31 +162,36 @@ _utf8_to_lendian_unicode( break; utf8_to_u_hostendian(UTF8, UNICODE, err_flag); - if(err_flag == 1) + if (err_flag == 1) return EINVAL; unicode = B_HOST_TO_LENDIAN_INT16(unicode); + if ((dstCount + 1) > dstLimit) { + status = B_BUFFER_OVERFLOW; + break; + } dst[dstCount++] = unicode & 0xFF; dst[dstCount++] = unicode >> 8; srcCount += UTF8 - ((uchar *)(src + srcCount)); + status = B_OK; } *srcLen = srcCount; *dstLen = dstCount; - return ((dstCount > 0) ? B_NO_ERROR : B_ERROR); + return status; } // takes a unicode name of unilen uchar's and converts to a utf8 name of at // most utf8len uint8's -status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, - uint32 *utf8len) +status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8, + size_t *utf8len) { - uint32 origlen = unilen; + //size_t origlen = unilen; status_t result = _lendian_unicode_to_utf8((char *)uni, - (int32 *)&unilen, (char *)utf8, utf8len); + &unilen, (char *)utf8, utf8len); /*if (unilen < origlen) { panic("Name is too long (%lx < %lx)\n", unilen, origlen); @@ -192,13 +202,13 @@ status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, } -status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen) +status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen) { - uint32 origlen = strlen(utf8) + 1; - uint32 utf8len = origlen; + size_t origlen = strlen(utf8) + 1; + size_t utf8len = origlen; status_t result = _utf8_to_lendian_unicode(utf8, - (int32 *)&utf8len, (char *)uni, unilen); + &utf8len, (char *)uni, unilen); /*if (origlen < utf8len) { panic("Name is too long (%lx < %lx)\n", *unilen, origlen); diff --git a/src/add-ons/kernel/file_systems/exfat/encodings.h b/src/add-ons/kernel/file_systems/exfat/encodings.h index 2d4fdcd33a..eaddd918bd 100644 --- a/src/add-ons/kernel/file_systems/exfat/encodings.h +++ b/src/add-ons/kernel/file_systems/exfat/encodings.h @@ -9,9 +9,9 @@ extern "C" { #endif -status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8, - uint32 *utf8len); -status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen); +status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8, + size_t *utf8len); +status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen); #ifdef __cplusplus } diff --git a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp index 2d0a6b2b6b..c2110e713a 100644 --- a/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/exfat/kernel_interface.cpp @@ -179,7 +179,7 @@ static status_t exfat_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type, uint32* _flags, bool reenter) { - TRACE("get_vnode %lu\n", id); + TRACE("get_vnode %" B_PRIdINO "\n", id); Volume* volume = (Volume*)_volume->private_volume; Inode* inode = new(std::nothrow) Inode(volume, id); @@ -236,7 +236,7 @@ exfat_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, while (true) { file_io_vec fileVecs[8]; - uint32 fileVecCount = 8; + size_t fileVecCount = 8; status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs, &fileVecCount, 0); @@ -322,10 +322,10 @@ exfat_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, offset += blockLength; size -= blockLength; - if (size <= vecs[index - 1].length || offset >= inode->Size()) { + if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) { // We're done! *_count = index; - TRACE("exfat_get_file_map for inode %lld\n", inode->ID()); + TRACE("exfat_get_file_map for inode %" B_PRIdINO"\n", inode->ID()); return B_OK; } } @@ -357,7 +357,7 @@ exfat_lookup(fs_volume* _volume, fs_vnode* _directory, const char* name, return status; } - TRACE("exfat_lookup: ID %d\n", *_vnodeID); + TRACE("exfat_lookup: ID %" B_PRIdINO "\n", *_vnodeID); return get_vnode(volume->FSVolume(), *_vnodeID, NULL); } @@ -367,7 +367,7 @@ static status_t exfat_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, void* buffer, size_t bufferLength) { - TRACE("ioctl: %lu\n", cmd); + TRACE("ioctl: %" B_PRIu32 "\n", cmd); /*Volume* volume = (Volume*)_volume->private_volume;*/ return B_DEV_INVALID_IOCTL; @@ -526,24 +526,40 @@ exfat_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, { TRACE("exfat_read_dir\n"); DirectoryIterator* iterator = (DirectoryIterator*)_cookie; - - size_t length = bufferSize; - ino_t id; - status_t status = iterator->GetNext(dirent->d_name, &length, &id); - if (status == B_ENTRY_NOT_FOUND) { - *_num = 0; - return B_OK; - } else if (status != B_OK) - return status; - Volume* volume = (Volume*)_volume->private_volume; - dirent->d_dev = volume->ID(); - dirent->d_ino = id; - dirent->d_reclen = sizeof(struct dirent) + length; - *_num = 1; + + uint32 maxCount = *_num; + uint32 count = 0; + while (count < maxCount && bufferSize > sizeof(struct dirent)) { + ino_t id; + size_t length = bufferSize - sizeof(struct dirent) + 1; + + status_t status = iterator->GetNext(dirent->d_name, &length, &id); + if (status == B_ENTRY_NOT_FOUND) + break; + + if (status == B_BUFFER_OVERFLOW) { + // the remaining name buffer length was too small + if (count == 0) + return B_BUFFER_OVERFLOW; + break; + } + + if (status != B_OK) + return status; + + dirent->d_dev = volume->ID(); + dirent->d_ino = id; + dirent->d_reclen = sizeof(struct dirent) + length; + + bufferSize -= dirent->d_reclen; + dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen); + count++; + } + + *_num = count; TRACE("exfat_read_dir end\n"); - return B_OK; } diff --git a/src/add-ons/kernel/file_systems/ext2/Attribute.cpp b/src/add-ons/kernel/file_systems/ext2/Attribute.cpp index 746b13ad9c..713d8b23fc 100644 --- a/src/add-ons/kernel/file_systems/ext2/Attribute.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Attribute.cpp @@ -211,7 +211,7 @@ Attribute::Read(attr_cookie* cookie, off_t pos, uint8* buffer, size_t* _length) start += EXT2_INODE_NORMAL_SIZE + fInode->Node().ExtraInodeSize() + sizeof(uint32); pos += fBodyEntry->ValueOffset(); - if ((pos + length) > (end - start) || length > fBodyEntry->ValueSize()) + if ((off_t)(pos + length) > (end - start) || length > fBodyEntry->ValueSize()) return ERANGE; } memcpy(buffer, start + (uint32)pos, length); diff --git a/src/add-ons/kernel/file_systems/ext2/BitmapBlock.cpp b/src/add-ons/kernel/file_systems/ext2/BitmapBlock.cpp index a048eb25f0..fcd5147640 100644 --- a/src/add-ons/kernel/file_systems/ext2/BitmapBlock.cpp +++ b/src/add-ons/kernel/file_systems/ext2/BitmapBlock.cpp @@ -28,7 +28,7 @@ BitmapBlock::BitmapBlock(Volume* volume, uint32 numBits) fNumBits(numBits), fMaxIndex(fNumBits >> 5) { - TRACE("BitmapBlock::BitmapBlock(): num bits: %lu\n", fNumBits); + TRACE("BitmapBlock::BitmapBlock(): num bits: %" B_PRIu32 "\n", fNumBits); } @@ -95,7 +95,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked) uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]); if ((bits & mask) != (marked ? mask : 0)) { - TRACE("BitmapBlock::_Check(): start %lx mask %lx\n", bits, mask); + TRACE("BitmapBlock::_Check(): start %" B_PRIx32 " mask %" B_PRIx32 + "\n", bits, mask); return false; } @@ -105,8 +106,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked) for (; iterations > 0; --iterations) { if (data[index++] != (marked ? 0xFFFFFFFF : 0)) { - TRACE("BitmapBlock::_Check(): iterations %lu bits: %lX\n", iterations, - data[index - 1]); + TRACE("BitmapBlock::_Check(): iterations %" B_PRIu32 " bits: %" + B_PRIx32 "\n", iterations, data[index - 1]); return false; } } @@ -116,8 +117,9 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked) uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]); if ((bits & mask) != (marked ? mask : 0)) { - TRACE("BitmapBlock::_Check(): remainingBits %ld remaining %lX mask %lX\n", - remainingBits, bits, mask); + TRACE("BitmapBlock::_Check(): remainingBits %" B_PRIu32 + " remaining %" B_PRIx32 " mask %" B_PRIx32 "\n", remainingBits, + bits, mask); return false; } } @@ -129,8 +131,8 @@ BitmapBlock::_Check(uint32 start, uint32 length, bool marked) bool BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) { - TRACE("BitmapBlock::_Update(%lu, %lu, %c, %c)\n", start, length, - unmark ? 't' : 'f', force ? 't' : 'f'); + TRACE("BitmapBlock::_Update(%" B_PRIu32 ", %" B_PRIu32 ", %c, %c)\n", + start, length, mark ? 't' : 'f', force ? 't' : 'f'); if (fData == NULL || start + length > fNumBits) return false; @@ -139,23 +141,24 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) uint32 startBit = start & 0x1F; uint32 remainingBits = (length + startBit) & 0x1F; - TRACE("BitmapBlock::_Update(): start index: %lu, start bit: %lu, remaining " - "bits: %lu)\n", startIndex, startBit, remainingBits); + TRACE("BitmapBlock::_Update(): start index: %" B_PRIu32 ", start bit: %" + B_PRIu32 ", remaining bits: %" B_PRIu32 ")\n", startIndex, startBit, + remainingBits); uint32 iterations; if (length < 32) { if (startBit + length < 32) { uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[startIndex]); - TRACE("BitmapBlock::_Update(): bits: %lx\n", bits); + TRACE("BitmapBlock::_Update(): bits: %" B_PRIx32 "\n", bits); uint32 mask = (1 << (startBit + length)) - 1; mask &= ~((1 << startBit) - 1); - TRACE("BitmapBlock::_Update(): mask: %lx\n", mask); + TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 "\n", mask); if ((bits & mask) != (mark ? 0 : mask)) { - ERROR("BitmapBlock::_Update() Marking failed bits %lx " - "startBit %ld\n", bits, startBit); + ERROR("BitmapBlock::_Update() Marking failed bits %" B_PRIx32 + " startBit %" B_PRIu32 "\n", bits, startBit); return false; } @@ -164,7 +167,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) else bits &= ~mask; - TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits); + TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n", + bits); fData[startIndex] = B_HOST_TO_LENDIAN_INT32(bits); return true; @@ -173,14 +177,15 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) } else iterations = (length - 32 + startBit) >> 5; - TRACE("BitmapBlock::_Update(): iterations: %lu\n", iterations); + TRACE("BitmapBlock::_Update(): iterations: %" B_PRIu32 "\n", iterations); uint32 index = startIndex; if (startBit != 0) { uint32 mask = ~((1 << startBit) - 1); uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[index]); - TRACE("BitmapBlock::_Update(): mask: %lx, bits: %lx\n", mask, bits); + TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 ", bits: %" B_PRIx32 + "\n", mask, bits); if (!force && (bits & mask) != (mark ? 0 : mask)) return false; @@ -191,7 +196,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) bits &= ~mask; fData[index] = B_HOST_TO_LENDIAN_INT32(bits); - TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits); + TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n", bits); index += 1; } else iterations++; @@ -199,7 +204,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) for (; iterations > 0; --iterations) { if (!force && fData[index] != (mark ? 0 : 0xFFFFFFFF)) { ERROR("BitmapBlock::_Update() Marking failed " - "index %ld, iterations %ld\n", index, iterations); + "index %" B_PRIu32 ", iterations %" B_PRId32 "\n", index, + iterations); return false; } fData[index++] = (mark ? 0xFFFFFFFF : 0); @@ -211,7 +217,8 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) uint32 mask = (1 << remainingBits) - 1; uint32 bits = B_LENDIAN_TO_HOST_INT32(fData[index]); - TRACE("BitmapBlock::_Update(): mask: %lx, bits: %lx\n", mask, bits); + TRACE("BitmapBlock::_Update(): mask: %" B_PRIx32 ", bits: %" B_PRIx32 + "\n", mask, bits); if (!force && (bits & mask) != (mark ? 0 : mask)) { ERROR("BitmapBlock::_Update() Marking failed remaining\n"); @@ -224,7 +231,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) bits &= ~mask; fData[index] = B_HOST_TO_LENDIAN_INT32(bits); - TRACE("BitmapBlock::_Update(): updated bits: %lx\n", bits); + TRACE("BitmapBlock::_Update(): updated bits: %" B_PRIx32 "\n", bits); } return true; @@ -234,7 +241,7 @@ BitmapBlock::_Update(uint32 start, uint32 length, bool mark, bool force) void BitmapBlock::_FindNext(uint32& pos, bool marked) { - TRACE("BitmapBlock::_FindNext(): pos: %lu\n", pos); + TRACE("BitmapBlock::_FindNext(): pos: %" B_PRIu32 "\n", pos); const uint32* data = fData == NULL ? fReadOnlyData : fData; if (data == NULL) @@ -252,8 +259,9 @@ BitmapBlock::_FindNext(uint32& pos, bool marked) uint32 mask = ~((1 << bit) - 1); uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]); - TRACE("BitmapBlock::_FindNext(): index: %lu, bit: %lu, mask: %lX, " - "bits: %lX\n", index, bit, mask, bits); + TRACE("BitmapBlock::_FindNext(): index: %" B_PRIu32 ", bit: %" B_PRIu32 + ", mask: %" B_PRIx32 ", bits: %" B_PRIx32 "\n", index, bit, mask, + bits); bits &= mask; if (bits == (marked ? 0 : mask) && index < fMaxIndex) { @@ -271,7 +279,7 @@ BitmapBlock::_FindNext(uint32& pos, bool marked) if (maxBit == 0) { // Not found TRACE("BitmapBlock::_FindNext(): reached end of block, " - "num bits: %lu\n", fNumBits); + "num bits: %" B_PRIu32 "\n", fNumBits); pos = fNumBits; return; } @@ -279,7 +287,7 @@ BitmapBlock::_FindNext(uint32& pos, bool marked) mask &= (1 << maxBit) - 1; if ((bits & mask) == (marked ? 0 : mask)) { TRACE("BitmapBlock::_FindNext(): reached end of block, " - "num bits: %lu\n", fNumBits); + "num bits: %" B_PRIu32 "\n", fNumBits); pos = fNumBits; return; } @@ -291,19 +299,19 @@ BitmapBlock::_FindNext(uint32& pos, bool marked) // Find the marked bit if ((bits >> bit & 1) != (marked ? 0U : 1U)) { pos = index << 5 | bit; - TRACE("BitmapBlock::_FindNext(): found bit: %lu\n", pos); + TRACE("BitmapBlock::_FindNext(): found bit: %" B_PRIu32 "\n", pos); return; } } - panic("Couldn't find bit inside an uint32 (%lx)\n", bits); + panic("Couldn't find bit inside an uint32 (%" B_PRIx32 ")\n", bits); } void BitmapBlock::FindPreviousMarked(uint32& pos) { - TRACE("BitmapBlock::FindPreviousMarked(%lu)\n", pos); + TRACE("BitmapBlock::FindPreviousMarked(%" B_PRIu32 ")\n", pos); const uint32* data = fData == NULL ? fReadOnlyData : fData; if (data == NULL) return; @@ -321,8 +329,8 @@ BitmapBlock::FindPreviousMarked(uint32& pos) uint32 bits = B_LENDIAN_TO_HOST_INT32(data[index]); bits = bits & mask; - TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n", - index, bit, bits); + TRACE("BitmapBlock::FindPreviousMarked(): index: %" B_PRIu32 " bit: %" + B_PRIu32 " bits: %" B_PRIx32 "\n", index, bit, bits); if (bits == 0) { // Find an block of 32 bits that has a marked bit @@ -340,8 +348,8 @@ BitmapBlock::FindPreviousMarked(uint32& pos) bit = 31; } - TRACE("BitmapBlock::FindPreviousMarked(): index: %lu bit: %lu bits: %lx\n", - index, bit, bits); + TRACE("BitmapBlock::FindPreviousMarked(): index: %" B_PRIu32 " bit: %" + B_PRIu32 " bits: %" B_PRIx32 "\n", index, bit, bits); for (; bit >= 0; --bit) { // Find the marked bit @@ -368,9 +376,10 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) uint32 index = 0; uint32 bits = B_LENDIAN_TO_HOST_INT32(data[0]); - TRACE("BitmapBlock::FindLargestUnmarkedRange(): word span: %lu, last " - "index: %lu, start index: %lu, index: %lu, bits: %lX, start: %lu, " - "length: %lu\n", wordSpan, fMaxIndex, startIndex, index, bits, start, + TRACE("BitmapBlock::FindLargestUnmarkedRange(): word span: %" B_PRIu32 + ", last index: %" B_PRIu32 ", start index: %" B_PRIu32 ", index: %" + B_PRIu32 ", bits: %" B_PRIx32 ", start: %" B_PRIu32 ", length: %" + B_PRIu32 "\n", wordSpan, fMaxIndex, startIndex, index, bits, start, length); if (wordSpan == 0) { @@ -390,7 +399,8 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) start = startPos; length = newLength; TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found " - "larger length %lu starting at %lu\n", length, start); + "larger length %" B_PRIu32 " starting at %" B_PRIu32 + "\n", length, start); } startPos = endPos; @@ -442,8 +452,9 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) wordSpan = length >> 5; TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found " - "larger length %lu starting at %lu; word span: " - "%lu\n", length, start, wordSpan); + "larger length %" B_PRIu32 " starting at %" B_PRIu32 + "; word span: %" B_PRIu32 "\n", length, start, + wordSpan); } } @@ -458,15 +469,16 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) uint32 newStart = (startIndex + 1) << 5; TRACE("BitmapBlock::FindLargestUnmarkedRange(): Possibly found a " - "larger range. index: %lu, start index: %lu, word span: %lu, " - "new length: %lu, new start: %lu\n", index, startIndex, wordSpan, + "larger range. index: %" B_PRIu32 ", start index: %" B_PRIu32 + ", word span: %" B_PRIu32 ", new length: %" B_PRIu32 + ", new start: %" B_PRIu32 "\n", index, startIndex, wordSpan, newLength, newStart); if (newStart != 0) { uint32 startBits = B_LENDIAN_TO_HOST_INT32(data[startIndex]); - TRACE("BitmapBlock::FindLargestUnmarkedRange(): start bits: %lu\n", - startBits); + TRACE("BitmapBlock::FindLargestUnmarkedRange(): start bits: %" + B_PRIu32 "\n", startBits); for (int32 bit = 31; bit >= 0; --bit) { if ((startBits >> bit & 1) != 0) @@ -477,7 +489,8 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) } TRACE("BitmapBlock::FindLargestUnmarkedRange(): updated new start " - "to %lu and new length to %lu\n", newStart, newLength); + "to %" B_PRIu32 " and new length to %" B_PRIu32 "\n", newStart, + newLength); } for (int32 bit = 0; bit < 32; ++bit) { @@ -488,13 +501,14 @@ BitmapBlock::FindLargestUnmarkedRange(uint32& start, uint32& length) } TRACE("BitmapBlock::FindLargestUnmarkedRange(): updated new length to " - "%lu\n", newLength); + "%" B_PRIu32 "\n", newLength); if (newLength > length) { start = newStart; length = newLength; TRACE("BitmapBlock::FindLargestUnmarkedRange(): Found " - "largest length %lu starting at %lu\n", length, start); + "largest length %" B_PRIu32 " starting at %" B_PRIu32 "\n", + length, start); } } } diff --git a/src/add-ons/kernel/file_systems/ext2/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/ext2/BlockAllocator.cpp index 934f4eaa39..bb4f85edfc 100644 --- a/src/add-ons/kernel/file_systems/ext2/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/ext2/BlockAllocator.cpp @@ -136,7 +136,7 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup, fFreeBits = fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature()); fLargestLength = fFreeBits; fLargestStart = _FirstFreeBlock(); - TRACE("Group %ld is uninit\n", fBlockGroup); + TRACE("Group %" B_PRIu32 " is uninit\n", fBlockGroup); return B_OK; } @@ -146,11 +146,11 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup, if (fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature()) != fFreeBits) { - ERROR("AllocationBlockGroup(%lu,%lld)::Initialize(): Mismatch between " - "counted free blocks (%lu/%lu) and what is set on the group " - "descriptor (%lu)\n", fBlockGroup, fBitmapBlock, fFreeBits, - fNumBits, fGroupDescriptor->FreeBlocks( - fVolume->Has64bitFeature())); + ERROR("AllocationBlockGroup(%" B_PRIu32 ",%" B_PRIu64 ")::Initialize()" + ": Mismatch between counted free blocks (%" B_PRIu32 "/%" B_PRIu32 + ") and what is set on the group descriptor (%" B_PRIu32 ")\n", + fBlockGroup, fBitmapBlock, fFreeBits, fNumBits, + fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature())); return B_BAD_DATA; } @@ -166,7 +166,7 @@ AllocationBlockGroup::Initialize(Volume* volume, uint32 blockGroup, status_t AllocationBlockGroup::_ScanFreeRanges() { - TRACE("AllocationBlockGroup::_ScanFreeRanges() for group %ld\n", + TRACE("AllocationBlockGroup::_ScanFreeRanges() for group %" B_PRIu32 "\n", fBlockGroup); BitmapBlock block(fVolume, fNumBits); @@ -206,7 +206,8 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start, uint32 length) { uint32 start = _start - fStart; - TRACE("AllocationBlockGroup::Allocate(%ld,%ld)\n", start, length); + TRACE("AllocationBlockGroup::Allocate(%" B_PRIu32 ",%" B_PRIu32 ")\n", + start, length); if (length == 0) return B_OK; @@ -222,13 +223,13 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start, if (!block.SetToWritable(transaction, fBitmapBlock)) return B_ERROR; - TRACE("AllocationBlockGroup::Allocate(): Largest range in %lu-%lu\n", - fLargestStart, fLargestStart + fLargestLength); + TRACE("AllocationBlockGroup::Allocate(): Largest range in %" B_PRIu32 "-%" + B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength); ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength)); if (!block.Mark(start, length)) { - ERROR("Failed to allocate blocks from %lu to %lu. Some were " - "already allocated.\n", start, start + length); + ERROR("Failed to allocate blocks from %" B_PRIu32 " to %" B_PRIu32 + ". Some were already allocated.\n", start, start + length); return B_ERROR; } @@ -261,8 +262,8 @@ AllocationBlockGroup::Allocate(Transaction& transaction, fsblock_t _start, return B_OK; } - TRACE("AllocationBlockGroup::Allocate(): Largest range in %lu-%lu\n", - fLargestStart, fLargestStart + fLargestLength); + TRACE("AllocationBlockGroup::Allocate(): Largest range in %" B_PRIu32 "-%" + B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength); ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength)); if (fLargestLength < fNumBits / 2) @@ -277,8 +278,8 @@ status_t AllocationBlockGroup::Free(Transaction& transaction, uint32 start, uint32 length) { - TRACE("AllocationBlockGroup::Free(): start: %lu, length %lu\n", start, - length); + TRACE("AllocationBlockGroup::Free(): start: %" B_PRIu32 ", length %" + B_PRIu32 "\n", start, length); if (length == 0) return B_OK; @@ -296,13 +297,13 @@ AllocationBlockGroup::Free(Transaction& transaction, uint32 start, if (!block.SetToWritable(transaction, fBitmapBlock)) return B_ERROR; - TRACE("AllocationBlockGroup::Free(): Largest range in %lu-%lu\n", - fLargestStart, fLargestStart + fLargestLength); + TRACE("AllocationBlockGroup::Free(): Largest range in %" B_PRIu32 "-%" + B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength); ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength)); if (!block.Unmark(start, length)) { - ERROR("Failed to free blocks from %lu to %lu. Some were " - "already freed.\n", start, start + length); + ERROR("Failed to free blocks from %" B_PRIu32 " to %" B_PRIu32 + ". Some were already freed.\n", start, start + length); return B_ERROR; } @@ -331,8 +332,8 @@ AllocationBlockGroup::Free(Transaction& transaction, uint32 start, } } - TRACE("AllocationBlockGroup::Free(): Largest range in %lu-%lu\n", - fLargestStart, fLargestStart + fLargestLength); + TRACE("AllocationBlockGroup::Free(): Largest range in %" B_PRIu32 "-%" + B_PRIu32 "\n", fLargestStart, fLargestStart + fLargestLength); ASSERT(block.CheckUnmarked(fLargestStart, fLargestLength)); fFreeBits += length; @@ -445,11 +446,11 @@ AllocationBlockGroup::_InitGroup(Transaction& transaction) if (fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature()) != fFreeBits) { - ERROR("AllocationBlockGroup(%lu,%lld)::_InitGroup(): Mismatch between " - "counted free blocks (%lu/%lu) and what is set on the group " - "descriptor (%lu)\n", fBlockGroup, fBitmapBlock, fFreeBits, - fNumBits, fGroupDescriptor->FreeBlocks( - fVolume->Has64bitFeature())); + ERROR("AllocationBlockGroup(%" B_PRIu32 ",%" B_PRIu64 ")::_InitGroup()" + ": Mismatch between counted free blocks (%" B_PRIu32 "/%" B_PRIu32 + ") and what is set on the group descriptor (%" B_PRIu32 ")\n", + fBlockGroup, fBitmapBlock, fFreeBits, fNumBits, + fGroupDescriptor->FreeBlocks(fVolume->Has64bitFeature())); return B_BAD_DATA; } @@ -561,9 +562,10 @@ BlockAllocator::Initialize() fFirstBlock = fVolume->FirstDataBlock(); fNumBlocks = fVolume->NumBlocks(); - TRACE("BlockAllocator::Initialize(): blocks per group: %lu, block groups: " - "%lu, first block: %llu, num blocks: %llu\n", fBlocksPerGroup, - fNumGroups, fFirstBlock, fNumBlocks); + TRACE("BlockAllocator::Initialize(): blocks per group: %" B_PRIu32 + ", block groups: %" B_PRIu32 ", first block: %" B_PRIu64 + ", num blocks: %" B_PRIu64 "\n", fBlocksPerGroup, fNumGroups, + fFirstBlock, fNumBlocks); fGroups = new(std::nothrow) AllocationBlockGroup[fNumGroups]; if (fGroups == NULL) @@ -597,9 +599,10 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum, MutexLocker lock(fLock); TRACE("BlockAllocator::AllocateBlocks(): Acquired lock\n"); - TRACE("BlockAllocator::AllocateBlocks(): transaction: %ld, min: %lu, " - "max: %lu, block group: %lu, start: %llu, num groups: %lu\n", - transaction.ID(), minimum, maximum, blockGroup, start, fNumGroups); + TRACE("BlockAllocator::AllocateBlocks(): transaction: %" B_PRId32 ", min: " + "%" B_PRIu32 ", max: %" B_PRIu32 ", block group: %" B_PRIu32 ", start:" + " %" B_PRIu64 ", num groups: %" B_PRIu32 "\n", transaction.ID(), + minimum, maximum, blockGroup, start, fNumGroups); fsblock_t bestStart = 0; uint32 bestLength = 0; @@ -612,8 +615,9 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum, for (int32 iterations = 0; iterations < 2; iterations++) { for (; group < last; ++group, ++groupNum) { - TRACE("BlockAllocator::AllocateBlocks(): Group %lu has largest " - "length of %lu\n", groupNum, group->LargestLength()); + TRACE("BlockAllocator::AllocateBlocks(): Group %" B_PRIu32 + " has largest length of %" B_PRIu32 "\n", groupNum, + group->LargestLength()); if (group->LargestLength() > bestLength) { if (start <= group->LargestStart()) { @@ -622,8 +626,9 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum, bestGroup = groupNum; TRACE("BlockAllocator::AllocateBlocks(): Found a better " - "range: block group: %lu, %llu-%llu\n", groupNum, - bestStart, bestStart + bestLength); + "range: block group: %" B_PRIu32 ", %" B_PRIu64 "-%" + B_PRIu64 "\n", groupNum, bestStart, + bestStart + bestLength); if (bestLength >= maximum) break; @@ -643,22 +648,24 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, uint32 minimum, } if (bestLength < minimum) { - TRACE("BlockAllocator::AllocateBlocks(): best range (length %lu) " - "doesn't have minimum length of %lu\n", bestLength, minimum); + TRACE("BlockAllocator::AllocateBlocks(): best range (length %" B_PRIu32 + ") doesn't have minimum length of %" B_PRIu32 "\n", bestLength, + minimum); return B_DEVICE_FULL; } if (bestLength > maximum) bestLength = maximum; - TRACE("BlockAllocator::AllocateBlocks(): Selected range: block group %lu, " - "%llu-%llu\n", bestGroup, bestStart, bestStart + bestLength); + TRACE("BlockAllocator::AllocateBlocks(): Selected range: block group %" + B_PRIu32 ", %" B_PRIu64 "-%" B_PRIu64 "\n", bestGroup, bestStart, + bestStart + bestLength); status_t status = fGroups[bestGroup].Allocate(transaction, bestStart, bestLength); if (status != B_OK) { - TRACE("BlockAllocator::AllocateBlocks(): Failed to allocate %lu blocks " - "inside block group %lu.\n", bestLength, bestGroup); + TRACE("BlockAllocator::AllocateBlocks(): Failed to allocate %" B_PRIu32 + " blocks inside block group %" B_PRIu32 ".\n", bestLength, bestGroup); return status; } @@ -753,7 +760,8 @@ BlockAllocator::Allocate(Transaction& transaction, Inode* inode, status_t BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length) { - TRACE("BlockAllocator::Free(%llu, %lu)\n", start, length); + TRACE("BlockAllocator::Free(%" B_PRIu64 ", %" B_PRIu32 ")\n", start, + length); MutexLocker lock(fLock); if (start <= fFirstBlock) { @@ -766,16 +774,16 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length) if (start > fNumBlocks || length > fNumBlocks) return B_BAD_VALUE; - TRACE("BlockAllocator::Free(): first block: %llu, blocks per group: %lu\n", - fFirstBlock, fBlocksPerGroup); + TRACE("BlockAllocator::Free(): first block: %" B_PRIu64 + ", blocks per group: %" B_PRIu32 "\n", fFirstBlock, fBlocksPerGroup); start -= fFirstBlock; off_t end = start + length - 1; uint32 group = start / fBlocksPerGroup; if (group >= fNumGroups) { - panic("BlockAllocator::Free() group %ld too big (fNumGroups %ld)\n", - group, fNumGroups); + panic("BlockAllocator::Free() group %" B_PRIu32 " too big (fNumGroups " + "%" B_PRIu32 ")\n", group, fNumGroups); } uint32 lastGroup = end / fBlocksPerGroup; start = start % fBlocksPerGroup; @@ -783,7 +791,8 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length) if (group == lastGroup) return fGroups[group].Free(transaction, start, length); - TRACE("BlockAllocator::Free(): Freeing from group %lu: %llu, %llu\n", group, + TRACE("BlockAllocator::Free(): Freeing from group %" B_PRIu32 ": %" + B_PRIu64 ", %" B_PRIu64 "\n", group, start, fGroups[group].NumBits() - start); status_t status = fGroups[group].Free(transaction, start, @@ -792,14 +801,15 @@ BlockAllocator::Free(Transaction& transaction, fsblock_t start, uint32 length) return status; for (++group; group < lastGroup; ++group) { - TRACE("BlockAllocator::Free(): Freeing all from group %lu\n", group); + TRACE("BlockAllocator::Free(): Freeing all from group %" B_PRIu32 "\n", + group); status = fGroups[group].FreeAll(transaction); if (status != B_OK) return status; } - TRACE("BlockAllocator::Free(): Freeing from group %lu: 0-%llu \n", group, - end % fBlocksPerGroup); + TRACE("BlockAllocator::Free(): Freeing from group %" B_PRIu32 ": 0-%" + B_PRIu64 " \n", group, end % fBlocksPerGroup); return fGroups[group].Free(transaction, 0, (end + 1) % fBlocksPerGroup); } @@ -815,7 +825,8 @@ BlockAllocator::_Initialize(BlockAllocator* allocator) uint32 numGroups = allocator->fNumGroups - 1; off_t freeBlocks = 0; - TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks); + TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n", + freeBlocks); for (uint32 i = 0; i < numGroups; ++i) { status_t status = groups[i].Initialize(volume, i, @@ -826,7 +837,8 @@ BlockAllocator::_Initialize(BlockAllocator* allocator) } freeBlocks += groups[i].FreeBits(); - TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks); + TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n", + freeBlocks); } // Last block group may have less blocks @@ -840,13 +852,15 @@ BlockAllocator::_Initialize(BlockAllocator* allocator) freeBlocks += groups[numGroups].FreeBits(); - TRACE("BlockAllocator::_Initialize(): free blocks: %llu\n", freeBlocks); + TRACE("BlockAllocator::_Initialize(): free blocks: %" B_PRIdOFF "\n", + freeBlocks); mutex_unlock(&allocator->fLock); if (freeBlocks != volume->NumFreeBlocks()) { - TRACE("Counted free blocks (%llu) doesn't match value in the " - "superblock (%llu).\n", freeBlocks, volume->NumFreeBlocks()); + TRACE("Counted free blocks (%" B_PRIdOFF ") doesn't match value in the" + " superblock (%" B_PRIdOFF ").\n", freeBlocks, + volume->NumFreeBlocks()); return B_BAD_DATA; } diff --git a/src/add-ons/kernel/file_systems/ext2/DataStream.cpp b/src/add-ons/kernel/file_systems/ext2/DataStream.cpp index 6a28b87715..54ed139f56 100644 --- a/src/add-ons/kernel/file_systems/ext2/DataStream.cpp +++ b/src/add-ons/kernel/file_systems/ext2/DataStream.cpp @@ -170,8 +170,8 @@ DataStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) return B_ERROR; } - TRACE("inode %Ld: FindBlock(offset %lld): %lld %ld\n", ID(), offset, block, - _count != NULL ? *_count : 1); + TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64" %" B_PRIu32 "\n", offset, + block, _count != NULL ? *_count : 1); return B_OK; } @@ -179,8 +179,8 @@ DataStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) status_t DataStream::Enlarge(Transaction& transaction, off_t& numBlocks) { - TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n", - fNumBlocks, numBlocks); + TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF ", target size: %" + B_PRIdOFF "\n", fNumBlocks, numBlocks); off_t targetBlocks = numBlocks; fWaiting = _BlocksNeeded(numBlocks); @@ -196,15 +196,15 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks) return status; } - TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); if (fNumBlocks == targetBlocks) return B_OK; } - TRACE("DataStream::Enlarge(): indirect current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): indirect current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); if (fNumBlocks <= kMaxIndirect) { status = _AddForIndirectBlock(transaction, targetBlocks); @@ -214,15 +214,15 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks) return status; } - TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); if (fNumBlocks == targetBlocks) return B_OK; } - TRACE("DataStream::Enlarge(): indirect2 current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): indirect2 current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); if (fNumBlocks <= kMaxDoubleIndirect) { status = _AddForDoubleIndirectBlock(transaction, targetBlocks); @@ -232,18 +232,18 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks) return status; } - TRACE("DataStream::Enlarge(): current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); if (fNumBlocks == targetBlocks) return B_OK; } - TRACE("DataStream::Enlarge(): indirect3 current size: %llu, target size: %llu\n", - fNumBlocks, targetBlocks); + TRACE("DataStream::Enlarge(): indirect3 current size: %" B_PRIdOFF + ", target size: %" B_PRIdOFF "\n", fNumBlocks, targetBlocks); - TRACE("DataStream::Enlarge(): allocated: %lu, waiting: %lu\n", fAllocated, - fWaiting); + TRACE("DataStream::Enlarge(): allocated: %" B_PRIu32 ", waiting: %" + B_PRIu32 "\n", fAllocated, fWaiting); return _AddForTripleIndirectBlock(transaction, targetBlocks); } @@ -252,8 +252,8 @@ DataStream::Enlarge(Transaction& transaction, off_t& numBlocks) status_t DataStream::Shrink(Transaction& transaction, off_t& numBlocks) { - TRACE("DataStream::Shrink(): current size: %llu, target size: %llu\n", - fNumBlocks, numBlocks); + TRACE("DataStream::Shrink(): current size: %" B_PRIdOFF ", target size: %" + B_PRIdOFF "\n", fNumBlocks, numBlocks); fFreeStart = 0; fFreeCount = 0; @@ -329,7 +329,7 @@ DataStream::Shrink(Transaction& transaction, off_t& numBlocks) uint32 DataStream::_BlocksNeeded(off_t numBlocks) { - TRACE("DataStream::BlocksNeeded(): num blocks %llu\n", numBlocks); + TRACE("DataStream::BlocksNeeded(): num blocks %" B_PRIdOFF "\n", numBlocks); off_t blocksNeeded = 0; if (numBlocks > fNumBlocks) { @@ -363,7 +363,7 @@ DataStream::_BlocksNeeded(off_t numBlocks) } } - TRACE("DataStream::BlocksNeeded(): %llu\n", blocksNeeded); + TRACE("DataStream::BlocksNeeded(): %" B_PRIdOFF "\n", blocksNeeded); return blocksNeeded; } @@ -371,8 +371,8 @@ DataStream::_BlocksNeeded(off_t numBlocks) status_t DataStream::_GetBlock(Transaction& transaction, uint32& blockNum) { - TRACE("DataStream::_GetBlock(): allocated: %lu, pos: %llu, waiting: %lu\n", - fAllocated, fAllocatedPos, fWaiting); + TRACE("DataStream::_GetBlock(): allocated: %" B_PRIu32 ", pos: %" B_PRIu64 + ", waiting: %" B_PRIu32 "\n", fAllocated, fAllocatedPos, fWaiting); if (fAllocated == 0) { uint32 blockGroup = (fAllocatedPos - fFirstBlock) @@ -387,8 +387,9 @@ DataStream::_GetBlock(Transaction& transaction, uint32& blockNum) fWaiting -= fAllocated; - TRACE("DataStream::_GetBlock(): newAllocated: %lu, newpos: %llu," - "newwaiting: %lu\n", fAllocated, fAllocatedPos, fWaiting); + TRACE("DataStream::_GetBlock(): newAllocated: %" B_PRIu32 ", newpos: %" + B_PRIu64 ", newwaiting: %" B_PRIu32 "\n", fAllocated, + fAllocatedPos, fWaiting); } fAllocated--; @@ -408,7 +409,8 @@ DataStream::_PrepareBlock(Transaction& transaction, uint32* pos, if (blockNum == 0) { status_t status = _GetBlock(transaction, blockNum); if (status != B_OK) { - ERROR("DataStream::_PrepareBlock() _GetBlock() failed blockNum %ld\n", blockNum); + ERROR("DataStream::_PrepareBlock() _GetBlock() failed blockNum %" + B_PRIu32 "\n", blockNum); return status; } @@ -424,7 +426,7 @@ status_t DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t _count) { off_t count = _count; - TRACE("DataStream::_AddBlocks(): count: %llu\n", count); + TRACE("DataStream::_AddBlocks(): count: %" B_PRIdOFF "\n", count); while (count > 0) { uint32 blockNum; @@ -446,8 +448,8 @@ status_t DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start, off_t end, int recursion) { - TRACE("DataStream::_AddBlocks(): start: %llu, end %llu, recursion: %d\n", - start, end, recursion); + TRACE("DataStream::_AddBlocks(): start: %" B_PRIdOFF ", end %" B_PRIdOFF + ", recursion: %d\n", start, end, recursion); bool clear; uint32 blockNum; @@ -477,8 +479,8 @@ DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start, uint32 elementPos = start / elementWidth; uint32 endPos = end / elementWidth; - TRACE("DataStream::_AddBlocks(): element pos: %lu, end pos: %lu\n", - elementPos, endPos); + TRACE("DataStream::_AddBlocks(): element pos: %" B_PRIu32 ", end pos: %" + B_PRIu32 "\n", elementPos, endPos); recursion--; @@ -525,8 +527,8 @@ DataStream::_AddBlocks(Transaction& transaction, uint32* block, off_t start, status_t DataStream::_AddForDirectBlocks(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_AddForDirectBlocks(): current size: %llu, target size: " - "%lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_AddForDirectBlocks(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32* direct = &fStream->direct[fNumBlocks]; uint32 end = numBlocks > kMaxDirect ? kMaxDirect : numBlocks; @@ -537,8 +539,8 @@ DataStream::_AddForDirectBlocks(Transaction& transaction, uint32 numBlocks) status_t DataStream::_AddForIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_AddForIndirectBlocks(): current size: %llu, target " - "size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_AddForIndirectBlocks(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32 *indirect = &fStream->indirect; uint32 start = fNumBlocks - kMaxDirect; uint32 end = numBlocks - kMaxDirect; @@ -554,8 +556,8 @@ status_t DataStream::_AddForDoubleIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_AddForDoubleIndirectBlock(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_AddForDoubleIndirectBlock(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32 *doubleIndirect = &fStream->double_indirect; uint32 start = fNumBlocks - kMaxIndirect; uint32 end = numBlocks - kMaxIndirect; @@ -571,8 +573,8 @@ status_t DataStream::_AddForTripleIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_AddForTripleIndirectBlock(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_AddForTripleIndirectBlock(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32 *tripleIndirect = &fStream->triple_indirect; uint32 start = fNumBlocks - kMaxDoubleIndirect; uint32 end = numBlocks - kMaxDoubleIndirect; @@ -584,8 +586,8 @@ DataStream::_AddForTripleIndirectBlock(Transaction& transaction, status_t DataStream::_PerformFree(Transaction& transaction) { - TRACE("DataStream::_PerformFree(): start: %lu, count: %lu\n", fFreeStart, - fFreeCount); + TRACE("DataStream::_PerformFree(): start: %" B_PRIu32 ", count: %" B_PRIu32 + "\n", fFreeStart, fFreeCount); status_t status; if (fFreeCount == 0) @@ -604,9 +606,9 @@ status_t DataStream::_MarkBlockForRemoval(Transaction& transaction, uint32* block) { - TRACE("DataStream::_MarkBlockForRemoval(*(%p) = %lu): free start: %lu, " - "free count: %lu\n", block, B_LENDIAN_TO_HOST_INT32(*block), - fFreeStart, fFreeCount); + TRACE("DataStream::_MarkBlockForRemoval(*(%p) = %" B_PRIu32 + "): free start: %" B_PRIu32 ", free count: %" B_PRIu32 "\n", block, + B_LENDIAN_TO_HOST_INT32(*block), fFreeStart, fFreeCount); uint32 blockNum = B_LENDIAN_TO_HOST_INT32(*block); *block = 0; @@ -632,7 +634,7 @@ status_t DataStream::_FreeBlocks(Transaction& transaction, uint32* block, uint32 _count) { uint32 count = _count; - TRACE("DataStream::_FreeBlocks(%p, %lu)\n", block, count); + TRACE("DataStream::_FreeBlocks(%p, %" B_PRIu32 ")\n", block, count); while (count > 0) { status_t status = _MarkBlockForRemoval(transaction, block); @@ -654,8 +656,8 @@ DataStream::_FreeBlocks(Transaction& transaction, uint32* block, off_t start, off_t end, bool freeParent, int recursion) { // TODO: Designed specifically for shrinking. Perhaps make it more general? - TRACE("DataStream::_FreeBlocks(%p, %llu, %llu, %c, %d)\n", - block, start, end, freeParent ? 't' : 'f', recursion); + TRACE("DataStream::_FreeBlocks(%p, %" B_PRIdOFF ", %" B_PRIdOFF + ", %c, %d)\n", block, start, end, freeParent ? 't' : 'f', recursion); uint32 blockNum = B_LENDIAN_TO_HOST_INT32(*block); @@ -726,8 +728,8 @@ DataStream::_FreeBlocks(Transaction& transaction, uint32* block, off_t start, status_t DataStream::_RemoveFromDirectBlocks(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_RemoveFromDirectBlocks(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_RemoveFromDirectBlocks(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32* direct = &fStream->direct[numBlocks]; off_t end = fNumBlocks > kMaxDirect ? kMaxDirect : fNumBlocks; @@ -738,8 +740,8 @@ DataStream::_RemoveFromDirectBlocks(Transaction& transaction, uint32 numBlocks) status_t DataStream::_RemoveFromIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_RemoveFromIndirectBlock(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_RemoveFromIndirectBlock(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32* indirect = &fStream->indirect; off_t start = numBlocks <= kMaxDirect ? 0 : numBlocks - kMaxDirect; off_t end = fNumBlocks - kMaxDirect; @@ -757,8 +759,8 @@ status_t DataStream::_RemoveFromDoubleIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_RemoveFromDoubleIndirectBlock(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_RemoveFromDoubleIndirectBlock(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32* doubleIndirect = &fStream->double_indirect; off_t start = numBlocks <= kMaxIndirect ? 0 : numBlocks - kMaxIndirect; off_t end = fNumBlocks - kMaxIndirect; @@ -776,8 +778,8 @@ status_t DataStream::_RemoveFromTripleIndirectBlock(Transaction& transaction, uint32 numBlocks) { - TRACE("DataStream::_RemoveFromTripleIndirectBlock(): current size: %llu, " - "target size: %lu\n", fNumBlocks, numBlocks); + TRACE("DataStream::_RemoveFromTripleIndirectBlock(): current size: %" B_PRIdOFF + ", target size: %" B_PRIu32 "\n", fNumBlocks, numBlocks); uint32* tripleIndirect = &fStream->triple_indirect; off_t start = numBlocks <= kMaxDoubleIndirect ? 0 : numBlocks - kMaxDoubleIndirect; diff --git a/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp b/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp index 21e64bd458..a1e4eb312e 100644 --- a/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp +++ b/src/add-ons/kernel/file_systems/ext2/DirectoryIterator.cpp @@ -56,8 +56,8 @@ DirectoryIterator::DirectoryIterator(Inode* directory, off_t start, fStartLogicalBlock(fLogicalBlock), fStartDisplacement(fDisplacement) { - TRACE("DirectoryIterator::DirectoryIterator() %lld: num blocks: %lu\n", - fDirectory->ID(), fNumBlocks); + TRACE("DirectoryIterator::DirectoryIterator() %" B_PRIdINO ": num blocks: " + "%" B_PRIu32 "\n", fDirectory->ID(), fNumBlocks); fIndexing = parent != NULL; fInitStatus = fDirectory->FindBlock(start, fPhysicalBlock); fStartPhysicalBlock = fPhysicalBlock; @@ -83,7 +83,7 @@ DirectoryIterator::InitCheck() status_t DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id) { - TRACE("DirectoryIterator::Get() ID %lld\n", fDirectory->ID()); + TRACE("DirectoryIterator::Get() ID %" B_PRIdINO "\n", fDirectory->ID()); if (_Offset() >= fDirectory->Size()) { TRACE("DirectoryIterator::Get() out of entries\n"); return B_ENTRY_NOT_FOUND; @@ -94,7 +94,8 @@ DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id) if (block == NULL) return B_IO_ERROR; - TRACE("DirectoryIterator::Get(): Displacement: %lu\n", fDisplacement); + TRACE("DirectoryIterator::Get(): Displacement: %" B_PRIu32 "\n", + fDisplacement); const ext2_dir_entry* entry = (const ext2_dir_entry*)&block[fDisplacement]; if (entry->Length() == 0 || entry->InodeID() == 0) @@ -103,13 +104,14 @@ DirectoryIterator::Get(char* name, size_t* _nameLength, ino_t* _id) if (entry->NameLength() != 0) { size_t length = entry->NameLength(); - TRACE("block %lu, displacement %lu: entry ino %lu, length %u, " - "name length %lu, type %u\n", fLogicalBlock, fDisplacement, - entry->InodeID(), entry->Length(), length, entry->FileType()); + TRACE("block %" B_PRIu32 ", displacement %" B_PRIu32 ": entry ino %" + B_PRIu32 ", length %u, name length %" B_PRIuSIZE ", type %u\n", + fLogicalBlock, fDisplacement, entry->InodeID(), entry->Length(), + length, entry->FileType()); if (*_nameLength > 0) { - if (*_nameLength < length) - length = *_nameLength - 1; + if (length + 1 > *_nameLength) + return B_BUFFER_OVERFLOW; memcpy(name, entry->name, length); name[length] = '\0'; @@ -141,7 +143,8 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id) status_t DirectoryIterator::Next() { - TRACE("DirectoryIterator::Next() fDirectory->ID() %lld\n", fDirectory->ID()); + TRACE("DirectoryIterator::Next() fDirectory->ID() %" B_PRIdINO "\n", + fDirectory->ID()); if (_Offset() >= fDirectory->Size()) { TRACE("DirectoryIterator::Next() out of entries\n"); @@ -161,8 +164,9 @@ DirectoryIterator::Next() entry = (ext2_dir_entry*)(block + fDisplacement); do { - TRACE("Checking entry at block %llu, displacement %lu entry inodeid %ld\n", fPhysicalBlock, - fDisplacement, entry->InodeID()); + TRACE("Checking entry at block %" B_PRIu64 ", displacement %" B_PRIu32 + " entry inodeid %" B_PRIu32 "\n", fPhysicalBlock, fDisplacement, + entry->InodeID()); if (entry->Length() != 0) { if (!entry->IsValid()) { @@ -183,7 +187,7 @@ DirectoryIterator::Next() if (status != B_OK) return status; - if (_Offset() + ext2_dir_entry::MinimumSize() + if ((off_t)(_Offset() + ext2_dir_entry::MinimumSize()) >= fDirectory->Size()) { TRACE("DirectoryIterator::Next() end of directory file\n"); return B_ENTRY_NOT_FOUND; @@ -203,7 +207,8 @@ DirectoryIterator::Next() entry = (ext2_dir_entry*)(block + fDisplacement); - TRACE("DirectoryIterator::Next() skipping entry %d %ld\n", entry->Length(), entry->InodeID()); + TRACE("DirectoryIterator::Next() skipping entry %d %" B_PRIu32 "\n", + entry->Length(), entry->InodeID()); } while (entry->Length() == 0 || entry->InodeID() == 0); TRACE("DirectoryIterator::Next() entry->Length() %d entry->name %*s\n", @@ -228,7 +233,8 @@ void DirectoryIterator::Restart() { TRACE("DirectoryIterator::Restart(): (logical, physical, displacement): " - "current: (%lu, %llu, %lu), start: (%lu, %llu, %lu)\n", fLogicalBlock, + "current: (%" B_PRIu32 ", %" B_PRIu64 ", %" B_PRIu32 "), start: (%" + B_PRIu32 ", %" B_PRIu64 ", %" B_PRIu32 ")\n", fLogicalBlock, fPhysicalBlock, fDisplacement, fStartLogicalBlock, fStartPhysicalBlock, fStartDisplacement); fLogicalBlock = fStartLogicalBlock; @@ -365,7 +371,8 @@ DirectoryIterator::RemoveEntry(Transaction& transaction) return B_OK; } - TRACE("DirectoryIterator::RemoveEntry() fDisplacement %ld\n", fDisplacement); + TRACE("DirectoryIterator::RemoveEntry() fDisplacement %" B_PRIu32 "\n", + fDisplacement); if (fPreviousDisplacement == fDisplacement) { char buffer[EXT2_NAME_LENGTH + 1]; @@ -471,8 +478,9 @@ DirectoryIterator::_AddEntry(Transaction& transaction, const char* name, uint8 nameLength, ino_t id, uint8 type, uint16 newLength, uint16 pos, bool hasPrevious) { - TRACE("DirectoryIterator::_AddEntry(%s, %d, %llu, %d, %d, %d, %c)\n", - name, nameLength, id, type, newLength, pos, hasPrevious ? 't' : 'f'); + TRACE("DirectoryIterator::_AddEntry(%s, %d, %" B_PRIdINO ", %d, %d, %d, " + "%c)\n", name, nameLength, id, type, newLength, pos, + hasPrevious ? 't' : 'f'); CachedBlock cached(fVolume); uint8* block = cached.SetToWritable(transaction, fPhysicalBlock); @@ -507,8 +515,8 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction, uint32 newBlocksPos, bool firstSplit) { // Block is full, split required - TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %llu, %lu, %c)\n", - name, nameLength, id, newBlocksPos, + TRACE("DirectoryIterator::_SplitIndexedBlock(.., %s, %u, %" B_PRIdINO ", %" + B_PRIu32 ", %c)\n", name, nameLength, id, newBlocksPos, firstSplit ? 't' : 'f'); // Allocate a buffer for the entries in the block @@ -598,14 +606,14 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction, TRACE("DirectoryIterator::_SplitIndexedBlock(): pos: %p, name " "length: %u, entry length: %u\n", entry.position, - (unsigned int)dirEntry->name_length, - (unsigned int)dirEntry->Length()); + dirEntry->name_length, + dirEntry->Length()); char cbuffer[256]; memcpy(cbuffer, dirEntry->name, dirEntry->name_length); cbuffer[dirEntry->name_length] = '\0'; entry.hash = htree.Hash(dirEntry->name, dirEntry->name_length); - TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %lu\n", + TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %" B_PRIu32 "\n", cbuffer, entry.hash); status = entrySet.Insert(entry); @@ -630,7 +638,7 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction, entry.position = (uint8*)&newEntry; entry.hash = htree.Hash(name, nameLength); - TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %lu\n", + TRACE("DirectoryIterator::_SplitIndexedBlock(): %s -> %" B_PRIu32 "\n", name, entry.hash); entrySet.Insert(entry); @@ -639,8 +647,8 @@ DirectoryIterator::_SplitIndexedBlock(Transaction& transaction, VectorSet::Iterator iterator = entrySet.Begin(); int32 median = entrySet.Count() / 2; displacement = 0; - TRACE("DirectoryIterator::_SplitIndexedBlock(): Count: %ld, median: %ld\n", - entrySet.Count(), median); + TRACE("DirectoryIterator::_SplitIndexedBlock(): Count: %" B_PRId32 + ", median: %" B_PRId32 "\n", entrySet.Count(), median); uint32 previousHash = (*iterator).hash; diff --git a/src/add-ons/kernel/file_systems/ext2/ExtentStream.cpp b/src/add-ons/kernel/file_systems/ext2/ExtentStream.cpp index 491ff15f07..6bf7ff62f9 100644 --- a/src/add-ons/kernel/file_systems/ext2/ExtentStream.cpp +++ b/src/add-ons/kernel/file_systems/ext2/ExtentStream.cpp @@ -49,7 +49,7 @@ status_t ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) { fileblock_t index = offset >> fVolume->BlockShift(); - TRACE("FindBlock(%lld, %lld)\n", offset, index); + TRACE("FindBlock(%" B_PRIdOFF ", %" B_PRIu64 ")\n", offset, index); if (offset >= fSize) { TRACE("FindBlock: offset larger than inode size\n"); @@ -69,8 +69,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) && stream->extent_index[i].LogicalBlock() <= index) { i++; } - TRACE("FindBlock() getting index %ld at %lld\n", i - 1, - stream->extent_index[i - 1].PhysicalBlock()); + TRACE("FindBlock() getting index %" B_PRId32 " at %" B_PRIu64 "\n", + i - 1, stream->extent_index[i - 1].PhysicalBlock()); stream = (ext2_extent_stream *)cached.SetTo( stream->extent_index[i - 1].PhysicalBlock()); if (!stream->extent_header.IsValid()) @@ -97,8 +97,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) - stream->extent_entries[middle].LogicalBlock(); if (diff > stream->extent_entries[middle].Length()) { // sparse block - TRACE("FindBlock() sparse block index %lld at %ld\n", index, - stream->extent_entries[middle].LogicalBlock()); + TRACE("FindBlock() sparse block index %" B_PRIu64 " at %" B_PRIu32 + "\n", index, stream->extent_entries[middle].LogicalBlock()); block = 0xffffffff; return B_OK; } @@ -106,16 +106,16 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) block = stream->extent_entries[middle].PhysicalBlock() + diff; if (_count) *_count = stream->extent_entries[middle].Length() - diff; - TRACE("FindBlock(offset %lld): %lld %ld\n", offset, - block, _count != NULL ? *_count : 1); + TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64 " %" B_PRIu32 + "\n", offset, block, _count != NULL ? *_count : 1); return B_OK; } for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) { if (stream->extent_entries[i].LogicalBlock() > index) { // sparse block - TRACE("FindBlock() sparse block index %lld at %ld\n", index, - stream->extent_entries[i].LogicalBlock()); + TRACE("FindBlock() sparse block index %" B_PRIu64 " at %" B_PRIu32 + "\n", index, stream->extent_entries[i].LogicalBlock()); block = 0xffffffff; return B_OK; } @@ -124,8 +124,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) block = stream->extent_entries[i].PhysicalBlock() + diff; if (_count) *_count = stream->extent_entries[i].Length() - diff; - TRACE("FindBlock(offset %lld): %lld %ld\n", offset, - block, _count != NULL ? *_count : 1); + TRACE("FindBlock(offset %" B_PRIdOFF "): %" B_PRIu64 " %" B_PRIu32 + "\n", offset, block, _count != NULL ? *_count : 1); return B_OK; } } @@ -137,8 +137,8 @@ ExtentStream::FindBlock(off_t offset, fsblock_t& block, uint32 *_count) status_t ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) { - TRACE("Enlarge(): current size: %llu, target size: %llu\n", - fNumBlocks, numBlocks); + TRACE("Enlarge(): current size: %" B_PRIdOFF ", target size: %" B_PRIdOFF + "\n", fNumBlocks, numBlocks); off_t targetBlocks = numBlocks; numBlocks = targetBlocks - fNumBlocks; @@ -172,8 +172,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) panic("stream->extent_header.NumEntries() == 0\n"); int32 lastIndex = stream->extent_header.NumEntries() - 1; TRACE("Enlarge() depth %d\n", stream->extent_header.Depth()); - TRACE("Enlarge() getting index %ld at %lld\n", lastIndex, - stream->extent_index[lastIndex].PhysicalBlock()); + TRACE("Enlarge() getting index %" B_PRId32 " at %" B_PRIu64 "\n", + lastIndex, stream->extent_index[lastIndex].PhysicalBlock()); path[++level] = stream->extent_index[lastIndex].PhysicalBlock(); stream = (ext2_extent_stream *)cached.SetTo(path[level]); if (stream == NULL) @@ -184,7 +184,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) if (stream->extent_header.NumEntries() > 0) { ext2_extent_entry &last = stream->extent_entries[ stream->extent_header.NumEntries() - 1]; - TRACE("Enlarge() last %lld allocatedPos %lld\n", + TRACE("Enlarge() last %" B_PRIu64 " allocatedPos %" B_PRIu64 "\n", last.PhysicalBlock() + last.Length(), fAllocatedPos); if (last.PhysicalBlock() + last.Length() == fAllocatedPos && (last.Length() + allocated) <= EXT2_EXTENT_MAX_LENGTH) { @@ -205,8 +205,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) if (stream->extent_header.NumEntries() >= stream->extent_header.MaxEntries()) { - TRACE("Enlarge() adding leaf and indexes at depth %d level %ld\n", - stream->extent_header.Depth(), level); + TRACE("Enlarge() adding leaf and indexes at depth %d level %" + B_PRId32 "\n", stream->extent_header.Depth(), level); // try to add a leaf and indexes while (--level >= 0) { stream = (ext2_extent_stream *)cached.SetTo(path[level]); @@ -216,7 +216,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) < stream->extent_header.MaxEntries()) { break; } - TRACE("Enlarge() going up from level %ld\n", level); + TRACE("Enlarge() going up from level %" B_PRId32 "\n", level); } if (level < 0 && fStream->extent_header.NumEntries() @@ -231,7 +231,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) return status; } ASSERT(_CheckBlock(fStream, newBlock) == B_OK); - TRACE("Enlarge() move root to block %lld\n", newBlock); + TRACE("Enlarge() move root to block %" B_PRIu64 "\n", + newBlock); numBlocks++; stream = (ext2_extent_stream *)cached.SetToWritable( transaction, newBlock); @@ -277,7 +278,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) path[level++] = newBlock; depth = stream->extent_header.Depth() - 1; - TRACE("Enlarge() init index block %lld at depth %d\n", + TRACE("Enlarge() init index block %" B_PRIu64 " at depth %d\n", newBlock, depth); stream = (ext2_extent_stream *)cached.SetToWritable( transaction, newBlock); @@ -293,12 +294,12 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) ASSERT(Check()); } - TRACE("Enlarge() depth %d level %ld\n", + TRACE("Enlarge() depth %d level %" B_PRId32 "\n", stream->extent_header.Depth(), level); if (stream->extent_header.Depth() == 1) { - TRACE("Enlarge() adding an entry block at depth %d level %ld\n", - depth, level); + TRACE("Enlarge() adding an entry block at depth %d level %" + B_PRId32 "\n", depth, level); fsblock_t newBlock; if (level >= 0) newBlock = path[level]; @@ -319,8 +320,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) stream->extent_index[index].SetPhysicalBlock(newBlock); stream->extent_header.SetNumEntries(index + 1); - TRACE("Enlarge() init entry block %lld at depth %d\n", - newBlock, depth); + TRACE("Enlarge() init entry block %" B_PRIu64 + " at depth %d\n", newBlock, depth); stream = (ext2_extent_stream *)cached.SetToWritable( transaction, newBlock); if (stream == NULL) @@ -336,7 +337,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) } // add a new entry - TRACE("Enlarge() add entry %lld\n", fAllocatedPos); + TRACE("Enlarge() add entry %" B_PRIu64 "\n", fAllocatedPos); if (stream != fStream) { stream = (ext2_extent_stream *)cached.SetToWritable( transaction, cached.BlockNumber()); @@ -348,7 +349,7 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) stream->extent_entries[index].SetLength(allocated); stream->extent_entries[index].SetPhysicalBlock(fAllocatedPos); stream->extent_header.SetNumEntries(index + 1); - TRACE("Enlarge() entry added at index %ld\n", index); + TRACE("Enlarge() entry added at index %" B_PRId32 "\n", index); ASSERT(stream->extent_header.IsValid()); fNumBlocks += allocated; @@ -362,8 +363,8 @@ ExtentStream::Enlarge(Transaction& transaction, off_t& numBlocks) status_t ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks) { - TRACE("DataStream::Shrink(): current size: %llu, target size: %llu\n", - fNumBlocks, numBlocks); + TRACE("DataStream::Shrink(): current size: %" B_PRIdOFF ", target size: %" + B_PRIdOFF "\n", fNumBlocks, numBlocks); off_t targetBlocks = numBlocks; numBlocks = fNumBlocks - targetBlocks; @@ -380,8 +381,8 @@ ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks) panic("stream->extent_header.NumEntries() == 0\n"); int32 lastIndex = stream->extent_header.NumEntries() - 1; TRACE("Shrink() depth %d\n", stream->extent_header.Depth()); - TRACE("Shrink() getting index %ld at %lld\n", lastIndex, - stream->extent_index[lastIndex].PhysicalBlock()); + TRACE("Shrink() getting index %" B_PRId32 " at %" B_PRIu64 "\n", + lastIndex, stream->extent_index[lastIndex].PhysicalBlock()); path[++level] = stream->extent_index[lastIndex].PhysicalBlock(); stream = (ext2_extent_stream *)cached.SetToWritable(transaction, path[level]); @@ -401,19 +402,20 @@ ExtentStream::Shrink(Transaction& transaction, off_t& numBlocks) } uint16 length = min_c(last.Length(), fNumBlocks - targetBlocks); fsblock_t block = last.PhysicalBlock() + last.Length() - length; - TRACE("Shrink() free block %lld length %d\n", block, length); + TRACE("Shrink() free block %" B_PRIu64 " length %d\n", block, + length); status = fVolume->FreeBlocks(transaction, block, length); if (status != B_OK) break; fNumBlocks -= length; stream->extent_entries[index].SetLength(last.Length() - length); - TRACE("Shrink() new length for %ld: %d\n", index, last.Length()); + TRACE("Shrink() new length for %" B_PRId32 ": %d\n", index, last.Length()); if (last.Length() != 0) break; index--; - TRACE("Shrink() next index: %ld\n", index); + TRACE("Shrink() next index: %" B_PRId32 "\n", index); } - TRACE("Shrink() new entry count: %ld\n", index + 1); + TRACE("Shrink() new entry count: %" B_PRId32 "\n", index + 1); stream->extent_header.SetNumEntries(index + 1); ASSERT(Check()); @@ -476,8 +478,8 @@ ExtentStream::_Check(ext2_extent_stream *stream, fileblock_t &block) for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) { ext2_extent_entry &entry = stream->extent_entries[i]; if (entry.LogicalBlock() < block) { - panic("_Check() entry %ld %lld %ld\n", i, block, - entry.LogicalBlock()); + panic("_Check() entry %" B_PRId32 " %" B_PRIu64 " %" B_PRIu32 + "\n", i, block, entry.LogicalBlock()); return B_BAD_VALUE; } block = entry.LogicalBlock() + entry.Length(); @@ -489,8 +491,8 @@ ExtentStream::_Check(ext2_extent_stream *stream, fileblock_t &block) for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) { ext2_extent_index &index = stream->extent_index[i]; if (index.LogicalBlock() < block) { - panic("_Check() index %ld %lld %ld\n", i, block, - index.LogicalBlock()); + panic("_Check() index %" B_PRId32 " %" B_PRIu64 " %" B_PRIu32 + "\n", i, block, index.LogicalBlock()); return B_BAD_VALUE; } ext2_extent_stream *child = (ext2_extent_stream *)cached.SetTo( @@ -519,8 +521,9 @@ ExtentStream::_CheckBlock(ext2_extent_stream *stream, fsblock_t block) ext2_extent_entry &entry = stream->extent_entries[i]; if (entry.PhysicalBlock() <= block && (entry.PhysicalBlock() + entry.Length()) > block) { - panic("_CheckBlock() entry %ld %lld %lld %d\n", i, block, - entry.PhysicalBlock(), entry.Length()); + panic("_CheckBlock() entry %" B_PRId32 " %" B_PRIu64 " %" + B_PRIu64 " %d\n", i, block, entry.PhysicalBlock(), + entry.Length()); return B_BAD_VALUE; } } @@ -531,7 +534,7 @@ ExtentStream::_CheckBlock(ext2_extent_stream *stream, fsblock_t block) for (int32 i = 0; i < stream->extent_header.NumEntries(); i++) { ext2_extent_index &index = stream->extent_index[i]; if (index.PhysicalBlock() == block) { - panic("_CheckBlock() index %ld %lld\n", i, block); + panic("_CheckBlock() index %" B_PRId32 " %" B_PRIu64 "\n", i, block); return B_BAD_VALUE; } ext2_extent_stream *child = (ext2_extent_stream *)cached.SetTo( diff --git a/src/add-ons/kernel/file_systems/ext2/HTree.cpp b/src/add-ons/kernel/file_systems/ext2/HTree.cpp index ad13fffc5f..07acc7e7fe 100644 --- a/src/add-ons/kernel/file_systems/ext2/HTree.cpp +++ b/src/add-ons/kernel/file_systems/ext2/HTree.cpp @@ -62,8 +62,8 @@ HTree::HTree(Volume* volume, Inode* directory) fHashSeed[2] = superBlock.HashSeed(2); fHashSeed[3] = superBlock.HashSeed(3); - TRACE("HTree::HTree() %lx %lx %lx %lx\n", fHashSeed[0], - fHashSeed[1], fHashSeed[2], fHashSeed[3]); + TRACE("HTree::HTree() %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32 + "\n", fHashSeed[0], fHashSeed[1], fHashSeed[2], fHashSeed[3]); if (fHashSeed[0] == 0 && fHashSeed[1] == 0 && fHashSeed[2] == 0 && fHashSeed[3] == 0) { @@ -179,7 +179,7 @@ HTree::Hash(const char* name, uint8 length) hash = 0; #endif - TRACE("HTree::_Hash(): filename hash 0x%lX\n", hash); + TRACE("HTree::_Hash(): filename hash 0x%" B_PRIx32 "\n", hash); return hash & ~1; } @@ -366,7 +366,8 @@ HTree::_HashTEA(const char* name, uint8 _length) uint32 blocks[4]; _PrepareBlocksForHash(name, (uint32)length, blocks, 4); - TRACE("_HashTEA %lx %lx %lx\n", blocks[0], blocks[1], blocks[2]); + TRACE("_HashTEA %" B_PRIx32 " %" B_PRIx32 " %" B_PRIx32 "\n", + blocks[0], blocks[1], blocks[2]); _TEATransform(buffer, blocks); name += 16; diff --git a/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp b/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp index 09299f9246..8f4bf2d0a6 100644 --- a/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp +++ b/src/add-ons/kernel/file_systems/ext2/HTreeEntryIterator.cpp @@ -41,8 +41,8 @@ HTreeEntryIterator::HTreeEntryIterator(off_t offset, Inode* directory) fCurrentEntry = fFirstEntry; } - TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %llu, " - "entry no. %lu, parent: %p\n", this, fBlockNum, (uint32)fCurrentEntry, + TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %" B_PRIu64 ", " + "entry no. %u, parent: %p\n", this, fBlockNum, fCurrentEntry, fParent); } @@ -63,16 +63,16 @@ HTreeEntryIterator::HTreeEntryIterator(uint32 block, uint32 blockSize, // fCurrentEntry is initialized to 1 to skip the fake directory entry fInitStatus = B_OK; - TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %lu, " - "parent: %p\n", this, block, fParent); + TRACE("HTreeEntryIterator::HTreeEntryIterator(): created %p, block %" + B_PRIu32 ", parent: %p\n", this, block, fParent); } status_t HTreeEntryIterator::Init() { - TRACE("HTreeEntryIterator::Init() first entry: %lu\n", - (uint32)fFirstEntry); + TRACE("HTreeEntryIterator::Init() first entry: %u\n", + fFirstEntry); if (fInitStatus != B_OK) return fInitStatus; @@ -99,15 +99,15 @@ HTreeEntryIterator::Init() } if (fLimit != fBlockSize / sizeof(HTreeEntry) - fFirstEntry) { - ERROR("HTreeEntryIterator::Init() bad fLimit %lu should be %lu " - "at block %llu\n", (uint32)fLimit, fBlockSize / sizeof(HTreeEntry) - - fFirstEntry, fBlockNum); + ERROR("HTreeEntryIterator::Init() bad fLimit %u should be %" B_PRIu32 + " at block %" B_PRIu64 "\n", fLimit, + (uint32)(fBlockSize / sizeof(HTreeEntry) - fFirstEntry), fBlockNum); fCount = fLimit = 0; return B_ERROR; } - TRACE("HTreeEntryIterator::Init() count %lu limit %lu\n", - (uint32)fCount, (uint32)fLimit); + TRACE("HTreeEntryIterator::Init() count %u limit %u\n", + fCount, fLimit); return B_OK; } @@ -149,8 +149,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections, HTreeEntry* end = (HTreeEntry*)block + fCount + fFirstEntry - 1; HTreeEntry* middle = start; - TRACE("HTreeEntryIterator::Lookup() current entry: %lu\n", - (uint32)fCurrentEntry); + TRACE("HTreeEntryIterator::Lookup() current entry: %u\n", + fCurrentEntry); TRACE("HTreeEntryIterator::Lookup() indirections: %d s:%p m:%p e:%p\n", indirections, start, middle, end); @@ -161,7 +161,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections, TRACE("HTreeEntryIterator::Lookup() indirections: %d s:%p m:%p e:%p\n", indirections, start, middle, end); - TRACE("HTreeEntryIterator::Lookup() %lx %lx\n", hash, middle->Hash()); + TRACE("HTreeEntryIterator::Lookup() %" B_PRIx32 " %" B_PRIx32 "\n", + hash, middle->Hash()); if (hash >= middle->Hash()) start = middle + 1; @@ -175,8 +176,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections, if (indirections == 0) { TRACE("HTreeEntryIterator::Lookup(): Creating an indexed directory " - "iterator starting at block: %lu, hash: 0x%lX\n", start->Block(), - start->Hash()); + "iterator starting at block: %" B_PRIu32 ", hash: 0x%" B_PRIx32 + "\n", start->Block(), start->Hash()); *directoryIterator = new(std::nothrow) DirectoryIterator(fDirectory, start->Block() * fBlockSize, this); @@ -188,7 +189,8 @@ HTreeEntryIterator::Lookup(uint32 hash, int indirections, } TRACE("HTreeEntryIterator::Lookup(): Creating a HTree entry iterator " - "starting at block: %lu, hash: 0x%lX\n", start->Block(), start->Hash()); + "starting at block: %" B_PRIu32 ", hash: 0x%" B_PRIx32 "\n", + start->Block(), start->Hash()); fsblock_t blockNum; status_t status = fDirectory->FindBlock(start->Block() * fBlockSize, blockNum); @@ -215,8 +217,8 @@ status_t HTreeEntryIterator::GetNext(uint32& childBlock) { fCurrentEntry++; - TRACE("HTreeEntryIterator::GetNext(): current entry: %lu count: %lu, " - "limit: %lu\n", (uint32)fCurrentEntry, (uint32)fCount, (uint32)fLimit); + TRACE("HTreeEntryIterator::GetNext(): current entry: %u count: %u, " + "limit: %u\n", fCurrentEntry, fCount, fLimit); bool endOfBlock = fCurrentEntry >= (fCount + fFirstEntry); if (endOfBlock) { @@ -231,8 +233,8 @@ HTreeEntryIterator::GetNext(uint32& childBlock) if (status != B_OK) return status; - TRACE("HTreeEntryIterator::GetNext(): moving to next block: %lu\n", - logicalBlock); + TRACE("HTreeEntryIterator::GetNext(): moving to next block: %" B_PRIx32 + "\n", logicalBlock); status = fDirectory->FindBlock(logicalBlock * fBlockSize, fBlockNum); if (status != B_OK) @@ -257,7 +259,7 @@ HTreeEntryIterator::GetNext(uint32& childBlock) if (!endOfBlock) fHasCollision = (entry[fCurrentEntry].Hash() & 1) == 1; - TRACE("HTreeEntryIterator::GetNext(): next block: %lu\n", + TRACE("HTreeEntryIterator::GetNext(): next block: %" B_PRIu32 "\n", entry->Block()); childBlock = entry->Block(); @@ -269,8 +271,8 @@ HTreeEntryIterator::GetNext(uint32& childBlock) uint32 HTreeEntryIterator::BlocksNeededForNewEntry() { - TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %llu, " - "volume: %p\n", fBlockNum, fVolume); + TRACE("HTreeEntryIterator::BlocksNeededForNewEntry(): block num: %" + B_PRIu64 ", volume: %p\n", fBlockNum, fVolume); CachedBlock cached(fVolume); const uint8* blockData = cached.SetTo(fBlockNum); @@ -305,7 +307,8 @@ status_t HTreeEntryIterator::InsertEntry(Transaction& transaction, uint32 hash, off_t blockNum, off_t newBlocksPos, bool hasCollision) { - TRACE("HTreeEntryIterator::InsertEntry(): block num: %llu\n", fBlockNum); + TRACE("HTreeEntryIterator::InsertEntry(): block num: %" B_PRIu64 "\n", + fBlockNum); CachedBlock cached(fVolume); uint8* blockData = cached.SetToWritable(transaction, fBlockNum); diff --git a/src/add-ons/kernel/file_systems/ext2/HashRevokeManager.cpp b/src/add-ons/kernel/file_systems/ext2/HashRevokeManager.cpp index 9fdaf7a887..10f3981714 100644 --- a/src/add-ons/kernel/file_systems/ext2/HashRevokeManager.cpp +++ b/src/add-ons/kernel/file_systems/ext2/HashRevokeManager.cpp @@ -134,8 +134,8 @@ HashRevokeManager::Compare(void* _revoked, const void *_block) /*static*/ uint32 HashRevokeManager::Hash(void* _revoked, const void* _block, uint32 range) { - TRACE("HashRevokeManager::Hash(): revoked: %p, block: %p, range: %lu\n", - _revoked, _block, range); + TRACE("HashRevokeManager::Hash(): revoked: %p, block: %p, range: %" + B_PRIu32 "\n", _revoked, _block, range); RevokeElement* revoked = (RevokeElement*)_revoked; if (revoked != NULL) @@ -161,8 +161,8 @@ HashRevokeManager::_ForceInsert(uint32 block, uint32 commitID) if (retValue == B_OK) { fRevokeCount++; - TRACE("HashRevokeManager::_ForceInsert(): revoke count: %lu\n", - fRevokeCount); + TRACE("HashRevokeManager::_ForceInsert(): revoke count: %" B_PRIu32 + "\n", fRevokeCount); } return retValue; diff --git a/src/add-ons/kernel/file_systems/ext2/Inode.cpp b/src/add-ons/kernel/file_systems/ext2/Inode.cpp index 6bffe52dcf..3a07a8c4c8 100644 --- a/src/add-ons/kernel/file_systems/ext2/Inode.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Inode.cpp @@ -43,8 +43,8 @@ Inode::Inode(Volume* volume, ino_t id) rw_lock_init(&fLock, "ext2 inode"); recursive_lock_init(&fSmallDataLock, "ext2 inode small data"); - TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %lu\n", - sizeof(ext2_inode), fVolume->InodeSize()); + TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %" B_PRIu32 + "\n", sizeof(ext2_inode), fVolume->InodeSize()); fNodeSize = sizeof(ext2_inode) > fVolume->InodeSize() ? fVolume->InodeSize() : sizeof(ext2_inode); @@ -78,7 +78,7 @@ Inode::Inode(Volume* volume) rw_lock_init(&fLock, "ext2 inode"); recursive_lock_init(&fSmallDataLock, "ext2 inode small data"); - TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %lu\n", + TRACE("Inode::Inode(): ext2_inode: %lu, disk inode: %" B_PRIu32 "\n", sizeof(ext2_inode), fVolume->InodeSize()); fNodeSize = sizeof(ext2_inode) > fVolume->InodeSize() ? fVolume->InodeSize() : sizeof(ext2_inode); @@ -138,15 +138,16 @@ Inode::WriteBack(Transaction& transaction) if (inodeBlockData == NULL) return B_IO_ERROR; - TRACE("Inode::WriteBack(): Inode ID: %lld, inode block: %llu, data: %p, " - "index: %lu, inode size: %lu, node size: %lu, this: %p, node: %p\n", + TRACE("Inode::WriteBack(): Inode ID: %" B_PRIdINO ", inode block: %" + B_PRIdOFF ", data: %p, index: %" B_PRIu32 ", inode size: %" B_PRIu32 + ", node size: %" B_PRIu32 ", this: %p, node: %p\n", fID, blockNum, inodeBlockData, fVolume->InodeBlockIndex(fID), fVolume->InodeSize(), fNodeSize, this, &fNode); memcpy(inodeBlockData + fVolume->InodeBlockIndex(fID) * fVolume->InodeSize(), (uint8*)&fNode, fNodeSize); - TRACE("Inode::WriteBack() finished %ld\n", Node().stream.direct[0]); + TRACE("Inode::WriteBack() finished %" B_PRId32 "\n", Node().stream.direct[0]); return B_OK; } @@ -161,7 +162,7 @@ Inode::UpdateNodeFromDisk() if (status != B_OK) return status; - TRACE("inode %lld at block %llu\n", fID, blockNum); + TRACE("inode %" B_PRIdINO " at block %" B_PRIdOFF "\n", fID, blockNum); CachedBlock cached(fVolume); const uint8* inodeBlock = cached.SetTo(blockNum); @@ -169,13 +170,13 @@ Inode::UpdateNodeFromDisk() if (inodeBlock == NULL) return B_IO_ERROR; - TRACE("Inode size: %lu, inode index: %lu\n", fVolume->InodeSize(), - fVolume->InodeBlockIndex(fID)); + TRACE("Inode size: %" B_PRIu32 ", inode index: %" B_PRIu32 "\n", + fVolume->InodeSize(), fVolume->InodeBlockIndex(fID)); ext2_inode* inode = (ext2_inode*)(inodeBlock + fVolume->InodeBlockIndex(fID) * fVolume->InodeSize()); TRACE("Attempting to copy inode data from %p to %p, ext2_inode " - "size: %lu\n", inode, &fNode, fNodeSize); + "size: %" B_PRIu32 "\n", inode, &fNode, fNodeSize); memcpy(&fNode, inode, fNodeSize); @@ -244,13 +245,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length) // set/check boundaries for pos/length if (pos < 0) { - ERROR("inode %lld: ReadAt failed(pos %lld, length %lu)\n", ID(), pos, - length); + ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF + ", length %" B_PRIuSIZE ")\n", ID(), pos, length); return B_BAD_VALUE; } if (pos >= Size() || length == 0) { - TRACE("inode %lld: ReadAt 0 (pos %lld, length %lu)\n", ID(), pos, length); + TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF ", length %" + B_PRIuSIZE ")\n", ID(), pos, length); *_length = 0; return B_NO_ERROR; } @@ -263,8 +265,8 @@ status_t Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer, size_t* _length) { - TRACE("Inode::WriteAt(%lld, %p, *(%p) = %ld)\n", pos, buffer, - _length, *_length); + TRACE("Inode::WriteAt(%" B_PRIdOFF ", %p, *(%p) = %" B_PRIuSIZE ")\n", pos, + buffer, _length, *_length); ReadLocker readLocker(fLock); if (IsFileCacheDisabled()) @@ -296,9 +298,10 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer, off_t end = pos + (off_t)length; off_t oldSize = Size(); - TRACE("Inode::WriteAt(): Old size: %x:%x, new size: %x:%x\n", - (int)(oldSize >> 32), (int)(oldSize & 0xFFFFFFFF), - (int)(end >> 32), (int)(end & 0xFFFFFFFF)); + TRACE("Inode::WriteAt(): Old size: %" B_PRIdOFF ":%" B_PRIdOFF + ", new size: %" B_PRIdOFF ":%" B_PRIdOFF "\n", + oldSize >> 32, oldSize & 0xFFFFFFFF, + end >> 32, end & 0xFFFFFFFF); if (end > oldSize) { status_t status = Resize(transaction, end); @@ -326,9 +329,10 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer, return B_OK; } - TRACE("Inode::WriteAt(): Performing write: %p, %lld, %p, %ld\n", - FileCache(), pos, buffer, *_length); - status_t status = file_cache_write(FileCache(), NULL, pos, buffer, _length); + TRACE("Inode::WriteAt(): Performing write: %p, %" B_PRIdOFF ", %p, %" + B_PRIuSIZE "\n", FileCache(), pos, buffer, *_length); + status_t status = file_cache_write(FileCache(), NULL, pos, buffer, + _length); WriteLockInTransaction(transaction); @@ -341,7 +345,8 @@ Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer, status_t Inode::FillGapWithZeros(off_t start, off_t end) { - TRACE("Inode::FileGapWithZeros(%lld - %lld)\n", start, end); + TRACE("Inode::FileGapWithZeros(%" B_PRIdOFF " - %" B_PRIdOFF ")\n", start, + end); while (start < end) { size_t size; @@ -352,7 +357,8 @@ Inode::FillGapWithZeros(off_t start, off_t end) size = end - start; TRACE("Inode::FillGapWithZeros(): Calling file_cache_write(%p, NULL, " - "%lld, NULL, &(%ld) = %p)\n", fCache, start, size, &size); + "%" B_PRIdOFF ", NULL, &(%" B_PRIuSIZE ") = %p)\n", fCache, start, + size, &size); status_t status = file_cache_write(fCache, NULL, start, NULL, &size); if (status != B_OK) @@ -368,7 +374,8 @@ Inode::FillGapWithZeros(off_t start, off_t end) status_t Inode::Resize(Transaction& transaction, off_t size) { - TRACE("Inode::Resize() ID:%lld size: %lld\n", ID(), size); + TRACE("Inode::Resize() ID:%" B_PRIdINO " size: %" B_PRIdOFF "\n", ID(), + size); if (size < 0) return B_BAD_VALUE; @@ -377,7 +384,8 @@ Inode::Resize(Transaction& transaction, off_t size) if (size == oldSize) return B_OK; - TRACE("Inode::Resize(): old size: %lld, new size: %lld\n", oldSize, size); + TRACE("Inode::Resize(): old size: %" B_PRIdOFF ", new size: %" B_PRIdOFF + "\n", oldSize, size); status_t status; if (size > oldSize) { @@ -397,7 +405,8 @@ Inode::Resize(Transaction& transaction, off_t size) file_cache_set_size(FileCache(), size); file_map_set_size(Map(), size); - TRACE("Inode::Resize(): Writing back inode changes. Size: %lld\n", Size()); + TRACE("Inode::Resize(): Writing back inode changes. Size: %" B_PRIdOFF + "\n", Size()); return WriteBack(transaction); } @@ -451,7 +460,7 @@ status_t Inode::Unlink(Transaction& transaction) { uint32 numLinks = fNode.NumLinks(); - TRACE("Inode::Unlink(): Current links: %lu\n", numLinks); + TRACE("Inode::Unlink(): Current links: %" B_PRIu32 "\n", numLinks); if (numLinks == 0) return B_BAD_VALUE; @@ -727,8 +736,8 @@ Inode::EnableFileCache() return B_OK; } - TRACE("Inode::EnableFileCache(): Creating file cache: %ld, %lld, %lld\n", - fVolume->ID(), ID(), Size()); + TRACE("Inode::EnableFileCache(): Creating file cache: %" B_PRIu32 ", %" + B_PRIdINO ", %" B_PRIdOFF "\n", fVolume->ID(), ID(), Size()); fCache = file_cache_create(fVolume->ID(), ID(), Size()); fMap = file_map_create(fVolume->ID(), ID(), Size()); @@ -819,7 +828,8 @@ Inode::_EnlargeDataStream(Transaction& transaction, off_t size) if (size <= maxSize) { // No need to allocate more blocks TRACE("Inode::_EnlargeDataStream(): No need to allocate more blocks\n"); - TRACE("Inode::_EnlargeDataStream(): Setting size to %Ld\n", size); + TRACE("Inode::_EnlargeDataStream(): Setting size to %" B_PRIdOFF "\n", + size); fNode.SetSize(size); return B_OK; } @@ -833,10 +843,11 @@ Inode::_EnlargeDataStream(Transaction& transaction, off_t size) DataStream stream(fVolume, &fNode.stream, oldSize); stream.Enlarge(transaction, end); } - TRACE("Inode::_EnlargeDataStream(): Setting size to %lld\n", size); + TRACE("Inode::_EnlargeDataStream(): Setting size to %" B_PRIdOFF "\n", + size); fNode.SetSize(size); - TRACE("Inode::_EnlargeDataStream(): Setting allocated block count to %llu\n", - end); + TRACE("Inode::_EnlargeDataStream(): Setting allocated block count to %" + B_PRIdOFF "\n", end); return _SetNumBlocks(_NumBlocks() + end * (fVolume->BlockSize() / 512)); } @@ -858,7 +869,8 @@ Inode::_ShrinkDataStream(Transaction& transaction, off_t size) if (size > minSize) { // No need to allocate more blocks TRACE("Inode::_ShrinkDataStream(): No need to allocate more blocks\n"); - TRACE("Inode::_ShrinkDataStream(): Setting size to %lld\n", size); + TRACE("Inode::_ShrinkDataStream(): Setting size to %" B_PRIdOFF "\n", + size); fNode.SetSize(size); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/ext2/Inode.h b/src/add-ons/kernel/file_systems/ext2/Inode.h index b126996f90..098f83542b 100644 --- a/src/add-ons/kernel/file_systems/ext2/Inode.h +++ b/src/add-ons/kernel/file_systems/ext2/Inode.h @@ -224,10 +224,10 @@ public: status_t status = B_OK; if (!inode->IsSymLink() && volume->ID() >= 0) { - TRACEI("Vnode::Publish(): Publishing vnode: %d, %d, %p, %p, %x, " - "%x\n", (int)volume->FSVolume(), (int)inode->ID(), inode, - vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps, (int)inode->Mode(), - (int)publishFlags); + TRACEI("Vnode::Publish(): Publishing volume: %p, %" B_PRIdINO + ", %p, %p, %" B_PRIu16 ", %" B_PRIx32 "\n", volume->FSVolume(), + inode->ID(), inode, vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps, + inode->Mode(), publishFlags); status = publish_vnode(volume->FSVolume(), inode->ID(), inode, vnodeOps != NULL ? vnodeOps : &gExt2VnodeOps, inode->Mode(), publishFlags); diff --git a/src/add-ons/kernel/file_systems/ext2/InodeAllocator.cpp b/src/add-ons/kernel/file_systems/ext2/InodeAllocator.cpp index 9ac91ee79a..04186c45d7 100644 --- a/src/add-ons/kernel/file_systems/ext2/InodeAllocator.cpp +++ b/src/add-ons/kernel/file_systems/ext2/InodeAllocator.cpp @@ -139,7 +139,7 @@ InodeAllocator::_AllocateInGroup(Transaction& transaction, uint32 blockGroup, uint32 freeInodes = group->FreeInodes(fVolume->Has64bitFeature()); if (freeInodes == 0) return B_DEVICE_FULL; - TRACE("InodeAllocator::_Allocate() freeInodes %ld\n", + TRACE("InodeAllocator::_Allocate() freeInodes %" B_PRId32 "\n", freeInodes); group->SetFreeInodes(freeInodes - 1, fVolume->Has64bitFeature()); if (isDirectory) { @@ -177,8 +177,8 @@ InodeAllocator::_MarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock, BitmapBlock inodeBitmap(fVolume, numInodes); if (!inodeBitmap.SetToWritable(transaction, bitmapBlock)) { - ERROR("Unable to open inode bitmap (block number: %llu) for block group " - "%lu\n", bitmapBlock, blockGroup); + ERROR("Unable to open inode bitmap (block number: %" B_PRIu64 + ") for block group %" B_PRIu32 "\n", bitmapBlock, blockGroup); return B_IO_ERROR; } @@ -186,15 +186,16 @@ InodeAllocator::_MarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock, inodeBitmap.FindNextUnmarked(pos); if (pos == inodeBitmap.NumBits()) { - ERROR("Even though the block group %lu indicates there are free " - "inodes, no unmarked bit was found in the inode bitmap at block " - "%llu (numInodes %lu).\n", blockGroup, bitmapBlock, numInodes); + ERROR("Even though the block group %" B_PRIu32 " indicates there are " + "free inodes, no unmarked bit was found in the inode bitmap at " + "block %" B_PRIu64 " (numInodes %" B_PRIu32 ").\n", blockGroup, + bitmapBlock, numInodes); return B_ERROR; } if (!inodeBitmap.Mark(pos, 1)) { - ERROR("Failed to mark bit %lu at bitmap block %llu\n", pos, - bitmapBlock); + ERROR("Failed to mark bit %" B_PRIu32 " at bitmap block %" B_PRIu64 + "\n", pos, bitmapBlock); return B_BAD_DATA; } @@ -209,14 +210,15 @@ InodeAllocator::_UnmarkInBitmap(Transaction& transaction, fsblock_t bitmapBlock, BitmapBlock inodeBitmap(fVolume, numInodes); if (!inodeBitmap.SetToWritable(transaction, bitmapBlock)) { - ERROR("Unable to open inode bitmap at block %llu\n", bitmapBlock); + ERROR("Unable to open inode bitmap at block %" B_PRIu64 "\n", + bitmapBlock); return B_IO_ERROR; } uint32 pos = (id - 1) % fVolume->InodesPerGroup(); if (!inodeBitmap.Unmark(pos, 1)) { - ERROR("Unable to unmark bit %lu in inode bitmap block %llu\n", pos, - bitmapBlock); + ERROR("Unable to unmark bit %" B_PRIu32 " in inode bitmap block %" + B_PRIu64 "\n", pos, bitmapBlock); return B_BAD_DATA; } diff --git a/src/add-ons/kernel/file_systems/ext2/Journal.cpp b/src/add-ons/kernel/file_systems/ext2/Journal.cpp index ab65174a46..7efea26d13 100644 --- a/src/add-ons/kernel/file_systems/ext2/Journal.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Journal.cpp @@ -268,7 +268,7 @@ Journal::Lock(Transaction* owner, bool separateSubTransactions) /*virtual*/ status_t Journal::Unlock(Transaction* owner, bool success) { - TRACE("Journal::Unlock(): Lock recursion: %ld\n", + TRACE("Journal::Unlock(): Lock recursion: %" B_PRId32 "\n", recursive_lock_get_recursion(&fLock)); if (fSeparateSubTransactions || recursive_lock_get_recursion(&fLock) == 1) { @@ -317,8 +317,8 @@ Journal::MapBlock(off_t logical, fsblock_t& physical) inline uint32 Journal::FreeLogBlocks() const { - TRACE("Journal::FreeLogBlocks(): start: %lu, end: %lu, size: %lu\n", - fLogStart, fLogEnd, fLogSize); + TRACE("Journal::FreeLogBlocks(): start: %" B_PRIu32 ", end: %" B_PRIu32 + ", size: %" B_PRIu32 "\n", fLogStart, fLogEnd, fLogSize); return fLogStart <= fLogEnd ? fLogSize - fLogEnd + fLogStart - 1 : fLogStart - fLogEnd; @@ -381,7 +381,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, if (escapedData == NULL) { TRACE("Journal::_WritePartialTransactionToLog(): Allocating " - "space for escaped block (%lu)\n", fBlockSize); + "space for escaped block (%" B_PRIu32 ")\n", fBlockSize); escapedData = new(std::nothrow) uint8[fBlockSize]; if (escapedData == NULL) { TRACE("Journal::_WritePartialTransactionToLof(): Failed to " @@ -411,7 +411,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, off_t logOffset = physicalBlock * fBlockSize; TRACE("Journal::_WritePartialTransactionToLog(): Writing from memory: " - "%p, to disk: %llu\n", finalData, logOffset); + "%p, to disk: %" B_PRIdOFF "\n", finalData, logOffset); size_t written = write_pos(fJournalVolume->Device(), logOffset, finalData, fBlockSize); if (written != fBlockSize) { @@ -420,7 +420,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, } TRACE("Journal::_WritePartialTransactionToLog(): Wrote a journal block " - "at: %lu\n", logBlock); + "at: %" B_PRIu32 "\n", logBlock); blockCount++; tag++; @@ -442,8 +442,8 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, off_t descriptorBlockOffset = physicalBlock * fBlockSize; - TRACE("Journal::_WritePartialTransactionToLog(): Writing to: %lld\n", - descriptorBlockOffset); + TRACE("Journal::_WritePartialTransactionToLog(): Writing to: %" B_PRIdOFF + "\n", descriptorBlockOffset); size_t written = write_pos(fJournalVolume->Device(), descriptorBlockOffset, descriptorBlock, fBlockSize); if (written != fBlockSize) { @@ -467,14 +467,15 @@ Journal::_WriteTransactionToLog() TRACE("Journal::_WriteTransactionToLog(): Attempting to get transaction " "size\n"); size_t size = _FullTransactionSize(); - TRACE("Journal::_WriteTransactionToLog(): transaction size: %lu\n", size); + TRACE("Journal::_WriteTransactionToLog(): transaction size: %" B_PRIuSIZE + "\n", size); if (size > fMaxTransactionSize) { TRACE("Journal::_WriteTransactionToLog(): not enough free space " "for the transaction. Attempting to free some space.\n"); size = _MainTransactionSize(); - TRACE("Journal::_WriteTransactionToLog(): main transaction size: %lu\n", - size); + TRACE("Journal::_WriteTransactionToLog(): main transaction size: %" + B_PRIuSIZE "\n", size); if(fHasSubTransaction && size < fMaxTransactionSize) { TRACE("Journal::_WriteTransactionToLog(): transaction doesn't fit, " @@ -482,22 +483,23 @@ Journal::_WriteTransactionToLog() detached = true; } else { // Error: transaction can't fit in log - panic("transaction too large (size: %lu, max size: %lu, log size: " - "%lu)\n", size, fMaxTransactionSize, fLogSize); + panic("transaction too large (size: %" B_PRIuSIZE ", max size: %" + B_PRIu32 ", log size: %" B_PRIu32 ")\n", size, + fMaxTransactionSize, fLogSize); return B_BUFFER_OVERFLOW; } } - TRACE("Journal::_WriteTransactionToLog(): free log blocks: %lu\n", - FreeLogBlocks()); + TRACE("Journal::_WriteTransactionToLog(): free log blocks: %" B_PRIu32 + "\n", FreeLogBlocks()); if (size > FreeLogBlocks()) { TRACE("Journal::_WriteTransactionToLog(): Syncing block cache\n"); cache_sync_transaction(fFilesystemBlockCache, fTransactionID); if (size > FreeLogBlocks()) { panic("Transaction fits, but sync didn't result in enough" - "free space.\n\tGot %ld when at least %ld was expected.", - FreeLogBlocks(), size); + "free space.\n\tGot %" B_PRIu32 " when at least %" B_PRIuSIZE + " was expected.", FreeLogBlocks(), size); } } @@ -510,7 +512,7 @@ Journal::_WriteTransactionToLog() // Prepare Descriptor block TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for " - "the descriptor block, block size %lu\n", fBlockSize); + "the descriptor block, block size %" B_PRIu32 "\n", fBlockSize); JournalHeader* descriptorBlock = (JournalHeader*)new(std::nothrow) uint8[fBlockSize]; if (descriptorBlock == NULL) { @@ -524,7 +526,7 @@ Journal::_WriteTransactionToLog() // Prepare Commit block TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for " - "the commit block, block size %lu\n", fBlockSize); + "the commit block, block size %" B_PRIu32 "\n", fBlockSize); JournalHeader* commitBlock = (JournalHeader*)new(std::nothrow) uint8[fBlockSize]; if (descriptorBlock == NULL) { @@ -588,7 +590,7 @@ Journal::_WriteTransactionToLog() off_t logOffset = physicalBlock * fBlockSize; TRACE("Journal::_WriteTransactionToLog(): Writting commit block to " - "%lld\n", logOffset); + "%" B_PRIdOFF "\n", logOffset); off_t written = write_pos(fJournalVolume->Device(), logOffset, commitBlock, fBlockSize); if (written != fBlockSize) { @@ -610,7 +612,8 @@ Journal::_WriteTransactionToLog() off_t logOffset = physicalBlock * fBlockSize; - TRACE("Journal::_WriteTransactionToLog(): Writing to: %lld\n", logOffset); + TRACE("Journal::_WriteTransactionToLog(): Writing to: %" B_PRIdOFF "\n", + logOffset); off_t written = write_pos(fJournalVolume->Device(), logOffset, commitBlock, fBlockSize); if (written != fBlockSize) { @@ -644,8 +647,8 @@ Journal::_WriteTransactionToLog() if (status == B_OK && _FullTransactionSize() > fLogSize) { // If the transaction is too large after writing, there is no way to // recover, so let this transaction fail. - ERROR("transaction too large (%ld blocks, log size %ld)!\n", - _FullTransactionSize(), fLogSize); + ERROR("transaction too large (%" B_PRIuSIZE " blocks, log size %" + B_PRIu32 ")!\n", _FullTransactionSize(), fLogSize); return B_BUFFER_OVERFLOW; } } else { @@ -679,7 +682,8 @@ Journal::_SaveSuperBlock() superblock.SetFirstCommitID(fFirstCommitID); superblock.SetLogStart(fLogStart); - TRACE("Journal::SaveSuperBlock(): Write to %lld\n", superblockPos); + TRACE("Journal::SaveSuperBlock(): Write to %" B_PRIdOFF "\n", + superblockPos); size_t bytesWritten = write_pos(fJournalVolume->Device(), superblockPos, &superblock, sizeof(superblock)); @@ -702,8 +706,8 @@ Journal::_LoadSuperBlock() if (status != B_OK) return status; - TRACE("Journal::_LoadSuperBlock(): superblock physical block: %llu\n", - superblockPos); + TRACE("Journal::_LoadSuperBlock(): superblock physical block: %" B_PRIu64 + "\n", superblockPos); JournalSuperBlock superblock; size_t bytesRead = read_pos(fJournalVolume->Device(), superblockPos @@ -715,8 +719,8 @@ Journal::_LoadSuperBlock() } if (!superblock.header.CheckMagic()) { - ERROR("Journal::_LoadSuperBlock(): Invalid superblock magic %lX\n", - superblock.header.Magic()); + ERROR("Journal::_LoadSuperBlock(): Invalid superblock magic %" B_PRIx32 + "\n", superblock.header.Magic()); return B_BAD_VALUE; } @@ -757,9 +761,10 @@ Journal::_LoadSuperBlock() // TODO: Why is "superblock.MaxTransactionBlocks();" zero? //fFirstCacheCommitID = fFirstCommitID - fTransactionID /*+ 1*/; - TRACE("Journal::_LoadSuperBlock(): block size: %lu, first commit id: %lu, " - "first log block: %lu, log start: %lu, log size: %lu, max transaction " - "size: %lu\n", fBlockSize, fFirstCommitID, fFirstLogBlock, fLogStart, + TRACE("Journal::_LoadSuperBlock(): block size: %" B_PRIu32 ", first commit" + " id: %" B_PRIu32 ", first log block: %" B_PRIu32 ", log start: %" + B_PRIu32 ", log size: %" B_PRIu32 ", max transaction size: %" B_PRIu32 + "\n", fBlockSize, fFirstCommitID, fFirstLogBlock, fLogStart, fLogSize, fMaxTransactionSize); return B_OK; @@ -795,7 +800,8 @@ Journal::_CountTags(JournalHeader* descriptorBlock) tags += 2; // Skip new UUID } - TRACE("Journal::_CountTags(): Tag block: %lu\n", tags->BlockNumber()); + TRACE("Journal::_CountTags(): Tag block: %" B_PRIu32 "\n", + tags->BlockNumber()); tags++; // Go to next tag count++; @@ -804,7 +810,7 @@ Journal::_CountTags(JournalHeader* descriptorBlock) if ((tags->Flags() & JOURNAL_FLAG_LAST_TAG) != 0) count++; - TRACE("Journal::_CountTags(): counted tags: %lu\n", count); + TRACE("Journal::_CountTags(): counted tags: %" B_PRIu32 "\n", count); return count; } @@ -858,11 +864,11 @@ Journal::_RecoverPassScan(uint32& lastCommitID) uint32 tags = _CountTags(header); nextBlock += tags; TRACE("Journal recover pass scan: Found a descriptor block with " - "%lu tags\n", tags); + "%" B_PRIu32 " tags\n", tags); } else if (blockType == JOURNAL_COMMIT_BLOCK) { nextCommitID++; TRACE("Journal recover pass scan: Found a commit block. Next " - "commit ID: %lu\n", nextCommitID); + "commit ID: %" B_PRIu32 "\n", nextCommitID); } else if (blockType != JOURNAL_REVOKE_BLOCK) { TRACE("Journal recover pass scan: Reached an unrecognized block, " "assuming as log's end.\n"); @@ -881,8 +887,8 @@ Journal::_RecoverPassScan(uint32& lastCommitID) header = (JournalHeader*)cached.SetTo(nextBlockPos); } - TRACE("Journal Recovery pass scan: Last detected transaction ID: %lu\n", - nextCommitID); + TRACE("Journal Recovery pass scan: Last detected transaction ID: %" + B_PRIu32 "\n", nextCommitID); lastCommitID = nextCommitID; return B_OK; @@ -946,7 +952,7 @@ Journal::_RecoverPassRevoke(uint32 lastCommitID) return B_ERROR; } - TRACE("Journal recovery pass revoke: Revoked blocks: %lu\n", + TRACE("Journal recovery pass revoke: Revoked blocks: %" B_PRIu32 "\n", fRevokeManager->NumRevokes()); return B_OK; @@ -1016,8 +1022,8 @@ Journal::_RecoverPassReplay(uint32 lastCommitID) = B_HOST_TO_BENDIAN_INT32(JOURNAL_MAGIC); } - TRACE("Journal::_RevoverPassReplay(): Write to %lu\n", - tag->BlockNumber() * fBlockSize); + TRACE("Journal::_RevoverPassReplay(): Write to %" B_PRIu32 + "\n", tag->BlockNumber() * fBlockSize); size_t written = write_pos(fFilesystemVolume->Device(), tag->BlockNumber() * fBlockSize, data, fBlockSize); @@ -1070,7 +1076,7 @@ Journal::_FlushLog(bool canWait, bool flushBlocks) status_t status = canWait ? recursive_lock_lock(&fLock) : recursive_lock_trylock(&fLock); - TRACE("Journal::_FlushLog(): Acquired fLock, recursion: %ld\n", + TRACE("Journal::_FlushLog(): Acquired fLock, recursion: %" B_PRId32 "\n", recursive_lock_get_recursion(&fLock)); if (status != B_OK) return status; @@ -1131,7 +1137,7 @@ Journal::_WrapAroundLog(uint32 block) size_t Journal::_CurrentTransactionSize() const { - TRACE("Journal::_CurrentTransactionSize(): transaction %ld\n", + TRACE("Journal::_CurrentTransactionSize(): transaction %" B_PRIu32 "\n", fTransactionID); size_t count; @@ -1140,12 +1146,12 @@ Journal::_CurrentTransactionSize() const count = cache_blocks_in_sub_transaction(fFilesystemBlockCache, fTransactionID); - TRACE("\tSub transaction size: %ld\n", count); + TRACE("\tSub transaction size: %" B_PRIuSIZE "\n", count); } else { count = cache_blocks_in_transaction(fFilesystemBlockCache, fTransactionID); - TRACE("\tTransaction size: %ld\n", count); + TRACE("\tTransaction size: %" B_PRIuSIZE "\n", count); } return count; @@ -1155,13 +1161,14 @@ Journal::_CurrentTransactionSize() const size_t Journal::_FullTransactionSize() const { - TRACE("Journal::_FullTransactionSize(): transaction %ld\n", fTransactionID); + TRACE("Journal::_FullTransactionSize(): transaction %" B_PRIu32 "\n", + fTransactionID); TRACE("\tFile sytem block cache: %p\n", fFilesystemBlockCache); size_t count = cache_blocks_in_transaction(fFilesystemBlockCache, fTransactionID); - TRACE("\tFull transaction size: %ld\n", count); + TRACE("\tFull transaction size: %" B_PRIuSIZE "\n", count); return count; } @@ -1170,12 +1177,13 @@ Journal::_FullTransactionSize() const size_t Journal::_MainTransactionSize() const { - TRACE("Journal::_MainTransactionSize(): transaction %ld\n", fTransactionID); + TRACE("Journal::_MainTransactionSize(): transaction %" B_PRIu32 "\n", + fTransactionID); size_t count = cache_blocks_in_main_transaction(fFilesystemBlockCache, fTransactionID); - TRACE("\tMain transaction size: %ld\n", count); + TRACE("\tMain transaction size: %" B_PRIuSIZE "\n", count); return count; } @@ -1186,13 +1194,13 @@ Journal::_TransactionDone(bool success) { if (!success) { if (fHasSubTransaction) { - TRACE("Journal::_TransactionDone(): transaction %ld failed, " - "aborting subtransaction\n", fTransactionID); + TRACE("Journal::_TransactionDone(): transaction %" B_PRIu32 + " failed, aborting subtransaction\n", fTransactionID); cache_abort_sub_transaction(fFilesystemBlockCache, fTransactionID); // parent is unaffected } else { - TRACE("Journal::_TransactionDone(): transaction %ld failed," - " aborting\n", fTransactionID); + TRACE("Journal::_TransactionDone(): transaction %" B_PRIu32 + " failed, aborting\n", fTransactionID); cache_abort_transaction(fFilesystemBlockCache, fTransactionID); fUnwrittenTransactions = 0; } @@ -1203,12 +1211,12 @@ Journal::_TransactionDone(bool success) // If possible, delay flushing the transaction uint32 size = _FullTransactionSize(); - TRACE("Journal::_TransactionDone(): full transaction size: %lu, max " - "transaction size: %lu, free log blocks: %lu\n", size, - fMaxTransactionSize, FreeLogBlocks()); + TRACE("Journal::_TransactionDone(): full transaction size: %" B_PRIu32 + ", max transaction size: %" B_PRIu32 ", free log blocks: %" B_PRIu32 + "\n", size, fMaxTransactionSize, FreeLogBlocks()); if (fMaxTransactionSize > 0 && size < fMaxTransactionSize) { TRACE("Journal::_TransactionDone(): delaying flush of transaction " - "%ld\n", fTransactionID); + "%" B_PRIu32 "\n", fTransactionID); // Make sure the transaction fits in the log if (size < FreeLogBlocks()) @@ -1228,8 +1236,8 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry) { LogEntry* logEntry = (LogEntry*)_logEntry; - TRACE("Journal::_TransactionWritten(): Transaction %ld checkpointed\n", - transactionID); + TRACE("Journal::_TransactionWritten(): Transaction %" B_PRIu32 + " checkpointed\n", transactionID); Journal* journal = logEntry->GetJournal(); @@ -1243,12 +1251,12 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry) TRACE("Journal::_TransactionWritten(): first log entry: %p\n", journal->fLogEntries.First()); if (logEntry == journal->fLogEntries.First()) { - TRACE("Journal::_TransactionWritten(): Moving start of log to %lu\n", - logEntry->Start()); + TRACE("Journal::_TransactionWritten(): Moving start of log to %" + B_PRIu32 "\n", logEntry->Start()); journal->fLogStart = logEntry->Start(); journal->fFirstCommitID = logEntry->CommitID(); - TRACE("Journal::_TransactionWritten(): Setting commit ID to %lu\n", - logEntry->CommitID()); + TRACE("Journal::_TransactionWritten(): Setting commit ID to %" B_PRIu32 + "\n", logEntry->CommitID()); if (journal->_SaveSuperBlock() != B_OK) panic("ext2: Failed to write journal superblock\n"); diff --git a/src/add-ons/kernel/file_systems/ext2/NoJournal.cpp b/src/add-ons/kernel/file_systems/ext2/NoJournal.cpp index d6230376eb..3d01b1c1a7 100644 --- a/src/add-ons/kernel/file_systems/ext2/NoJournal.cpp +++ b/src/add-ons/kernel/file_systems/ext2/NoJournal.cpp @@ -84,8 +84,8 @@ NoJournal::Unlock(Transaction* owner, bool success) status_t NoJournal::_WriteTransactionToLog() { - TRACE("NoJournal::_WriteTransactionToLog(): Ending transaction %ld\n", - fTransactionID); + TRACE("NoJournal::_WriteTransactionToLog(): Ending transaction %" B_PRId32 + "\n", fTransactionID); fTransactionID = cache_end_transaction(fFilesystemBlockCache, fTransactionID, _TransactionWritten, NULL); @@ -97,5 +97,5 @@ NoJournal::_WriteTransactionToLog() /*static*/ void NoJournal::_TransactionWritten(int32 transactionID, int32 event, void* param) { - TRACE("Transaction %ld checkpointed\n", transactionID); + TRACE("Transaction %" B_PRId32" checkpointed\n", transactionID); } diff --git a/src/add-ons/kernel/file_systems/ext2/RevokeManager.cpp b/src/add-ons/kernel/file_systems/ext2/RevokeManager.cpp index 1e15f652bf..e8ed581dc7 100644 --- a/src/add-ons/kernel/file_systems/ext2/RevokeManager.cpp +++ b/src/add-ons/kernel/file_systems/ext2/RevokeManager.cpp @@ -31,14 +31,16 @@ RevokeManager::~RevokeManager() status_t -RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock, uint32 commitID) +RevokeManager::ScanRevokeBlock(JournalRevokeHeader* revokeBlock, + uint32 commitID) { - TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %lu\n", commitID); + TRACE("RevokeManager::ScanRevokeBlock(): Commit ID: %" B_PRIu32 "\n", + commitID); int count = revokeBlock->NumBytes() / 4; for (int i = 0; i < count; ++i) { - TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %lu\n", - revokeBlock->RevokeBlock(i)); + TRACE("RevokeManager::ScanRevokeBlock(): Found a revoked block: %" + B_PRIu32 "\n", revokeBlock->RevokeBlock(i)); status_t status = Insert(revokeBlock->RevokeBlock(i), commitID); if (status != B_OK) { diff --git a/src/add-ons/kernel/file_systems/ext2/Transaction.cpp b/src/add-ons/kernel/file_systems/ext2/Transaction.cpp index 834da245aa..e69a6aec9c 100644 --- a/src/add-ons/kernel/file_systems/ext2/Transaction.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Transaction.cpp @@ -187,11 +187,11 @@ Transaction::NotifyListeners(bool success) TRACE("Transaction::NotifyListeners(): fListeners.First(): %p\n", fListeners.First()); if (success) { - TRACE("Transaction::NotifyListeners(true): Number of listeners: %ld\n", - fListeners.Count()); + TRACE("Transaction::NotifyListeners(true): Number of listeners: %" + B_PRId32 "\n", fListeners.Count()); } else { - TRACE("Transaction::NotifyListeners(false): Number of listeners: %ld\n", - fListeners.Count()); + TRACE("Transaction::NotifyListeners(false): Number of listeners: %" + B_PRId32 "\n", fListeners.Count()); } TRACE("Transaction::NotifyListeners(): Finished counting\n"); diff --git a/src/add-ons/kernel/file_systems/ext2/Volume.cpp b/src/add-ons/kernel/file_systems/ext2/Volume.cpp index b833eee746..629cec7dc6 100644 --- a/src/add-ons/kernel/file_systems/ext2/Volume.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Volume.cpp @@ -296,7 +296,8 @@ Volume::Mount(const char* deviceName, uint32 flags) if (opener.IsReadOnly()) fFlags |= VOLUME_READ_ONLY; - TRACE("features %lx, incompatible features %lx, read-only features %lx\n", + TRACE("features %" B_PRIx32 ", incompatible features %" B_PRIx32 + ", read-only features %" B_PRIx32 "\n", fSuperBlock.CompatibleFeatures(), fSuperBlock.IncompatibleFeatures(), fSuperBlock.ReadOnlyFeatures()); @@ -336,8 +337,9 @@ Volume::Mount(const char* deviceName, uint32 flags) fGroupsPerBlock = fBlockSize / fGroupDescriptorSize; fNumInodes = fSuperBlock.NumInodes(); - TRACE("block size %ld, num groups %ld, groups per block %ld, first %lu\n", - fBlockSize, fNumGroups, fGroupsPerBlock, fFirstDataBlock); + TRACE("block size %" B_PRIu32 ", num groups %" B_PRIu32 ", groups per " + "block %" B_PRIu32 ", first %" B_PRIu32 "\n", fBlockSize, fNumGroups, + fGroupsPerBlock, fFirstDataBlock); uint32 blockCount = (fNumGroups + fGroupsPerBlock - 1) / fGroupsPerBlock; @@ -523,8 +525,8 @@ Volume::_UnsupportedIncompatibleFeatures(ext2_super_block& superBlock) & ~supportedIncompatible; if (unsupported != 0) { - FATAL("ext2: incompatible features not supported: %lx (extents %x)\n", - unsupported, EXT2_INCOMPATIBLE_FEATURE_EXTENTS); + FATAL("ext2: incompatible features not supported: %" B_PRIx32 + " (extents %x)\n", unsupported, EXT2_INCOMPATIBLE_FEATURE_EXTENTS); } return unsupported; @@ -545,8 +547,10 @@ Volume::_UnsupportedReadOnlyFeatures(ext2_super_block& superBlock) uint32 unsupported = superBlock.ReadOnlyFeatures() & ~supportedReadOnly; - if (unsupported != 0) - FATAL("ext2: readonly features not supported: %lx\n", unsupported); + if (unsupported != 0) { + FATAL("ext2: readonly features not supported: %" B_PRIx32 "\n", + unsupported); + } return unsupported; } @@ -611,8 +615,8 @@ Volume::GetBlockGroup(int32 index, ext2_block_group** _group) memcpy(fGroupBlocks[blockIndex], block, fBlockSize); - TRACE("group [%ld]: inode table %lld\n", index, ((ext2_block_group*) - (fGroupBlocks[blockIndex] + blockOffset + TRACE("group [%" B_PRId32 "]: inode table %" B_PRIu64 "\n", index, + ((ext2_block_group*)(fGroupBlocks[blockIndex] + blockOffset * fGroupDescriptorSize))->InodeTable(Has64bitFeature())); } @@ -646,9 +650,9 @@ Volume::WriteBlockGroup(Transaction& transaction, int32 index) + blockOffset * fGroupDescriptorSize); group->checksum = _GroupCheckSum(group, index); - TRACE("Volume::WriteBlockGroup() checksum 0x%x for group %ld " - "(free inodes %ld, unused %ld)\n", group->checksum, index, - group->FreeInodes(Has64bitFeature()), + TRACE("Volume::WriteBlockGroup() checksum 0x%x for group %" B_PRId32 " " + "(free inodes %" B_PRIu32 ", unused %" B_PRIu32 ")\n", group->checksum, + index, group->FreeInodes(Has64bitFeature()), group->UnusedInodes(Has64bitFeature())); CachedBlock cached(this); @@ -822,7 +826,8 @@ Volume::AllocateBlocks(Transaction& transaction, uint32 minimum, uint32 maximum, if (status != B_OK) return status; - TRACE("Volume::AllocateBlocks(): Allocated %lu blocks\n", length); + TRACE("Volume::AllocateBlocks(): Allocated %" B_PRIu32 " blocks\n", + length); fFreeBlocks -= length; @@ -833,7 +838,7 @@ Volume::AllocateBlocks(Transaction& transaction, uint32 minimum, uint32 maximum, status_t Volume::FreeBlocks(Transaction& transaction, fsblock_t start, uint32 length) { - TRACE("Volume::FreeBlocks(%llu, %lu)\n", start, length); + TRACE("Volume::FreeBlocks(%" B_PRIu64 ", %" B_PRIu32 ")\n", start, length); if (IsReadOnly()) return B_READ_ONLY_DEVICE; @@ -841,11 +846,11 @@ Volume::FreeBlocks(Transaction& transaction, fsblock_t start, uint32 length) if (status != B_OK) return status; - TRACE("Volume::FreeBlocks(): number of free blocks (before): %llu\n", - fFreeBlocks); + TRACE("Volume::FreeBlocks(): number of free blocks (before): %" B_PRIdOFF + "\n", fFreeBlocks); fFreeBlocks += length; - TRACE("Volume::FreeBlocks(): number of free blocks (after): %llu\n", - fFreeBlocks); + TRACE("Volume::FreeBlocks(): number of free blocks (after): %" B_PRIdOFF + "\n", fFreeBlocks); return WriteSuperBlock(transaction); } @@ -880,8 +885,9 @@ Volume::WriteSuperBlock(Transaction& transaction) fSuperBlock.SetFreeInodes(fFreeInodes); // TODO: Rest of fields that can be modified - TRACE("Volume::WriteSuperBlock(): free blocks: %llu, free inodes: %lu\n", - fSuperBlock.FreeBlocks(Has64bitFeature()), fSuperBlock.FreeInodes()); + TRACE("Volume::WriteSuperBlock(): free blocks: %" B_PRIu64 ", free inodes:" + " %" B_PRIu32 "\n", fSuperBlock.FreeBlocks(Has64bitFeature()), + fSuperBlock.FreeInodes()); CachedBlock cached(this); uint8* block = cached.SetToWritable(transaction, fFirstDataBlock); @@ -889,8 +895,8 @@ Volume::WriteSuperBlock(Transaction& transaction) if (block == NULL) return B_IO_ERROR; - TRACE("Volume::WriteSuperBlock(): first data block: %lu, block: %p, " - "superblock: %p\n", fFirstDataBlock, block, &fSuperBlock); + TRACE("Volume::WriteSuperBlock(): first data block: %" B_PRIu32 ", block:" + " %p, superblock: %p\n", fFirstDataBlock, block, &fSuperBlock); if (fFirstDataBlock == 0) memcpy(block + 1024, &fSuperBlock, sizeof(fSuperBlock)); diff --git a/src/add-ons/kernel/file_systems/ext2/ext2.h b/src/add-ons/kernel/file_systems/ext2/ext2.h index 25a8468e1a..b966e7c72d 100644 --- a/src/add-ons/kernel/file_systems/ext2/ext2.h +++ b/src/add-ons/kernel/file_systems/ext2/ext2.h @@ -13,9 +13,6 @@ #include -//#define TRACE_EXT2 - - typedef uint64 fileblock_t; // file block number typedef uint64 fsblock_t; // filesystem block number diff --git a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp index 9842fd23cb..daea2ec47f 100644 --- a/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp @@ -217,7 +217,7 @@ ext2_get_vnode(fs_volume* _volume, ino_t id, fs_vnode* _node, int* _type, Volume* volume = (Volume*)_volume->private_volume; if (id < 2 || id > volume->NumInodes()) { - ERROR("invalid inode id %lld requested!\n", id); + ERROR("invalid inode id %" B_PRIdINO " requested!\n", id); return B_BAD_VALUE; } @@ -319,7 +319,7 @@ ext2_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie, while (true) { file_io_vec fileVecs[8]; - uint32 fileVecCount = 8; + size_t fileVecCount = 8; status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs, &fileVecCount, 0); @@ -436,8 +436,8 @@ ext2_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, return status; if (block > volume->NumBlocks()) { - panic("ext2_get_file_map() found block %lld for offset %lld\n", - block, offset); + panic("ext2_get_file_map() found block %" B_PRIu64 " for offset %" + B_PRIdOFF "\n", block, offset); } off_t blockOffset = block << volume->BlockShift(); @@ -467,10 +467,10 @@ ext2_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset, offset += blockLength; size -= blockLength; - if (size <= vecs[index - 1].length || offset >= inode->Size()) { + if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) { // We're done! *_count = index; - TRACE("ext2_get_file_map for inode %lld\n", inode->ID()); + TRACE("ext2_get_file_map for inode %" B_PRIdINO "\n", inode->ID()); return B_OK; } } @@ -518,7 +518,7 @@ static status_t ext2_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, void* buffer, size_t bufferLength) { - TRACE("ioctl: %lu\n", cmd); + TRACE("ioctl: %" B_PRIu32 "\n", cmd); Volume* volume = (Volume*)_volume->private_volume; switch (cmd) { @@ -537,14 +537,15 @@ ext2_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd, uint32 group = 0; uint32 length; - TRACE("ioctl: blocks per group: %lu, block size: %lu, " - "first block: %lu, start: %llu, group: %lu\n", blocksPerGroup, + TRACE("ioctl: blocks per group: %" B_PRIu32 ", block size: %" + B_PRIu32 ", first block: %" B_PRIu32 ", start: %" B_PRIu64 + ", group: %" B_PRIu32 "\n", blocksPerGroup, blockSize, firstBlock, start, group); while (volume->AllocateBlocks(transaction, 1, 2048, group, start, length) == B_OK) { - TRACE("ioctl: Allocated blocks in group %lu: %llu-%llu\n", group, - start, start + length); + TRACE("ioctl: Allocated blocks in group %" B_PRIu32 ": %" + B_PRIu64 "-%" B_PRIu64 "\n", group, start, start + length); off_t blockNum = start + group * blocksPerGroup - firstBlock; for (uint32 i = 0; i < length; ++i) { @@ -1072,8 +1073,8 @@ ext2_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName, status = inodeIterator.FindEntry(".."); if (status == B_ENTRY_NOT_FOUND) { - TRACE("Corrupt file sytem. Missing \"..\" in directory %ld\n", - (int32)inode->ID()); + TRACE("Corrupt file system. Missing \"..\" in directory %" + B_PRIdINO "\n", inode->ID()); return B_BAD_DATA; } else if (status != B_OK) return status; @@ -1266,7 +1267,7 @@ ext2_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer, if (!inode->IsSymLink()) return B_BAD_VALUE; - if (inode->Size() < *_bufferSize) + if (inode->Size() < (off_t)*_bufferSize) *_bufferSize = inode->Size(); if (inode->Size() > EXT2_SHORT_SYMLINK_LENGTH) @@ -1414,27 +1415,44 @@ ext2_read_dir(fs_volume *_volume, fs_vnode *_node, void *_cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { DirectoryIterator *iterator = (DirectoryIterator *)_cookie; - - size_t length = bufferSize; - ino_t id; - status_t status = iterator->GetNext(dirent->d_name, &length, &id); - if (status == B_ENTRY_NOT_FOUND) { - *_num = 0; - return B_OK; - } else if (status != B_OK) - return status; - - status = iterator->Next(); - if (status != B_OK && status != B_ENTRY_NOT_FOUND) - return status; - Volume* volume = (Volume*)_volume->private_volume; - dirent->d_dev = volume->ID(); - dirent->d_ino = id; - dirent->d_reclen = sizeof(struct dirent) + length; + uint32 maxCount = *_num; + uint32 count = 0; - *_num = 1; + while (count < maxCount && bufferSize > sizeof(struct dirent)) { + + size_t length = bufferSize - sizeof(struct dirent) + 1; + ino_t id; + + status_t status = iterator->GetNext(dirent->d_name, &length, &id); + if (status == B_ENTRY_NOT_FOUND) + break; + + if (status == B_BUFFER_OVERFLOW) { + // the remaining name buffer length was too small + if (count == 0) + return B_BUFFER_OVERFLOW; + break; + } + + if (status != B_OK) + return status; + + status = iterator->Next(); + if (status != B_OK && status != B_ENTRY_NOT_FOUND) + return status; + + dirent->d_dev = volume->ID(); + dirent->d_ino = id; + dirent->d_reclen = sizeof(struct dirent) + length; + + bufferSize -= dirent->d_reclen; + dirent = (struct dirent*)((uint8*)dirent + dirent->d_reclen); + count++; + } + + *_num = count; return B_OK; } diff --git a/src/add-ons/kernel/file_systems/fat/file.c b/src/add-ons/kernel/file_systems/fat/file.c index f06102115a..d9239a3b59 100644 --- a/src/add-ons/kernel/file_systems/fat/file.c +++ b/src/add-ons/kernel/file_systems/fat/file.c @@ -180,7 +180,10 @@ dosfs_rstat(fs_volume *_vol, fs_vnode *_node, struct stat *st) st->st_size = node->st_size; st->st_blocks = (node->st_size + 511) / 512; st->st_blksize = 0x10000; /* this value was chosen arbitrarily */ - st->st_atime = st->st_mtime = st->st_ctime = st->st_crtime = node->st_time; + st->st_atim.tv_sec = st->st_mtim.tv_sec = st->st_ctim.tv_sec + = st->st_crtim.tv_sec = node->st_time; + st->st_atim.tv_nsec = st->st_mtim.tv_nsec = st->st_ctim.tv_nsec + = st->st_crtim.tv_nsec = 0; UNLOCK_VOL(vol); diff --git a/src/add-ons/kernel/file_systems/fat/util.c b/src/add-ons/kernel/file_systems/fat/util.c index d5114f7731..7bab5e3a20 100644 --- a/src/add-ons/kernel/file_systems/fat/util.c +++ b/src/add-ons/kernel/file_systems/fat/util.c @@ -106,7 +106,7 @@ dos2time_t(uint32 t) days = daze[(t>>21)&15] + ((t>>25)+10)*365 + leaps((t>>25)+10,((t>>21)&15)-1)+((t>>16)&31)-1; - return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) + tzoffset) * 60 + 2*(t&31); + return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) - tzoffset) * 60 + 2*(t&31); } @@ -118,7 +118,7 @@ time_t2dos(time_t s) get_tzoffset(); - t = (s % 60) / 2; s /= 60; s -= tzoffset; + t = (s % 60) / 2; s /= 60; s += tzoffset; t += (s % 60) << 5; s /= 60; t += (s % 24) << 11;s /= 24; diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp index c66ae29058..bbe2685e19 100644 --- a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp @@ -975,7 +975,7 @@ ConvertRecDate(ISORecDate* inDate, time_t* outDate) time_t time; int days, i, year, tz; - year = inDate->year -70; + year = inDate->year - 70; tz = inDate->offsetGMT; if (year < 0) { @@ -1002,7 +1002,7 @@ ConvertRecDate(ISORecDate* inDate, time_t* outDate) tz |= (-1 << 8); if (-48 <= tz && tz <= 52) - time += tz *15 * 60; + time -= tz * 15 * 60; } *outDate = time; return 0; diff --git a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp index 4ed83b5f90..fc3405cb43 100644 --- a/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp @@ -492,8 +492,10 @@ fs_read_stat(fs_volume* _volume, fs_vnode* _node, struct stat* st) // Same for file/dir in ISO9660 st->st_size = node->dataLen[FS_DATA_FORMAT]; st->st_blocks = (st->st_size + 511) / 512; - if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR) - st->st_ctime = st->st_mtime = st->st_atime = time; + if (ConvertRecDate(&(node->recordDate), &time) == B_NO_ERROR) { + st->st_ctim.tv_sec = st->st_mtim.tv_sec = st->st_atim.tv_sec = time; + st->st_ctim.tv_nsec = st->st_mtim.tv_nsec = st->st_atim.tv_nsec = 0; + } TRACE(("fs_read_stat - EXIT, result is %s\n", strerror(result))); diff --git a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp index 5e451aae73..201c5583ae 100644 --- a/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp @@ -1049,7 +1049,7 @@ AttributeEntry::FillDirent(struct dirent *dirent, size_t bufferSize, status_t AttributeEntry::Read(off_t position, void *buffer, size_t *length) { - *length = min_c(*length, fEntry->size - position); + *length = (size_t)min_c((off_t)*length, fEntry->size - position); memcpy(buffer, fData + position, *length); return B_OK; } diff --git a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp index cdd0916c0a..5081db194d 100644 --- a/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp +++ b/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp @@ -687,7 +687,7 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length, uint8 *pointer = (uint8 *)buffer; write_buffer *element = fWriteBuffers; - size_t bytesLeft = MIN(fStat.st_size - position, *length); + size_t bytesLeft = (size_t)MIN(fStat.st_size - position, (off_t)*length); *length = bytesLeft; void *superCookie = _cookie; @@ -697,14 +697,15 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length, while (bytesLeft > 0) { size_t gapSize = bytesLeft; if (element != NULL) { - gapSize = MIN(bytesLeft, element->position > position ? + gapSize = (size_t)MIN((off_t)bytesLeft, element->position > position ? element->position - position : 0); } if (gapSize > 0 && !fIsVirtual && position < fOriginalNodeLength) { // there's a part missing between the read position and our // next position, fill the gap with original file content - size_t readLength = MIN(fOriginalNodeLength - position, gapSize); + size_t readLength = (size_t)MIN(fOriginalNodeLength - position, + (off_t)gapSize); status_t result = B_ERROR; if (readPages) { iovec vector; @@ -767,7 +768,8 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length, off_t elementEnd = element->position + element->length; if (elementEnd > position) { - size_t copyLength = MIN(elementEnd - position, bytesLeft); + size_t copyLength = (size_t)MIN(elementEnd - position, + (off_t)bytesLeft); const void *source = element->buffer + (position - element->position); diff --git a/src/add-ons/kernel/file_systems/netfs/client/ShareAttrDir.cpp b/src/add-ons/kernel/file_systems/netfs/client/ShareAttrDir.cpp index a92a01facc..febc358ea5 100644 --- a/src/add-ons/kernel/file_systems/netfs/client/ShareAttrDir.cpp +++ b/src/add-ons/kernel/file_systems/netfs/client/ShareAttrDir.cpp @@ -395,7 +395,7 @@ ShareAttrDir::GetAttribute(const char* name) const return attribute; } - return false; + return NULL; } // GetFirstAttribute diff --git a/src/add-ons/kernel/file_systems/netfs/server/AttributeDirectory.cpp b/src/add-ons/kernel/file_systems/netfs/server/AttributeDirectory.cpp index 07b549dda0..8023ed2f2b 100644 --- a/src/add-ons/kernel/file_systems/netfs/server/AttributeDirectory.cpp +++ b/src/add-ons/kernel/file_systems/netfs/server/AttributeDirectory.cpp @@ -329,7 +329,7 @@ AttributeDirectory::GetAttribute(const char* name) const return attribute; } - return false; + return NULL; } // GetFirstAttribute diff --git a/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c b/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c index 1341e37381..eab631ca2d 100644 --- a/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c +++ b/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c @@ -229,7 +229,8 @@ postoffice_func(fs_nspace *ns) while (release_sem (call->sem) == B_INTERRUPTED); } else { - dprintf("nfs: postoffice: can't find pending call to remove for xid %ld\n", xid); + dprintf("nfs: postoffice: can't find pending call to remove " + "for xid %" B_PRId32 "\n", xid); } } } @@ -324,7 +325,7 @@ send_rpc_call(fs_nspace *ns, const struct sockaddr_in *addr, int32 prog, call = RPCPendingCallsFindAndRemovePendingCall(&ns->pendingCalls, xid, addr); - dprintf("nfs: xid %ld timed out, removing from queue", xid); + dprintf("nfs: xid %" B_PRId32 " timed out, removing from queue", xid); #if 0 if (call==NULL) @@ -375,14 +376,15 @@ is_successful_reply(struct XDRInPacket *reply) rpc_reject_stat rejectStat = (rpc_reject_stat)XDRInPacketGetInt32(reply); if (rejectStat == RPC_RPC_MISMATCH) { - int32 low=XDRInPacketGetInt32(reply); - int32 high=XDRInPacketGetInt32(reply); + int32 low = XDRInPacketGetInt32(reply); + int32 high = XDRInPacketGetInt32(reply); - dprintf ("nfs: RPC_MISMATCH (%ld,%ld)", low, high); + dprintf("nfs: RPC_MISMATCH (%" B_PRId32 ",%" B_PRId32 ")", low, + high); } else { rpc_auth_stat authStat = (rpc_auth_stat)XDRInPacketGetInt32(reply); - dprintf ("nfs: RPC_AUTH_ERROR (%d)", authStat); + dprintf("nfs: RPC_AUTH_ERROR (%d)", authStat); } } else { rpc_auth_flavor flavor = (rpc_auth_flavor)XDRInPacketGetInt32(reply); @@ -397,9 +399,10 @@ is_successful_reply(struct XDRInPacket *reply) int32 low = XDRInPacketGetInt32(reply); int32 high = XDRInPacketGetInt32(reply); - dprintf ("nfs: RPC_PROG_MISMATCH (%ld,%ld)", low, high); + dprintf("nfs: RPC_PROG_MISMATCH (%" B_PRId32 ",%" B_PRId32 ")", + low, high); } else if (acceptStat != RPC_SUCCESS) - dprintf ("nfs: Accepted but failed (%d)", acceptStat); + dprintf("nfs: Accepted but failed (%d)", acceptStat); else success = true; } @@ -1217,7 +1220,8 @@ fs_mount(fs_volume *_vol, const char *devname, uint32 flags, const char *_parms, if (_parms == NULL) return EINVAL; - dprintf("nfs: mount(%ld, %s, %08lx)\n", _vol->id, devname, flags); + dprintf("nfs: mount(%" B_PRId32 ", %s, %08" B_PRIx32 ")\n", _vol->id, + devname, flags); dprintf("nfs: nfs_params: %s\n", _parms); // HAIKU: this should go to std_ops @@ -1244,18 +1248,18 @@ fs_mount(fs_volume *_vol, const char *devname, uint32 flags, const char *_parms, memset(ns->mountAddr.sin_zero, 0, sizeof(ns->mountAddr.sin_zero)); if ((result = create_socket(ns)) < B_OK) { - dprintf( "nfs: could not create socket (%d)\n", (int)result ); + dprintf("nfs: could not create socket (%" B_PRId32 ")\n", result); goto err_socket; } if ((result = init_postoffice(ns)) < B_OK) { - dprintf( "nfs: could not init_postoffice() (%d)\n", (int)result ); + dprintf("nfs: could not init_postoffice() (%" B_PRId32 ")\n", result); goto err_postoffice; } if ((result = get_remote_address(ns, MOUNT_PROGRAM, MOUNT_VERSION, PMAP_IPPROTO_UDP, &ns->mountAddr)) < B_OK) { - dprintf( "could not get_remote_address() (%d)\n", (int)result ); + dprintf("could not get_remote_address() (%" B_PRId32 ")\n", result); goto err_sem; } diff --git a/src/add-ons/kernel/file_systems/nfs4/InodeRegular.cpp b/src/add-ons/kernel/file_systems/nfs4/InodeRegular.cpp index a343f7c60d..d591fddda2 100644 --- a/src/add-ons/kernel/file_systems/nfs4/InodeRegular.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/InodeRegular.cpp @@ -419,7 +419,7 @@ Inode::Write(OpenFileCookie* cookie, off_t pos, const void* _buffer, if ((cookie->fMode & O_APPEND) != 0) pos = fMaxFileSize; - uint64 fileSize = max_c((off_t)fMaxFileSize, pos + *_length); + uint64 fileSize = pos + *_length; if (fileSize > fMaxFileSize) { status_t result = file_cache_set_size(fFileCache, fileSize); if (result != B_OK) diff --git a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp index 570f6da44b..643fb4659b 100644 --- a/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/MetadataCache.cpp @@ -75,7 +75,7 @@ void MetadataCache::GrowFile(size_t newSize) { MutexLocker _(fLock); - fStatCache.st_size = max_c(newSize, fStatCache.st_size); + fStatCache.st_size = max_c((off_t)newSize, fStatCache.st_size); } diff --git a/src/add-ons/kernel/file_systems/udf/AllocationDescriptorList.h b/src/add-ons/kernel/file_systems/udf/AllocationDescriptorList.h index 3c3c8ff163..5a6b1d9d98 100644 --- a/src/add-ons/kernel/file_systems/udf/AllocationDescriptorList.h +++ b/src/add-ons/kernel/file_systems/udf/AllocationDescriptorList.h @@ -101,7 +101,7 @@ status_t AllocationDescriptorList::FindExtent(off_t start, long_address *extent, bool *isEmpty) { - TRACE(("AllocationDescriptorList<>::FindExtent: start: %Ld, " + TRACE(("AllocationDescriptorList<>::FindExtent: start: %" B_PRIdOFF ", " "extent: %p, isEmpty: %p\n", start, extent, isEmpty)); off_t startBlock = start >> fVolume->BlockShift(); @@ -132,7 +132,8 @@ AllocationDescriptorList::FindExtent(off_t start, } } else { TRACE_ERROR(("AllocationDescriptorList<>::FindExtent: " - "Descriptor #%ld found NULL\n", _DescriptorNumber())); + "Descriptor #%" B_PRId32 " found NULL\n", + _DescriptorNumber())); status = B_ERROR; break; } diff --git a/src/add-ons/kernel/file_systems/udf/Icb.cpp b/src/add-ons/kernel/file_systems/udf/Icb.cpp index 61a91357af..c924966e54 100644 --- a/src/add-ons/kernel/file_systems/udf/Icb.cpp +++ b/src/add-ons/kernel/file_systems/udf/Icb.cpp @@ -22,9 +22,9 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id) if (!id || !name || !length) return B_BAD_VALUE; - TRACE(("DirectoryIterator::GetNextEntry: name = %p, length = %ld, " - "id = %p, position = %Ld, parent length = %Ld\n", name, *length, id, - fPosition, Parent()->Length())); + TRACE(("DirectoryIterator::GetNextEntry: name = %p, length = %" B_PRIu32 + ", id = %p, position = %" B_PRIdOFF ", parent length = %" B_PRIu64 + "\n", name, *length, id, fPosition, Parent()->Length())); status_t status = B_OK; if (fAtBeginning) { @@ -62,7 +62,8 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, ino_t *id) } else { UdfString string(entry->id(), entry->id_length()); TRACE(("DirectoryIterator::GetNextEntry: UfdString id == `%s', " - "length = %lu\n", string.Utf8(), string.Utf8Length())); + "length = %" B_PRIu32 "\n", string.Utf8(), + string.Utf8Length())); DUMP(entry->icb()); sprintf(name, "%s", string.Utf8()); *length = string.Utf8Length(); @@ -111,9 +112,9 @@ Icb::Icb(Volume *volume, long_address address) fFileCache(NULL), fFileMap(NULL) { - TRACE(("Icb::Icb: volume = %p, address(block = %ld, partition = %d, " - "length = %ld)\n", volume, address.block(), address.partition(), - address.length())); + TRACE(("Icb::Icb: volume = %p, address(block = %" B_PRIu32 ", partition = " + "%d, length = %" B_PRIu32 ")\n", volume, address.block(), + address.partition(), address.length())); if (volume == NULL) fInitStatus = B_BAD_VALUE; @@ -142,7 +143,8 @@ Icb::Icb(Volume *volume, long_address address) } fInitStatus = status; - TRACE(("Icb::Icb: status = 0x%lx, `%s'\n", status, strerror(status))); + TRACE(("Icb::Icb: status = 0x%" B_PRIx32 ", `%s'\n", status, + strerror(status))); } @@ -222,7 +224,7 @@ Icb::FindBlock(uint32 logicalBlock, off_t &block, bool &recorded) return B_ERROR; } - DEBUG_INIT_ETC("Icb", ("pos: %lld", pos)); + DEBUG_INIT_ETC("Icb", ("pos: %" B_PRIdOFF, pos)); status_t status = B_OK; long_address extent; @@ -237,8 +239,9 @@ Icb::FindBlock(uint32 logicalBlock, off_t &block, bool &recorded) ShortDescriptorAccessor(fPartition)); status = list.FindExtent(pos, &extent, &isEmpty); if (status != B_OK) { - TRACE_ERROR(("Icb::FindBlock: error finding extent for offset %Ld. " - "status = 0x%lx `%s'\n", pos, status, strerror(status))); + TRACE_ERROR(("Icb::FindBlock: error finding extent for offset " + "%" B_PRIdOFF ". status = 0x%" B_PRIx32 " `%s'\n", pos, status, + strerror(status))); } break; } @@ -249,8 +252,9 @@ Icb::FindBlock(uint32 logicalBlock, off_t &block, bool &recorded) AllocationDescriptorList list(this); status = list.FindExtent(pos, &extent, &isEmpty); if (status != B_OK) { - TRACE_ERROR(("Icb::FindBlock: error finding extent for offset %Ld. " - "status = 0x%lx `%s'\n", pos, status, strerror(status))); + TRACE_ERROR(("Icb::FindBlock: error finding extent for offset " + "%" B_PRIdOFF ". status = 0x%" B_PRIx32 " `%s'\n", pos, + status, strerror(status))); } break; } @@ -281,7 +285,7 @@ Icb::FindBlock(uint32 logicalBlock, off_t &block, bool &recorded) if (status == B_OK) { block = extent.block(); recorded = extent.type() == EXTENT_TYPE_RECORDED; - TRACE(("Icb::FindBlock: block %lld\n", block)); + TRACE(("Icb::FindBlock: block %" B_PRIdOFF "\n", block)); } return status; } @@ -290,7 +294,7 @@ Icb::FindBlock(uint32 logicalBlock, off_t &block, bool &recorded) status_t Icb::Read(off_t pos, void *buffer, size_t *length, uint32 *block) { - TRACE(("Icb::Read: pos = %Ld, buffer = %p, length = (%p)->%ld\n", + TRACE(("Icb::Read: pos = %" B_PRIdOFF ", buffer = %p, length = (%p)->%ld\n", pos, buffer, length, (length ? *length : 0))); if (!buffer || !length || pos < 0) @@ -356,8 +360,8 @@ template status_t Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint32 *block) { - TRACE(("Icb::_Read(): list = %p, pos = %Ld, buffer = %p, length = %ld\n", - &list, pos, _buffer, (length ? *length : 0))); + TRACE(("Icb::_Read(): list = %p, pos = %" B_PRIdOFF ", buffer = %p, " + "length = %ld\n", &list, pos, _buffer, (length ? *length : 0))); uint64 bytesLeftInFile = uint64(pos) > Length() ? 0 : Length() - pos; size_t bytesLeft = (*length >= bytesLeftInFile) ? bytesLeftInFile : *length; @@ -370,19 +374,22 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3 while (bytesLeft > 0) { - TRACE(("Icb::_Read(): pos: %Ld, bytesLeft: %ld\n", pos, bytesLeft)); + TRACE(("Icb::_Read(): pos: %" B_PRIdOFF ", bytesLeft: %ld\n", pos, + bytesLeft)); long_address extent; bool isEmpty = false; status = list.FindExtent(pos, &extent, &isEmpty); if (status != B_OK) { - TRACE_ERROR(("Icb::_Read: error finding extent for offset %Ld. " - "status = 0x%lx `%s'\n", pos, status, strerror(status))); + TRACE_ERROR(("Icb::_Read: error finding extent for offset %" + B_PRIdOFF ". status = 0x%" B_PRIx32 " `%s'\n", pos, status, + strerror(status))); break; } - TRACE(("Icb::_Read(): found extent for offset %Ld: (block: %ld, " - "partition: %d, length: %ld, type: %d)\n", pos, extent.block(), - extent.partition(), extent.length(), extent.type())); + TRACE(("Icb::_Read(): found extent for offset %" B_PRIdOFF ": (block: " + "%" B_PRIu32 ", partition: %d, length: %" B_PRIu32 ", type: %d)\n", + pos, extent.block(), extent.partition(), extent.length(), + extent.type())); switch (extent.type()) { case EXTENT_TYPE_RECORDED: @@ -421,8 +428,8 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3 if (extent.length() < readLength) readLength = extent.length(); - TRACE(("Icb::_Read: reading block. offset = %Ld, length: %ld\n", - blockOffset, readLength)); + TRACE(("Icb::_Read: reading block. offset = %" B_PRIdOFF + ", length: %ld\n", blockOffset, readLength)); if (isEmpty) { TRACE(("Icb::_Read: reading %ld empty bytes as zeros\n", @@ -436,8 +443,8 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3 break; } - TRACE(("Icb::_Read: %ld bytes from disk block %Ld using " - "block_cache_get_etc()\n", readLength, diskBlock)); + TRACE(("Icb::_Read: %ld bytes from disk block %" B_PRIdOFF " using" + " block_cache_get_etc()\n", readLength, diskBlock)); uint8 *data = (uint8*)block_cache_get_etc(volume->BlockCache(), diskBlock, 0, readLength); if (data == NULL) @@ -530,7 +537,7 @@ Icb::_GetFileMap(DescriptorList &list, off_t offset, size_t size, size -= length; index++; - if (index >= max || size <= vecs[index - 1].length + if (index >= max || (off_t)size <= vecs[index - 1].length || offset >= (off_t)Length()) { *count = index; return index >= max ? B_BUFFER_OVERFLOW : B_OK; diff --git a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp index 50a336237c..d118d3bf53 100644 --- a/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp +++ b/src/add-ons/kernel/file_systems/udf/PhysicalPartition.cpp @@ -11,8 +11,8 @@ PhysicalPartition::PhysicalPartition(uint16 number, uint32 start, uint32 length) fStart(start), fLength(length) { - TRACE(("PhysicalPartition::PhysicalPartition: number = %d, start = %lu," - "length = %lu\n", number, start, length)); + TRACE(("PhysicalPartition::PhysicalPartition: number = %d, start = %" + B_PRIu32 ",length = %" B_PRIu32 "\n", number, start, length)); } @@ -31,15 +31,15 @@ PhysicalPartition::~PhysicalPartition() status_t PhysicalPartition::MapBlock(uint32 logicalBlock, off_t &physicalBlock) { - TRACE(("PhysicalPartition::MapBlock: %ld\n", logicalBlock)); + TRACE(("PhysicalPartition::MapBlock: %" B_PRIu32 "\n", logicalBlock)); if (logicalBlock >= fLength) { - TRACE_ERROR(("PhysicalPartition::MapBlock: block %ld invalid," - "length = %ld\n", logicalBlock, fLength)); + TRACE_ERROR(("PhysicalPartition::MapBlock: block %" B_PRIu32 " invalid" + ",length = %" B_PRIu32 "\n", logicalBlock, fLength)); return B_BAD_ADDRESS; } else { physicalBlock = fStart + logicalBlock; - TRACE(("PhysicalPartition::MapBlock: block %ld mapped to %Ld\n", - logicalBlock, physicalBlock)); + TRACE(("PhysicalPartition::MapBlock: block %" B_PRIu32 " mapped to %" + B_PRIdOFF "\n", logicalBlock, physicalBlock)); return B_OK; } } diff --git a/src/add-ons/kernel/file_systems/udf/Recognition.cpp b/src/add-ons/kernel/file_systems/udf/Recognition.cpp index fbc8a27ced..0cab1e07e8 100644 --- a/src/add-ons/kernel/file_systems/udf/Recognition.cpp +++ b/src/add-ons/kernel/file_systems/udf/Recognition.cpp @@ -54,23 +54,24 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, partition_descriptor partitionDescriptors[], uint8 &partitionDescriptorCount) { - TRACE(("udf_recognize: device: = %d, offset = %Ld, length = %Ld, " - "blockSize = %ld, ", device, offset, length, blockSize)); - + TRACE(("udf_recognize: device: = %d, offset = %" B_PRIdOFF ", length = %" + B_PRIdOFF ", blockSize = %" B_PRIu32 "\n", device, offset, length, + blockSize)); // Check the block size status_t status = get_block_shift(blockSize, blockShift); if (status != B_OK) { TRACE_ERROR(("\nudf_recognize: Block size must be a positive power of " - "two! (blockSize = %ld)\n", blockSize)); + "two! (blockSize = %" B_PRIu32 ")\n", blockSize)); return status; } - TRACE(("blockShift: %ld\n", blockShift)); + TRACE(("blockShift: %" B_PRIu32 "\n", blockShift)); // Check for a valid volume recognition sequence status = walk_volume_recognition_sequence(device, offset, blockSize, blockShift); if (status != B_OK) { - TRACE_ERROR(("udf_recognize: Invalid sequence. status = %ld\n", status)); + TRACE_ERROR(("udf_recognize: Invalid sequence. status = %" B_PRId32 + "\n", status)); return status; } // Now hunt down a volume descriptor sequence from one of @@ -80,8 +81,8 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, logicalVolumeDescriptor, partitionDescriptors, partitionDescriptorCount); if (status != B_OK) { - TRACE_ERROR(("udf_recognize: cannot find volume descriptor. status = %ld\n", - status)); + TRACE_ERROR(("udf_recognize: cannot find volume descriptor. status = %" + B_PRId32 "\n", status)); return status; } // Now walk the integrity sequence and make sure the last integrity @@ -90,7 +91,7 @@ udf_recognize(int device, off_t offset, off_t length, uint32 blockSize, logicalVolumeDescriptor.integrity_sequence_extent()); if (status != B_OK) { TRACE_ERROR(("udf_recognize: last integrity descriptor not closed. " - "status = %ld\n", status)); + "status = %" B_PRId32 "\n", status)); return status; } @@ -106,9 +107,9 @@ status_t walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uint32 blockShift) { - TRACE(("walk_volume_recognition_sequence: device = %d, offset = %Ld, " - "blockSize = %ld, blockShift = %lu\n", device, offset, blockSize, - blockShift)); + TRACE(("walk_volume_recognition_sequence: device = %d, offset = %" + B_PRIdOFF ", blockSize = %" B_PRIu32 ", blockShift = %" B_PRIu32 "\n", + device, offset, blockSize, blockShift)); // vrs starts at block 16. Each volume structure descriptor (vsd) // should be one block long. We're expecting to find 0 or more iso9660 @@ -125,8 +126,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, bool foundECMA168 = false; for (uint32 block = 16; true; block++) { off_t address = (offset + block) << blockShift; - TRACE(("walk_volume_recognition_sequence: block = %ld, " - "address = %Ld, ", block, address)); + TRACE(("walk_volume_recognition_sequence: block = %" B_PRIu32 ", " + "address = %" B_PRIdOFF ", ", block, address)); ssize_t bytesRead = read_pos(device, address, chunk.Data(), blockSize); if (bytesRead == (ssize_t)blockSize) { volume_structure_descriptor_header* descriptor @@ -155,8 +156,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, break; } } else { - TRACE_ERROR(("read_pos(pos:%Ld, len:%ld) failed with: 0x%lx\n", address, - blockSize, bytesRead)); + TRACE_ERROR(("read_pos(pos:%" B_PRIdOFF ", len:%" B_PRIu32 ") " + "failed with: 0x%lx\n", address, blockSize, bytesRead)); break; } } diff --git a/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp b/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp index 124e191d6e..480bbb498c 100644 --- a/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp +++ b/src/add-ons/kernel/file_systems/udf/SparablePartition.cpp @@ -19,8 +19,9 @@ SparablePartition::SparablePartition(uint16 number, uint32 start, uint32 length, fTableCount(tableCount), fInitStatus(B_NO_INIT) { - TRACE(("SparablePartition::SparablePartition: number = %d, start = %lu," - "length = %lu, packetLength = %d\n", number, start, length, packetLength)); + TRACE(("SparablePartition::SparablePartition: number = %d, start = %" + B_PRIu32 ",length = %" B_PRIu32 ", packetLength = %d\n", number, start, + length, packetLength)); status_t status = (0 < TableCount() && TableCount() <= kMaxSparingTableCount) ? B_OK : B_BAD_VALUE; diff --git a/src/add-ons/kernel/file_systems/udf/UdfString.cpp b/src/add-ons/kernel/file_systems/udf/UdfString.cpp index 2e0eb472d9..b7eaa95c58 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfString.cpp +++ b/src/add-ons/kernel/file_systems/udf/UdfString.cpp @@ -147,8 +147,8 @@ UdfString::SetTo(const char *utf8) // First copy the utf8 string fUtf8String = new(nothrow) char[length + 1]; if (fUtf8String == NULL) { - TRACE_ERROR(("UdfString::SetTo: fUtf8String[%ld] allocation failed\n", - length + 1)); + TRACE_ERROR(("UdfString::SetTo: fUtf8String[%" B_PRIu32 + "] allocation failed\n", length + 1)); return; } @@ -159,8 +159,8 @@ UdfString::SetTo(const char *utf8) // or have to use burly 16-bit unicode. uint32 *raw = new(nothrow) uint32[length]; if (raw == NULL) { - TRACE_ERROR(("UdfString::SetTo: uint32 raw[%ld] temporary string " - "allocation failed\n", length)); + TRACE_ERROR(("UdfString::SetTo: uint32 raw[%" B_PRIu32 "] temporary" + " string allocation failed\n", length)); _Clear(); return; } @@ -201,8 +201,8 @@ UdfString::SetTo(const char *utf8) for (uint32 i = 0; i < rawLength; i++) fCs0String[i + 1] = raw[i] % 256; } else { - TRACE_ERROR(("UdfString::SetTo: fCs0String[%ld] allocation failed\n", - fCs0Length)); + TRACE_ERROR(("UdfString::SetTo: fCs0String[%" B_PRIu32 + "] allocation failed\n", fCs0Length)); _Clear(); return; } @@ -221,8 +221,8 @@ UdfString::SetTo(const char *utf8) fCs0String[pos++] = low; } } else { - TRACE_ERROR(("UdfString::SetTo: fCs0String[%ld] allocation failed\n", - fCs0Length)); + TRACE_ERROR(("UdfString::SetTo: fCs0String[%" B_PRIu32 + "] allocation failed\n", fCs0Length)); _Clear(); return; } diff --git a/src/add-ons/kernel/file_systems/udf/UdfString.h b/src/add-ons/kernel/file_systems/udf/UdfString.h index 8db6127ddf..4d64fb36d1 100644 --- a/src/add-ons/kernel/file_systems/udf/UdfString.h +++ b/src/add-ons/kernel/file_systems/udf/UdfString.h @@ -61,7 +61,8 @@ UdfString::UdfString(const array &dString) : fCs0String(NULL) , fUtf8String(NULL) { - TRACE(("UdfString::UdfString: dString.length(): %ld", dString.length())); + TRACE(("UdfString::UdfString: dString.length(): %" B_PRIu32, + dString.length())); SetTo(dString); } diff --git a/src/add-ons/kernel/file_systems/udf/Utils.cpp b/src/add-ons/kernel/file_systems/udf/Utils.cpp index 111e41036d..f93aabe471 100644 --- a/src/add-ons/kernel/file_systems/udf/Utils.cpp +++ b/src/add-ons/kernel/file_systems/udf/Utils.cpp @@ -153,8 +153,8 @@ decode_time(timestamp ×tamp, struct timespec ×pec) long_address to_long_address(ino_t id, uint32 length) { - TRACE(("udf_to_long_address: ino_t = %Ld (0x%Lx), length = %ld", - id, id, length)); + TRACE(("udf_to_long_address: ino_t = %" B_PRIdINO ", length = %" B_PRIu32, + id, length)); long_address result; result.set_block((id >> 16) & 0xffffffff); result.set_partition(id & 0xffff); @@ -171,9 +171,11 @@ to_vnode_id(long_address address) ino_t result = address.block(); result <<= 16; result |= address.partition(); - TRACE(("block: %ld, 0x%lx\n", address.block(), address.block())); + TRACE(("block: %" B_PRIu32 ", 0x%" B_PRIx32 "\n", address.block(), + address.block())); TRACE(("partition: %d, 0x%x\n", address.partition(), address.partition())); - TRACE(("length: %ld, 0x%lx\n", address.length(), address.length())); - TRACE(("ino_t: %Ld, 0x%Lx\n", result, result)); + TRACE(("length: %" B_PRIu32 ", 0x%" B_PRIx32 "\n", address.length(), + address.length())); + TRACE(("ino_t: %" B_PRIdINO "\n", result)); return result; } diff --git a/src/add-ons/kernel/file_systems/udf/Volume.cpp b/src/add-ons/kernel/file_systems/udf/Volume.cpp index 87360165a2..7222003de2 100644 --- a/src/add-ons/kernel/file_systems/udf/Volume.cpp +++ b/src/add-ons/kernel/file_systems/udf/Volume.cpp @@ -48,9 +48,9 @@ status_t Volume::Mount(const char *deviceName, off_t offset, off_t length, uint32 blockSize, uint32 flags) { - TRACE(("Volume::Mount: deviceName = `%s', offset = %Ld, length = %Ld, " - "blockSize: %ld, flags: %ld\n", deviceName, offset, length, blockSize, - flags)); + TRACE(("Volume::Mount: deviceName = `%s', offset = %" B_PRIdOFF ", length " + "= %" B_PRIdOFF ", blockSize: %" B_PRIu32 ", flags: %" B_PRIu32 "\n", + deviceName, offset, length, blockSize, flags)); if (!deviceName) return B_BAD_VALUE; if (Mounted()) @@ -134,8 +134,9 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length, status = partition ? B_OK : B_NO_MEMORY; if (!status) { TRACE(("Volume::Mount: adding PhysicalPartition(number: %d, " - "start: %ld, length: %ld)\n", map->partition_number(), - descriptor->start(), descriptor->length())); + "start: %" B_PRIu32 ", length: %" B_PRIu32 ")\n", + map->partition_number(), descriptor->start(), + descriptor->length())); status = _SetPartition(i, partition); if (!status) physicalCount++; @@ -197,7 +198,7 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length, metadataCount++; } else { TRACE_ERROR(("Volume::Mount: metadata partition " - "creation failed! 0x%lx\n", status)); + "creation failed! 0x%" B_PRIx32 "\n", status)); } } else { TRACE_ERROR(("Volume::Mount: no matching partition descriptor found!\n")); @@ -241,9 +242,9 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length, fBlockSize = blockSize; fBlockShift = blockShift; } - TRACE(("Volume::Mount: device = %d, offset = %Ld, length = %Ld, " - "blockSize = %ld, blockShift = %ld\n", device, offset, length, - blockSize, blockShift)); + TRACE(("Volume::Mount: device = %d, offset = %" B_PRIdOFF ", length = %" + B_PRIdOFF ", blockSize = %" B_PRIu32 ", blockShift = %" B_PRIu32 "\n", + device, offset, length, blockSize, blockShift)); // At this point we've found a valid set of volume descriptors and // our partitions are all set up. We now need to investigate the file // set descriptor pointed to by the logical volume descriptor. @@ -265,8 +266,9 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length, = read_pos(device, address, chunk.Data(), blockSize); if (bytesRead != ssize_t(blockSize)) { status = B_IO_ERROR; - TRACE_ERROR(("read_pos(pos:%Ld, len:%ld) failed with: 0x%lx\n", - address, blockSize, bytesRead)); + TRACE_ERROR(("read_pos(pos:%" B_PRIdOFF ", len:%" B_PRIu32 + ") failed with: 0x%lx\n", address, blockSize, + bytesRead)); } } // See if it's valid, and if so, create the root icb @@ -286,21 +288,22 @@ Volume::Mount(const char *deviceName, off_t offset, off_t length, return B_NO_MEMORY; } - TRACE(("Volume::Mount: Root Node id = %Ld\n", fRootIcb->Id())); + TRACE(("Volume::Mount: Root Node id = %" B_PRIdINO "\n", + fRootIcb->Id())); if (!status) { status = publish_vnode(fFSVolume, fRootIcb->Id(), fRootIcb, &gUDFVnodeOps, fRootIcb->Mode(), 0); if (status != B_OK) { TRACE_ERROR(("Error creating vnode for root icb! " - "status = 0x%lx, `%s'\n", status, + "status = 0x%" B_PRIx32 ", `%s'\n", status, strerror(status))); // Clean up the icb we created, since _Unset() // won't do this for us. delete fRootIcb; fRootIcb = NULL; } - TRACE(("Volume::Mount: Root vnode published. Id = %Ld\n", - fRootIcb->Id())); + TRACE(("Volume::Mount: Root vnode published. Id = %" + B_PRIdINO "\n", fRootIcb->Id())); } } } @@ -330,10 +333,12 @@ Volume::Name() const { status_t Volume::MapBlock(long_address address, off_t *mappedBlock) { - TRACE(("Volume::MapBlock: partition = %d, block = %ld, mappedBlock = %p\n", - address.partition(), address.block(), mappedBlock)); - DEBUG_INIT_ETC("Volume", ("partition = %d, block = %ld, mappedBlock = %p", - address.partition(), address.block(), mappedBlock)); + TRACE(("Volume::MapBlock: partition = %d, block = %" B_PRIu32 + ", mappedBlock = %p\n", address.partition(), address.block(), + mappedBlock)); + DEBUG_INIT_ETC("Volume", ("partition = %d, block = %" B_PRIu32 + ", mappedBlock = %p", address.partition(), address.block(), + mappedBlock)); status_t error = mappedBlock ? B_OK : B_BAD_VALUE; if (!error) { Partition *partition = _GetPartition(address.partition()); diff --git a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp index 06a3a292b9..7c0b6d40de 100644 --- a/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/udf/kernel_interface.cpp @@ -410,8 +410,8 @@ udf_open_dir(fs_volume *volume, fs_vnode *vnode, void **cookie) DirectoryIterator *iterator = NULL; status_t status = dir->GetDirectoryIterator(&iterator); if (status != B_OK) { - TRACE_ERROR(("udf_open_dir: error getting directory iterator: 0x%lx, " - "`%s'\n", status, strerror(status))); + TRACE_ERROR(("udf_open_dir: error getting directory iterator: 0x%" + B_PRIx32 ", `%s'\n", status, strerror(status))); return status; } *cookie = (void *)iterator; diff --git a/src/add-ons/kernel/generic/mpu401/mpu401.c b/src/add-ons/kernel/generic/mpu401/mpu401.c index e68c99e2ec..cb61dc3f28 100644 --- a/src/add-ons/kernel/generic/mpu401/mpu401.c +++ b/src/add-ons/kernel/generic/mpu401/mpu401.c @@ -237,7 +237,7 @@ midi_close(void * cookie) delete_sem(mpu_device->writesemaphore); atomic_add(&mpu_device->count, -1); - PRINT(("midi_close() done (count = %lu)\n", mpu_device->count)); + PRINT(("midi_close() done (count = %" B_PRId32 ")\n", mpu_device->count)); return B_OK; } diff --git a/src/add-ons/kernel/network/notifications/notifications.cpp b/src/add-ons/kernel/network/notifications/notifications.cpp index 6d01979e65..839edab235 100644 --- a/src/add-ons/kernel/network/notifications/notifications.cpp +++ b/src/add-ons/kernel/network/notifications/notifications.cpp @@ -130,22 +130,32 @@ notifications_std_ops(int32 op, ...) { switch (op) { case B_MODULE_INIT: + { TRACE("init\n"); new(&sNotificationService) NetNotificationService(); + status_t result = sNotificationService.Register(); + if (result != B_OK) + return result; register_generic_syscall(NET_NOTIFICATIONS_SYSCALLS, net_notifications_control, 1, 0); return B_OK; - + } case B_MODULE_UNINIT: TRACE("uninit\n"); unregister_generic_syscall(NET_NOTIFICATIONS_SYSCALLS, 1); + // TODO: due to the way the locking in the notification + // manager works, there's a potential race condition here + // where someone attempts to add a listener right as + // we're uninitializing. Needs to be looked at/resolved. + sNotificationService.Unregister(); + // we need to release the reference that was acquired // on our behalf by the NotificationManager. -// sNotificationService.ReleaseReference(); + sNotificationService.ReleaseReference(); sNotificationService.~NetNotificationService(); return B_OK; diff --git a/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp index 289f926ada..4fbc15965c 100644 --- a/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp +++ b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp @@ -336,7 +336,7 @@ Header::_PrintGUID(const guid_t &id) { static char guid[48]; snprintf(guid, sizeof(guid), - "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + "%08" B_PRIx32 "-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", B_LENDIAN_TO_HOST_INT32(id.data1), B_LENDIAN_TO_HOST_INT16(id.data2), B_LENDIAN_TO_HOST_INT16(id.data3), id.data4[0], id.data4[1], id.data4[2], id.data4[3], id.data4[4], id.data4[5], id.data4[6], @@ -350,17 +350,17 @@ Header::_Dump(const efi_table_header& header) { dprintf("EFI header: %.8s\n", header.header); dprintf("EFI revision: %" B_PRIx32 "\n", header.Revision()); - dprintf("header size: %ld\n", header.HeaderSize()); - dprintf("header CRC: %ld\n", header.HeaderCRC()); - dprintf("absolute block: %Ld\n", header.AbsoluteBlock()); - dprintf("alternate block: %Ld\n", header.AlternateBlock()); - dprintf("first usable block: %Ld\n", header.FirstUsableBlock()); - dprintf("last usable block: %Ld\n", header.LastUsableBlock()); + dprintf("header size: %" B_PRId32 "\n", header.HeaderSize()); + dprintf("header CRC: %" B_PRId32 "\n", header.HeaderCRC()); + dprintf("absolute block: %" B_PRIu64 "\n", header.AbsoluteBlock()); + dprintf("alternate block: %" B_PRIu64 "\n", header.AlternateBlock()); + dprintf("first usable block: %" B_PRIu64 "\n", header.FirstUsableBlock()); + dprintf("last usable block: %" B_PRIu64 "\n", header.LastUsableBlock()); dprintf("disk GUID: %s\n", _PrintGUID(header.disk_guid)); - dprintf("entries block: %Ld\n", header.EntriesBlock()); - dprintf("entry size: %ld\n", header.EntrySize()); - dprintf("entry count: %ld\n", header.EntryCount()); - dprintf("entries CRC: %ld\n", header.EntriesCRC()); + dprintf("entries block: %" B_PRIu64 "\n", header.EntriesBlock()); + dprintf("entry size: %" B_PRIu32 "\n", header.EntrySize()); + dprintf("entry count: %" B_PRIu32 "\n", header.EntryCount()); + dprintf("entries CRC: %" B_PRIu32 "\n", header.EntriesCRC()); } @@ -373,14 +373,14 @@ Header::_DumpPartitions() if (entry.partition_type == kEmptyGUID) continue; - dprintf("[%3ld] partition type: %s\n", i, + dprintf("[%3" B_PRIu32 "] partition type: %s\n", i, _PrintGUID(entry.partition_type)); dprintf(" unique id: %s\n", _PrintGUID(entry.unique_guid)); - dprintf(" start block: %Ld\n", entry.StartBlock()); - dprintf(" end block: %Ld\n", entry.EndBlock()); + dprintf(" start block: %" B_PRIu64 "\n", entry.StartBlock()); + dprintf(" end block: %" B_PRIu64 "\n", entry.EndBlock()); dprintf(" size: %g MB\n", (entry.EndBlock() - entry.StartBlock()) * 512 / 1024.0 / 1024.0); - dprintf(" attributes: %Lx\n", entry.Attributes()); + dprintf(" attributes: %" B_PRIx64 "\n", entry.Attributes()); char name[64]; to_utf8(entry.name, EFI_PARTITION_NAME_LENGTH, name, sizeof(name)); diff --git a/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp index 8dbf7ad741..ad8f784bca 100644 --- a/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp @@ -119,7 +119,8 @@ efi_gpt_scan_partition(int fd, partition_data* partition, void* _cookie) partition->offset + entry.StartBlock() * partition->block_size, entry.BlockCount() * partition->block_size, -1); if (child == NULL) { - TRACE(("efi_gpt: Creating child at index %ld failed\n", index - 1)); + TRACE(("efi_gpt: Creating child at index %" B_PRIu32 " failed\n", + index - 1)); return B_ERROR; } @@ -128,7 +129,7 @@ efi_gpt_scan_partition(int fd, partition_data* partition, void* _cookie) child->name = strdup(name); child->type = strdup(get_partition_type(entry.partition_type)); child->block_size = partition->block_size; - child->cookie = (void*)i; + child->cookie = (void*)(addr_t)i; } return B_OK; @@ -492,7 +493,7 @@ efi_gpt_resize_child(int fd, partition_id partitionID, off_t size, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -553,7 +554,7 @@ efi_gpt_move_child(int fd, partition_id partitionID, partition_id childID, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -614,7 +615,7 @@ efi_gpt_set_content_name(int fd, partition_id partitionID, const char* name, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -660,7 +661,7 @@ efi_gpt_set_type(int fd, partition_id partitionID, const char* type, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; @@ -777,7 +778,7 @@ efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, child->name = strdup(name); child->type = strdup(type); child->parameters = strdup(parameters); - child->cookie = (void*)entryIndex; + child->cookie = (void*)(addr_t)entryIndex; if (child->type == NULL || child->parameters == NULL) { delete_partition(child->id); @@ -813,7 +814,7 @@ efi_gpt_delete_child(int fd, partition_id partitionID, partition_id childID, if (header == NULL) return B_BAD_VALUE; - uint32 entryIndex = (uint32)child->cookie; + uint32 entryIndex = (uint32)(addr_t)child->cookie; if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp index 03e8487ebf..38936ec26a 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/ConfigView.cpp @@ -85,7 +85,7 @@ RuleFilterConfig::RuleFilterConfig(const BMessage *settings) chain = settings->FindInt32("argument"); else chain = -1; - printf("Chain: %ld\n",chain); + printf("Chain: %" B_PRId32 "\n",chain); BMailAccounts accounts; for (int32 i = 0; i < accounts.CountAccounts(); i++) { diff --git a/src/add-ons/mail_daemon/inbound_filters/match_header/RuleFilter.cpp b/src/add-ons/mail_daemon/inbound_filters/match_header/RuleFilter.cpp index 512a00247c..ed3bf8a74b 100644 --- a/src/add-ons/mail_daemon/inbound_filters/match_header/RuleFilter.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/match_header/RuleFilter.cpp @@ -43,7 +43,7 @@ RuleFilter::RuleFilter(MailProtocol& protocol, AddonSettings* addonSettings) fMatcher.SetPattern(regex, false); settings->FindString("argument",&fArg); - settings->FindInt32("do_what",(long *)&fDoWhat); + settings->FindInt32("do_what", (int32*)&fDoWhat); if (fDoWhat == Z_SET_REPLY) settings->FindInt32("argument", &fReplyAccount); } diff --git a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp index bc71405e1d..2d0820ba48 100644 --- a/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp +++ b/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilterConfig.cpp @@ -414,7 +414,7 @@ AGMSBayesianSpamFilterConfig::ShowSpamServerConfigurationWindow () { maximizeCommand.what = B_SET_PROPERTY; maximizeCommand.AddBool ("data", false); maximizeCommand.AddSpecifier ("Minimize"); - maximizeCommand.AddSpecifier ("Window", 0L); + maximizeCommand.AddSpecifier ("Window", (int32)0); errorCode = messengerToServer.SendMessage (&maximizeCommand, &replyMessage); if (errorCode != B_OK) goto ErrorExit; diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp index 6f33929002..8297b9de54 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPProtocol.cpp @@ -297,7 +297,7 @@ IMAPProtocol::SendCommand(const char* command, int32 commandID) return B_NO_MEMORY; static char cmd[256]; - ::sprintf(cmd, "A%.7ld %s"CRLF, commandID, command); + ::sprintf(cmd, "A%.7" B_PRId32 " %s"CRLF, commandID, command); TRACE("_SendCommand: %s\n", cmd); int commandLength = strlen(cmd); @@ -347,7 +347,7 @@ IMAPProtocol::HandleResponse(int32 commandID, bigtime_t timeout, for (std::vector::iterator it = fOngoingCommands.begin(); it != fOngoingCommands.end(); it++) { static char idString[8]; - ::sprintf(idString, "A%.7ld", *it); + ::sprintf(idString, "A%.7" B_PRId32, *it); if (line.FindFirst(idString) >= 0) { if (*it == commandID) { BString result = IMAPParser::ExtractElementAfter(line, diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp index 17c6f043de..762fad56f3 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/IMAPStorage.cpp @@ -240,7 +240,7 @@ IMAPStorage::DeleteMessage(int32 uid) BPath filePath = fMailboxPath; filePath.Append(storageEntry.fileName); BEntry entry(filePath.Path()); - TRACE("IMAPStorage::DeleteMessage %s, %ld\n", filePath.Path(), uid); + TRACE("IMAPStorage::DeleteMessage %s, %" B_PRId32 "\n", filePath.Path(), uid); status_t status = entry.Remove(); if (status != B_OK) diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/MessageIO.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/MessageIO.cpp index 58913947ab..a49a77108b 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/MessageIO.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/MessageIO.cpp @@ -102,7 +102,7 @@ BMailMessageIO::ReadAt(off_t pos, void* buffer, size_t amountToRead) // Put the file position back at where it was, if possible. That's because // ReadAt isn't supposed to affect the file position. - if (oldPosition < fSize) + if (oldPosition < (off_t)fSize) fSlave->Seek (oldPosition, SEEK_SET); else fSlave->Seek (0, SEEK_END); diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp index 25a391d6ed..078b45ebe9 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp @@ -494,8 +494,9 @@ POP3Protocol::Stat() if (SendCommand("STAT" CRLF) < B_OK) return B_ERROR; - int32 messages,dropSize; - if (sscanf(fLog.String(), "+OK %ld %ld", &messages, &dropSize) < 2) + int32 messages, dropSize; + if (sscanf(fLog.String(), "+OK %" B_SCNd32" %" B_SCNd32, &messages, + &dropSize) < 2) return B_ERROR; fNumMessages = messages; @@ -591,11 +592,11 @@ POP3Protocol::Retrieve(int32 message, BPositionIO *write_to) int32 message_len = MessageSize(message); write_to->Seek (0, SEEK_END); if (write_to->Position() != message_len) { - printf ("POP3Protocol::Retrieve Note: message size is %d, was " - "expecting %ld, for message #%ld. Could be a transmission error " - "or a bad POP server implementation (does it remove escape codes " - "when it counts size?).\n", - (int) write_to->Position(), message_len, message); + printf ("POP3Protocol::Retrieve Note: message size is %" B_PRIdOFF + ", was expecting %" B_PRId32 ", for message #%" B_PRId32 ". " + "Could be a transmission error or a bad POP server " + "implementation (does it remove escape codes when it counts " + "size?).\n", write_to->Position(), message_len, message); } } @@ -916,7 +917,7 @@ POP3Protocol::_UniqueIDs() b = atol(&(result.String()[b])); else b = 0; - fSizes.AddItem((void *)(b)); + fSizes.AddItem((void *)(addr_t)b); } return ret; diff --git a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp index b138573f55..5bcc8208aa 100644 --- a/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp +++ b/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp @@ -321,7 +321,8 @@ void AudioMixer::HandleInputBuffer(BBuffer* buffer, bigtime_t lateness) { if (lateness > kMaxJitter && lateness > fLastLateness) { - debug_printf("AudioMixer: Dequeued input buffer %Ld usec late\n", lateness); + debug_printf("AudioMixer: Dequeued input buffer %" B_PRIdBIGTIME + " usec late\n", lateness); if (RunMode() == B_DROP_DATA || RunMode() == B_DECREASE_PRECISION || RunMode() == B_INCREASE_LATENCY) { debug_printf("AudioMixer: sending notify\n"); @@ -380,8 +381,8 @@ AudioMixer::GetLatencyFor(const media_destination &for_whom, *out_latency = EventLatency(); *out_timesource = TimeSource()->ID(); - printf("AudioMixer::GetLatencyFor %Ld, timesource is %ld\n", - *out_latency, *out_timesource); + printf("AudioMixer::GetLatencyFor %" B_PRIdBIGTIME ", timesource is %" + B_PRId32 "\n", *out_latency, *out_timesource); return B_OK; } @@ -398,8 +399,8 @@ AudioMixer::Connected(const media_source &producer, // BBufferProducer::PrepareToConnect() should have removed all wildcards. if (out_input->format.u.raw_audio.frame_rate == 0) { fprintf(stderr, "Audio Mixer Warning: " - "Producer (port %ld, id %ld) connected with frame_rate=0\n", - producer.port, producer.id); + "Producer (port %" B_PRId32 ", id %" B_PRId32 ") connected with " + "frame_rate=0\n", producer.port, producer.id); MixerOutput *output = fCore->Output(); float frame_rate = output ? output->MediaOutput().format.u.raw_audio.frame_rate : 44100.0f; @@ -422,8 +423,10 @@ AudioMixer::Connected(const media_source &producer, // name, the name given the connection by the producer may still be an // empty string. // if the input has no name, assign one - if (strlen(out_input->name) == 0) - sprintf(out_input->name, "Input %ld", out_input->destination.id); + if (strlen(out_input->name) == 0) { + sprintf(out_input->name, "Input %" B_PRId32, + out_input->destination.id); + } // add a new input to the mixer engine MixerInput *input; @@ -607,16 +610,19 @@ AudioMixer::FormatChangeRequested(const media_source &source, media_node_id id; FindLatencyFor(destination, &fDownstreamLatency, &id); - TRACE("AudioMixer: Downstream Latency is %Ld usecs\n", fDownstreamLatency); + TRACE("AudioMixer: Downstream Latency is %" B_PRIdBIGTIME " usecs\n", + fDownstreamLatency); // SetDuration of one buffer SetBufferDuration(buffer_duration(io_format->u.raw_audio)); - TRACE("AudioMixer: buffer duration is %Ld usecs\n", BufferDuration()); + TRACE("AudioMixer: buffer duration is %" B_PRIdBIGTIME " usecs\n", + BufferDuration()); // Our internal latency is at least the length of a full output buffer fInternalLatency = BufferDuration() - + max(4500LL, bigtime_t(0.5 * BufferDuration())); - TRACE("AudioMixer: Internal latency is %Ld usecs\n", fInternalLatency); + + max((bigtime_t)4500, bigtime_t(0.5 * BufferDuration())); + TRACE("AudioMixer: Internal latency is %" B_PRIdBIGTIME " usecs\n", + fInternalLatency); SetEventLatency(fDownstreamLatency + fInternalLatency); @@ -1020,7 +1026,8 @@ AudioMixer::LateNoticeReceived(const media_source& what, bigtime_t howMuch, fLastLateNotification = TimeSource()->Now() + howMuch; - debug_printf("AudioMixer: increasing internal latency to %Ld usec\n", fInternalLatency); + debug_printf("AudioMixer: increasing internal latency to %" + B_PRIdBIGTIME " usec\n", fInternalLatency); SetEventLatency(fDownstreamLatency + fInternalLatency); PublishEventLatencyChange(); diff --git a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp index 3ff2a8fecc..4931f4560d 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerCore.cpp @@ -492,7 +492,7 @@ MixerCore::_MixThread() if (!LockFromMixThread()) return; - bigtime_t latency = max(3600LL, bigtime_t(0.4 * buffer_duration( + bigtime_t latency = max((bigtime_t)3600, bigtime_t(0.4 * buffer_duration( fOutput->MediaOutput().format.u.raw_audio))); // TODO: when the format changes while running, everything is wrong! diff --git a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp index 5bb5085f61..420a2d728b 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp @@ -183,22 +183,24 @@ MixerInput::BufferReceived(BBuffer* buffer) offset = expected_frame; } else { printf("MixerInput::BufferReceived: GLITCH! last frame was " - "%4ld, expected frame was %4d, new frame is %4d\n", - fLastDataFrameWritten, expected_frame, offset); + "%4" B_PRId32 ", expected frame was %4d, new frame is %4d" + "\n", fLastDataFrameWritten, expected_frame, offset); if (start > fLastDataAvailableTime) { if ((start - fLastDataAvailableTime) < (buffer_duration / 10)) { // buffer is less than 10% of buffer duration too late printf("short glitch, buffer too late, time delta " - "%Ld\n", start - fLastDataAvailableTime); + "%" B_PRIdBIGTIME "\n", start + - fLastDataAvailableTime); offset = expected_frame; out_frames++; } else { // buffer more than 10% of buffer duration too late // TODO: zerofill buffer printf("MAJOR glitch, buffer too late, time delta " - "%Ld\n", start - fLastDataAvailableTime); + "%" B_PRIdBIGTIME "\n", start + - fLastDataAvailableTime); } } else { // start <= fLastDataAvailableTime // the new buffer is too early @@ -206,7 +208,8 @@ MixerInput::BufferReceived(BBuffer* buffer) < (buffer_duration / 10)) { // buffer is less than 10% of buffer duration too early printf("short glitch, buffer too early, time delta " - "%Ld\n", fLastDataAvailableTime - start); + "%" B_PRIdBIGTIME "\n", fLastDataAvailableTime + - start); offset = expected_frame; out_frames--; if (out_frames < 1) @@ -215,7 +218,8 @@ MixerInput::BufferReceived(BBuffer* buffer) // buffer more than 10% of buffer duration too early // TODO: zerofill buffer printf("MAJOR glitch, buffer too early, time delta " - "%Ld\n", fLastDataAvailableTime - start); + "%" B_PRIdBIGTIME "\n", fLastDataAvailableTime + - start); } } } diff --git a/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp b/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp index ce28d01de6..a050bea7eb 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerUtils.cpp @@ -53,7 +53,7 @@ StringForChannelMask(char *str, uint32 mask) DECODE(B_CHANNEL_MONO, "Mono"); #undef DECODE if (mask) - sprintf(str + strlen(str), "0x%08lX", mask); + sprintf(str + strlen(str), "0x%08" B_PRIx32, mask); return str; } diff --git a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp index ffac270c82..ddac66162e 100644 --- a/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp +++ b/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp @@ -364,7 +364,7 @@ MultiAudioNode::NodeRegistered() input->destination.port = ControlPort(); input->destination.id = fInputs.CountItems(); input->node = Node(); - sprintf(input->name, "output %ld", input->destination.id); + sprintf(input->name, "output %" B_PRId32, input->destination.id); currentInput = new node_input(*input, fOutputPreferredFormat); currentInput->fPreferredFormat.u.raw_audio.channel_count = 1; @@ -414,7 +414,7 @@ MultiAudioNode::NodeRegistered() output->source.port = ControlPort(); output->source.id = fOutputs.CountItems(); output->node = Node(); - sprintf(output->name, "input %ld", output->source.id); + sprintf(output->name, "input %" B_PRId32, output->source.id); currentOutput = new node_output(*output, fInputPreferredFormat); currentOutput->fPreferredFormat.u.raw_audio.channel_count = 1; @@ -1014,8 +1014,10 @@ MultiAudioNode::Disconnect(const media_source& what, delete channel->fBufferGroup; channel->fBufferGroup = NULL; } else { - fprintf(stderr, "\tDisconnect() called with wrong source/destination (%ld/%ld), ours is (%ld/%ld)\n", - what.id, where.id, channel->fOutput.source.id, channel->fOutput.destination.id); + fprintf(stderr, "\tDisconnect() called with wrong source/destination (" + "%" B_PRId32 "/%" B_PRId32 "), ours is (%" B_PRId32 "/%" B_PRId32 + ")\n", what.id, where.id, channel->fOutput.source.id, + channel->fOutput.destination.id); } } @@ -1047,7 +1049,7 @@ MultiAudioNode::LateNoticeReceived(const media_source& what, bigtime_t howMuch, fInternalLatency += howMuch; SetEventLatency(fLatency + fInternalLatency); - fprintf(stderr, "\tincreasing latency to %Ld\n", + fprintf(stderr, "\tincreasing latency to %" B_PRIdBIGTIME"\n", fLatency + fInternalLatency); } else { // The other run modes dictate various strategies for sacrificing data @@ -1122,7 +1124,7 @@ MultiAudioNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, _HandleParameter(event, lateness, realTimeEvent); break; default: - fprintf(stderr," unknown event type: %li\n", event->type); + fprintf(stderr," unknown event type: %" B_PRId32 "\n", event->type); break; } } @@ -1158,7 +1160,7 @@ MultiAudioNode::_HandleBuffer(const media_timed_event* event, // lateness doesn't matter in offline mode or in recording mode //mLateBuffers++; NotifyLateProducer(channel->fInput.source, -howEarly, performanceTime); - fprintf(stderr," <- LATE BUFFER : %lli\n", howEarly); + fprintf(stderr," <- LATE BUFFER : %" B_PRIdBIGTIME "\n", howEarly); buffer->Recycle(); } else { //WriteBuffer(buffer, *channel); diff --git a/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp b/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp index df9fd14f2d..427d3020fc 100644 --- a/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp +++ b/src/add-ons/media/media-add-ons/opensound/OpenSoundDevice.cpp @@ -364,8 +364,8 @@ status_t OpenSoundDevice::InitDriver() { CALLED(); - PRINT(("OpenSoundDevice::InitDriver: %ld engines, %ld mixers\n", - CountEngines(), CountMixers())); + PRINT(("OpenSoundDevice::InitDriver: %" B_PRId32 " engines, %" B_PRId32 + " mixers\n", CountEngines(), CountMixers())); if (CountMixers()) { ;//... diff --git a/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp b/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp index 4e26d27f8d..cf74f4629d 100644 --- a/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp +++ b/src/add-ons/media/media-add-ons/opensound/OpenSoundDeviceEngine.cpp @@ -540,7 +540,8 @@ status_t OpenSoundDeviceEngine::AcceptFormatFor(int fmt, media_format &format, b return err; } - PRINT(("%s:step1 fmt=0x%08x, raw.format=0x%08lx\n", __FUNCTION__, fmt, raw.format)); + PRINT(("%s:step1 fmt=0x%08x, raw.format=0x%08" B_PRIx32 "\n", + __FUNCTION__, fmt, raw.format)); // if specified, try it if (raw.format) afmt = OpenSoundDevice::convert_media_format_to_oss_format(raw.format); @@ -556,7 +557,8 @@ status_t OpenSoundDeviceEngine::AcceptFormatFor(int fmt, media_format &format, b PRINT(("%s:step3 afmt=0x%08x\n", __FUNCTION__, afmt)); // convert back raw.format = OpenSoundDevice::convert_oss_format_to_media_format(afmt); - PRINT(("%s:step4 afmt=0x%08x, raw.format=0x%08lx\n", __FUNCTION__, afmt, raw.format)); + PRINT(("%s:step4 afmt=0x%08x, raw.format=0x%08" B_PRIx32 "\n", + __FUNCTION__, afmt, raw.format)); raw.valid_bits = OpenSoundDevice::convert_oss_format_to_valid_bits(afmt); err = SetFormat(afmt); @@ -634,7 +636,8 @@ status_t OpenSoundDeviceEngine::SpecializeFormatFor(int fmt, media_format &forma if (format.type == B_MEDIA_RAW_AUDIO) { media_multi_audio_format &raw = format.u.raw_audio; - PRINT(("%s:step1 fmt=0x%08x, raw.format=0x%08lx\n", __FUNCTION__, fmt, raw.format)); + PRINT(("%s:step1 fmt=0x%08x, raw.format=0x%08" B_PRIx32 "\n", + __FUNCTION__, fmt, raw.format)); // select the best as default if (!raw.format) { afmt = OpenSoundDevice::select_oss_format(fmt); @@ -651,7 +654,8 @@ status_t OpenSoundDeviceEngine::SpecializeFormatFor(int fmt, media_format &forma } // convert back raw.format = OpenSoundDevice::convert_oss_format_to_media_format(afmt); - PRINT(("%s:step4 afmt=0x%08x, raw.format=0x%08lx\n", __FUNCTION__, afmt, raw.format)); + PRINT(("%s:step4 afmt=0x%08x, raw.format=0x%08" B_PRIx32 "\n", + __FUNCTION__, afmt, raw.format)); if (!raw.valid_bits) raw.valid_bits = OpenSoundDevice::convert_oss_format_to_valid_bits(afmt); if (raw.valid_bits != OpenSoundDevice::convert_oss_format_to_valid_bits(afmt)) { diff --git a/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp b/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp index 39d747df76..8658b8b652 100644 --- a/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp +++ b/src/add-ons/media/media-add-ons/opensound/OpenSoundNode.cpp @@ -158,7 +158,7 @@ public: // make sure all buffers are recycled, or we might hang // when told to quit - while (BBuffer* buffer = (BBuffer*)fBuffers.RemoveItem(0L)) + while (BBuffer* buffer = (BBuffer*)fBuffers.RemoveItem((int32)0)) buffer->Recycle(); } @@ -325,7 +325,7 @@ OpenSoundNode::OpenSoundNode(BMediaAddOn* addon, const char* name, fTimeSourceStartTime(0), fWeb(NULL), - fConfig(0UL) + fConfig((uint32)0) { CALLED(); @@ -488,7 +488,7 @@ OpenSoundNode::NodeRegistered() const char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(mediaInput.name, "%sOutput %ld (%s)", prefix, + sprintf(mediaInput.name, "%sOutput %" B_PRId32 " (%s)", prefix, mediaInput.destination.id, gSupportedFormatsNames[f]); NodeInput* input = new (nothrow) NodeInput(mediaInput, i, fmt, @@ -536,7 +536,7 @@ OpenSoundNode::NodeRegistered() const char *prefix = ""; if (strstr(engine->Info()->name, "SPDIF")) prefix = "S/PDIF "; - sprintf(mediaOutput.name, "%sInput %ld (%s)", prefix, + sprintf(mediaOutput.name, "%sInput %" B_PRId32 " (%s)", prefix, mediaOutput.source.id, gSupportedFormatsNames[f]); NodeOutput* output = new (nothrow) NodeOutput(mediaOutput, @@ -1282,8 +1282,9 @@ OpenSoundNode::Disconnect(const media_source& what, channel->FreeBuffers(); } else { fprintf(stderr, "\tDisconnect() called with wrong source/destination " - "(%ld/%ld), ours is (%ld/%ld)\n", what.id, where.id, - channel->fOutput.source.id, channel->fOutput.destination.id); + "(%" B_PRId32 "/%" B_PRId32 "), ours is (%" B_PRId32 "/%" B_PRId32 + ")\n", what.id, where.id, channel->fOutput.source.id, + channel->fOutput.destination.id); } } @@ -1315,7 +1316,7 @@ OpenSoundNode::LateNoticeReceived(const media_source& what, bigtime_t how_much, fInternalLatency += how_much; SetEventLatency(fLatency + fInternalLatency); - fprintf(stderr, "\tincreasing latency to %Ld\n", + fprintf(stderr, "\tincreasing latency to %" B_PRIdBIGTIME "\n", fLatency + fInternalLatency); } else { // The other run modes dictate various strategies for sacrificing data @@ -1396,7 +1397,8 @@ OpenSoundNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, HandleParameter(event,lateness,realTimeEvent); break; default: - fprintf(stderr," unknown event type: %li\n",event->type); + fprintf(stderr," unknown event type: %" B_PRId32 "\n", + event->type); break; } } @@ -1448,7 +1450,7 @@ OpenSoundNode::HandleBuffer(const media_timed_event* event, // TODO: Debug //mLateBuffers++; NotifyLateProducer(channel->fInput.source, -how_early, perf_time); - fprintf(stderr," <- LATE BUFFER : %lli\n", how_early); + fprintf(stderr," <- LATE BUFFER : %" B_PRIdBIGTIME "\n", how_early); buffer->Recycle(); } else { fDevice->Locker()->Lock(); @@ -1610,8 +1612,8 @@ OpenSoundNode::TimeSourceOp(const time_source_op_info& op, void* _reserved) break; case B_TIMESOURCE_SEEK: // TRACE("TimeSourceOp op B_TIMESOURCE_SEEK\n"); -printf("TimeSourceOp op B_TIMESOURCE_SEEK, real %lld, " - "perf %lld\n", op.real_time, op.performance_time); +printf("TimeSourceOp op B_TIMESOURCE_SEEK, real %" B_PRIdBIGTIME ", " + "perf %" B_PRIdBIGTIME "\n", op.real_time, op.performance_time); BroadcastTimeWarp(op.real_time, op.performance_time); break; default: @@ -2257,7 +2259,7 @@ OpenSoundNode::_PlayThread(NodeInput* input) TRACE("OpenSoundNode::_PlayThread: buffers: %ld\n", input->fBuffers.CountItems()); - BBuffer* buffer = (BBuffer*)input->fBuffers.RemoveItem(0L); + BBuffer* buffer = (BBuffer*)input->fBuffers.RemoveItem((int32)0); fDevice->Locker()->Unlock(); diff --git a/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp b/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp index 7967feced9..e10172ee35 100644 --- a/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp +++ b/src/add-ons/media/media-add-ons/tone_producer_demo/ToneProducer.cpp @@ -662,7 +662,8 @@ ToneProducer::Stop(bigtime_t performance_time, bool immediate) { // send 'data not available' message if(mOutput.destination != media_destination::null) { - printf("ToneProducer: B_PRODUCER_STOPPED at %Ld\n", performance_time); + printf("ToneProducer: B_PRODUCER_STOPPED at %" B_PRIdBIGTIME "\n", + performance_time); SendDataStatus(B_PRODUCER_STOPPED, mOutput.destination, performance_time); } diff --git a/src/add-ons/print/drivers/pdf/source/PDFText.cpp b/src/add-ons/print/drivers/pdf/source/PDFText.cpp index e3c82f0c80..f7f6790ac9 100644 --- a/src/add-ons/print/drivers/pdf/source/PDFText.cpp +++ b/src/add-ons/print/drivers/pdf/source/PDFText.cpp @@ -320,10 +320,9 @@ void PDFWriter::ToPDFUnicode(const char *string, BString &unicode) { // PDFlib requires BOM at begin and two 0 at end of string - char marker[3] = { 0xfe, 0xff, 0}; // byte order marker BString s; ToUnicode(string, s); - unicode << marker; + unicode << "\xfe\xff"; int32 len = s.Length()+2; char* buf = unicode.LockBuffer(len + 2); // reserve space for two additional '\0' diff --git a/src/add-ons/print/drivers/preview/JobSetupWindow.cpp b/src/add-ons/print/drivers/preview/JobSetupWindow.cpp index 9ba38eb419..5d142469cf 100644 --- a/src/add-ons/print/drivers/preview/JobSetupWindow.cpp +++ b/src/add-ons/print/drivers/preview/JobSetupWindow.cpp @@ -121,7 +121,7 @@ void JobSetupWindow::UpdateJobMessage() { int32 from = 1; - int32 to = LONG_MAX; + int32 to = INT32_MAX; if (fAll->Value() == B_CONTROL_OFF) { from = atoi(fFrom->Text()); to = atoi(fTo->Text()); diff --git a/src/add-ons/print/drivers/preview/PrinterDriver.cpp b/src/add-ons/print/drivers/preview/PrinterDriver.cpp index 117e3ecdbc..ef2048f477 100644 --- a/src/add-ons/print/drivers/preview/PrinterDriver.cpp +++ b/src/add-ons/print/drivers/preview/PrinterDriver.cpp @@ -78,8 +78,8 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg) printf("\n"); for (int32 page = 1; page <= pfh.page_count; ++page) { - printf("PrinterDriver::PrintPage(): Faking print of page %ld/ %ld\n", - page, pfh.page_count); + printf("PrinterDriver::PrintPage(): Faking print of page %" B_PRId32 + "/ %" B_PRId32 "\n", page, pfh.page_count); } fJobFile->Seek(0, SEEK_SET); @@ -87,9 +87,10 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg) status_t status = reader.InitCheck(); printf("\nPrintJobReader::InitCheck(): %s\n", status == B_OK ? "B_OK" : "B_ERROR"); - printf("PrintJobReader::NumberOfPages(): %ld\n", reader.NumberOfPages()); - printf("PrintJobReader::FirstPage(): %ld\n", reader.FirstPage()); - printf("PrintJobReader::LastPage(): %ld\n", reader.LastPage()); + printf("PrintJobReader::NumberOfPages(): %" B_PRId32 "\n", + reader.NumberOfPages()); + printf("PrintJobReader::FirstPage(): %" B_PRId32 "\n", reader.FirstPage()); + printf("PrintJobReader::LastPage(): %" B_PRId32 "\n", reader.LastPage()); BRect rect = reader.PaperRect(); printf("PrintJobReader::PaperRect(): BRect(l:%.1f, t:%.1f, r:%.1f, b:%.1f)\n", @@ -101,7 +102,8 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg) int32 xdpi, ydpi; reader.GetResolution(&xdpi, &ydpi); - printf("PrintJobReader::GetResolution(): xdpi:%ld, ydpi:%ld\n", xdpi, ydpi); + printf("PrintJobReader::GetResolution(): xdpi:%" B_PRId32 ", ydpi:%" + B_PRId32 "\n", xdpi, ydpi); printf("PrintJobReader::GetScale(): %.1f\n", reader.GetScale()); fPrinting = false; @@ -172,7 +174,7 @@ PrinterDriver::JobSetup(BMessage *jobMsg, const char *printerName) jobMsg->AddInt32("first_page", 1); if (!jobMsg->HasInt32("last_page")) - jobMsg->AddInt32("last_page", LONG_MAX); + jobMsg->AddInt32("last_page", INT32_MAX); BlockingWindow* w = NewJobSetupWindow(jobMsg, printerName); return w->Go(); diff --git a/src/add-ons/print/transports/ipp/Ipp.cpp b/src/add-ons/print/transports/ipp/Ipp.cpp index b4a69983a3..2906be87de 100644 --- a/src/add-ons/print/transports/ipp/Ipp.cpp +++ b/src/add-ons/print/transports/ipp/Ipp.cpp @@ -93,7 +93,8 @@ IPPPrinterRoster::Listen() packet[len] = '\0'; // Verify packet format - if (sscanf(packet, "%lx%lx%1023s", &type, &state, uri) == 3) { + if (sscanf(packet, "%" B_SCNx32 "%" B_SCNx32 "%1023s", &type, &state, + uri) == 3) { IPPPrinter *printer = fPrinters.Get(uri); if (!printer) { printer = new IPPPrinter(uri, type); diff --git a/src/add-ons/print/transports/ipp/IppTransport.cpp b/src/add-ons/print/transports/ipp/IppTransport.cpp index 64814f1502..65b7c767bf 100644 --- a/src/add-ons/print/transports/ipp/IppTransport.cpp +++ b/src/add-ons/print/transports/ipp/IppTransport.cpp @@ -64,7 +64,7 @@ IppTransport::IppTransport(BMessage *msg) else strcpy(__user, "baron"); - sprintf(__file, "%s/%s@ipp.%ld", spool_path, __user, __jobid); + sprintf(__file, "%s/%s@ipp.%" B_PRId32, spool_path, __user, __jobid); __fs.open(__file, ios::in | ios::out | ios::binary | ios::trunc); if (__fs.good()) { diff --git a/src/add-ons/print/transports/lpr/LprTransport.cpp b/src/add-ons/print/transports/lpr/LprTransport.cpp index 8ac8daf536..6de02a45c5 100644 --- a/src/add-ons/print/transports/lpr/LprTransport.cpp +++ b/src/add-ons/print/transports/lpr/LprTransport.cpp @@ -66,7 +66,7 @@ LprTransport::LprTransport(BMessage *msg) } dir.WriteAttr(LPR_JOB_ID, B_INT32_TYPE, 0, &fJobId, sizeof(fJobId)); - sprintf(fFile, "%s/%s@ipp.%ld", spool_path, fUser, fJobId); + sprintf(fFile, "%s/%s@ipp.%" B_PRId32, spool_path, fUser, fJobId); fStream.open(fFile, ios::in | ios::out | ios::binary | ios::trunc); if (fStream.good()) { diff --git a/src/add-ons/screen_savers/message/Message.cpp b/src/add-ons/screen_savers/message/Message.cpp index f45643d430..3cbf41cc88 100644 --- a/src/add-ons/screen_savers/message/Message.cpp +++ b/src/add-ons/screen_savers/message/Message.cpp @@ -176,7 +176,8 @@ Message::Draw(BView *view, int32 frame) buffer.Lock(); // Set up the colors - rgb_color base_color = {rand() % 25, rand() % 25, rand() % 25}; + rgb_color base_color = {(uint8)(rand() % 25), (uint8)(rand() % 25), + (uint8)(rand() % 25)}; offscreen.SetHighColor(base_color); offscreen.SetLowColor(tint_color(base_color, 0.815F)); offscreen.FillRect(offscreen.Bounds(), kCheckered); diff --git a/src/add-ons/screen_savers/spider/Polygon.cpp b/src/add-ons/screen_savers/spider/Polygon.cpp index 71c401e12a..cec30cb3ee 100644 --- a/src/add-ons/screen_savers/spider/Polygon.cpp +++ b/src/add-ons/screen_savers/spider/Polygon.cpp @@ -39,7 +39,7 @@ Polygon::Polygon(BRect bounds, BList points) // destructor Polygon::~Polygon() { - while (point_vector* pv = (point_vector*)fPoints.RemoveItem(0L)) + while (point_vector* pv = (point_vector*)fPoints.RemoveItem((int32)0)) delete pv; } diff --git a/src/add-ons/translators/gif/SavePalette.cpp b/src/add-ons/translators/gif/SavePalette.cpp index eb1ffb1284..7f8d66d493 100644 --- a/src/add-ons/translators/gif/SavePalette.cpp +++ b/src/add-ons/translators/gif/SavePalette.cpp @@ -244,7 +244,7 @@ SavePalette::SavePalette(BBitmap *bitmap, int32 maxSizeInBits) fSize(0), fSizeInBits(0), fMode(OPTIMAL_PALETTE), - fTransparentMode(fTransparentMode), + fTransparentMode(NO_TRANSPARENCY), fTransparentIndex(-1), fBackgroundIndex(0), fFatalError(pal == NULL) diff --git a/src/add-ons/translators/icns/Jamfile b/src/add-ons/translators/icns/Jamfile index 68ab239ba9..0782acd7fb 100644 --- a/src/add-ons/translators/icns/Jamfile +++ b/src/add-ons/translators/icns/Jamfile @@ -44,6 +44,9 @@ local openjpeg_files = ObjectCcFlags [ FGristFiles $(openjpeg_files:S=$(SUFOBJ)) ] : -w ; +Includes [ FGristFiles icns_png.c ] + : $(HAIKU_LIBPNG_HEADERS_DEPENDENCY) ; + local libicns_files = icns_debug.c icns_element.c diff --git a/src/add-ons/translators/jpeg/JPEGTranslator.cpp b/src/add-ons/translators/jpeg/JPEGTranslator.cpp index c6bb97b963..ab57fcb88e 100644 --- a/src/add-ons/translators/jpeg/JPEGTranslator.cpp +++ b/src/add-ons/translators/jpeg/JPEGTranslator.cpp @@ -402,7 +402,7 @@ SSlider::SSlider(const char* name, const char* label, const char* SSlider::UpdateText() const { - snprintf(fStatusLabel, sizeof(fStatusLabel), "%ld", Value()); + snprintf(fStatusLabel, sizeof(fStatusLabel), "%" B_PRId32, Value()); return fStatusLabel; } diff --git a/src/add-ons/translators/jpeg/Jamfile b/src/add-ons/translators/jpeg/Jamfile index 5f3db755cb..d04e786e46 100644 --- a/src/add-ons/translators/jpeg/Jamfile +++ b/src/add-ons/translators/jpeg/Jamfile @@ -12,7 +12,8 @@ UseHeaders $(HAIKU_JPEG_HEADERS) : true ; AddResources JPEGTranslator : JPEGTranslator.rdef ; -Includes [ FGristFiles be_jdatadst.cpp be_jerror.cpp ] +Includes [ FGristFiles be_jdatadst.cpp be_jdatasrc.cpp + be_jerror.cpp JPEGTranslator.cpp ] : $(HAIKU_JPEG_HEADERS_DEPENDENCY) ; Translator JPEGTranslator : diff --git a/src/apps/activitymonitor/ActivityView.cpp b/src/apps/activitymonitor/ActivityView.cpp index ad6e5cd3a7..f10bd84dc8 100644 --- a/src/apps/activitymonitor/ActivityView.cpp +++ b/src/apps/activitymonitor/ActivityView.cpp @@ -600,10 +600,6 @@ ActivityView::~ActivityView() { delete fOffscreen; delete fSystemInfoHandler; - - // replicant deleted, destroy the about window - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } @@ -647,8 +643,6 @@ ActivityView::_Init(const BMessage* settings) const char* name; for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++) AddDataSource(DataSource::FindSource(name), settings); - - fAboutWindow = NULL; } @@ -1112,22 +1106,21 @@ ActivityView::MessageReceived(BMessage* message) switch (message->what) { case B_ABOUT_REQUESTED: - if (fAboutWindow == NULL) { - const char* authors[] = { - "Axel Dörfler", - NULL - }; + { + BAboutWindow* window = new BAboutWindow(kAppName, kSignature); - fAboutWindow = new BAboutWindow(kAppName, kSignature); - fAboutWindow->AddCopyright(2008, "Haiku, Inc."); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + const char* authors[] = { + "Axel Dörfler", + NULL + }; + + window->AddCopyright(2008, "Haiku, Inc."); + window->AddAuthors(authors); + + window->Show(); break; + } case kMsgUpdateResolution: { diff --git a/src/apps/activitymonitor/ActivityView.h b/src/apps/activitymonitor/ActivityView.h index 0e1ccf6520..17ac4f89d1 100644 --- a/src/apps/activitymonitor/ActivityView.h +++ b/src/apps/activitymonitor/ActivityView.h @@ -17,7 +17,6 @@ #include "DataSource.h" -class BAboutWindow; class BBitmap; class BMessageRunner; class Scale; @@ -146,8 +145,6 @@ private: int32 fOriginalResolution; SystemInfoHandler* fSystemInfoHandler; std::map fScales; - - BAboutWindow* fAboutWindow; }; #endif // ACTIVITY_VIEW_H diff --git a/src/apps/bsnow/Flakes.cpp b/src/apps/bsnow/Flakes.cpp index 7613e0406b..c9eeb79fdd 100644 --- a/src/apps/bsnow/Flakes.cpp +++ b/src/apps/bsnow/Flakes.cpp @@ -3,7 +3,7 @@ #define TRAN 0xFF #define WHIT 0x3F -const char gFlakeBits[NUM_PATTERNS][64] = { +const uchar gFlakeBits[NUM_PATTERNS][64] = { { TRAN, TRAN, TRAN, TRAN, TRAN, TRAN, TRAN, TRAN, TRAN, TRAN, WHIT, TRAN, WHIT, TRAN, TRAN, TRAN, diff --git a/src/apps/bsnow/Flakes.h b/src/apps/bsnow/Flakes.h index 35158dda63..3ba4088224 100644 --- a/src/apps/bsnow/Flakes.h +++ b/src/apps/bsnow/Flakes.h @@ -6,7 +6,7 @@ #define PAT_HOTSPOT 3,3 -extern const char gFlakeBits[NUM_PATTERNS][64]; +extern const uchar gFlakeBits[NUM_PATTERNS][64]; #endif diff --git a/src/apps/clock/cl_view.cpp b/src/apps/clock/cl_view.cpp index d0605d95e4..d6cfb8e6a8 100644 --- a/src/apps/clock/cl_view.cpp +++ b/src/apps/clock/cl_view.cpp @@ -333,7 +333,7 @@ void TOnscreenView::MouseDown( BPoint point ) { BPoint cursor; - ulong buttons; + uint32 buttons; BRect bounds = Bounds(); GetMouse(&cursor,&buttons); diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index 36f17d4bac..f68df37330 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -65,7 +65,7 @@ ErrorAlert(const char* message, status_t err, BWindow *window = NULL) alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); - printf("%s\n%s [%lx]", message, strerror(err), err); + printf("%s\n%s [%" B_PRIx32 "]", message, strerror(err), err); } @@ -541,7 +541,7 @@ VideoWindow::MessageReceived(BMessage* message) case msg_upl_client: message->FindInt32("client", &(fFtpInfo.uploadClient)); - FTPINFO("upl client = %ld\n", fFtpInfo.uploadClient); + FTPINFO("upl client = %" B_PRId32 "\n", fFtpInfo.uploadClient); _UploadClientChanged(); break; diff --git a/src/apps/codycam/Settings.cpp b/src/apps/codycam/Settings.cpp index af06871438..537d0bf1f9 100644 --- a/src/apps/codycam/Settings.cpp +++ b/src/apps/codycam/Settings.cpp @@ -177,7 +177,7 @@ ScalarValueSetting::Value() const void ScalarValueSetting::GetValueAsString(char* buffer) const { - sprintf(buffer, "%ld", fValue); + sprintf(buffer, "%" B_PRId32, fValue); } diff --git a/src/apps/codycam/Settings.h b/src/apps/codycam/Settings.h index 7bce95515a..cde0f821ba 100644 --- a/src/apps/codycam/Settings.h +++ b/src/apps/codycam/Settings.h @@ -61,7 +61,7 @@ public: int32 defaultValue, const char* valueExpectedErrorString, const char* wrongValueErrorString, - int32 min = LONG_MIN, int32 max = LONG_MAX); + int32 min = INT32_MIN, int32 max = INT32_MAX); virtual ~ScalarValueSetting(); void ValueChanged(int32 newValue); diff --git a/src/apps/codycam/VideoConsumer.cpp b/src/apps/codycam/VideoConsumer.cpp index c764d19c7c..55618e0972 100644 --- a/src/apps/codycam/VideoConsumer.cpp +++ b/src/apps/codycam/VideoConsumer.cpp @@ -124,7 +124,7 @@ VideoConsumer::~VideoConsumer() BMediaAddOn* -VideoConsumer::AddOn(long* cookie) const +VideoConsumer::AddOn(int32* cookie) const { FUNCTION("VideoConsumer::AddOn\n"); // do the right thing if we're ever used with an add-on @@ -243,7 +243,8 @@ VideoConsumer::HandleMessage(int32 message, const void* data, size_t size) void VideoConsumer::BufferReceived(BBuffer* buffer) { - LOOP("VideoConsumer::Buffer #%ld received, start_time %Ld\n", buffer->ID(), buffer->Header()->start_time); + LOOP("VideoConsumer::Buffer #%" B_PRId32 " received, start_time %" B_PRIdBIGTIME + "\n", buffer->ID(), buffer->Header()->start_time); if (RunState() == B_STOPPED) { buffer->Recycle(); @@ -309,8 +310,8 @@ VideoConsumer::CreateBuffers(const media_format& withFormat) else PROGRESS("VideoConsumer::CreateBuffers - SUCCESSFUL ADD BUFFER TO GROUP\n"); } else { - ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING BUFFER: %08lx\n", - status); + ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING " + "BUFFER: %08" B_PRIx32 "\n", status); return B_ERROR; } } @@ -322,8 +323,8 @@ VideoConsumer::CreateBuffers(const media_format& withFormat) if ((status = fBuffers->GetBufferList(3, buffList)) == B_OK) for (int j = 0; j < 3; j++) if (buffList[j] != NULL) { - fBufferMap[j] = (uint32)buffList[j]; - PROGRESS(" j = %d buffer = %08lx\n", j, fBufferMap[j]); + fBufferMap[j] = buffList[j]; + PROGRESS(" j = %d buffer = %p\n", j, fBufferMap[j]); } else { ERROR("VideoConsumer::CreateBuffers ERROR MAPPING RING BUFFER\n"); return B_ERROR; @@ -542,7 +543,7 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness, uint32 index = 0; fOurBuffers = true; while (index < 3) - if ((uint32)buffer == fBufferMap[index]) + if (buffer == fBufferMap[index]) break; else index++; @@ -735,7 +736,7 @@ VideoConsumer::FtpSave(char* filename) uint32 time = real_time_clock(); char s[80]; strcpy(s, B_TRANSLATE("Last Capture: ")); - strcat(s, ctime((const long*)&time)); + strcat(s, ctime((const time_t*)&time)); s[strlen(s) - 1] = 0; UpdateFtpStatus(s); delete ftp; diff --git a/src/apps/codycam/VideoConsumer.h b/src/apps/codycam/VideoConsumer.h index 473bd4f069..af3e640a47 100644 --- a/src/apps/codycam/VideoConsumer.h +++ b/src/apps/codycam/VideoConsumer.h @@ -43,7 +43,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { /* BMediaNode */ public: - virtual BMediaAddOn* AddOn(long* cookie) const; + virtual BMediaAddOn* AddOn(int32* cookie) const; protected: virtual void Start(bigtime_t performanceTime); @@ -114,7 +114,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { private: BStringView* fStatusLine; - uint32 fInternalID; + int32 fInternalID; BMediaAddOn* fAddOn; thread_id fFtpThread; @@ -129,7 +129,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer { BBitmap* fBitmap[3]; bool fOurBuffers; BBufferGroup* fBuffers; - uint32 fBufferMap[3]; + BBuffer* fBufferMap[3]; BBitmap* fFtpBitmap; volatile bool fTimeToFtp; diff --git a/src/apps/cortex/addons/common/AudioBuffer.cpp b/src/apps/cortex/addons/common/AudioBuffer.cpp index f09212714b..92ceffb4f9 100644 --- a/src/apps/cortex/addons/common/AudioBuffer.cpp +++ b/src/apps/cortex/addons/common/AudioBuffer.cpp @@ -295,7 +295,7 @@ uint32 AudioBuffer::findMin(uint32 fromFrame, uint32 frameCount, if(pAt) { // reset pAt for(n = 0; n < channels; n++) - pAt[n] = ULONG_MAX; + pAt[n] = UINT32_MAX; } // find minimum for each channel @@ -348,7 +348,7 @@ uint32 AudioBuffer::findMax(uint32 fromFrame, uint32 frameCount, if(pAt) { // reset pAt for(n = 0; n < channels; n++) - pAt[n] = ULONG_MAX; + pAt[n] = UINT32_MAX; } // find minimum for each channel @@ -400,7 +400,7 @@ uint32 AudioBuffer::findPeaks(uint32 fromFrame, uint32 frameCount, if(pAt) { // reset pAt for(n = 0; n < channels; n++) - pAt[n] = ULONG_MAX; + pAt[n] = UINT32_MAX; } // find peaks in both directions diff --git a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp index d0326ebbfb..4e6bd81323 100644 --- a/src/apps/cortex/addons/common/MediaNodeControlApp.cpp +++ b/src/apps/cortex/addons/common/MediaNodeControlApp.cpp @@ -82,7 +82,7 @@ MediaNodeControlApp::MediaNodeControlApp( if(err < B_OK) { char buffer[512]; sprintf(buffer, - "MediaNodeControlApp: couldn't find node (%ld):\n%s\n", + "MediaNodeControlApp: couldn't find node (%" B_PRId32 "):\n%s\n", nodeID, strerror(err)); BAlert* alert = new BAlert("error", buffer, "OK"); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); @@ -96,8 +96,8 @@ MediaNodeControlApp::MediaNodeControlApp( if(err < B_OK) { char buffer[512]; sprintf(buffer, - "MediaNodeControlApp: couldn't get node info (%ld):\n%s\n", - nodeID, strerror(err)); + "MediaNodeControlApp: couldn't get node info (%" B_PRId32 + "):\n%s\n", nodeID, strerror(err)); BAlert* alert = new BAlert("error", buffer, "OK"); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); @@ -113,8 +113,8 @@ MediaNodeControlApp::MediaNodeControlApp( if(err < B_OK) { char buffer[512]; sprintf(buffer, - "MediaNodeControlApp: no parameters for node (%ld):\n%s\n", - nodeID, strerror(err)); + "MediaNodeControlApp: no parameters for node (%" B_PRId32 + "):\n%s\n", nodeID, strerror(err)); BAlert* alert = new BAlert("error", buffer, "OK"); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); diff --git a/src/apps/debuganalyzer/gui/table/Table.cpp b/src/apps/debuganalyzer/gui/table/Table.cpp index 70819add04..2eb7b93cc3 100644 --- a/src/apps/debuganalyzer/gui/table/Table.cpp +++ b/src/apps/debuganalyzer/gui/table/Table.cpp @@ -63,6 +63,12 @@ TableModelListener::TableRowsChanged(TableModel* model, int32 rowIndex, } +void +TableModelListener::TableModelReset(TableModel* model) +{ +} + + // #pragma mark - TableModel @@ -118,6 +124,17 @@ TableModel::NotifyRowsChanged(int32 rowIndex, int32 count) } +void +TableModel::NotifyTableModelReset() +{ + int32 listenerCount = fListeners.CountItems(); + for (int32 i = listenerCount - 1; i >= 0; i--) { + TableModelListener* listener = fListeners.ItemAt(i); + listener->TableModelReset(this); + } +} + + // #pragma mark - TableSelectionModel TableSelectionModel::TableSelectionModel(Table* table) @@ -616,6 +633,12 @@ Table::TableRowsAdded(TableModel* model, int32 rowIndex, int32 count) void Table::TableRowsRemoved(TableModel* model, int32 rowIndex, int32 count) { + if (rowIndex == 0 && count == fRows.CountItems()) { + fRows.MakeEmpty(); + Clear(); + return; + } + for (int32 i = rowIndex + count - 1; i >= rowIndex; i--) { if (BRow* row = fRows.RemoveItemAt(i)) { RemoveRow(row); @@ -639,6 +662,14 @@ Table::TableRowsChanged(TableModel* model, int32 rowIndex, int32 count) } +void +Table::TableModelReset(TableModel* model) +{ + Clear(); + TableRowsAdded(model, 0, model->CountRows()); +} + + void Table::ItemInvoked() { diff --git a/src/apps/debuganalyzer/gui/table/Table.h b/src/apps/debuganalyzer/gui/table/Table.h index 1018849c85..99abf6853e 100644 --- a/src/apps/debuganalyzer/gui/table/Table.h +++ b/src/apps/debuganalyzer/gui/table/Table.h @@ -29,6 +29,7 @@ public: int32 rowIndex, int32 count); virtual void TableRowsChanged(TableModel* model, int32 rowIndex, int32 count); + virtual void TableModelReset(TableModel* model); }; @@ -51,6 +52,7 @@ protected: void NotifyRowsAdded(int32 rowIndex, int32 count); void NotifyRowsRemoved(int32 rowIndex, int32 count); void NotifyRowsChanged(int32 rowIndex, int32 count); + void NotifyTableModelReset(); protected: ListenerList fListeners; @@ -154,6 +156,7 @@ private: int32 rowIndex, int32 count); virtual void TableRowsChanged(TableModel* model, int32 rowIndex, int32 count); + virtual void TableModelReset(TableModel* model); private: class Column; diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.cpp b/src/apps/debuganalyzer/gui/table/TreeTable.cpp index 851342a4cd..c69149ed9b 100644 --- a/src/apps/debuganalyzer/gui/table/TreeTable.cpp +++ b/src/apps/debuganalyzer/gui/table/TreeTable.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -156,6 +156,12 @@ TreeTableModelListener::TableNodesChanged(TreeTableModel* model, } +void +TreeTableModelListener::TableModelReset(TreeTableModel* model) +{ +} + + // #pragma mark - TreeTableModel @@ -227,6 +233,16 @@ TreeTableModel::NotifyNodesChanged(const TreeTablePath& path, int32 childIndex, } +void +TreeTableModel::NotifyTableModelReset() +{ + int32 listenerCount = fListeners.CountItems(); + for (int32 i = listenerCount - 1; i >= 0; i--) { + TreeTableModelListener* listener = fListeners.ItemAt(i); + listener->TableModelReset(this); + } +} + // #pragma mark - TreeTableToolTipProvider @@ -965,6 +981,15 @@ TreeTable::TableNodesChanged(TreeTableModel* model, const TreeTablePath& path, } +void +TreeTable::TableModelReset(TreeTableModel* model) +{ + _RemoveChildRows(fRootNode, 0, fRootNode->CountChildren()); + _AddChildRows(fRootNode, 0, fModel->CountChildren( + fModel->Root()), fModel->CountColumns()); +} + + void TreeTable::ExpandOrCollapse(BRow* _row, bool expand) { @@ -1038,6 +1063,14 @@ void TreeTable::_RemoveChildRows(TreeTableNode* parentNode, int32 childIndex, int32 count) { + // check if the removal request would in effect remove all + // existing nodes. + if (parentNode == fRootNode && childIndex == 0 + && count == parentNode->CountChildren()) { + Clear(); + return; + } + for (int32 i = childIndex + count - 1; i >= childIndex; i--) { if (TreeTableNode* child = parentNode->RemoveChild(i)) { int32 childCount = child->CountChildren(); diff --git a/src/apps/debuganalyzer/gui/table/TreeTable.h b/src/apps/debuganalyzer/gui/table/TreeTable.h index b006e083f1..81d8924a7a 100644 --- a/src/apps/debuganalyzer/gui/table/TreeTable.h +++ b/src/apps/debuganalyzer/gui/table/TreeTable.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef TREE_TABLE_H @@ -61,6 +61,7 @@ public: virtual void TableNodesChanged(TreeTableModel* model, const TreeTablePath& path, int32 childIndex, int32 count); + virtual void TableModelReset(TreeTableModel* model); }; @@ -93,6 +94,7 @@ protected: int32 childIndex, int32 count); void NotifyNodesChanged(const TreeTablePath& path, int32 childIndex, int32 count); + void NotifyTableModelReset(); protected: ListenerList fListeners; @@ -217,6 +219,7 @@ private: virtual void TableNodesChanged(TreeTableModel* model, const TreeTablePath& path, int32 childIndex, int32 count); + virtual void TableModelReset(TreeTableModel* model); private: class Column; diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index 295b0542c8..9b2db4333a 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include @@ -279,7 +281,8 @@ get_debugged_program(const Options& options, DebuggedProgramInfo& _info) static TeamDebugger* start_team_debugger(team_id teamID, SettingsManager* settingsManager, TeamDebugger::Listener* listener, thread_id threadID = -1, - bool stopInMain = false, UserInterface* userInterface = NULL) + bool stopInMain = false, UserInterface* userInterface = NULL, + status_t* _result = NULL) { if (teamID < 0) return NULL; @@ -307,11 +310,13 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager, printf("Error: debugger for team %" B_PRId32 " failed to init: %s!\n", teamID, strerror(error)); delete debugger; - return NULL; + debugger = NULL; } else printf("debugger for team %" B_PRId32 " created and initialized " "successfully!\n", teamID); + if (_result != NULL) + *_result = error; return debugger; } @@ -342,6 +347,9 @@ private: TeamDebugger* _FindTeamDebugger(team_id teamID) const; + status_t _StartNewTeam(const char* path, const char* args); + status_t _StartOrFindTeam(Options& options); + private: SettingsManager fSettingsManager; TeamDebuggerList fTeamDebuggers; @@ -433,6 +441,20 @@ Debugger::MessageReceived(BMessage* message) start_team_debugger(teamID, &fSettingsManager, this); break; } + case MSG_START_NEW_TEAM: + { + const char* teamPath = NULL; + const char* args = NULL; + + message->FindString("path", &teamPath); + message->FindString("arguments", &args); + + status_t result = _StartNewTeam(teamPath, args); + BMessage reply; + reply.AddInt32("status", result); + message->SendReply(&reply); + break; + } case MSG_TEAM_DEBUGGER_QUIT: { int32 threadID; @@ -467,20 +489,8 @@ Debugger::ArgvReceived(int32 argc, char** argv) return; } - DebuggedProgramInfo programInfo; - if (!get_debugged_program(options, programInfo)) - return; + _StartOrFindTeam(options); - TeamDebugger* debugger = _FindTeamDebugger(programInfo.team); - if (debugger != NULL) { - printf("There's already a debugger for team: %" B_PRId32 "\n", - programInfo.team); - debugger->Activate(); - return; - } - - start_team_debugger(programInfo.team, &fSettingsManager, this, - programInfo.thread, programInfo.stopInMain); } @@ -557,6 +567,57 @@ Debugger::_FindTeamDebugger(team_id teamID) const } +status_t +Debugger::_StartNewTeam(const char* path, const char* args) +{ + if (path == NULL) + return B_BAD_VALUE; + + BString data; + data.SetToFormat("%s %s", path, args); + if (data.Length() == 0) + return B_NO_MEMORY; + + ArgumentVector argVector; + argVector.Parse(data.String()); + + Options options; + options.commandLineArgc = argVector.ArgumentCount(); + if (options.commandLineArgc <= 0) + return B_BAD_VALUE; + + char** argv = argVector.DetachArguments(); + + options.commandLineArgv = argv; + MemoryDeleter deleter(argv); + + return _StartOrFindTeam(options); +} + + +status_t +Debugger::_StartOrFindTeam(Options& options) +{ + DebuggedProgramInfo programInfo; + if (!get_debugged_program(options, programInfo)) + return B_BAD_VALUE; + + TeamDebugger* debugger = _FindTeamDebugger(programInfo.team); + if (debugger != NULL) { + printf("There's already a debugger for team: %" B_PRId32 "\n", + programInfo.team); + debugger->Activate(); + return B_OK; + } + + status_t result; + start_team_debugger(programInfo.team, &fSettingsManager, this, + programInfo.thread, programInfo.stopInMain, NULL, &result); + + return result; +} + + // #pragma mark - CliDebugger diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 139f5a9adb..39a1c4fd6f 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -156,6 +156,7 @@ Application Debugger : SymbolInfo.cpp SystemInfo.cpp Team.cpp + TeamInfo.cpp TeamMemory.cpp TeamMemoryBlock.cpp TeamTypeInformation.cpp @@ -226,6 +227,7 @@ Application Debugger : MemoryView.cpp # user_interface/gui/teams_window + StartTeamWindow.cpp TeamsWindow.cpp TeamsListView.cpp @@ -265,6 +267,7 @@ Application Debugger : ArchivingUtils.cpp BitBuffer.cpp IntegerFormatter.cpp + RangeList.cpp StringUtils.cpp Worker.cpp @@ -327,7 +330,7 @@ Application Debugger : libexpression_parser.a libmapm.a libedit.a - libtermcap.a + libncurses.a $(TARGET_LIBSTDC++) be tracker libbsd.so libdebug.so diff --git a/src/apps/debugger/MessageCodes.h b/src/apps/debugger/MessageCodes.h index 610935a959..ae81129ab3 100644 --- a/src/apps/debugger/MessageCodes.h +++ b/src/apps/debugger/MessageCodes.h @@ -8,6 +8,7 @@ enum { MSG_THREAD_RUN = 'run_', + MSG_THREAD_SET_ADDRESS = 'sead', MSG_THREAD_STOP = 'stop', MSG_THREAD_STEP_OVER = 'stov', MSG_THREAD_STEP_INTO = 'stin', @@ -49,13 +50,17 @@ enum { MSG_TEAM_DEBUGGER_QUIT = 'dbqt', MSG_SHOW_TEAMS_WINDOW = 'stsw', MSG_TEAMS_WINDOW_CLOSED = 'tswc', + MSG_START_NEW_TEAM = 'sttt', MSG_DEBUG_THIS_TEAM = 'dbtt', MSG_SHOW_INSPECTOR_WINDOW = 'sirw', MSG_INSPECTOR_WINDOW_CLOSED = 'irwc', MSG_INSPECT_ADDRESS = 'isad', MSG_SHOW_TYPECAST_NODE_PROMPT = 'stnp', + MSG_TYPECAST_TO_ARRAY = 'stta', MSG_TYPECAST_NODE = 'tyno', MSG_SHOW_WATCH_VARIABLE_PROMPT = 'swvp', + MSG_SHOW_CONTAINER_RANGE_PROMPT = 'scrp', + MSG_SET_CONTAINER_RANGE = 'chcr', MSG_GENERATE_DEBUG_REPORT = 'gdrp' }; diff --git a/src/apps/debugger/arch/CpuState.h b/src/apps/debugger/arch/CpuState.h index 44b845b649..5d50154178 100644 --- a/src/apps/debugger/arch/CpuState.h +++ b/src/apps/debugger/arch/CpuState.h @@ -21,13 +21,22 @@ class CpuState : public BReferenceable { public: virtual ~CpuState(); + virtual status_t Clone(CpuState*& _clone) const = 0; + + virtual status_t UpdateDebugState(void* state, size_t size) + const = 0; + virtual target_addr_t InstructionPointer() const = 0; + virtual void SetInstructionPointer( + target_addr_t address) = 0; + virtual target_addr_t StackFramePointer() const = 0; virtual target_addr_t StackPointer() const = 0; virtual bool GetRegisterValue(const Register* reg, BVariant& _value) const = 0; virtual bool SetRegisterValue(const Register* reg, const BVariant& value) = 0; + }; diff --git a/src/apps/debugger/arch/x86/CpuStateX86.cpp b/src/apps/debugger/arch/x86/CpuStateX86.cpp index 236c5054c3..9ec0e156af 100644 --- a/src/apps/debugger/arch/x86/CpuStateX86.cpp +++ b/src/apps/debugger/arch/x86/CpuStateX86.cpp @@ -1,11 +1,15 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #include "CpuStateX86.h" +#include + +#include + #include "Register.h" @@ -47,6 +51,53 @@ CpuStateX86::~CpuStateX86() } +status_t +CpuStateX86::Clone(CpuState*& _clone) const +{ + CpuStateX86* newState = new(std::nothrow) CpuStateX86(); + if (newState == NULL) + return B_NO_MEMORY; + + + memcpy(newState->fIntRegisters, fIntRegisters, sizeof(fIntRegisters)); + newState->fSetRegisters = fSetRegisters; + newState->fInterruptVector = fInterruptVector; + + _clone = newState; + + return B_OK; +} + + +status_t +CpuStateX86::UpdateDebugState(void* state, size_t size) const +{ + if (size != sizeof(x86_debug_cpu_state)) + return B_BAD_VALUE; + + x86_debug_cpu_state* x86State = (x86_debug_cpu_state*)state; + + x86State->eip = InstructionPointer(); + x86State->user_esp = StackPointer(); + x86State->ebp = StackFramePointer(); + x86State->eax = IntRegisterValue(X86_REGISTER_EAX); + x86State->ebx = IntRegisterValue(X86_REGISTER_EBX); + x86State->ecx = IntRegisterValue(X86_REGISTER_ECX); + x86State->edx = IntRegisterValue(X86_REGISTER_EDX); + x86State->esi = IntRegisterValue(X86_REGISTER_ESI); + x86State->edi = IntRegisterValue(X86_REGISTER_EDI); + x86State->cs = IntRegisterValue(X86_REGISTER_CS); + x86State->ds = IntRegisterValue(X86_REGISTER_DS); + x86State->es = IntRegisterValue(X86_REGISTER_ES); + x86State->fs = IntRegisterValue(X86_REGISTER_FS); + x86State->gs = IntRegisterValue(X86_REGISTER_GS); + x86State->user_ss = IntRegisterValue(X86_REGISTER_SS); + x86State->vector = fInterruptVector; + + return B_OK; +} + + target_addr_t CpuStateX86::InstructionPointer() const { @@ -55,6 +106,13 @@ CpuStateX86::InstructionPointer() const } +void +CpuStateX86::SetInstructionPointer(target_addr_t address) +{ + SetIntRegister(X86_REGISTER_EIP, (uint32)address); +} + + target_addr_t CpuStateX86::StackFramePointer() const { diff --git a/src/apps/debugger/arch/x86/CpuStateX86.h b/src/apps/debugger/arch/x86/CpuStateX86.h index 795d331f82..d32e68c081 100644 --- a/src/apps/debugger/arch/x86/CpuStateX86.h +++ b/src/apps/debugger/arch/x86/CpuStateX86.h @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef CPU_STATE_X86_H @@ -44,7 +44,14 @@ public: CpuStateX86(const x86_debug_cpu_state& state); virtual ~CpuStateX86(); + virtual status_t Clone(CpuState*& _clone) const; + + virtual status_t UpdateDebugState(void* state, size_t size) + const; + virtual target_addr_t InstructionPointer() const; + virtual void SetInstructionPointer(target_addr_t address); + virtual target_addr_t StackFramePointer() const; virtual target_addr_t StackPointer() const; virtual bool GetRegisterValue(const Register* reg, diff --git a/src/apps/debugger/arch/x86_64/CpuStateX8664.cpp b/src/apps/debugger/arch/x86_64/CpuStateX8664.cpp index 1d562e02d0..daa5230010 100644 --- a/src/apps/debugger/arch/x86_64/CpuStateX8664.cpp +++ b/src/apps/debugger/arch/x86_64/CpuStateX8664.cpp @@ -1,12 +1,16 @@ /* * Copyright 2012, Alex Smith, alex@alex-smith.me.uk. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #include "CpuStateX8664.h" +#include + +#include + #include "Register.h" @@ -52,6 +56,59 @@ CpuStateX8664::~CpuStateX8664() } +status_t +CpuStateX8664::Clone(CpuState*& _clone) const +{ + CpuStateX8664* newState = new(std::nothrow) CpuStateX8664(); + if (newState == NULL) + return B_NO_MEMORY; + + + memcpy(newState->fIntRegisters, fIntRegisters, sizeof(fIntRegisters)); + newState->fSetRegisters = fSetRegisters; + + _clone = newState; + + return B_OK; +} + + +status_t +CpuStateX8664::UpdateDebugState(void* state, size_t size) const +{ + if (size != sizeof(x86_64_debug_cpu_state)) + return B_BAD_VALUE; + + x86_64_debug_cpu_state* x64State = (x86_64_debug_cpu_state*)state; + + x64State->rip = InstructionPointer(); + x64State->rsp = StackPointer(); + x64State->rbp = StackFramePointer(); + x64State->rax = IntRegisterValue(X86_64_REGISTER_RAX); + x64State->rbx = IntRegisterValue(X86_64_REGISTER_RBX); + x64State->rcx = IntRegisterValue(X86_64_REGISTER_RCX); + x64State->rdx = IntRegisterValue(X86_64_REGISTER_RDX); + x64State->rsi = IntRegisterValue(X86_64_REGISTER_RSI); + x64State->rdi = IntRegisterValue(X86_64_REGISTER_RDI); + x64State->r8 = IntRegisterValue(X86_64_REGISTER_R8); + x64State->r9 = IntRegisterValue(X86_64_REGISTER_R9); + x64State->r10 = IntRegisterValue(X86_64_REGISTER_R10); + x64State->r11 = IntRegisterValue(X86_64_REGISTER_R11); + x64State->r12 = IntRegisterValue(X86_64_REGISTER_R12); + x64State->r13 = IntRegisterValue(X86_64_REGISTER_R13); + x64State->r14 = IntRegisterValue(X86_64_REGISTER_R14); + x64State->r15 = IntRegisterValue(X86_64_REGISTER_R15); + x64State->cs = IntRegisterValue(X86_64_REGISTER_CS); + x64State->ds = IntRegisterValue(X86_64_REGISTER_DS); + x64State->es = IntRegisterValue(X86_64_REGISTER_ES); + x64State->fs = IntRegisterValue(X86_64_REGISTER_FS); + x64State->gs = IntRegisterValue(X86_64_REGISTER_GS); + x64State->ss = IntRegisterValue(X86_64_REGISTER_SS); + + return B_OK; +} + + target_addr_t CpuStateX8664::InstructionPointer() const { @@ -60,6 +117,13 @@ CpuStateX8664::InstructionPointer() const } +void +CpuStateX8664::SetInstructionPointer(target_addr_t address) +{ + SetIntRegister(X86_64_REGISTER_RIP, address); +} + + target_addr_t CpuStateX8664::StackFramePointer() const { diff --git a/src/apps/debugger/arch/x86_64/CpuStateX8664.h b/src/apps/debugger/arch/x86_64/CpuStateX8664.h index 2c52d60b90..de3f5b88f9 100644 --- a/src/apps/debugger/arch/x86_64/CpuStateX8664.h +++ b/src/apps/debugger/arch/x86_64/CpuStateX8664.h @@ -1,7 +1,7 @@ /* * Copyright 2012, Alex Smith, alex@alex-smith.me.uk. * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef CPU_STATE_X86_64_H @@ -54,7 +54,14 @@ public: CpuStateX8664(const x86_64_debug_cpu_state& state); virtual ~CpuStateX8664(); + virtual status_t Clone(CpuState*& _clone) const; + + virtual status_t UpdateDebugState(void* state, size_t size) + const; + virtual target_addr_t InstructionPointer() const; + virtual void SetInstructionPointer(target_addr_t address); + virtual target_addr_t StackFramePointer() const; virtual target_addr_t StackPointer() const; virtual bool GetRegisterValue(const Register* reg, diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp b/src/apps/debugger/controllers/DebugReportGenerator.cpp index 6abebe164c..66ac0f2966 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.cpp +++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp @@ -122,6 +122,10 @@ DebugReportGenerator::_GenerateReport(const entry_ref& outputPath) if (result != B_OK) return result; + result = _DumpRunningThreads(output); + if (result != B_OK) + return result; + result = _DumpLoadedImages(output); if (result != B_OK) return result; @@ -134,10 +138,6 @@ DebugReportGenerator::_GenerateReport(const entry_ref& outputPath) if (result != B_OK) return result; - result = _DumpRunningThreads(output); - if (result != B_OK) - return result; - result = file.Write(output.String(), output.Length()); if (result < 0) return result; @@ -248,22 +248,34 @@ DebugReportGenerator::_DumpLoadedImages(BString& _output) AutoLocker< ::Team> locker(fTeam); _output << "\nLoaded Images:\n"; + BObjectList images; BString data; for (ImageList::ConstIterator it = fTeam->Images().GetIterator(); Image* image = it.Next();) { + images.AddItem(image); + } + + images.SortItems(&_CompareImages); + + Image* image = NULL; + data.SetToFormat("\tID\t\tText Base\tText End\tData Base\tData" + " End\tType\tName\n\t"); + _output << data; + _output.Append('-', 80); + _output.Append("\n"); + for (int32 i = 0; (image = images.ItemAt(i)) != NULL; i++) { const ImageInfo& info = image->Info(); char buffer[32]; try { target_addr_t textBase = info.TextBase(); target_addr_t dataBase = info.DataBase(); - data.SetToFormat("\t%s (%" B_PRId32 ", %s) " - "Text: %#08" B_PRIx64 " - %#08" B_PRIx64 ", Data: %#08" - B_PRIx64 " - %#08" B_PRIx64 "\n", info.Name().String(), - info.ImageID(), UiUtils::ImageTypeToString(info.Type(), - buffer, sizeof(buffer)), textBase, - textBase + info.TextSize(), dataBase, - dataBase + info.DataSize()); + data.SetToFormat("\t%" B_PRId32 "\t0x%08" B_PRIx64 "\t" + "0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t" + "%-7s\t%s\n", info.ImageID(), textBase, textBase + info.TextSize(), + dataBase, dataBase + info.DataSize(), + UiUtils::ImageTypeToString(info.Type(), buffer, + sizeof(buffer)), info.Name().String()); _output << data; } catch (...) { @@ -283,22 +295,27 @@ DebugReportGenerator::_DumpAreas(BString& _output) if (result != B_OK) return result; + areas.SortItems(&_CompareAreas); + _output << "\nAreas:\n"; BString data; + data.SetToFormat("\tID\t\tBase\t\tEnd\t\t\tSize (KiB)\tProtection\tLocking\t\t\tName\n\t"); + _output << data; + _output.Append('-', 80); + _output.Append("\n"); AreaInfo* info; BString protectionBuffer; char lockingBuffer[32]; for (int32 i = 0; (info = areas.ItemAt(i)) != NULL; i++) { try { - data.SetToFormat("\t%s (%" B_PRId32 ") " - "Base: %#08" B_PRIx64 ", Size: %" B_PRId64 - ", RAM Size: %" B_PRId64 ",Locking: %s, Protection: %s\n", - info->Name().String(), info->AreaID(), info->BaseAddress(), - info->Size(), info->RamSize(), - UiUtils::AreaLockingFlagsToString(info->Lock(), lockingBuffer, - sizeof(lockingBuffer)), + data.SetToFormat("\t%" B_PRId32 "\t0x%08" B_PRIx64 "\t" + "0x%08" B_PRIx64 "\t%10" B_PRId64 "\t%-11s\t%-14s\t%s\n", + info->AreaID(), info->BaseAddress(), info->BaseAddress() + + info->Size(), info->Size() / 1024, UiUtils::AreaProtectionFlagsToString(info->Protection(), - protectionBuffer).String()); + protectionBuffer).String(), + UiUtils::AreaLockingFlagsToString(info->Lock(), lockingBuffer, + sizeof(lockingBuffer)), info->Name().String()); _output << data; } catch (...) { @@ -306,6 +323,9 @@ DebugReportGenerator::_DumpAreas(BString& _output) } } + _output << "\nProtection Flags: r - read, w - write, x - execute, " + "s - stack, o - overcommit, c - cloneable, S - shared, k - kernel\n"; + return B_OK; } @@ -318,15 +338,20 @@ DebugReportGenerator::_DumpSemaphores(BString& _output) if (result != B_OK) return result; + semaphores.SortItems(&_CompareSemaphores); + _output << "\nSemaphores:\n"; BString data; + data.SetToFormat("\tID\t\tCount\tLast Holder\tName\n\t"); + _output << data; + _output.Append('-', 60); + _output.Append("\n"); SemaphoreInfo* info; for (int32 i = 0; (info = semaphores.ItemAt(i)) != NULL; i++) { try { - data.SetToFormat("\t%s (%" B_PRId32 ") " - "Count: %" B_PRId32 ", Latest Holding Thread: %" B_PRId32 "\n", - info->Name().String(), info->SemID(), info->Count(), - info->LatestHolder()); + data.SetToFormat("\t%" B_PRId32 "\t%5" B_PRId32 "\t%11" B_PRId32 + "\t%s\n", info->SemID(), info->Count(), + info->LatestHolder(), info->Name().String()); _output << data; } catch (...) { @@ -346,24 +371,30 @@ DebugReportGenerator::_DumpRunningThreads(BString& _output) _output << "\nActive Threads:\n"; BString data; status_t result = B_OK; + BObjectList< ::Thread> threads; + ::Thread* thread; for (ThreadList::ConstIterator it = fTeam->Threads().GetIterator(); - ::Thread* thread = it.Next();) { + (thread = it.Next());) { + threads.AddItem(thread); + } + + threads.SortItems(&_CompareThreads); + for (int32 i = 0; (thread = threads.ItemAt(i)) != NULL; i++) { try { - data.SetToFormat("\t%s %s, id: %" B_PRId32", state: %s", + data.SetToFormat("\tthread %" B_PRId32 ": %s %s", thread->ID(), thread->Name(), thread->IsMainThread() - ? "(main)" : "", thread->ID(), - UiUtils::ThreadStateToString(thread->State(), - thread->StoppedReason())); - - if (thread->State() == THREAD_STATE_STOPPED) { - const BString& stoppedInfo = thread->StoppedReasonInfo(); - if (stoppedInfo.Length() != 0) - data << " (" << stoppedInfo << ")"; - } - + ? "(main)" : ""); _output << data << "\n"; if (thread->State() == THREAD_STATE_STOPPED) { + data.SetToFormat("\t\tstate: %s", + UiUtils::ThreadStateToString(thread->State(), + thread->StoppedReason())); + const BString& stoppedInfo = thread->StoppedReasonInfo(); + if (stoppedInfo.Length() != 0) + data << " (" << stoppedInfo << ")"; + _output << data << "\n\n"; + // we need to release our lock on the team here // since we might need to block and wait // on the stack trace. @@ -554,3 +585,51 @@ DebugReportGenerator::_HandleMemoryBlockRetrieved(TeamMemoryBlock* block, fCurrentBlock = block; release_sem(fTeamDataSem); } + + +/*static*/ int +DebugReportGenerator::_CompareAreas(const AreaInfo* a, const AreaInfo* b) +{ + if (a->BaseAddress() < b->BaseAddress()) + return -1; + + return 1; +} + + +/*static*/ int +DebugReportGenerator::_CompareImages(const Image* a, const Image* b) +{ + if (a->Info().TextBase() < b->Info().TextBase()) + return -1; + + return 1; +} + + +/*static*/ int +DebugReportGenerator::_CompareSemaphores(const SemaphoreInfo* a, + const SemaphoreInfo* b) +{ + if (a->SemID() < b->SemID()) + return -1; + + return 1; +} + + +/*static*/ int +DebugReportGenerator::_CompareThreads(const ::Thread* a, + const ::Thread* b) +{ + // sort stopped threads last, otherwise sort by thread ID + if (a->State() == b->State()) + return a->ID() < b->ID() ? -1 : 1; + + if (a->State() == THREAD_STATE_STOPPED && b->State() + != THREAD_STATE_STOPPED) { + return 1; + } + + return -1; +} diff --git a/src/apps/debugger/controllers/DebugReportGenerator.h b/src/apps/debugger/controllers/DebugReportGenerator.h index f19fa1bf97..13746e9502 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.h +++ b/src/apps/debugger/controllers/DebugReportGenerator.h @@ -15,8 +15,10 @@ class entry_ref; class Architecture; +class AreaInfo; class BString; class DebuggerInterface; +class SemaphoreInfo; class StackFrame; class Team; class Thread; @@ -77,6 +79,13 @@ private: void _HandleMemoryBlockRetrieved( TeamMemoryBlock* block, status_t result); + static int _CompareAreas(const AreaInfo* a, + const AreaInfo* b); + static int _CompareImages(const Image* a, const Image* b); + static int _CompareSemaphores(const SemaphoreInfo* a, + const SemaphoreInfo* b); + static int _CompareThreads(const ::Thread* a, + const ::Thread* b); private: ::Team* fTeam; Architecture* fArchitecture; diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 433e8ef61c..63d7ba5ee3 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010-2011, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -39,6 +39,7 @@ #include "Statement.h" #include "SymbolInfo.h" #include "TeamDebugInfo.h" +#include "TeamInfo.h" #include "TeamMemoryBlock.h" #include "TeamMemoryBlockManager.h" #include "TeamSettings.h" @@ -338,9 +339,8 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain) return error; // check whether the team exists at all - // TODO: That should be done in the debugger interface! - team_info teamInfo; - error = get_team_info(fTeamID, &teamInfo); + TeamInfo teamInfo; + error = fDebuggerInterface->GetTeamInfo(teamInfo); if (error != B_OK) return error; @@ -354,7 +354,7 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool stopInMain) error = fTeam->Init(); if (error != B_OK) return error; - fTeam->SetName(teamInfo.args); + fTeam->SetName(teamInfo.Arguments()); // TODO: Set a better name! fTeam->AddListener(this); @@ -530,17 +530,22 @@ TeamDebugger::MessageReceived(BMessage* message) { switch (message->what) { case MSG_THREAD_RUN: + case MSG_THREAD_SET_ADDRESS: case MSG_THREAD_STOP: case MSG_THREAD_STEP_OVER: case MSG_THREAD_STEP_INTO: case MSG_THREAD_STEP_OUT: { int32 threadID; + target_addr_t address; if (message->FindInt32("thread", &threadID) != B_OK) break; + if (message->FindUInt64("address", &address) != B_OK) + address = 0; + if (ThreadHandler* handler = _GetThreadHandler(threadID)) { - handler->HandleThreadAction(message->what); + handler->HandleThreadAction(message->what, address); handler->ReleaseReference(); } break; @@ -801,10 +806,11 @@ TeamDebugger::ValueNodeValueRequested(CpuState* cpuState, void TeamDebugger::ThreadActionRequested(thread_id threadID, - uint32 action) + uint32 action, target_addr_t address) { BMessage message(action); message.AddInt32("thread", threadID); + message.AddUInt64("address", address); PostMessage(&message); } @@ -1145,10 +1151,14 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) //printf("B_DEBUGGER_MESSAGE_TEAM_CREATED: team: %ld\n", message.team_created.new_team); // break; case B_DEBUGGER_MESSAGE_TEAM_DELETED: - // TODO: Handle! + { TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %" B_PRId32 "\n", event->Team()); + TeamDeletedEvent* teamEvent + = dynamic_cast(event); + handled = _HandleTeamDeleted(teamEvent); break; + } case B_DEBUGGER_MESSAGE_TEAM_EXEC: TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_EXEC: team: %" B_PRId32 "\n", event->Team()); @@ -1226,6 +1236,20 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } +bool +TeamDebugger::_HandleTeamDeleted(TeamDeletedEvent* event) +{ + char message[64]; + snprintf(message, sizeof(message), "Team %" B_PRId32 " has terminated.", + event->Team()); + fUserInterface->SynchronouslyAskUser("Quit Debugger", message, "Quit", + NULL, NULL); + PostMessage(B_QUIT_REQUESTED); + + return true; +} + + bool TeamDebugger::_HandleThreadCreated(ThreadCreatedEvent* event) { diff --git a/src/apps/debugger/controllers/TeamDebugger.h b/src/apps/debugger/controllers/TeamDebugger.h index b8b43478af..6b5e33b010 100644 --- a/src/apps/debugger/controllers/TeamDebugger.h +++ b/src/apps/debugger/controllers/TeamDebugger.h @@ -60,7 +60,7 @@ private: ValueNodeContainer* container, ValueNode* valueNode); virtual void ThreadActionRequested(thread_id threadID, - uint32 action); + uint32 action, target_addr_t address); virtual void SetBreakpointRequested(target_addr_t address, bool enabled); virtual void SetBreakpointEnabledRequested( @@ -116,6 +116,8 @@ private: void _HandleDebuggerMessage(DebugEvent* event); + bool _HandleTeamDeleted( + TeamDeletedEvent* event); bool _HandleThreadCreated( ThreadCreatedEvent* event); bool _HandleThreadRenamed( diff --git a/src/apps/debugger/controllers/ThreadHandler.cpp b/src/apps/debugger/controllers/ThreadHandler.cpp index 72e519b70b..2a84a5b444 100644 --- a/src/apps/debugger/controllers/ThreadHandler.cpp +++ b/src/apps/debugger/controllers/ThreadHandler.cpp @@ -37,7 +37,8 @@ enum { STEP_NONE, STEP_OVER, STEP_INTO, - STEP_OUT + STEP_OUT, + STEP_UNTIL }; @@ -124,7 +125,7 @@ ThreadHandler::HandleBreakpointHit(BreakpointHitEvent* event) // check whether this is a temporary breakpoint we're waiting for if (fBreakpointAddress != 0 && instructionPointer == fBreakpointAddress && fStepMode != STEP_NONE) { - if (_HandleBreakpointHitStep(cpuState)) + if (fStepMode != STEP_UNTIL && _HandleBreakpointHitStep(cpuState)) return true; } else { // Might be a user breakpoint, but could as well be a temporary @@ -199,7 +200,7 @@ ThreadHandler::HandleExceptionOccurred(ExceptionOccurredEvent* event) void -ThreadHandler::HandleThreadAction(uint32 action) +ThreadHandler::HandleThreadAction(uint32 action, target_addr_t address) { AutoLocker locker(fThread->GetTeam()); @@ -219,6 +220,11 @@ ThreadHandler::HandleThreadAction(uint32 action) BReference cpuStateReference(cpuState); BReference stackTraceReference(stackTrace); + if (action == MSG_THREAD_SET_ADDRESS) { + _HandleSetAddress(cpuState, address); + return; + } + // When continuing the thread update thread state before actually issuing // the command, since we need to unlock. if (action != MSG_THREAD_STOP) { @@ -230,7 +236,9 @@ ThreadHandler::HandleThreadAction(uint32 action) switch (action) { case MSG_THREAD_RUN: - fStepMode = STEP_NONE; + fStepMode = address != 0 ? STEP_UNTIL : STEP_NONE; + if (address != 0) + _InstallTemporaryBreakpoint(address); _RunThread(0); return; case MSG_THREAD_STOP: @@ -269,6 +277,7 @@ ThreadHandler::HandleThreadAction(uint32 action) TRACE_CONTROL(" ip: %#" B_PRIx64 "\n", frame->InstructionPointer()); + target_addr_t frameIP = frame->GetCpuState()->InstructionPointer(); // When the thread is in a syscall, do the same for all step kinds: Stop it // when it returns by means of a breakpoint. if (frame->Type() == STACK_FRAME_TYPE_SYSCALL) { @@ -284,15 +293,14 @@ ThreadHandler::HandleThreadAction(uint32 action) // The second issue is that the temporary breakpoint is probably not necessary // anymore, since single-stepping over "syscall" instructions should just work // as expected. - status_t error = _InstallTemporaryBreakpoint( - frame->GetCpuState()->InstructionPointer()); + status_t error = _InstallTemporaryBreakpoint(frameIP); if (error != B_OK) { _StepFallback(); return; } fStepMode = STEP_OUT; - _RunThread(frame->GetCpuState()->InstructionPointer()); + _RunThread(frameIP); return; } @@ -303,9 +311,10 @@ ThreadHandler::HandleThreadAction(uint32 action) _StepFallback(); return; } + fPreviousInstructionPointer = frameIP; fPreviousFrameAddress = frame->FrameAddress(); fStepMode = STEP_OUT; - _RunThread(frame->GetCpuState()->InstructionPointer()); + _RunThread(frameIP); return; } @@ -324,7 +333,7 @@ ThreadHandler::HandleThreadAction(uint32 action) if (action == MSG_THREAD_STEP_INTO) { // step into fStepMode = STEP_INTO; - _SingleStepThread(frame->GetCpuState()->InstructionPointer()); + _SingleStepThread(frameIP); } else { fPreviousFrameAddress = frame->FrameAddress(); // step over @@ -408,6 +417,26 @@ ThreadHandler::_HandleThreadStopped(CpuState* cpuState, uint32 stoppedReason, } +bool +ThreadHandler::_HandleSetAddress(CpuState* state, target_addr_t address) +{ + CpuState* newState = NULL; + if (state->Clone(newState) != B_OK) + return false; + BReference stateReference(newState, true); + + newState->SetInstructionPointer(address); + if (fDebuggerInterface->SetCpuState(fThread->ID(), newState) != B_OK) + return false; + + AutoLocker locker(fThread->GetTeam()); + fThread->SetStackTrace(NULL); + fThread->SetCpuState(newState); + + return true; +} + + void ThreadHandler::_SetThreadState(uint32 state, CpuState* cpuState, uint32 stoppedReason, const BString& stoppedReasonInfo) @@ -648,7 +677,7 @@ ThreadHandler::_HandleBreakpointHitStep(CpuState* cpuState) " - step out adding return value\n", cpuState ->StackFramePointer(), fPreviousFrameAddress); ReturnValueInfo* info = new(std::nothrow) ReturnValueInfo( - cpuState->InstructionPointer(), cpuState); + fPreviousInstructionPointer, cpuState); if (info == NULL) return false; BReference infoReference(info, true); @@ -730,8 +759,8 @@ ThreadHandler::_HandleSingleStepStep(CpuState* cpuState) TRACE_CONTROL("ThreadHandler::_HandleSingleStepStep() " " - adding return value for STEP_OVER\n"); ReturnValueInfo* info = new(std::nothrow) - ReturnValueInfo(cpuState->InstructionPointer(), - cpuState); + ReturnValueInfo(fStepStatement + ->CoveringAddressRange().Start(), cpuState); if (info == NULL) return false; BReference infoReference(info, true); diff --git a/src/apps/debugger/controllers/ThreadHandler.h b/src/apps/debugger/controllers/ThreadHandler.h index 4fd078565a..3a79f601c5 100644 --- a/src/apps/debugger/controllers/ThreadHandler.h +++ b/src/apps/debugger/controllers/ThreadHandler.h @@ -53,7 +53,8 @@ public: bool HandleExceptionOccurred( ExceptionOccurredEvent* event); - void HandleThreadAction(uint32 action); + void HandleThreadAction(uint32 action, + target_addr_t address); void HandleThreadStateChanged(); void HandleCpuStateChanged(); @@ -69,6 +70,9 @@ private: const BString& stoppedReasonInfo = BString()); + bool _HandleSetAddress(CpuState* cpuState, + target_addr_t address); + void _SetThreadState(uint32 state, CpuState* cpuState, uint32 stoppedReason, const BString& stoppedReasonInfo); diff --git a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp index 8aa49b4c48..4cd65c460e 100644 --- a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -42,9 +43,10 @@ DebuggerImageDebugInfo::Init() status_t -DebuggerImageDebugInfo::GetFunctions(BObjectList& functions) +DebuggerImageDebugInfo::GetFunctions(const BObjectList& symbols, + BObjectList& functions) { - return SpecificImageDebugInfo::GetFunctionsFromSymbols(functions, + return SpecificImageDebugInfo::GetFunctionsFromSymbols(symbols, functions, fDebuggerInterface, fImageInfo, this); } diff --git a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h index efe5816b58..e491f50c98 100644 --- a/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h +++ b/src/apps/debugger/debug_info/DebuggerImageDebugInfo.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef DEBUGGER_IMAGE_DEBUG_INFO_H @@ -26,6 +27,7 @@ public: status_t Init(); virtual status_t GetFunctions( + const BObjectList& symbols, BObjectList& functions); virtual status_t GetType(GlobalTypeCache* cache, const BString& name, diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index b9dad3117d..254fd36ce0 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -299,7 +299,8 @@ DwarfImageDebugInfo::Init() status_t -DwarfImageDebugInfo::GetFunctions(BObjectList& functions) +DwarfImageDebugInfo::GetFunctions(const BObjectList& symbols, + BObjectList& functions) { TRACE_IMAGES("DwarfImageDebugInfo::GetFunctions()\n"); TRACE_IMAGES(" %" B_PRId32 " compilation units\n", @@ -413,9 +414,14 @@ DwarfImageDebugInfo::GetFunctions(BObjectList& functions) return B_OK; // if we had no compilation units, fall back to providing basic - // debug infos with DWARF-supported call frame unwinding - return SpecificImageDebugInfo::GetFunctionsFromSymbols(functions, - fDebuggerInterface, fImageInfo, this); + // debug infos with DWARF-supported call frame unwinding, + // if available. + if (fFile->HasFrameInformation()) { + return SpecificImageDebugInfo::GetFunctionsFromSymbols(symbols, + functions, fDebuggerInterface, fImageInfo, this); + } + + return B_OK; } @@ -1106,6 +1112,8 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, status_t result = B_OK; ImageDebugInfo* imageInfo = image->GetImageDebugInfo(); FunctionInstance* targetFunction; + target_size_t addressSize = fDebuggerInterface->GetArchitecture() + ->AddressSize(); if (subroutineAddress >= fPLTSectionStart && subroutineAddress < fPLTSectionEnd) { // if the function in question is position-independent, the call @@ -1118,8 +1126,6 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, return B_BAD_VALUE; } - target_size_t addressSize = fDebuggerInterface->GetArchitecture() - ->AddressSize(); ssize_t bytesRead = fDebuggerInterface->ReadMemory( info.TargetAddress(), &subroutineAddress, addressSize); @@ -1155,6 +1161,11 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, } else byteSize = returnType->ByteSize()->constant; + // if we were unable to determine a size for the type, + // simply default to the architecture's register width. + if (byteSize == 0) + byteSize = addressSize; + ValueLocation* location; result = fArchitecture->GetReturnAddressLocation(frame, byteSize, location); diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.h b/src/apps/debugger/debug_info/DwarfImageDebugInfo.h index 422925a9b9..0a2daf2e48 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.h +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010-2012, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef DWARF_IMAGE_DEBUG_INFO_H @@ -52,6 +52,7 @@ public: { return fRelocationDelta; } virtual status_t GetFunctions( + const BObjectList& symbols, BObjectList& functions); virtual status_t GetType(GlobalTypeCache* cache, const BString& name, diff --git a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp index ed28f8820c..032c129f5c 100644 --- a/src/apps/debugger/debug_info/DwarfTypeFactory.cpp +++ b/src/apps/debugger/debug_info/DwarfTypeFactory.cpp @@ -301,7 +301,6 @@ DwarfTypeFactory::CreateType(DIEType* typeEntry, DwarfType*& _type) // try the type cache first BString name; DwarfUtils::GetFullyQualifiedDIEName(typeEntry, name); -// TODO: The DIE may not have a name (e.g. pointer and reference types don't). TypeLookupConstraints constraints( dwarf_tag_to_type_kind(typeEntry->Tag())); diff --git a/src/apps/debugger/debug_info/ImageDebugInfo.cpp b/src/apps/debugger/debug_info/ImageDebugInfo.cpp index 2a39419a19..feeb5df0ff 100644 --- a/src/apps/debugger/debug_info/ImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/ImageDebugInfo.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -8,9 +8,11 @@ #include +#include "DebuggerInterface.h" #include "FunctionDebugInfo.h" #include "FunctionInstance.h" #include "SpecificImageDebugInfo.h" +#include "SymbolInfo.h" ImageDebugInfo::ImageDebugInfo(const ImageInfo& imageInfo) @@ -35,14 +37,21 @@ ImageDebugInfo::AddSpecificInfo(SpecificImageDebugInfo* info) status_t -ImageDebugInfo::FinishInit() +ImageDebugInfo::FinishInit(DebuggerInterface* interface) { + BObjectList symbols(50, true); + status_t error = interface->GetSymbolInfos(fImageInfo.TeamID(), + fImageInfo.ImageID(), symbols); + if (error != B_OK) + return error; + symbols.SortItems(&_CompareSymbols); + // get functions -- get them from most expressive debug info first and add // missing functions from less expressive debug infos for (int32 i = 0; SpecificImageDebugInfo* specificInfo = fSpecificInfos.ItemAt(i); i++) { BObjectList functions; - status_t error = specificInfo->GetFunctions(functions); + error = specificInfo->GetFunctions(symbols, functions); if (error != B_OK) return error; @@ -175,3 +184,11 @@ ImageDebugInfo::_CompareAddressFunction(const target_addr_t* address, return -1; return *address < function->Address() + function->Size() ? 0 : 1; } + + +/*static*/ int +ImageDebugInfo::_CompareSymbols(const SymbolInfo* a, const SymbolInfo* b) +{ + return a->Address() < b->Address() + ? -1 : (a->Address() == b->Address() ? 0 : 1); +} diff --git a/src/apps/debugger/debug_info/ImageDebugInfo.h b/src/apps/debugger/debug_info/ImageDebugInfo.h index 5f30ace950..395dfe2347 100644 --- a/src/apps/debugger/debug_info/ImageDebugInfo.h +++ b/src/apps/debugger/debug_info/ImageDebugInfo.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef IMAGE_DEBUG_INFO_H @@ -25,6 +25,7 @@ class FunctionInstance; class GlobalTypeCache; class LocatableFile; class SpecificImageDebugInfo; +class SymbolInfo; class Type; class TypeLookupConstraints; @@ -37,7 +38,7 @@ public: const ImageInfo& GetImageInfo() const { return fImageInfo; } bool AddSpecificInfo(SpecificImageDebugInfo* info); - status_t FinishInit(); + status_t FinishInit(DebuggerInterface* interface); status_t GetType(GlobalTypeCache* cache, const BString& name, @@ -65,6 +66,8 @@ private: static int _CompareAddressFunction( const target_addr_t* address, const FunctionInstance* function); + static int _CompareSymbols(const SymbolInfo* a, + const SymbolInfo* b); private: ImageInfo fImageInfo; diff --git a/src/apps/debugger/debug_info/SpecificImageDebugInfo.cpp b/src/apps/debugger/debug_info/SpecificImageDebugInfo.cpp index b2e363abf2..0be04e63fd 100644 --- a/src/apps/debugger/debug_info/SpecificImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/SpecificImageDebugInfo.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -19,19 +20,10 @@ SpecificImageDebugInfo::~SpecificImageDebugInfo() /*static*/ status_t SpecificImageDebugInfo::GetFunctionsFromSymbols( + const BObjectList& symbols, BObjectList& functions, DebuggerInterface* interface, const ImageInfo& imageInfo, SpecificImageDebugInfo* info) { - BObjectList symbols(20, true); - status_t error = interface->GetSymbolInfos(imageInfo.TeamID(), - imageInfo.ImageID(), symbols); - if (error != B_OK) - return error; - - // sort the symbols -- not necessary, but a courtesy to ImageDebugInfo which - // will peform better when inserting functions at the end of a list - symbols.SortItems(&_CompareSymbols); - // create the function infos int32 functionsAdded = 0; for (int32 i = 0; SymbolInfo* symbol = symbols.ItemAt(i); i++) { @@ -56,11 +48,3 @@ SpecificImageDebugInfo::GetFunctionsFromSymbols( return B_OK; } - -/*static*/ int -SpecificImageDebugInfo::_CompareSymbols(const SymbolInfo* a, - const SymbolInfo* b) -{ - return a->Address() < b->Address() - ? -1 : (a->Address() == b->Address() ? 0 : 1); -} diff --git a/src/apps/debugger/debug_info/SpecificImageDebugInfo.h b/src/apps/debugger/debug_info/SpecificImageDebugInfo.h index 02a1fa92e6..40d9f83a88 100644 --- a/src/apps/debugger/debug_info/SpecificImageDebugInfo.h +++ b/src/apps/debugger/debug_info/SpecificImageDebugInfo.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef SPECIFIC_IMAGE_DEBUG_INFO_H @@ -41,6 +42,7 @@ public: virtual ~SpecificImageDebugInfo(); virtual status_t GetFunctions( + const BObjectList& symbols, BObjectList& functions) = 0; // returns references @@ -87,14 +89,12 @@ public: protected: static status_t GetFunctionsFromSymbols( + const BObjectList& symbols, BObjectList& functions, DebuggerInterface* interface, const ImageInfo& imageInfo, SpecificImageDebugInfo* info); -private: - static int _CompareSymbols(const SymbolInfo* a, - const SymbolInfo* b); }; diff --git a/src/apps/debugger/debug_info/TeamDebugInfo.cpp b/src/apps/debugger/debug_info/TeamDebugInfo.cpp index 9a22093933..802f4a7094 100644 --- a/src/apps/debugger/debug_info/TeamDebugInfo.cpp +++ b/src/apps/debugger/debug_info/TeamDebugInfo.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -431,7 +431,7 @@ TeamDebugInfo::LoadImageDebugInfo(const ImageInfo& imageInfo, imageInfo); if (imageDebugInfo == NULL) return B_NO_MEMORY; - ObjectDeleter imageDebugInfoDeleter(imageDebugInfo); + BReference imageDebugInfoReference(imageDebugInfo, true); for (int32 i = 0; SpecificTeamDebugInfo* specificTeamInfo = fSpecificInfos.ItemAt(i); i++) { @@ -448,11 +448,11 @@ TeamDebugInfo::LoadImageDebugInfo(const ImageInfo& imageInfo, // fail only when out of memory } - status_t error = imageDebugInfo->FinishInit(); + status_t error = imageDebugInfo->FinishInit(fDebuggerInterface); if (error != B_OK) return error; - _imageDebugInfo = imageDebugInfoDeleter.Detach(); + _imageDebugInfo = imageDebugInfoReference.Detach(); return B_OK; } diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp index 641d9dc8d6..49a1a02abf 100644 --- a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp +++ b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp @@ -23,12 +23,14 @@ #include "ArchitectureX86.h" #include "ArchitectureX8664.h" #include "AreaInfo.h" +#include "AutoDeleter.h" #include "CpuState.h" #include "DebugEvent.h" #include "ImageInfo.h" #include "SemaphoreInfo.h" #include "SymbolInfo.h" #include "SystemInfo.h" +#include "TeamInfo.h" #include "ThreadInfo.h" @@ -482,6 +484,19 @@ DebuggerInterface::GetSystemInfo(SystemInfo& info) } +status_t +DebuggerInterface::GetTeamInfo(TeamInfo& info) +{ + team_info teamInfo; + status_t result = get_team_info(fTeamID, &teamInfo); + if (result != B_OK) + return result; + + info.SetTo(fTeamID, teamInfo); + return B_OK; +} + + status_t DebuggerInterface::GetThreadInfos(BObjectList& infos) { @@ -564,9 +579,9 @@ DebuggerInterface::GetSymbolInfos(team_id team, image_id image, BObjectList& infos) { // create a lookup context -// TODO: It's too expensive to create a lookup context for each image! debug_symbol_lookup_context* lookupContext; - status_t error = debug_create_symbol_lookup_context(team, &lookupContext); + status_t error = debug_create_symbol_lookup_context(team, image, + &lookupContext); if (error != B_OK) return error; @@ -609,10 +624,9 @@ DebuggerInterface::GetSymbolInfo(team_id team, image_id image, const char* name, int32 symbolType, SymbolInfo& info) { // create a lookup context - // TODO: It's a bit expensive to create a lookup context just for one - // symbol! debug_symbol_lookup_context* lookupContext; - status_t error = debug_create_symbol_lookup_context(team, &lookupContext); + status_t error = debug_create_symbol_lookup_context(team, image, + &lookupContext); if (error != B_OK) return error; @@ -650,24 +664,37 @@ DebuggerInterface::GetThreadInfo(thread_id thread, ThreadInfo& info) status_t DebuggerInterface::GetCpuState(thread_id thread, CpuState*& _state) { - DebugContextGetter contextGetter(fDebugContextPool); - - debug_nub_get_cpu_state message; - message.reply_port = contextGetter.Context()->reply_port; - message.thread = thread; - - debug_nub_get_cpu_state_reply reply; - - status_t error = send_debug_message(contextGetter.Context(), - B_DEBUG_MESSAGE_GET_CPU_STATE, &message, sizeof(message), &reply, - sizeof(reply)); + debug_cpu_state debugState; + status_t error = _GetDebugCpuState(thread, debugState); if (error != B_OK) return error; - if (reply.error != B_OK) - return reply.error; + return fArchitecture->CreateCpuState(&debugState, sizeof(debug_cpu_state), + _state); +} - return fArchitecture->CreateCpuState(&reply.cpu_state, - sizeof(debug_cpu_state), _state); + +status_t +DebuggerInterface::SetCpuState(thread_id thread, const CpuState* state) +{ + debug_cpu_state debugState; + status_t error = _GetDebugCpuState(thread, debugState); + if (error != B_OK) + return error; + + DebugContextGetter contextGetter(fDebugContextPool); + + error = state->UpdateDebugState(&debugState, sizeof(debugState)); + if (error != B_OK) + return error; + + debug_nub_set_cpu_state message; + message.thread = thread; + + memcpy(&message.cpu_state, &debugState, sizeof(debugState)); + + return send_debug_message(contextGetter.Context(), + B_DEBUG_MESSAGE_SET_CPU_STATE, &message, sizeof(message), NULL, + 0); } @@ -870,3 +897,28 @@ DebuggerInterface::_GetNextSystemWatchEvent(DebugEvent*& _event, return error; } + + +status_t +DebuggerInterface::_GetDebugCpuState(thread_id thread, debug_cpu_state& _state) +{ + DebugContextGetter contextGetter(fDebugContextPool); + + debug_nub_get_cpu_state message; + message.reply_port = contextGetter.Context()->reply_port; + message.thread = thread; + + debug_nub_get_cpu_state_reply reply; + + status_t error = send_debug_message(contextGetter.Context(), + B_DEBUG_MESSAGE_GET_CPU_STATE, &message, sizeof(message), &reply, + sizeof(reply)); + if (error != B_OK) + return error; + if (reply.error != B_OK) + return reply.error; + + memcpy(&_state, &reply.cpu_state, sizeof(debug_cpu_state)); + + return B_OK; +} diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.h b/src/apps/debugger/debugger_interface/DebuggerInterface.h index f726074da5..b4b32841ff 100644 --- a/src/apps/debugger/debugger_interface/DebuggerInterface.h +++ b/src/apps/debugger/debugger_interface/DebuggerInterface.h @@ -22,6 +22,7 @@ class ImageInfo; class SemaphoreInfo; class SymbolInfo; class SystemInfo; +class TeamInfo; class ThreadInfo; namespace BPrivate { @@ -56,6 +57,7 @@ public: virtual status_t UninstallWatchpoint(target_addr_t address); virtual status_t GetSystemInfo(SystemInfo& info); + virtual status_t GetTeamInfo(TeamInfo& info); virtual status_t GetThreadInfos(BObjectList& infos); virtual status_t GetImageInfos(BObjectList& infos); virtual status_t GetAreaInfos(BObjectList& infos); @@ -72,6 +74,8 @@ public: virtual status_t GetCpuState(thread_id thread, CpuState*& _state); // returns a reference to the caller + virtual status_t SetCpuState(thread_id thread, + const CpuState* state); // TeamMemory virtual ssize_t ReadMemory(target_addr_t address, void* buffer, @@ -92,6 +96,9 @@ private: status_t _GetNextSystemWatchEvent(DebugEvent*& _event, BPrivate::KMessage& message); + status_t _GetDebugCpuState(thread_id thread, + debug_cpu_state& _state); + private: team_id fTeamID; port_id fDebuggerPort; diff --git a/src/apps/debugger/dwarf/DwarfFile.h b/src/apps/debugger/dwarf/DwarfFile.h index 458180c8f5..52575c3732 100644 --- a/src/apps/debugger/dwarf/DwarfFile.h +++ b/src/apps/debugger/dwarf/DwarfFile.h @@ -1,6 +1,6 @@ /* * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef DWARF_FILE_H @@ -39,6 +39,10 @@ public: const char* Name() const { return fName; } ElfFile* GetElfFile() const { return fElfFile; } + bool HasFrameInformation() const + { return fDebugFrameSection != NULL + || fEHFrameSection != NULL; } + int32 CountCompilationUnits() const; CompilationUnit* CompilationUnitAt(int32 index) const; CompilationUnit* CompilationUnitForDIE( diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index f32816101e..88fd0de2f9 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011-2012, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -39,6 +39,67 @@ DwarfUtils::GetDIEName(const DebugInfoEntry* entry, BString& _name) } +/*static*/ void +DwarfUtils::GetDIETypeName(const DebugInfoEntry* entry, BString& _name) +{ + const DIEType* type = dynamic_cast(entry); + if (type == NULL) + return; + + const DIEModifiedType* modifiedType = dynamic_cast( + type); + BString typeName; + BString modifier; + + if (modifiedType != NULL) { + const DIEType* baseType = type; + while ((modifiedType = dynamic_cast( + baseType)) != NULL) { + switch (modifiedType->Tag()) { + case DW_TAG_pointer_type: + modifier.Prepend("*"); + break; + case DW_TAG_reference_type: + modifier.Prepend("&"); + break; + case DW_TAG_const_type: + modifier.Prepend(" const "); + break; + default: + break; + } + + baseType = modifiedType->GetType(); + } + type = baseType; + } + + // if the parameter has no type associated, + // then it's the unspecified type. + if (type == NULL) + typeName = "void"; + else + GetFullyQualifiedDIEName(type, typeName); + + if (modifier.Length() > 0) { + if (modifier[modifier.Length() - 1] == ' ') + modifier.Truncate(modifier.Length() - 1); + + // if the modifier has a leading const, treat it + // as the degenerate case and prepend it to the + // type name since that's the more typically used + // representation in source + if (modifier[0] == ' ') { + typeName.Prepend("const "); + modifier.Remove(0, 7); + } + typeName += modifier; + } + + _name = typeName; +} + + /*static*/ void DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) { @@ -62,9 +123,13 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) } } - // we found no name for this entry whatsoever, abort. - if (name == NULL) + if (name == NULL) { + if (dynamic_cast(entry) != NULL) + GetDIETypeName(entry, _name); + + // we found no name for this entry whatsoever, abort. return; + } generatedName = name; @@ -98,51 +163,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) BString paramName; BString modifier; DIEType* type = parameter->GetType(); - if (DIEModifiedType* modifiedType = dynamic_cast( - type)) { - DIEType* baseType = type; - while ((modifiedType = dynamic_cast( - baseType)) != NULL) { - switch (modifiedType->Tag()) { - case DW_TAG_pointer_type: - modifier.Prepend("*"); - break; - case DW_TAG_reference_type: - modifier.Prepend("&"); - break; - case DW_TAG_const_type: - modifier.Prepend(" const "); - break; - default: - break; - } - - baseType = modifiedType->GetType(); - } - type = baseType; - } - - // if the parameter has no type associated, - // then it's the unspecified type. - if (type == NULL) - paramName = "void"; - else - GetFullyQualifiedDIEName(type, paramName); - - if (modifier.Length() > 0) { - if (modifier[modifier.Length() - 1] == ' ') - modifier.Truncate(modifier.Length() - 1); - - // if the modifier has a leading const, treat it - // as the degenerate case and prepend it to the - // type name since that's the more typically used - // representation in source - if (modifier[0] == ' ') { - paramName.Prepend("const "); - modifier.Remove(0, 7); - } - paramName += modifier; - } + GetDIETypeName(type, paramName); if (firstParameter) firstParameter = false; @@ -158,7 +179,6 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) generatedName += "void"; generatedName += ")"; } - _name = generatedName; } diff --git a/src/apps/debugger/dwarf/DwarfUtils.h b/src/apps/debugger/dwarf/DwarfUtils.h index 092aa75643..1bedfd0802 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.h +++ b/src/apps/debugger/dwarf/DwarfUtils.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef DWARF_UTILS_H @@ -17,6 +18,8 @@ class DwarfUtils { public: static void GetDIEName(const DebugInfoEntry* entry, BString& _name); + static void GetDIETypeName(const DebugInfoEntry* entry, + BString& _name); static void GetFullDIEName(const DebugInfoEntry* entry, BString& _name); static void GetFullyQualifiedDIEName( diff --git a/src/apps/debugger/model/TeamInfo.cpp b/src/apps/debugger/model/TeamInfo.cpp new file mode 100644 index 0000000000..bc520f27e3 --- /dev/null +++ b/src/apps/debugger/model/TeamInfo.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + + +#include "TeamInfo.h" + + +TeamInfo::TeamInfo() + : + fTeam(-1), + fArguments() +{ +} + + +TeamInfo::TeamInfo(const TeamInfo &other) +{ + fTeam = other.fTeam; + fArguments = other.fArguments; +} + + +TeamInfo::TeamInfo(team_id team, const team_info& info) +{ + SetTo(team, info); +} + + +void +TeamInfo::SetTo(team_id team, const team_info& info) +{ + fTeam = team; + fArguments.SetTo(info.args); +} diff --git a/src/apps/debugger/model/TeamInfo.h b/src/apps/debugger/model/TeamInfo.h new file mode 100644 index 0000000000..c5cf78d184 --- /dev/null +++ b/src/apps/debugger/model/TeamInfo.h @@ -0,0 +1,33 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef TEAM_INFO_H +#define TEAM_INFO_H + +#include +#include + +#include "Types.h" + + +class TeamInfo { +public: + TeamInfo(); + TeamInfo(const TeamInfo& other); + TeamInfo(team_id team, + const team_info& info); + + void SetTo(team_id team, const team_info& info); + + team_id TeamID() const { return fTeam; } + + const BString& Arguments() const { return fArguments; } + +private: + team_id fTeam; + BString fArguments; +}; + + +#endif // TEAM_INFO_H diff --git a/src/apps/debugger/settings/generic/Setting.cpp b/src/apps/debugger/settings/generic/Setting.cpp index f704699270..3213649dd9 100644 --- a/src/apps/debugger/settings/generic/Setting.cpp +++ b/src/apps/debugger/settings/generic/Setting.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -78,6 +79,16 @@ OptionsSetting::DefaultValue() const } +// #pragma mark - BoundedSetting + + +setting_type +BoundedSetting::Type() const +{ + return SETTING_TYPE_BOUNDED; +} + + // #pragma mark - RangeSetting @@ -284,7 +295,7 @@ OptionsSettingImpl::SetDefaultOption(SettingsOption* option) // #pragma mark - RangeSettingImpl -RangeSettingImpl::RangeSettingImpl(const BString& id, const BString& name, +BoundedSettingImpl::BoundedSettingImpl(const BString& id, const BString& name, const BVariant& lowerBound, const BVariant& upperBound, const BVariant& defaultValue) : @@ -297,12 +308,52 @@ RangeSettingImpl::RangeSettingImpl(const BString& id, const BString& name, BVariant -RangeSettingImpl::DefaultValue() const +BoundedSettingImpl::DefaultValue() const { return fDefaultValue; } +BVariant +BoundedSettingImpl::LowerBound() const +{ + return fLowerBound; +} + + +BVariant +BoundedSettingImpl::UpperBound() const +{ + return fUpperBound; +} + + +// #pragma mark - RangeSettingImpl + + +RangeSettingImpl::RangeSettingImpl(const BString& id, const BString& name, + const BVariant& lowerBound, const BVariant& upperBound, + const BVariant& lowerValue, const BVariant& upperValue) + : + AbstractSetting(id, name), + fLowerBound(lowerBound), + fUpperBound(upperBound), + fLowerValue(lowerValue), + fUpperValue(upperValue) +{ +} + + +BVariant +RangeSettingImpl::DefaultValue() const +{ + // this one doesn't really make sense for RangeSetting since it + // describes a pair of values, which BVariant can't readily + // represent. + return BVariant(); +} + + BVariant RangeSettingImpl::LowerBound() const { @@ -317,6 +368,20 @@ RangeSettingImpl::UpperBound() const } +BVariant +RangeSettingImpl::LowerValue() const +{ + return fLowerValue; +} + + +BVariant +RangeSettingImpl::UpperValue() const +{ + return fUpperValue; +} + + // #pragma mark - RectSettingImpl diff --git a/src/apps/debugger/settings/generic/Setting.h b/src/apps/debugger/settings/generic/Setting.h index e779451f00..baa8803957 100644 --- a/src/apps/debugger/settings/generic/Setting.h +++ b/src/apps/debugger/settings/generic/Setting.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef SETTING_H @@ -18,6 +18,7 @@ enum setting_type { SETTING_TYPE_BOOL, SETTING_TYPE_FLOAT, SETTING_TYPE_OPTIONS, + SETTING_TYPE_BOUNDED, SETTING_TYPE_RANGE, SETTING_TYPE_RECT }; @@ -78,7 +79,7 @@ public: }; -class RangeSetting : public virtual Setting { +class BoundedSetting : public virtual Setting { public: virtual setting_type Type() const; @@ -87,6 +88,14 @@ public: }; +class RangeSetting : public virtual BoundedSetting { + virtual setting_type Type() const; + + virtual BVariant LowerValue() const = 0; + virtual BVariant UpperValue() const = 0; +}; + + class RectSetting : public virtual Setting { public: virtual setting_type Type() const; @@ -164,9 +173,9 @@ private: }; -class RangeSettingImpl : public AbstractSetting, public RangeSetting { +class BoundedSettingImpl : public AbstractSetting, public BoundedSetting { public: - RangeSettingImpl(const BString& id, + BoundedSettingImpl(const BString& id, const BString& name, const BVariant& lowerBound, const BVariant& upperBound, @@ -184,6 +193,30 @@ private: }; +class RangeSettingImpl : public AbstractSetting, public RangeSetting { +public: + RangeSettingImpl(const BString& id, + const BString& name, + const BVariant& lowerBound, + const BVariant& upperBound, + const BVariant& lowerValue, + const BVariant& upperValue); + + virtual BVariant DefaultValue() const; + + virtual BVariant LowerBound() const; + virtual BVariant UpperBound() const; + virtual BVariant LowerValue() const; + virtual BVariant UpperValue() const; + +private: + BVariant fLowerBound; + BVariant fUpperBound; + BVariant fLowerValue; + BVariant fUpperValue; +}; + + class RectSettingImpl : public AbstractSetting, public RectSetting { public: RectSettingImpl(const BString& id, diff --git a/src/apps/debugger/source_language/CLanguageFamily.cpp b/src/apps/debugger/source_language/CLanguageFamily.cpp index 592cf53009..142ecc6cd5 100644 --- a/src/apps/debugger/source_language/CLanguageFamily.cpp +++ b/src/apps/debugger/source_language/CLanguageFamily.cpp @@ -50,11 +50,10 @@ CLanguageFamily::ParseTypeExpression(const BString& expression, modifierIndex = parsedName.FindFirst('&'); if (modifierIndex == -1) modifierIndex = parsedName.FindFirst('['); + if (modifierIndex == -1) + modifierIndex = parsedName.Length(); - if (modifierIndex >= 0) - parsedName.MoveInto(baseTypeName, 0, modifierIndex); - else - baseTypeName = parsedName; + parsedName.MoveInto(baseTypeName, 0, modifierIndex); modifierIndex = parsedName.FindFirst('['); if (modifierIndex >= 0) { diff --git a/src/apps/debugger/user_interface/UserInterface.h b/src/apps/debugger/user_interface/UserInterface.h index 9ed4657440..96d1926ab8 100644 --- a/src/apps/debugger/user_interface/UserInterface.h +++ b/src/apps/debugger/user_interface/UserInterface.h @@ -90,7 +90,8 @@ public: ValueNodeContainer* container, ValueNode* valueNode) = 0; virtual void ThreadActionRequested(thread_id threadID, - uint32 action) = 0; + uint32 action, + target_addr_t address = 0) = 0; virtual void SetBreakpointRequested(target_addr_t address, bool enabled) = 0; diff --git a/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp b/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp index 6bb84f3a87..8387b4941b 100644 --- a/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp +++ b/src/apps/debugger/user_interface/cli/CliThreadsCommand.cpp @@ -38,7 +38,14 @@ CliThreadsCommand::Execute(int argc, const char* const* argv, Thread* thread = it.Next();) { const char* stateString = UiUtils::ThreadStateToString( thread->State(), thread->StoppedReason()); - printf("%10" B_PRId32 " %-9s \"%s\"\n", thread->ID(), stateString, + printf("%10" B_PRId32 " %-9s \"%s\"", thread->ID(), stateString, thread->Name()); + + const BString& stoppedReason = thread->StoppedReasonInfo(); + if (thread->State() == THREAD_STATE_STOPPED + && !stoppedReason.IsEmpty()) { + printf(" (Reason: \"%s\")", stoppedReason.String()); + } + printf("\n"); } } diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp index 5dbb1083aa..1293e2f6ad 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Rene Gollent, rene@gollent.com. All rights reserved. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -125,8 +125,8 @@ InspectorWindow::_Init() textMenu->AddItem(item); BLayoutBuilder::Group<>(this, B_VERTICAL) - .SetInsets(4.0f, 4.0f, 4.0f, 4.0f) - .AddGroup(B_HORIZONTAL, 4.0f) + .SetInsets(B_USE_DEFAULT_SPACING) + .AddGroup(B_HORIZONTAL) .Add(fAddressInput = new BTextControl("addrInput", "Target Address:", "", new BMessage(MSG_INSPECT_ADDRESS))) @@ -135,7 +135,7 @@ InspectorWindow::_Init() .Add(fNextBlockButton = new BButton("navNext", ">", new BMessage(MSG_NAVIGATE_NEXT_BLOCK))) .End() - .AddGroup(B_HORIZONTAL, 4.0f) + .AddGroup(B_HORIZONTAL) .Add(fHexMode = new BMenuField("hexMode", "Hex Mode:", hexMenu)) .AddGlue() @@ -156,7 +156,7 @@ InspectorWindow::_Init() int32 targetEndian = fTeam->GetArchitecture()->IsBigEndian() ? EndianModeBigEndian : EndianModeLittleEndian; - scrollView->SetTarget(fMemoryView = MemoryView::Create(fTeam)); + scrollView->SetTarget(fMemoryView = MemoryView::Create(fTeam, this)); fAddressInput->SetTarget(this); fPreviousBlockButton->SetTarget(this); @@ -221,6 +221,7 @@ InspectorWindow::MessageReceived(BMessage* msg) } if (addressValid) { + fCurrentAddress = address; if (fCurrentBlock != NULL && !fCurrentBlock->Contains(address)) { fCurrentBlock->ReleaseReference(); @@ -231,11 +232,6 @@ InspectorWindow::MessageReceived(BMessage* msg) fListener->InspectRequested(address, this); else fMemoryView->SetTargetAddress(fCurrentBlock, address); - - fCurrentAddress = address; - BString computedAddress; - computedAddress.SetToFormat("0x%" B_PRIx64, address); - fAddressInput->SetText(computedAddress.String()); } break; } @@ -289,6 +285,19 @@ InspectorWindow::MemoryBlockRetrieved(TeamMemoryBlock* block) } +void +InspectorWindow::TargetAddressChanged(target_addr_t address) +{ + AutoLocker lock(this); + if (lock.IsLocked()) { + fCurrentAddress = address; + BString computedAddress; + computedAddress.SetToFormat("0x%" B_PRIx64, address); + fAddressInput->SetText(computedAddress.String()); + } +} + + status_t InspectorWindow::LoadSettings(const GuiTeamUiSettings& settings) { diff --git a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h index a145e1899c..320e344d9f 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h +++ b/src/apps/debugger/user_interface/gui/inspector_window/InspectorWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Rene Gollent, rene@gollent.com. All rights reserved. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef INSPECTOR_WINDOW_H @@ -8,6 +8,7 @@ #include +#include "MemoryView.h" #include "TeamMemoryBlock.h" #include "Types.h" @@ -17,13 +18,13 @@ class BMenuField; class BMessenger; class BTextControl; class GuiTeamUiSettings; -class MemoryView; class Team; class UserInterfaceListener; class InspectorWindow : public BWindow, - public TeamMemoryBlock::Listener { + public TeamMemoryBlock::Listener, + public MemoryView::Listener { public: InspectorWindow(::Team* team, UserInterfaceListener* listener, @@ -38,8 +39,12 @@ public: virtual void MessageReceived(BMessage* message); virtual bool QuitRequested(); + // TeamMemoryBlock::Listener virtual void MemoryBlockRetrieved(TeamMemoryBlock* block); + // MemoryView::Listener + virtual void TargetAddressChanged(target_addr_t address); + status_t LoadSettings( const GuiTeamUiSettings& settings); status_t SaveSettings( diff --git a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp index fe30580295..a59e96760e 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp +++ b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Rene Gollent, rene@gollent.com. All rights reserved. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -26,7 +26,7 @@ enum { }; -MemoryView::MemoryView(::Team* team) +MemoryView::MemoryView(::Team* team, Listener* listener) : BView("memoryView", B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE | B_SUBPIXEL_PRECISE), @@ -38,7 +38,8 @@ MemoryView::MemoryView(::Team* team) fTextCharsPerLine(0), fHexBlocksPerLine(0), fHexMode(HexMode8BitInt), - fTextMode(TextModeASCII) + fTextMode(TextModeASCII), + fListener(listener) { Architecture* architecture = team->GetArchitecture(); fTargetAddressSize = architecture->AddressSize() * 2; @@ -56,9 +57,9 @@ MemoryView::~MemoryView() /*static */ MemoryView* -MemoryView::Create(::Team* team) +MemoryView::Create(::Team* team, Listener* listener) { - MemoryView* self = new MemoryView(team); + MemoryView* self = new MemoryView(team, listener); try { self->_Init(); @@ -85,6 +86,13 @@ MemoryView::SetTargetAddress(TeamMemoryBlock* block, target_addr_t address) } +void +MemoryView::UnsetListener() +{ + fListener = NULL; +} + + void MemoryView::AttachedToWindow() { @@ -329,6 +337,8 @@ MemoryView::MessageReceived(BMessage* message) _RecalcScrollBars(); ScrollToSelection(); Invalidate(); + if (fListener != NULL) + fListener->TargetAddressChanged(fTargetAddress); break; } case MSG_SET_HEX_MODE: @@ -546,3 +556,11 @@ MemoryView::_GetNextHexBlock(char* buffer, int32 bufferSize, } } } + + +//#pragma mark - Listener + + +MemoryView::Listener::~Listener() +{ +} diff --git a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.h b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.h index 9f0dba6e4e..ca10a25c48 100644 --- a/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.h +++ b/src/apps/debugger/user_interface/gui/inspector_window/MemoryView.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Rene Gollent, rene@gollent.com. All rights reserved. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -46,15 +46,19 @@ class TeamMemoryBlock; class MemoryView : public BView { public: - MemoryView(::Team* team); + class Listener; + + MemoryView(::Team* team, Listener* listener); virtual ~MemoryView(); - static MemoryView* Create(::Team* team); + static MemoryView* Create(::Team* team, Listener* listener); // throws void SetTargetAddress(TeamMemoryBlock* block, target_addr_t address); + void UnsetListener(); + virtual void AttachedToWindow(); virtual void Draw(BRect rect); virtual void FrameResized(float width, float height); @@ -83,6 +87,17 @@ private: int32 fCurrentEndianMode; int32 fHexMode; int32 fTextMode; + Listener* fListener; }; + +class MemoryView::Listener { +public: + virtual ~Listener(); + + virtual void TargetAddressChanged(target_addr_t address) + = 0; +}; + + #endif // MEMORY_VIEW_H diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp index b1698c8f41..8c6ba03cc8 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -11,12 +11,16 @@ #include +#include + #include #include +#include "Architecture.h" #include "FunctionID.h" #include "GuiSettingsUtils.h" #include "LocatableFile.h" +#include "MessageCodes.h" #include "table/TableColumns.h" #include "TargetAddressTableColumn.h" #include "Team.h" @@ -24,6 +28,73 @@ #include "Watchpoint.h" +// #pragma mark - BreakpointProxy + + +BreakpointProxy::BreakpointProxy(UserBreakpoint* breakpoint, + Watchpoint* watchpoint) + : + fBreakpoint(breakpoint), + fWatchpoint(watchpoint) +{ + if (fBreakpoint != NULL) + fBreakpoint->AcquireReference(); + + if (fWatchpoint != NULL) + fWatchpoint->AcquireReference(); +} + + +BreakpointProxy::~BreakpointProxy() +{ + if (fBreakpoint != NULL) + fBreakpoint->ReleaseReference(); + + if (fWatchpoint != NULL) + fWatchpoint->ReleaseReference(); +} + + +breakpoint_proxy_type +BreakpointProxy::Type() const +{ + return fBreakpoint != NULL ? BREAKPOINT_PROXY_TYPE_BREAKPOINT + : BREAKPOINT_PROXY_TYPE_WATCHPOINT; +} + + +// #pragma mark - ListInputFilter + + +class BreakpointListView::ListInputFilter : public BMessageFilter { +public: + ListInputFilter(BView* view) + : + BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, B_KEY_DOWN), + fTargetView(view) + { + } + + ~ListInputFilter() + { + } + + filter_result Filter(BMessage* message, BHandler** target) + { + const char* bytes; + if (message->FindString("bytes", &bytes) == B_OK + && bytes[0] == B_DELETE) { + BMessenger(fTargetView).SendMessage(MSG_CLEAR_BREAKPOINT); + } + + return B_DISPATCH_MESSAGE; + } + +private: + BView* fTargetView; +}; + + // #pragma mark - BreakpointsTableModel @@ -34,25 +105,23 @@ public: fTeam(team) { UpdateBreakpoint(NULL); - UpdateWatchpoint(NULL); } ~BreakpointsTableModel() { fTeam = NULL; UpdateBreakpoint(NULL); - UpdateWatchpoint(NULL); } - bool UpdateBreakpoint(UserBreakpoint* changedBreakpoint) + bool UpdateBreakpoint(BreakpointProxy* proxy) { if (fTeam == NULL) { for (int32 i = 0; - UserBreakpoint* breakpoint = fBreakpoints.ItemAt(i); + BreakpointProxy* proxy = fBreakpointProxies.ItemAt(i); i++) { - breakpoint->ReleaseReference(); + proxy->ReleaseReference(); } - fBreakpoints.MakeEmpty(); + fBreakpointProxies.MakeEmpty(); return true; } @@ -61,132 +130,126 @@ public: UserBreakpointList::ConstIterator it = fTeam->UserBreakpoints().GetIterator(); + int32 watchpointIndex = 0; UserBreakpoint* newBreakpoint = it.Next(); + Watchpoint* newWatchpoint = fTeam->WatchpointAt(watchpointIndex); int32 index = 0; + bool remove; // remove no longer existing breakpoints - while (UserBreakpoint* oldBreakpoint = fBreakpoints.ItemAt(index)) { - if (oldBreakpoint == newBreakpoint) { - if (oldBreakpoint == changedBreakpoint) - NotifyRowsChanged(index, 1); - index++; - newBreakpoint = it.Next(); - } else { + while (BreakpointProxy* oldProxy = fBreakpointProxies.ItemAt(index)) { + remove = false; + switch (oldProxy->Type()) { + case BREAKPOINT_PROXY_TYPE_BREAKPOINT: + { + UserBreakpoint* breakpoint = oldProxy->GetBreakpoint(); + if (breakpoint == newBreakpoint) { + if (breakpoint == proxy->GetBreakpoint()) + NotifyRowsChanged(index, 1); + ++index; + newBreakpoint = it.Next(); + } else + remove = true; + } + break; + + case BREAKPOINT_PROXY_TYPE_WATCHPOINT: + { + Watchpoint* watchpoint = oldProxy->GetWatchpoint(); + if (watchpoint == newWatchpoint) { + if (watchpoint == proxy->GetWatchpoint()) + NotifyRowsChanged(index, 1); + ++watchpointIndex; + ++index; + newWatchpoint = fTeam->WatchpointAt(watchpointIndex); + } else + remove = true; + } + break; + } + + if (remove) { // TODO: Not particularly efficient! - fBreakpoints.RemoveItemAt(index); - oldBreakpoint->ReleaseReference(); + fBreakpointProxies.RemoveItemAt(index); + oldProxy->ReleaseReference(); NotifyRowsRemoved(index, 1); } } // add new breakpoints - int32 countBefore = fBreakpoints.CountItems(); + int32 countBefore = fBreakpointProxies.CountItems(); + BreakpointProxy* newProxy = NULL; + BReference proxyReference; while (newBreakpoint != NULL) { - if (!fBreakpoints.AddItem(newBreakpoint)) + newProxy = new(std::nothrow) BreakpointProxy(newBreakpoint, NULL); + if (newProxy == NULL) return false; - newBreakpoint->AcquireReference(); + proxyReference.SetTo(newProxy, true); + if (!fBreakpointProxies.AddItem(newProxy)) + return false; + + proxyReference.Detach(); newBreakpoint = it.Next(); } - int32 count = fBreakpoints.CountItems(); + // add new watchpoints + while (newWatchpoint != NULL) { + newProxy = new(std::nothrow) BreakpointProxy(NULL, newWatchpoint); + if (newProxy == NULL) + return false; + + proxyReference.SetTo(newProxy, true); + if (!fBreakpointProxies.AddItem(newProxy)) + return false; + + proxyReference.Detach(); + newWatchpoint = fTeam->WatchpointAt(++watchpointIndex); + } + + + int32 count = fBreakpointProxies.CountItems(); if (count > countBefore) NotifyRowsAdded(countBefore, count - countBefore); return true; } - bool UpdateWatchpoint(Watchpoint* changedWatchpoint) - { - if (fTeam == NULL) { - for (int32 i = 0; - Watchpoint* watchpoint = fWatchpoints.ItemAt(i); - i++) { - watchpoint->ReleaseReference(); - } - fWatchpoints.MakeEmpty(); - - return true; - } - - AutoLocker locker(fTeam); - - int32 breakpointCount = fBreakpoints.CountItems(); - int32 index = 0; - int32 teamIndex = 0; - Watchpoint* newWatchpoint = fTeam->WatchpointAt(teamIndex); - // remove no longer existing breakpoints - while (Watchpoint* oldWatchpoint = fWatchpoints.ItemAt(index)) { - if (oldWatchpoint == newWatchpoint) { - if (oldWatchpoint == changedWatchpoint) - NotifyRowsChanged(index + breakpointCount, 1); - index++; - teamIndex++; - newWatchpoint = fTeam->WatchpointAt(teamIndex); - } else { - // TODO: Not particularly efficient! - fWatchpoints.RemoveItemAt(index); - oldWatchpoint->ReleaseReference(); - NotifyRowsRemoved(index + breakpointCount, 1); - } - } - - // add new breakpoints - int32 countBefore = fWatchpoints.CountItems(); - while (newWatchpoint != NULL) { - if (!fWatchpoints.AddItem(newWatchpoint)) - return false; - - newWatchpoint->AcquireReference(); - teamIndex++; - newWatchpoint = fTeam->WatchpointAt(teamIndex); - } - - int32 count = fWatchpoints.CountItems(); - if (count > countBefore) - NotifyRowsAdded(countBefore + breakpointCount, count - countBefore); - - return true; - } - virtual int32 CountColumns() const { - return 5; + return 3; } virtual int32 CountRows() const { - return fBreakpoints.CountItems() + fWatchpoints.CountItems(); + return fBreakpointProxies.CountItems(); } virtual bool GetValueAt(int32 rowIndex, int32 columnIndex, BVariant& value) { - int32 breakpointCount = fBreakpoints.CountItems(); - if (rowIndex < breakpointCount) - return _GetBreakpointValueAt(rowIndex, columnIndex, value); + BreakpointProxy* proxy = fBreakpointProxies.ItemAt(rowIndex); + if (proxy == NULL) + return false; - return _GetWatchpointValueAt(rowIndex - breakpointCount, columnIndex, - value); + if (proxy->Type() == BREAKPOINT_PROXY_TYPE_BREAKPOINT) { + return _GetBreakpointValueAt(proxy->GetBreakpoint(), rowIndex, + columnIndex, value); + } + + return _GetWatchpointValueAt(proxy->GetWatchpoint(), rowIndex, + columnIndex, value); } - UserBreakpoint* BreakpointAt(int32 index) const + BreakpointProxy* BreakpointProxyAt(int32 index) const { - return fBreakpoints.ItemAt(index); - } - - Watchpoint* WatchpointAt(int32 index) const - { - return fWatchpoints.ItemAt(index - fBreakpoints.CountItems()); + return fBreakpointProxies.ItemAt(index); } private: - bool _GetBreakpointValueAt(int32 rowIndex, int32 columnIndex, - BVariant &value) + bool _GetBreakpointValueAt(UserBreakpoint* breakpoint, int32 rowIndex, + int32 columnIndex, BVariant &value) { - UserBreakpoint* breakpoint = fBreakpoints.ItemAt(rowIndex); - if (breakpoint == NULL) - return false; const UserBreakpointLocation& location = breakpoint->Location(); switch (columnIndex) { @@ -198,62 +261,75 @@ private: B_VARIANT_DONT_COPY_DATA); return true; case 2: - if (LocatableFile* sourceFile = location.SourceFile()) { - value.SetTo(sourceFile->Name(), B_VARIANT_DONT_COPY_DATA); - return true; - } - return false; - case 3: - if (location.SourceFile() != NULL) { - value.SetTo(location.GetSourceLocation().Line() + 1); - return true; - } - return false; - case 4: - if (location.SourceFile() == NULL) { + { + LocatableFile* sourceFile = location.SourceFile(); + if (sourceFile != NULL) { + BString data; + data.SetToFormat("%s:%" B_PRId32, sourceFile->Name(), + location.GetSourceLocation().Line() + 1); + value.SetTo(data); + } else { AutoLocker teamLocker(fTeam); if (UserBreakpointInstance* instance = breakpoint->InstanceAt(0)) { value.SetTo(instance->Address()); - return true; } } - return false; + return true; + } default: return false; } } - bool _GetWatchpointValueAt(int32 rowIndex, int32 columnIndex, - BVariant& value) + bool _GetWatchpointValueAt(Watchpoint* watchpoint, int32 rowIndex, + int32 columnIndex, BVariant &value) { - Watchpoint* watchpoint = fWatchpoints.ItemAt(rowIndex); - if (watchpoint == NULL) - return false; - switch (columnIndex) { case 0: value.SetTo((int32)watchpoint->IsEnabled()); return true; case 1: - value.SetTo("Watchpoint"); + { + BString data; + data.SetToFormat("%s at 0x%" B_PRIx64 " (%" B_PRId32 " bytes)", + _WatchpointTypeToString(watchpoint->Type()), + watchpoint->Address(), watchpoint->Length()); + value.SetTo(data); return true; + } case 2: + { return false; - case 3: - return false; - case 4: - value.SetTo(watchpoint->Address()); - return true; + } default: return false; } } + const char* _WatchpointTypeToString(uint32 type) const + { + switch (type) { + case WATCHPOINT_CAPABILITY_FLAG_READ: + { + return "read"; + } + case WATCHPOINT_CAPABILITY_FLAG_WRITE: + { + return "write"; + } + case WATCHPOINT_CAPABILITY_FLAG_READ_WRITE: + { + return "read/write"; + } + default: + return NULL; + } + } + private: Team* fTeam; - BObjectList fBreakpoints; - BObjectList fWatchpoints; + BreakpointProxyList fBreakpointProxies; }; @@ -264,7 +340,6 @@ BreakpointListView::BreakpointListView(Team* team, Listener* listener) : BGroupView(B_VERTICAL), fTeam(team), - fBreakpoint(NULL), fBreakpointsTable(NULL), fBreakpointsTableModel(NULL), fListener(listener) @@ -280,12 +355,12 @@ BreakpointListView::~BreakpointListView() /*static*/ BreakpointListView* -BreakpointListView::Create(Team* team, Listener* listener) +BreakpointListView::Create(Team* team, Listener* listener, BView* filterTarget) { BreakpointListView* self = new BreakpointListView(team, listener); try { - self->_Init(); + self->_Init(filterTarget); } catch (...) { delete self; throw; @@ -302,46 +377,19 @@ BreakpointListView::UnsetListener() } -void -BreakpointListView::SetBreakpoint(UserBreakpoint* breakpoint, - Watchpoint* watchpoint) -{ - if (breakpoint == fBreakpoint) - return; - - if (fBreakpoint != NULL) - fBreakpoint->ReleaseReference(); - - fBreakpoint = breakpoint; - - if (fBreakpoint != NULL) { - fBreakpoint->AcquireReference(); - - for (int32 i = 0; - UserBreakpoint* other = fBreakpointsTableModel->BreakpointAt(i); - i++) { - if (fBreakpoint == other) { - fBreakpointsTable->SelectRow(i, false); - return; - } - } - } - - fBreakpointsTable->DeselectAllRows(); -} - - void BreakpointListView::UserBreakpointChanged(UserBreakpoint* breakpoint) { - fBreakpointsTableModel->UpdateBreakpoint(breakpoint); + BreakpointProxy proxy(breakpoint, NULL); + fBreakpointsTableModel->UpdateBreakpoint(&proxy); } void BreakpointListView::WatchpointChanged(Watchpoint* watchpoint) { - fBreakpointsTableModel->UpdateWatchpoint(watchpoint); + BreakpointProxy proxy(NULL, watchpoint); + fBreakpointsTableModel->UpdateBreakpoint(&proxy); } @@ -378,20 +426,22 @@ BreakpointListView::TableSelectionChanged(Table* table) return; TableSelectionModel* selectionModel = table->SelectionModel(); - UserBreakpoint* breakpoint = fBreakpointsTableModel->BreakpointAt( - selectionModel->RowAt(0)); - if (breakpoint != NULL) - fListener->BreakpointSelectionChanged(breakpoint); - else { - Watchpoint* watchpoint = fBreakpointsTableModel->WatchpointAt( - selectionModel->RowAt(0)); - fListener->WatchpointSelectionChanged(watchpoint); + BreakpointProxyList proxyList; + for (int32 i = 0; i < selectionModel->CountRows(); i++) { + BreakpointProxy* proxy = fBreakpointsTableModel->BreakpointProxyAt( + selectionModel->RowAt(i)); + if (proxy == NULL) + continue; + if (!proxyList.AddItem(proxy)) + return; } + + fListener->BreakpointSelectionChanged(proxyList); } void -BreakpointListView::_Init() +BreakpointListView::_Init(BView* filterTarget) { fBreakpointsTable = new Table("breakpoints list", 0, B_FANCY_BORDER); AddChild(fBreakpointsTable->ToView()); @@ -399,17 +449,15 @@ BreakpointListView::_Init() // columns fBreakpointsTable->AddColumn(new BoolStringTableColumn(0, "State", 70, 20, 1000, "Enabled", "Disabled")); - fBreakpointsTable->AddColumn(new StringTableColumn(1, "Function", 250, 40, + fBreakpointsTable->AddColumn(new StringTableColumn(1, "Location", 250, 40, 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); - fBreakpointsTable->AddColumn(new StringTableColumn(2, "File", 250, 40, - 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); - fBreakpointsTable->AddColumn(new Int32TableColumn(3, "Line", 60, 20, - 1000, B_TRUNCATE_END, B_ALIGN_RIGHT)); - fBreakpointsTable->AddColumn(new TargetAddressTableColumn(4, "Address", 100, - 20, 1000, B_TRUNCATE_END, B_ALIGN_RIGHT)); + fBreakpointsTable->AddColumn(new StringTableColumn(2, "File:Line/Address", + 250, 40, 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); - fBreakpointsTable->SetSelectionMode(B_SINGLE_SELECTION_LIST); + fBreakpointsTable->SetSelectionMode(B_MULTIPLE_SELECTION_LIST); fBreakpointsTable->AddTableListener(this); + fBreakpointsTable->AddFilter(new ListInputFilter(filterTarget)); + fBreakpointsTableModel = new BreakpointsTableModel(fTeam); fBreakpointsTable->SetTableModel(fBreakpointsTableModel); diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.h b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.h index 317ca5be71..9045148abc 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.h +++ b/src/apps/debugger/user_interface/gui/team_window/BreakpointListView.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef BREAKPOINT_LIST_VIEW_H @@ -16,6 +17,31 @@ class UserBreakpoint; class Watchpoint; +enum breakpoint_proxy_type { + BREAKPOINT_PROXY_TYPE_BREAKPOINT = 0, + BREAKPOINT_PROXY_TYPE_WATCHPOINT = 1 +}; + + +class BreakpointProxy : public BReferenceable { +public: + BreakpointProxy(UserBreakpoint* breakpoint, + Watchpoint* watchpoint); + ~BreakpointProxy(); + + breakpoint_proxy_type Type() const; + + UserBreakpoint* GetBreakpoint() const { return fBreakpoint; } + Watchpoint* GetWatchpoint() const { return fWatchpoint; } + +private: + UserBreakpoint* fBreakpoint; + Watchpoint* fWatchpoint; +}; + +typedef BObjectList BreakpointProxyList; + + class BreakpointListView : public BGroupView, private TableListener { public: class Listener; @@ -25,14 +51,12 @@ public: Listener* listener); ~BreakpointListView(); - static BreakpointListView* Create(Team* team, Listener* listener); + static BreakpointListView* Create(Team* team, Listener* listener, + BView* filterTarget); // throws void UnsetListener(); - void SetBreakpoint(UserBreakpoint* breakpoint, - Watchpoint* watchpoint); - void UserBreakpointChanged( UserBreakpoint* breakpoint); void WatchpointChanged( @@ -43,17 +67,16 @@ public: private: class BreakpointsTableModel; + class ListInputFilter; private: // TableListener virtual void TableSelectionChanged(Table* table); - void _Init(); + void _Init(BView* filterTarget); private: Team* fTeam; - UserBreakpoint* fBreakpoint; - Watchpoint* fWatchpoint; Table* fBreakpointsTable; BreakpointsTableModel* fBreakpointsTableModel; Listener* fListener; @@ -65,10 +88,7 @@ public: virtual ~Listener(); virtual void BreakpointSelectionChanged( - UserBreakpoint* breakpoint) = 0; - - virtual void WatchpointSelectionChanged( - Watchpoint* watchpoint) = 0; + BreakpointProxyList& breakpoints) = 0; }; diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.cpp b/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.cpp index 599113b99e..e798b3a20b 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -27,8 +27,6 @@ BreakpointsView::BreakpointsView(Team* team, Listener* listener) : BGroupView(B_HORIZONTAL, 4.0f), fTeam(team), - fBreakpoint(NULL), - fWatchpoint(NULL), fListView(NULL), fToggleBreakpointButton(NULL), fRemoveBreakpointButton(NULL), @@ -68,32 +66,6 @@ BreakpointsView::UnsetListener() } -void -BreakpointsView::SetBreakpoint(UserBreakpoint* breakpoint, Watchpoint* watchpoint) -{ - if (breakpoint == fBreakpoint && watchpoint == fWatchpoint) - return; - - if (fWatchpoint != NULL) - fWatchpoint->ReleaseReference(); - - if (fBreakpoint != NULL) - fBreakpoint->ReleaseReference(); - - fWatchpoint = watchpoint; - fBreakpoint = breakpoint; - - if (fBreakpoint != NULL) - fBreakpoint->AcquireReference(); - else if (fWatchpoint != NULL) - fWatchpoint->AcquireReference(); - - fListView->SetBreakpoint(breakpoint, watchpoint); - - _UpdateButtons(); -} - - void BreakpointsView::UserBreakpointChanged(UserBreakpoint* breakpoint) { @@ -117,35 +89,9 @@ BreakpointsView::MessageReceived(BMessage* message) { switch (message->what) { case MSG_ENABLE_BREAKPOINT: - if (fListener != NULL) { - if (fBreakpoint != NULL) { - fListener->SetBreakpointEnabledRequested(fBreakpoint, - true); - } else if (fWatchpoint != NULL) { - fListener->SetWatchpointEnabledRequested(fWatchpoint, - true); - } - } - break; case MSG_DISABLE_BREAKPOINT: - if (fListener != NULL) { - if (fBreakpoint != NULL) { - fListener->SetBreakpointEnabledRequested(fBreakpoint, - false); - } else if (fWatchpoint != NULL) { - fListener->SetWatchpointEnabledRequested(fWatchpoint, - false); - } - } - break; case MSG_CLEAR_BREAKPOINT: - if (fListener != NULL) { - if (fBreakpoint != NULL) { - fListener->ClearBreakpointRequested(fBreakpoint); - } else if (fWatchpoint != NULL) { - fListener->ClearWatchpointRequested(fWatchpoint); - } - } + _HandleBreakpointAction(message->what); break; default: BGroupView::MessageReceived(message); @@ -187,27 +133,22 @@ BreakpointsView::SaveSettings(BMessage& settings) void -BreakpointsView::BreakpointSelectionChanged(UserBreakpoint* breakpoint) +BreakpointsView::BreakpointSelectionChanged(BreakpointProxyList& proxies) { if (fListener != NULL) - fListener->BreakpointSelectionChanged(breakpoint); -} + fListener->BreakpointSelectionChanged(proxies); - -void -BreakpointsView::WatchpointSelectionChanged(Watchpoint* watchpoint) -{ - if (fListener != NULL) - fListener->WatchpointSelectionChanged(watchpoint); + _SetSelection(proxies); } void BreakpointsView::_Init() { - BLayoutBuilder::Group<>(this) - .Add(fListView = BreakpointListView::Create(fTeam, this)) - .AddGroup(B_VERTICAL, 4.0f) + BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0.0f) + .Add(fListView = BreakpointListView::Create(fTeam, this, this)) + .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) + .SetInsets(B_USE_SMALL_SPACING) .Add(fToggleBreakpointButton = new BButton("Toggle")) .Add(fRemoveBreakpointButton = new BButton("Remove")) .AddGlue() @@ -225,19 +166,44 @@ BreakpointsView::_UpdateButtons() { AutoLocker teamLocker(fTeam); - bool enabled = false; + bool hasEnabled = false; + bool hasDisabled = false; bool valid = false; - if (fBreakpoint != NULL && fBreakpoint->IsValid()) { - valid = true; - enabled = fBreakpoint->IsEnabled(); - } else if (fWatchpoint != NULL) { - valid = true; - enabled = fWatchpoint->IsEnabled(); + for (int32 i = 0; i < fSelectedBreakpoints.CountItems(); i++) { + BreakpointProxy* proxy = fSelectedBreakpoints.ItemAt(i); + switch (proxy->Type()) { + case BREAKPOINT_PROXY_TYPE_BREAKPOINT: + { + UserBreakpoint* breakpoint = proxy->GetBreakpoint(); + if (breakpoint->IsValid()) { + valid = true; + if (breakpoint->IsEnabled()) + hasEnabled = true; + else + hasDisabled = true; + } + break; + } + case BREAKPOINT_PROXY_TYPE_WATCHPOINT: + { + Watchpoint* watchpoint = proxy->GetWatchpoint(); + valid = true; + if (watchpoint->IsEnabled()) + hasEnabled = true; + else + hasDisabled = true; + break; + } + default: + break; + } } if (valid) { - if (enabled) { + // if we have at least one disabled breakpoint in the + // selection, we leave the button as an Enable button + if (hasEnabled && !hasDisabled) { fToggleBreakpointButton->SetLabel("Disable"); fToggleBreakpointButton->SetMessage( new BMessage(MSG_DISABLE_BREAKPOINT)); @@ -257,6 +223,56 @@ BreakpointsView::_UpdateButtons() } +void +BreakpointsView::_SetSelection(BreakpointProxyList& proxies) +{ + for (int32 i = 0; i < fSelectedBreakpoints.CountItems(); i++) + fSelectedBreakpoints.ItemAt(i)->ReleaseReference(); + + fSelectedBreakpoints.MakeEmpty(); + + for (int32 i = 0; i < proxies.CountItems(); i++) { + BreakpointProxy* proxy = proxies.ItemAt(i); + if (!fSelectedBreakpoints.AddItem(proxy)) + return; + proxy->AcquireReference(); + } + + _UpdateButtons(); +} + + +void +BreakpointsView::_HandleBreakpointAction(uint32 action) +{ + if (fListener == NULL) + return; + + for (int32 i = 0; i < fSelectedBreakpoints.CountItems(); i++) { + BreakpointProxy* proxy = fSelectedBreakpoints.ItemAt(i); + if (proxy->Type() == BREAKPOINT_PROXY_TYPE_BREAKPOINT) { + UserBreakpoint* breakpoint = proxy->GetBreakpoint(); + if (action == MSG_ENABLE_BREAKPOINT && !breakpoint->IsEnabled()) + fListener->SetBreakpointEnabledRequested(breakpoint, true); + else if (action == MSG_DISABLE_BREAKPOINT + && breakpoint->IsEnabled()) { + fListener->SetBreakpointEnabledRequested(breakpoint, false); + } else if (action == MSG_CLEAR_BREAKPOINT) + fListener->ClearBreakpointRequested(breakpoint); + } else { + Watchpoint* watchpoint = proxy->GetWatchpoint(); + if (action == MSG_ENABLE_BREAKPOINT && !watchpoint->IsEnabled()) + fListener->SetWatchpointEnabledRequested(watchpoint, true); + else if (action == MSG_DISABLE_BREAKPOINT + && watchpoint->IsEnabled()) { + fListener->SetWatchpointEnabledRequested(watchpoint, false); + } else if (action == MSG_CLEAR_BREAKPOINT) + fListener->ClearWatchpointRequested(watchpoint); + } + } +} + + // #pragma mark - Listener diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.h b/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.h index 02bef310b6..374b89674c 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.h +++ b/src/apps/debugger/user_interface/gui/team_window/BreakpointsView.h @@ -28,9 +28,6 @@ public: void UnsetListener(); - void SetBreakpoint(UserBreakpoint* breakpoint, - Watchpoint* watchpoint); - void UserBreakpointChanged( UserBreakpoint* breakpoint); void WatchpointChanged( @@ -45,19 +42,18 @@ public: private: // BreakpointListView::Listener virtual void BreakpointSelectionChanged( - UserBreakpoint* breakpoint); - virtual void WatchpointSelectionChanged( - Watchpoint* watchpoint); + BreakpointProxyList& proxies); void _Init(); void _UpdateButtons(); + void _SetSelection(BreakpointProxyList& proxies); + void _HandleBreakpointAction(uint32 action); private: Team* fTeam; - UserBreakpoint* fBreakpoint; - Watchpoint* fWatchpoint; BreakpointListView* fListView; + BreakpointProxyList fSelectedBreakpoints; BButton* fToggleBreakpointButton; BButton* fRemoveBreakpointButton; Listener* fListener; @@ -70,15 +66,13 @@ public: virtual ~Listener(); virtual void BreakpointSelectionChanged( - UserBreakpoint* breakpoint) = 0; + BreakpointProxyList& proxies) = 0; virtual void SetBreakpointEnabledRequested( UserBreakpoint* breakpoint, bool enabled) = 0; virtual void ClearBreakpointRequested( UserBreakpoint* breakpoint) = 0; - virtual void WatchpointSelectionChanged( - Watchpoint* Watchpoint) = 0; virtual void SetWatchpointEnabledRequested( Watchpoint* breakpoint, bool enabled) = 0; diff --git a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp index 9d21acb028..ac2917a9b2 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -8,8 +8,10 @@ #include -#include #include +#include + +#include #include @@ -23,6 +25,132 @@ #include "Tracing.h" +// #pragma mark - SourcePathComponentNode + + +class ImageFunctionsView::SourcePathComponentNode : public BReferenceable { +public: + SourcePathComponentNode(SourcePathComponentNode* parent, + const BString& componentName, LocatableFile* sourceFile, + FunctionInstance* function) + : + fParent(parent), + fComponentName(componentName), + fSourceFile(sourceFile), + fFunction(function) + { + if (fSourceFile != NULL) + fSourceFile->AcquireReference(); + if (fFunction != NULL) + fFunction->AcquireReference(); + } + + virtual ~SourcePathComponentNode() + { + for (int32 i = 0; i < fChildPathComponents.CountItems(); i++) + fChildPathComponents.ItemAt(i)->ReleaseReference(); + + if (fSourceFile != NULL) + fSourceFile->ReleaseReference(); + + if (fFunction != NULL) + fFunction->ReleaseReference(); + } + + const BString& ComponentName() const + { + return fComponentName; + } + + LocatableFile* SourceFile() const + { + return fSourceFile; + } + + FunctionInstance* Function() const + { + return fFunction; + } + + int32 CountChildren() const + { + return fChildPathComponents.CountItems(); + } + + SourcePathComponentNode* ChildAt(int32 index) + { + return fChildPathComponents.ItemAt(index); + } + + SourcePathComponentNode* FindChildByName(const BString& name) const + { + return fChildPathComponents.BinarySearchByKey(name, + &CompareByComponentName); + } + + int32 FindChildIndexByName(const BString& name) const + { + return fChildPathComponents.BinarySearchIndexByKey(name, + &CompareByComponentName); + } + + bool AddChild(SourcePathComponentNode* child) + { + if (!fChildPathComponents.BinaryInsert(child, + &CompareComponents)) { + return false; + } + + child->AcquireReference(); + + return true; + } + + bool RemoveChild(SourcePathComponentNode* child) + { + if (!fChildPathComponents.RemoveItem(child)) + return false; + + child->ReleaseReference(); + + return true; + } + + bool RemoveAllChildren() + { + for (int32 i = 0; i < fChildPathComponents.CountItems(); i++) + RemoveChild(fChildPathComponents.ItemAt(i)); + + return true; + } + +private: + friend class ImageFunctionsView::FunctionsTableModel; + + static int CompareByComponentName(const BString* name, const + SourcePathComponentNode* node) + { + return name->Compare(node->ComponentName()); + } + + static int CompareComponents(const SourcePathComponentNode* a, + const SourcePathComponentNode* b) + { + return a->ComponentName().Compare(b->ComponentName()); + } + +private: + typedef BObjectList ChildPathComponentList; + +private: + SourcePathComponentNode* fParent; + BString fComponentName; + LocatableFile* fSourceFile; + FunctionInstance* fFunction; + ChildPathComponentList fChildPathComponents; +}; + + // #pragma mark - FunctionsTableModel @@ -31,10 +159,7 @@ public: FunctionsTableModel() : fImageDebugInfo(NULL), - fFunctions(NULL), - fFunctionCount(0), - fSourceFileIndices(NULL), - fSourceFileCount(0) + fSourcelessNode(NULL) { } @@ -46,84 +171,75 @@ public: void SetImageDebugInfo(ImageDebugInfo* imageDebugInfo) { // unset old functions - if (fSourceFileIndices != NULL) { - NotifyNodesRemoved(TreeTablePath(), 0, fSourceFileCount); + int32 count = fChildPathComponents.CountItems(); + if (fImageDebugInfo != NULL) { + for (int32 i = 0; i < count; i++) + fChildPathComponents.ItemAt(i)->ReleaseReference(); - delete[] fFunctions; - fFunctions = NULL; - fFunctionCount = 0; - - delete[] fSourceFileIndices; - fSourceFileIndices = NULL; - fSourceFileCount = 0; + fChildPathComponents.MakeEmpty(); + fSourcelessNode = NULL; } fImageDebugInfo = imageDebugInfo; // set new functions - if (fImageDebugInfo == NULL || fImageDebugInfo->CountFunctions() == 0) + if (fImageDebugInfo == NULL || fImageDebugInfo->CountFunctions() + == 0) { + NotifyNodesRemoved(TreeTablePath(), 0, count); return; + } - // create an array with the functions + std::set functionAddresses; + + SourcePathComponentNode* sourcelessNode = new(std::nothrow) + SourcePathComponentNode(NULL, "", NULL, NULL); + BReference sourceNodeRef( + sourcelessNode, true); + + LocatableFile* currentFile = NULL; + BStringList pathComponents; int32 functionCount = fImageDebugInfo->CountFunctions(); - FunctionInstance** functions - = new(std::nothrow) FunctionInstance*[functionCount]; - if (functions == NULL) - return; - ArrayDeleter functionsDeleter(functions); - - for (int32 i = 0; i < functionCount; i++) - functions[i] = fImageDebugInfo->FunctionAt(i); - - // sort them - std::sort(functions, functions + functionCount, &_FunctionLess); - - // eliminate duplicate function instances - if (functionCount > 0) { - Function* previousFunction = functions[0]->GetFunction(); - int32 removed = 0; - for (int32 i = 1; i < functionCount; i++) { - if (functions[i]->GetFunction() == previousFunction) { - removed++; - } else { - functions[i - removed] = functions[i]; - previousFunction = functions[i]->GetFunction(); + for (int32 i = 0; i < functionCount; i++) { + FunctionInstance* instance = fImageDebugInfo->FunctionAt(i); + target_addr_t address = instance->Address(); + if (functionAddresses.find(address) != functionAddresses.end()) + continue; + else { + try { + functionAddresses.insert(address); + } catch (...) { + return; } } - functionCount -= removed; - // The array might now be too large, but we can live with that. + LocatableFile* sourceFile = instance->SourceFile(); + if (sourceFile == NULL) { + if (!_AddFunctionNode(sourcelessNode, instance, NULL)) + return; + continue; + } + + if (sourceFile != currentFile) { + currentFile = sourceFile; + if (!_GetSourcePathComponents(currentFile, + pathComponents)) { + return; + } + } + + if (!_AddFunctionByPath(pathComponents, instance, currentFile)) + return; } - // count the different source files - int32 sourceFileCount = 1; - for (int32 i = 1; i < functionCount; i++) { - if (_CompareSourceFileNames(functions[i - 1]->SourceFile(), - functions[i]->SourceFile()) != 0) { - sourceFileCount++; + if (sourcelessNode->CountChildren() != 0) { + if (fChildPathComponents.BinaryInsert(sourcelessNode, + &SourcePathComponentNode::CompareComponents)) { + fSourcelessNode = sourcelessNode; + sourceNodeRef.Detach(); } } - // allocate and init the indices for the source files - fSourceFileIndices = new(std::nothrow) int32[sourceFileCount]; - if (fSourceFileIndices == NULL) - return; - fSourceFileCount = sourceFileCount; - - fSourceFileIndices[0] = 0; - - int32 sourceFileIndex = 1; - for (int32 i = 1; i < functionCount; i++) { - if (_CompareSourceFileNames(functions[i - 1]->SourceFile(), - functions[i]->SourceFile()) != 0) { - fSourceFileIndices[sourceFileIndex++] = i; - } - } - - fFunctions = functionsDeleter.Detach(); - fFunctionCount = functionCount; - - NotifyNodesAdded(TreeTablePath(), 0, fSourceFileCount); + NotifyTableModelReset(); } virtual int32 CountColumns() const @@ -139,34 +255,17 @@ public: virtual int32 CountChildren(void* parent) const { if (parent == this) - return fSourceFileCount; + return fChildPathComponents.CountItems(); - if (parent >= fSourceFileIndices - && parent < fSourceFileIndices + fSourceFileCount) { - int32 sourceIndex = (int32*)parent - fSourceFileIndices; - return _CountSourceFileFunctions(sourceIndex); - } - - return 0; + return ((SourcePathComponentNode*)parent)->CountChildren(); } virtual void* ChildAt(void* parent, int32 index) const { - if (parent == this) { - return index >= 0 && index < fSourceFileCount - ? fSourceFileIndices + index : NULL; - } + if (parent == this) + return fChildPathComponents.ItemAt(index); - if (parent >= fSourceFileIndices - && parent < fSourceFileIndices + fSourceFileCount) { - int32 sourceIndex = (int32*)parent - fSourceFileIndices; - int32 count = _CountSourceFileFunctions(sourceIndex); - int32 firstFunctionIndex = fSourceFileIndices[sourceIndex]; - return index >= 0 && index < count - ? fFunctions[firstFunctionIndex + index] : NULL; - } - - return NULL; + return ((SourcePathComponentNode*)parent)->ChildAt(index); } virtual bool GetValueAt(void* object, int32 columnIndex, BVariant& value) @@ -177,124 +276,175 @@ public: if (object == this) return false; - if (object >= fSourceFileIndices - && object < fSourceFileIndices + fSourceFileCount) { - int32 index = *(int32*)object; - if (LocatableFile* file = fFunctions[index]->SourceFile()) { - BString path; - file->GetPath(path); - value.SetTo(path); - } else - value.SetTo("", B_VARIANT_DONT_COPY_DATA); + SourcePathComponentNode* node = (SourcePathComponentNode*)object; - return true; - } + value.SetTo(node->ComponentName(), B_VARIANT_DONT_COPY_DATA); - FunctionInstance* function = (FunctionInstance*)object; - value.SetTo(function->PrettyName(), B_VARIANT_DONT_COPY_DATA); return true; } bool GetFunctionPath(FunctionInstance* function, TreeTablePath& _path) { - int32 index = -1; - for (int32 i = 0; i < fFunctionCount; i++) { - if (fFunctions[i] == function) { - index = i; - break; + if (function == NULL) + return false; + + LocatableFile* sourceFile = function->SourceFile(); + SourcePathComponentNode* node = NULL; + int32 childIndex = -1; + if (sourceFile == NULL) { + node = fSourcelessNode; + _path.AddComponent(fChildPathComponents.IndexOf(node)); + } else { + BStringList pathComponents; + if (!_GetSourcePathComponents(sourceFile, pathComponents)) + return false; + + for (int32 i = 0; i < pathComponents.CountStrings(); i++) { + BString component = pathComponents.StringAt(i); + + if (node == NULL) { + childIndex = fChildPathComponents.BinarySearchIndexByKey( + component, + &SourcePathComponentNode::CompareByComponentName); + node = fChildPathComponents.ItemAt(childIndex); + } else { + childIndex = node->FindChildIndexByName(component); + node = node->ChildAt(childIndex); + } + + if (childIndex < 0) + return false; + + _path.AddComponent(childIndex); } } - if (index < 0) + if (node == NULL) return false; - int32 sourceIndex = fSourceFileCount - 1; - while (fSourceFileIndices[sourceIndex] > index) - sourceIndex--; + childIndex = node->FindChildIndexByName(function->PrettyName()); + if (childIndex < 0) + return false; - _path.Clear(); - return _path.AddComponent(sourceIndex) - && _path.AddComponent(index - fSourceFileIndices[sourceIndex]); + _path.AddComponent(childIndex); + return true; } bool GetObjectForPath(const TreeTablePath& path, LocatableFile*& _sourceFile, FunctionInstance*& _function) { - int32 componentCount = path.CountComponents(); - if (componentCount == 0 || componentCount > 2) + SourcePathComponentNode* node = fChildPathComponents.ItemAt( + path.ComponentAt(0)); + + if (node == NULL) return false; - int32 sourceIndex = path.ComponentAt(0); - if (sourceIndex < 0 || sourceIndex >= fSourceFileCount) + for (int32 i = 1; i < path.CountComponents(); i++) + node = node->ChildAt(path.ComponentAt(i)); + + if (node != NULL) { + _sourceFile = node->SourceFile(); + _function = node->Function(); + return true; + } + + return false; + } + +private: + bool _GetSourcePathComponents(LocatableFile* currentFile, + BStringList& pathComponents) + { + BString sourcePath; + currentFile->GetPath(sourcePath); + if (sourcePath.IsEmpty()) return false; - _sourceFile = fFunctions[fSourceFileIndices[sourceIndex]]->SourceFile(); + pathComponents.MakeEmpty(); - _function = NULL; + int32 startIndex = 0; + if (sourcePath[0] == '/') + startIndex = 1; - if (componentCount == 2) { - int32 index = path.ComponentAt(1); - if (index >= 0 && index < _CountSourceFileFunctions(sourceIndex)) - _function = fFunctions[fSourceFileIndices[sourceIndex] + index]; + while (startIndex < sourcePath.Length()) { + int32 searchIndex = sourcePath.FindFirst('/', startIndex); + BString data; + if (searchIndex < 0) + searchIndex = sourcePath.Length(); + + sourcePath.CopyInto(data, startIndex, searchIndex - startIndex); + if (!pathComponents.Add(data)) + return false; + + startIndex = searchIndex + 1; } return true; } - int32 CountSourceFiles() const + bool _AddFunctionByPath(const BStringList& pathComponents, + FunctionInstance* function, LocatableFile* file) { - return fSourceFileCount; + SourcePathComponentNode* parentNode = NULL; + SourcePathComponentNode* currentNode = NULL; + for (int32 i = 0; i < pathComponents.CountStrings(); i++) { + const BString pathComponent = pathComponents.StringAt(i); + if (parentNode == NULL) { + currentNode = fChildPathComponents.BinarySearchByKey( + pathComponent, + SourcePathComponentNode::CompareByComponentName); + } else + currentNode = parentNode->FindChildByName(pathComponent); + + if (currentNode == NULL) { + currentNode = new(std::nothrow) SourcePathComponentNode( + parentNode, pathComponent, NULL, NULL); + if (currentNode == NULL) + return false; + BReference nodeReference(currentNode, + true); + if (parentNode != NULL) { + if (!parentNode->AddChild(currentNode)) + return false; + } else { + if (!fChildPathComponents.BinaryInsert(currentNode, + &SourcePathComponentNode::CompareComponents)) { + return false; + } + + nodeReference.Detach(); + } + } + parentNode = currentNode; + } + + return _AddFunctionNode(currentNode, function, file); + } + + bool _AddFunctionNode(SourcePathComponentNode* parent, + FunctionInstance* function, LocatableFile* file) + { + SourcePathComponentNode* functionNode = new(std::nothrow) + SourcePathComponentNode(parent, function->PrettyName(), file, + function); + + if (functionNode == NULL) + return B_NO_MEMORY; + + BReference nodeReference(functionNode, true); + if (!parent->AddChild(functionNode)) + return false; + + return true; } private: - int32 _CountSourceFileFunctions(int32 sourceIndex) const - { - if (sourceIndex < 0 || sourceIndex >= fSourceFileCount) - return 0; - - int32 nextFunctionIndex = sourceIndex + 1 < fSourceFileCount - ? fSourceFileIndices[sourceIndex + 1] : fFunctionCount; - return nextFunctionIndex - fSourceFileIndices[sourceIndex]; - } - - static int _CompareSourceFileNames(LocatableFile* a, LocatableFile* b) - { - if (a == b) - return 0; - - if (a == NULL) - return 1; - if (b == NULL) - return -1; - - BString pathA; - a->GetPath(pathA); - - BString pathB; - b->GetPath(pathB); - - return pathA.Compare(pathB); - } - - static bool _FunctionLess(const FunctionInstance* a, - const FunctionInstance* b) - { - // compare source file name first - int compared = _CompareSourceFileNames(a->SourceFile(), - b->SourceFile()); - if (compared != 0) - return compared < 0; - - // source file names are equal -- compare the function names - return strcasecmp(a->PrettyName(), b->PrettyName()) < 0; - } + typedef BObjectList ChildPathComponentList; private: - ImageDebugInfo* fImageDebugInfo; - FunctionInstance** fFunctions; - int32 fFunctionCount; - int32* fSourceFileIndices; - int32 fSourceFileCount; + ImageDebugInfo* fImageDebugInfo; + ChildPathComponentList fChildPathComponents; + SourcePathComponentNode* fSourcelessNode; }; @@ -364,7 +514,7 @@ ImageFunctionsView::SetImageDebugInfo(ImageDebugInfo* imageDebugInfo) // If there's only one source file (i.e. "no source file"), expand the item. if (fImageDebugInfo != NULL - && fFunctionsTableModel->CountSourceFiles() == 1) { + && fFunctionsTableModel->CountChildren(fFunctionsTableModel) == 1) { TreeTablePath path; path.AddComponent(0); fFunctionsTable->SetNodeExpanded(path, true, false); @@ -388,6 +538,7 @@ ImageFunctionsView::SetFunction(FunctionInstance* function) fFunctionsTable->SetNodeExpanded(path, true, true); fFunctionsTable->SelectNode(path, false); fFunctionsTable->ScrollToNode(path); + fFunctionsTable->ResizeAllColumnsToPreferred(); } else fFunctionsTable->DeselectAllNodes(); } @@ -444,7 +595,7 @@ ImageFunctionsView::_Init() // columns fFunctionsTable->AddColumn(new StringTableColumn(0, "File/Function", 300, - 100, 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); + 100, 1000, B_TRUNCATE_BEGINNING, B_ALIGN_LEFT)); fFunctionsTableModel = new FunctionsTableModel(); fFunctionsTable->SetTreeTableModel(fFunctionsTableModel); diff --git a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.h b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.h index eb4ed2674e..55fb9594ac 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.h +++ b/src/apps/debugger/user_interface/gui/team_window/ImageFunctionsView.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef IMAGE_FUNCTIONS_VIEW_H @@ -36,6 +37,7 @@ public: private: class FunctionsTableModel; + class SourcePathComponentNode; private: // TreeTableListener diff --git a/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp b/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp index 1588aefb04..4494fc06e6 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ImageListView.cpp @@ -292,7 +292,7 @@ ImageListView::_Init() fImagesTable->AddColumn(new Int32TableColumn(0, "ID", 40, 20, 1000, B_TRUNCATE_MIDDLE, B_ALIGN_RIGHT)); fImagesTable->AddColumn(new StringTableColumn(1, "Name", 80, 40, 1000, - B_TRUNCATE_END, B_ALIGN_LEFT)); + B_TRUNCATE_BEGINNING, B_ALIGN_LEFT)); fImagesTable->AddTableListener(this); diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp index 24a515044c..b6c6d9bacf 100644 --- a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2009, Rene Gollent, rene@gollent.com. + * Copyright 2009-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -14,18 +14,24 @@ #include #include +#include #include #include +#include #include #include +#include #include +#include #include #include #include +#include #include #include +#include "AutoDeleter.h" #include "Breakpoint.h" #include "DisassembledCode.h" #include "Function.h" @@ -45,6 +51,17 @@ static const int32 kSpacesPerTab = 4; // TODO: Should be settable! static const bigtime_t kScrollTimer = 10000LL; +static const char* kClearBreakpointMessage = "Click to clear breakpoint at " + "line %" B_PRId32 "."; +static const char* kDisableBreakpointMessage = "Click to disable breakpoint at " + "line %" B_PRId32 "."; +static const char* kEnableBreakpointMessage = "Click to enable breakpoint at " + "line %" B_PRId32 "."; + +static const uint32 MSG_OPEN_SOURCE_FILE = 'mosf'; + +static const char* kTrackerSignature = "application/x-vnd.Be-TRAK"; + class SourceView::BaseView : public BView { public: @@ -157,6 +174,8 @@ public: virtual void MouseDown(BPoint where); +protected: + virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); private: Team* fTeam; @@ -301,6 +320,19 @@ private: void _ScrollToTop(); void _ScrollToBottom(); + bool _AddGeneralActions(BPopUpMenu* menu, + int32 line); + bool _AddFlowControlActions(BPopUpMenu* menu, + int32 line); + + bool _AddGeneralActionItem(BPopUpMenu* menu, + const char* text, BMessage* message) const; + // takes ownership of message + // regardless of outcome + bool _AddFlowControlActionItem(BPopUpMenu* menu, + const char* text, uint32 what, + target_addr_t address) const; + private: float fMaxLineWidth; @@ -908,18 +940,11 @@ SourceView::MarkerView::MouseDown(BPoint where) return; int32 line = LineAtOffset(where.y); - if (line < 0) - return; - AutoLocker locker(fTeam); Statement* statement; - if (fTeam->GetStatementAtSourceLocation(fSourceCode, - SourceLocation(line), statement) != B_OK) { + if (!fSourceView->GetStatementForLine(line, statement)) return; - } BReference statementReference(statement, true); - if (statement->StartSourceLocation().Line() != line) - return; int32 modifiers; if (Looper()->CurrentMessage()->FindInt32("modifiers", &modifiers) != B_OK) @@ -944,6 +969,57 @@ SourceView::MarkerView::MouseDown(BPoint where) } +bool +SourceView::MarkerView::GetToolTipAt(BPoint point, BToolTip** _tip) +{ + if (fSourceCode == NULL) + return false; + + int32 line = LineAtOffset(point.y); + if (line < 0) + return false; + + AutoLocker locker(fTeam); + Statement* statement; + if (fTeam->GetStatementAtSourceLocation(fSourceCode, + SourceLocation(line), statement) != B_OK) { + return false; + } + BReference statementReference(statement, true); + if (statement->StartSourceLocation().Line() != line) + return false; + + SourceView::MarkerManager::BreakpointMarker* marker = + fMarkerManager->BreakpointMarkerAtLine(line); + + BString text; + if (marker == NULL) { + text.SetToFormat(kEnableBreakpointMessage, line); + } else if ((modifiers() & B_SHIFT_KEY) != 0) { + if (!marker->IsEnabled()) + text.SetToFormat(kClearBreakpointMessage, line); + else + text.SetToFormat(kDisableBreakpointMessage, line); + } else { + if (marker->IsEnabled()) + text.SetToFormat(kClearBreakpointMessage, line); + else + text.SetToFormat(kEnableBreakpointMessage, line); + } + + if (text.Length() > 0) { + BTextToolTip* tip = new(std::nothrow) BTextToolTip(text); + if (tip == NULL) + return false; + + *_tip = tip; + return true; + } + + return false; +} + + // #pragma mark - TextView @@ -1132,7 +1208,15 @@ SourceView::TextView::MessageReceived(BMessage* message) void SourceView::TextView::MouseDown(BPoint where) { - if (fSourceCode != NULL) { + if (fSourceCode == NULL) + return; + + int32 buttons; + if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK) + buttons = B_PRIMARY_MOUSE_BUTTON; + + + if (buttons == B_PRIMARY_MOUSE_BUTTON) { if (!IsFocus()) MakeFocus(true); fTrackState = kTracking; @@ -1172,6 +1256,39 @@ SourceView::TextView::MouseDown(BPoint where) Invalidate(); SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); } + } else if (buttons == B_SECONDARY_MOUSE_BUTTON) { + int32 line = LineAtOffset(where.y); + if (line < 0) + return; + + ::Team* team = fSourceView->fTeam; + AutoLocker locker(team); + ::Thread* activeThread = fSourceView->fActiveThread; + + if (activeThread == NULL) + return; + else if (activeThread->State() != THREAD_STATE_STOPPED) + return; + + BPopUpMenu* menu = new(std::nothrow) BPopUpMenu(""); + if (menu == NULL) + return; + ObjectDeleter menuDeleter(menu); + + if (!_AddGeneralActions(menu, line)) + return; + + if (!_AddFlowControlActions(menu, line)) + return; + + menuDeleter.Detach(); + + BPoint screenWhere(where); + ConvertToScreen(&screenWhere); + menu->SetTargetForItems(fSourceView); + BRect mouseRect(screenWhere, screenWhere); + mouseRect.InsetBy(-4.0, -4.0); + menu->Go(screenWhere, true, false, mouseRect, true); } } @@ -1627,6 +1744,92 @@ SourceView::TextView::_ScrollToBottom(void) } +bool +SourceView::TextView::_AddGeneralActions(BPopUpMenu* menu, int32 line) +{ + BMessage* message = new(std::nothrow) BMessage(MSG_OPEN_SOURCE_FILE); + if (message == NULL) + return false; + message->AddInt32("line", line); + + if (!_AddGeneralActionItem(menu, "Open source file", message)) + return false; + + return true; +} + + +bool +SourceView::TextView::_AddFlowControlActions(BPopUpMenu* menu, int32 line) +{ + Statement* statement; + if (!fSourceView->GetStatementForLine(line, statement)) + return true; + + BReference statementReference(statement, true); + target_addr_t address = statement->CoveringAddressRange().Start(); + + if (menu->CountItems() > 0) + menu->AddSeparatorItem(); + + if (!_AddFlowControlActionItem(menu, "Run to cursor", MSG_THREAD_RUN, + address)) { + return false; + } + + if (!_AddFlowControlActionItem(menu, "Set next statement", + MSG_THREAD_SET_ADDRESS, address)) { + return false; + } + + return true; +} + + +bool +SourceView::TextView::_AddGeneralActionItem(BPopUpMenu* menu, const char* text, + BMessage* message) const +{ + ObjectDeleter messageDeleter(message); + + BMenuItem* item = new(std::nothrow) BMenuItem(text, message); + if (item == NULL) + return false; + ObjectDeleter itemDeleter(item); + messageDeleter.Detach(); + + if (!menu->AddItem(item)) + return false; + + itemDeleter.Detach(); + return true; +} + + +bool +SourceView::TextView::_AddFlowControlActionItem(BPopUpMenu* menu, + const char* text, uint32 what, target_addr_t address) const +{ + BMessage* message = new(std::nothrow) BMessage(what); + if (message == NULL) + return false; + ObjectDeleter messageDeleter(message); + + message->AddUInt64("address", address); + BMenuItem* item = new(std::nothrow) BMenuItem(text, message); + if (item == NULL) + return false; + ObjectDeleter itemDeleter(item); + messageDeleter.Detach(); + + if (!menu->AddItem(item)) + return false; + + itemDeleter.Detach(); + return true; +} + + // #pragma mark - SourceView @@ -1634,6 +1837,7 @@ SourceView::SourceView(Team* team, Listener* listener) : BView("source view", 0), fTeam(team), + fActiveThread(NULL), fStackTrace(NULL), fStackFrame(NULL), fSourceCode(NULL), @@ -1652,7 +1856,7 @@ SourceView::SourceView(Team* team, Listener* listener) SourceView::~SourceView() { SetStackFrame(NULL); - SetStackTrace(NULL); + SetStackTrace(NULL, NULL); SetSourceCode(NULL); } @@ -1673,6 +1877,63 @@ SourceView::Create(Team* team, Listener* listener) } +void +SourceView::MessageReceived(BMessage* message) +{ + switch(message->what) { + case MSG_THREAD_RUN: + case MSG_THREAD_SET_ADDRESS: + { + target_addr_t address; + if (message->FindUInt64("address", &address) != B_OK) + break; + fListener->ThreadActionRequested(fActiveThread, message->what, + address); + break; + } + + case MSG_OPEN_SOURCE_FILE: + { + int32 line; + if (message->FindInt32("line", &line) != B_OK) + break; + // be:line is 1-based. + ++line; + if (fSourceCode == NULL) + break; + LocatableFile* file = fSourceCode->GetSourceFile(); + if (file == NULL) + break; + + BString sourcePath; + file->GetLocatedPath(sourcePath); + if (sourcePath.IsEmpty()) + break; + + BPath path(sourcePath); + entry_ref ref; + if (path.InitCheck() != B_OK) + break; + + if (get_ref_for_path(path.Path(), &ref) != B_OK) + break; + + BMessage trackerMessage(B_REFS_RECEIVED); + trackerMessage.AddRef("refs", &ref); + trackerMessage.AddInt32("be:line", line); + + BMessenger messenger(kTrackerSignature); + messenger.SendMessage(&trackerMessage); + break; + } + + default: + BView::MessageReceived(message); + break; + } +} + + void SourceView::UnsetListener() { @@ -1681,13 +1942,21 @@ SourceView::UnsetListener() void -SourceView::SetStackTrace(StackTrace* stackTrace) +SourceView::SetStackTrace(StackTrace* stackTrace, Thread* activeThread) { TRACE_GUI("SourceView::SetStackTrace(%p)\n", stackTrace); if (stackTrace == fStackTrace) return; + if (fActiveThread != NULL) + fActiveThread->ReleaseReference(); + + fActiveThread = activeThread; + + if (fActiveThread != NULL) + fActiveThread->AcquireReference(); + if (fStackTrace != NULL) { fMarkerManager->SetStackTrace(NULL); fMarkerView->SetStackTrace(NULL); @@ -1888,6 +2157,29 @@ SourceView::DoLayout() } +bool +SourceView::GetStatementForLine(int32 line, Statement*& _statement) +{ + if (line < 0) + return false; + + AutoLocker locker(fTeam); + Statement* statement; + if (fTeam->GetStatementAtSourceLocation(fSourceCode, SourceLocation(line), + statement) != B_OK) { + return false; + } + BReference statementReference(statement, true); + if (statement->StartSourceLocation().Line() != line) + return false; + + _statement = statement; + statementReference.Detach(); + + return true; +} + + void SourceView::_Init() { diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.h b/src/apps/debugger/user_interface/gui/team_window/SourceView.h index bf12eefb2d..efe25e6f71 100644 --- a/src/apps/debugger/user_interface/gui/team_window/SourceView.h +++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.h @@ -18,6 +18,7 @@ class StackFrame; class StackTrace; class Statement; class Team; +class Thread; class UserBreakpoint; @@ -32,9 +33,12 @@ public: static SourceView* Create(Team* team, Listener* listener); // throws + virtual void MessageReceived(BMessage* message); + void UnsetListener(); - void SetStackTrace(StackTrace* stackTrace); + void SetStackTrace(StackTrace* stackTrace, + Thread* thread); void SetStackFrame(StackFrame* stackFrame); void SetSourceCode(SourceCode* sourceCode); @@ -59,12 +63,20 @@ private: class MarkerView; class TextView; + // for gcc2 + friend class TextView; + friend class MarkerView; + struct FontInfo { BFont font; font_height fontHeight; float lineHeight; }; +protected: + bool GetStatementForLine(int32 line, + Statement*& _statement); + private: void _Init(); void _UpdateScrollBars(); @@ -72,6 +84,7 @@ private: private: Team* fTeam; + Thread* fActiveThread; StackTrace* fStackTrace; StackFrame* fStackFrame; SourceCode* fSourceCode; @@ -91,6 +104,8 @@ public: target_addr_t address, bool enabled) = 0; virtual void ClearBreakpointRequested( target_addr_t address) = 0; + virtual void ThreadActionRequested(Thread* thread, + uint32 action, target_addr_t address) = 0; }; diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 2c8ddf6c25..5d0fea6183 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -610,9 +610,17 @@ TeamWindow::FunctionSelectionChanged(FunctionInstance* function) void -TeamWindow::BreakpointSelectionChanged(UserBreakpoint* breakpoint) +TeamWindow::BreakpointSelectionChanged(BreakpointProxyList &proxies) { - _SetActiveBreakpoint(breakpoint); + if (proxies.CountItems() == 0 && fActiveBreakpoint != NULL) { + fActiveBreakpoint->ReleaseReference(); + fActiveBreakpoint = NULL; + } else if (proxies.CountItems() == 1) { + BreakpointProxy* proxy = proxies.ItemAt(0); + if (proxy->Type() == BREAKPOINT_PROXY_TYPE_BREAKPOINT) + _SetActiveBreakpoint(proxy->GetBreakpoint()); + } + // if more than one item is selected, do nothing. } @@ -646,9 +654,10 @@ TeamWindow::ClearBreakpointRequested(target_addr_t address) void -TeamWindow::WatchpointSelectionChanged(Watchpoint* watchpoint) +TeamWindow::ThreadActionRequested(::Thread* thread, uint32 action, + target_addr_t address) { - fBreakpointsView->SetBreakpoint(NULL, watchpoint); + fListener->ThreadActionRequested(thread->ID(), action, address); } @@ -760,29 +769,31 @@ TeamWindow::_Init() { BScrollView* sourceScrollView; - BLayoutBuilder::Group<>(this, B_VERTICAL) + const float splitSpacing = 3.0f; + + BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f) .Add(fMenuBar = new BMenuBar("Menu")) - .AddSplit(B_VERTICAL, 3.0f) + .AddSplit(B_VERTICAL, splitSpacing) .GetSplitView(&fFunctionSplitView) - .SetInsets(4.0f, 4.0f, 4.0f, 4.0f) + .SetInsets(B_USE_SMALL_INSETS) .Add(fTabView = new BTabView("tab view"), 0.4f) - .AddGroup(B_VERTICAL, 4.0f) - .AddGroup(B_HORIZONTAL, 4.0f) - .Add(fRunButton = new BButton("Run")) - .Add(fStepOverButton = new BButton("Step Over")) - .Add(fStepIntoButton = new BButton("Step Into")) - .Add(fStepOutButton = new BButton("Step Out")) - .AddGlue() - .End() - .Add(fSourcePathView = new BStringView( - "source path", - "Source path unavailable."), 4.0f) - .AddSplit(B_HORIZONTAL, 3.0f) - .GetSplitView(&fSourceSplitView) + .AddSplit(B_HORIZONTAL, splitSpacing) + .GetSplitView(&fSourceSplitView) + .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) + .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING) + .Add(fRunButton = new BButton("Run")) + .Add(fStepOverButton = new BButton("Step Over")) + .Add(fStepIntoButton = new BButton("Step Into")) + .Add(fStepOutButton = new BButton("Step Out")) + .AddGlue() + .End() + .Add(fSourcePathView = new BStringView( + "source path", + "Source path unavailable."), 4.0f) .Add(sourceScrollView = new BScrollView("source scroll", - NULL, 0, true, true), 3.0f) - .Add(fLocalsTabView = new BTabView("locals view")) + NULL, 0, true, true), splitSpacing) .End() + .Add(fLocalsTabView = new BTabView("locals view")) .End() .End(); @@ -790,7 +801,7 @@ TeamWindow::_Init() sourceScrollView->SetTarget(fSourceView = SourceView::Create(fTeam, this)); // add threads tab - BSplitView* threadGroup = new BSplitView(B_HORIZONTAL); + BSplitView* threadGroup = new BSplitView(B_HORIZONTAL, splitSpacing); threadGroup->SetName("Threads"); fTabView->AddTab(threadGroup); BLayoutBuilder::Split<>(threadGroup) @@ -799,7 +810,7 @@ TeamWindow::_Init() .Add(fStackTraceView = StackTraceView::Create(this)); // add images tab - BSplitView* imagesGroup = new BSplitView(B_HORIZONTAL); + BSplitView* imagesGroup = new BSplitView(B_HORIZONTAL, splitSpacing); imagesGroup->SetName("Images"); fTabView->AddTab(imagesGroup); BLayoutBuilder::Split<>(imagesGroup) @@ -808,11 +819,12 @@ TeamWindow::_Init() .Add(fImageFunctionsView = ImageFunctionsView::Create(this)); // add breakpoints tab - BGroupView* breakpointsGroup = new BGroupView(B_HORIZONTAL, 4.0f); + BGroupView* breakpointsGroup = new BGroupView(B_HORIZONTAL, + B_USE_SMALL_SPACING); breakpointsGroup->SetName("Breakpoints"); fTabView->AddTab(breakpointsGroup); BLayoutBuilder::Group<>(breakpointsGroup) - .SetInsets(4.0f, 4.0f, 4.0f, 4.0f) +// .SetInsets(0.0f) .Add(fBreakpointsView = BreakpointsView::Create(fTeam, this)); // add local variables tab @@ -840,10 +852,10 @@ TeamWindow::_Init() fSourcePathView->AddFilter(filter); // add menus and menu items - BMenu* menu = new BMenu("File"); + BMenu* menu = new BMenu("Team"); fMenuBar->AddItem(menu); - BMenuItem* item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), - 'Q'); + BMenuItem* item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), + 'W'); menu->AddItem(item); item->SetTarget(this); menu = new BMenu("Edit"); @@ -950,7 +962,7 @@ TeamWindow::_SetActiveStackTrace(StackTrace* stackTrace) fActiveStackTrace->AcquireReference(); fStackTraceView->SetStackTrace(fActiveStackTrace); - fSourceView->SetStackTrace(fActiveStackTrace); + fSourceView->SetStackTrace(fActiveStackTrace, fActiveThread); if (fActiveStackTrace != NULL) _SetActiveStackFrame(fActiveStackTrace->FrameAt(0)); @@ -1030,8 +1042,6 @@ TeamWindow::_SetActiveBreakpoint(UserBreakpoint* breakpoint) // automatically, if the active function remains the same) _ScrollToActiveFunction(); } - - fBreakpointsView->SetBreakpoint(fActiveBreakpoint, NULL); } diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h index 2e8e8d487f..810d975105 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h @@ -88,15 +88,13 @@ private: // BreakpointsView::Listener virtual void BreakpointSelectionChanged( - UserBreakpoint* breakpoint); + BreakpointProxyList& proxies); virtual void SetBreakpointEnabledRequested( UserBreakpoint* breakpoint, bool enabled); virtual void ClearBreakpointRequested( UserBreakpoint* breakpoint); - virtual void WatchpointSelectionChanged( - Watchpoint* Watchpoint); virtual void SetWatchpointEnabledRequested( Watchpoint* breakpoint, bool enabled); @@ -107,7 +105,11 @@ private: // SourceView::Listener virtual void SetBreakpointRequested(target_addr_t address, bool enabled); - virtual void ClearBreakpointRequested(target_addr_t address); + virtual void ClearBreakpointRequested( + target_addr_t address); + virtual void ThreadActionRequested(::Thread* thread, + uint32 action, target_addr_t address); + // VariablesView::Listener virtual void ValueNodeValueRequested(CpuState* cpuState, diff --git a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp index a229f855dc..6569fb9efe 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ThreadListView.cpp @@ -95,7 +95,7 @@ public: virtual int32 CountColumns() const { - return 3; + return 4; } virtual int32 CountRows() const @@ -123,6 +123,14 @@ public: case 2: value.SetTo(thread->Name(), B_VARIANT_DONT_COPY_DATA); return true; + case 3: + { + if (thread->State() != THREAD_STATE_RUNNING) { + value.SetTo(thread->StoppedReasonInfo(), + B_VARIANT_DONT_COPY_DATA); + } + return true; + } default: return false; } @@ -363,6 +371,8 @@ ThreadListView::_Init() B_TRUNCATE_END, B_ALIGN_LEFT)); fThreadsTable->AddColumn(new StringTableColumn(2, "Name", 200, 40, 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); + fThreadsTable->AddColumn(new StringTableColumn(3, "Stop Reason", + 200, 40, 1000, B_TRUNCATE_END, B_ALIGN_LEFT)); fThreadsTable->SetSelectionMode(B_SINGLE_SELECTION_LIST); fThreadsTable->AddTableListener(this); diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index fbae043de7..b31f8250ca 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -32,6 +32,7 @@ #include "FunctionInstance.h" #include "GuiSettingsUtils.h" #include "MessageCodes.h" +#include "RangeList.h" #include "Register.h" #include "SettingsMenu.h" #include "SourceLanguage.h" @@ -46,6 +47,7 @@ #include "TypeComponentPath.h" #include "TypeHandlerRoster.h" #include "TypeLookupConstraints.h" +#include "UiUtils.h" #include "Value.h" #include "ValueHandler.h" #include "ValueHandlerRoster.h" @@ -173,6 +175,9 @@ public: Type* GetType() const { + if (fCastedType != NULL) + return fCastedType; + return fNodeChild->GetType(); } @@ -926,18 +931,19 @@ VariablesView::VariableTableModel::SetStackFrame(Thread* thread, fNodeManager->SetStackFrame(thread, stackFrame); + int32 count = fNodes.CountItems(); fNodeTable.Clear(true); if (!fNodes.IsEmpty()) { - int32 count = fNodes.CountItems(); for (int32 i = 0; i < count; i++) fNodes.ItemAt(i)->ReleaseReference(); fNodes.MakeEmpty(); - NotifyNodesRemoved(TreeTablePath(), 0, count); } - if (stackFrame == NULL) + if (stackFrame == NULL) { + NotifyNodesRemoved(TreeTablePath(), 0, count); return; + } ValueNodeContainer* container = fNodeManager->GetContainer(); AutoLocker containerLocker(container); @@ -950,6 +956,8 @@ VariablesView::VariableTableModel::SetStackFrame(Thread* thread, // so those won't invoke our callback hook. Add them directly here. ValueNodeChildrenCreated(child->Node()); } + + NotifyTableModelReset(); } @@ -996,11 +1004,9 @@ VariablesView::VariableTableModel::ValueNodeChildrenCreated( child->IsInternal(), childCount == 1); } - if (valueNode->ChildCreationNeedsValue()) { - ModelNode* childNode = fNodeTable.Lookup(child); - if (childNode != NULL) - fContainerListener->ModelNodeValueRequested(childNode); - } + ModelNode* childNode = fNodeTable.Lookup(child); + if (childNode != NULL) + fContainerListener->ModelNodeValueRequested(childNode); } if (valueNode->ChildCreationNeedsValue()) @@ -1035,8 +1041,12 @@ VariablesView::VariableTableModel::ValueNodeChildrenDeleted(ValueNode* node) fNodeTable.Remove(hiddenChild); } - for (int32 i = 0; i < modelNode->CountChildren(); i++) { + for (int32 i = modelNode->CountChildren() - 1; i >= 0 ; i--) { BReference childNode = modelNode->ChildAt(i); + // recursively remove the current node's child hierarchy. + if (childNode->CountChildren() != 0) + ValueNodeChildrenDeleted(childNode->NodeChild()->Node()); + TreeTablePath treePath; if (GetTreePath(childNode, treePath)) { int32 index = treePath.RemoveLastComponent(); @@ -1103,7 +1113,7 @@ VariablesView::VariableTableModel::ValueNodeValueChanged(ValueNode* valueNode) int32 VariablesView::VariableTableModel::CountColumns() const { - return 2; + return 3; } @@ -1191,6 +1201,15 @@ VariablesView::VariableTableModel::GetValueAt(void* object, int32 columnIndex, _value.SetTo(node, VALUE_NODE_TYPE); return true; + case 2: + { + Type* type = node->GetType(); + if (type == NULL) + return false; + + _value.SetTo(type->Name(), B_VARIANT_DONT_COPY_DATA); + return true; + } default: return false; } @@ -1248,31 +1267,48 @@ VariablesView::VariableTableModel::GetToolTipForTablePath( if (node->NodeChild()->LocationResolutionState() != B_OK) return false; - ValueLocation* location = node->NodeChild()->Location(); BString tipData; - for (int32 i = 0; i < location->CountPieces(); i++) { - ValuePieceLocation piece = location->PieceAt(i); - BString pieceData; - switch (piece.type) { - case VALUE_PIECE_LOCATION_MEMORY: - pieceData.SetToFormat("(%" B_PRId32 "): Address: %#" B_PRIx64 - ", Size: %" B_PRId64 " bytes", i, piece.address, piece.size); - break; - case VALUE_PIECE_LOCATION_REGISTER: - { - Architecture* architecture = fThread->GetTeam()->GetArchitecture(); - pieceData.SetToFormat("(%" B_PRId32 "): Register (%s)", - i, architecture->Registers()[piece.reg].Name()); + switch (columnIndex) { + case 0: + { + ValueLocation* location = node->NodeChild()->Location(); + for (int32 i = 0; i < location->CountPieces(); i++) { + ValuePieceLocation piece = location->PieceAt(i); + BString pieceData; + switch (piece.type) { + case VALUE_PIECE_LOCATION_MEMORY: + pieceData.SetToFormat("(%" B_PRId32 "): Address: %#" + B_PRIx64 ", Size: %" B_PRId64 " bytes", i, + piece.address, piece.size); + break; + case VALUE_PIECE_LOCATION_REGISTER: + { + Architecture* architecture = fThread->GetTeam() + ->GetArchitecture(); + pieceData.SetToFormat("(%" B_PRId32 "): Register (%s)", + i, architecture->Registers()[piece.reg].Name()); + break; + } + default: + break; + } - break; + tipData += pieceData; + if (i < location->CountPieces() - 1) + tipData += "\n"; } - default: - break; + break; } + case 1: + { + Value* value = node->GetValue(); + if (value != NULL) + value->ToString(tipData); - tipData += pieceData; - if (i < location->CountPieces() - 1) - tipData += "\n"; + break; + } + default: + break; } if (tipData.IsEmpty()) @@ -1500,7 +1536,8 @@ VariablesView::MessageReceived(BMessage* message) promptMessage->AddPointer("node", fVariableTable ->SelectionModel()->NodeAt(0)); PromptWindow* promptWindow = new(std::nothrow) PromptWindow( - "Specify Type", "Type: ", BMessenger(this), promptMessage); + "Specify Type", "Type: ", NULL, BMessenger(this), + promptMessage); if (promptWindow == NULL) return; @@ -1543,14 +1580,133 @@ VariablesView::MessageReceived(BMessage* message) break; } + BReference typeRef(type, true); ValueNode* valueNode = NULL; if (TypeHandlerRoster::Default()->CreateValueNode( - node->NodeChild(), type, valueNode) != B_OK) { + node->NodeChild(), type, valueNode) != B_OK) { break; } + typeRef.Detach(); node->NodeChild()->SetNode(valueNode); node->SetCastedType(type); + fVariableTableModel->NotifyNodeChanged(node); + break; + } + case MSG_TYPECAST_TO_ARRAY: + { + ModelNode* node = NULL; + if (message->FindPointer("node", reinterpret_cast(&node)) + != B_OK) { + break; + } + + Type* baseType = dynamic_cast(node->NodeChild() + ->Node()->GetType())->BaseType(); + ArrayType* arrayType = NULL; + if (baseType->CreateDerivedArrayType(0, kMaxArrayElementCount, + false, arrayType) != B_OK) { + break; + } + + AddressType* addressType = NULL; + BReference typeRef(arrayType, true); + if (arrayType->CreateDerivedAddressType(DERIVED_TYPE_POINTER, + addressType) != B_OK) { + break; + } + + typeRef.Detach(); + typeRef.SetTo(addressType, true); + ValueNode* valueNode = NULL; + if (TypeHandlerRoster::Default()->CreateValueNode( + node->NodeChild(), addressType, valueNode) != B_OK) { + break; + } + + typeRef.Detach(); + node->NodeChild()->SetNode(valueNode); + node->SetCastedType(addressType); + fVariableTableModel->NotifyNodeChanged(node); + break; + } + case MSG_SHOW_CONTAINER_RANGE_PROMPT: + { + ModelNode* node = (ModelNode*)fVariableTable + ->SelectionModel()->NodeAt(0); + int32 lowerBound, upperBound; + ValueNode* valueNode = node->NodeChild()->Node(); + if (!valueNode->IsRangedContainer()) { + valueNode = node->ChildAt(0)->NodeChild()->Node(); + if (!valueNode->IsRangedContainer()) + break; + } + + bool fixedRange = valueNode->IsContainerRangeFixed(); + if (valueNode->SupportedChildRange(lowerBound, upperBound) + != B_OK) { + break; + } + + BMessage* promptMessage = new(std::nothrow) BMessage( + MSG_SET_CONTAINER_RANGE); + if (promptMessage == NULL) + break; + + ObjectDeleter messageDeleter(promptMessage); + promptMessage->AddPointer("node", node); + promptMessage->AddBool("fixedRange", fixedRange); + BString infoText; + if (fixedRange) { + infoText.SetToFormat("Allowed range: %" B_PRId32 + "-%" B_PRId32 ".", lowerBound, upperBound); + } else { + infoText.SetToFormat("Current range: %" B_PRId32 + "-%" B_PRId32 ".", lowerBound, upperBound); + } + + PromptWindow* promptWindow = new(std::nothrow) PromptWindow( + "Set Range", "Range: ", infoText.String(), BMessenger(this), + promptMessage); + if (promptWindow == NULL) + return; + + messageDeleter.Detach(); + promptWindow->CenterOnScreen(); + promptWindow->Show(); + break; + } + case MSG_SET_CONTAINER_RANGE: + { + ModelNode* node = (ModelNode*)fVariableTable + ->SelectionModel()->NodeAt(0); + int32 lowerBound, upperBound; + ValueNode* valueNode = node->NodeChild()->Node(); + if (!valueNode->IsRangedContainer()) + valueNode = node->ChildAt(0)->NodeChild()->Node(); + if (valueNode->SupportedChildRange(lowerBound, upperBound) != B_OK) + break; + + bool fixedRange = message->FindBool("fixedRange"); + + BString rangeExpression = message->FindString("text"); + if (rangeExpression.Length() == 0) + break; + + RangeList ranges; + status_t result = UiUtils::ParseRangeExpression( + rangeExpression, lowerBound, upperBound, fixedRange, ranges); + if (result != B_OK) + break; + + valueNode->ClearChildren(); + for (int32 i = 0; i < ranges.CountRanges(); i++) { + const Range* range = ranges.RangeAt(i); + result = valueNode->CreateChildrenInRange( + range->lowerBound, range->upperBound); + if (result != B_OK) + break; + } break; } case MSG_SHOW_WATCH_VARIABLE_PROMPT: @@ -1805,6 +1961,8 @@ VariablesView::_Init() B_TRUNCATE_END, B_ALIGN_LEFT)); fVariableTable->AddColumn(new VariableValueColumn(1, "Value", 80, 40, 1000, B_TRUNCATE_END, B_ALIGN_RIGHT)); + fVariableTable->AddColumn(new StringTableColumn(2, "Type", 80, 40, 1000, + B_TRUNCATE_END, B_ALIGN_LEFT)); fVariableTableModel = new VariableTableModel; if (fVariableTableModel->Init() != B_OK) @@ -1838,9 +1996,23 @@ VariablesView::_RequestNodeValue(ModelNode* node) // get the value node and check whether its value has not yet been resolved ValueNode* valueNode = nodeChild->Node(); - if (valueNode == NULL - || valueNode->LocationAndValueResolutionState() - != VALUE_NODE_UNRESOLVED) { + if (valueNode == NULL) { + ModelNode* parent = node->Parent(); + if (parent != NULL) { + TreeTablePath path; + if (!fVariableTableModel->GetTreePath(parent, path)) + return; + + // if the parent node was already expanded when the child was + // added, we may not yet have added a value node. + // Notify the table model that this needs to be done. + if (fVariableTable->IsNodeExpanded(path)) + fVariableTableModel->NodeExpanded(parent); + } + } + + if (valueNode == NULL || valueNode->LocationAndValueResolutionState() + != VALUE_NODE_UNRESOLVED) { return; } @@ -1858,19 +2030,31 @@ VariablesView::_GetContextActionsForNode(ModelNode* node, ContextActionList* actions) { ValueLocation* location = node->NodeChild()->Location(); - - // if the location's stored somewhere other than in memory, - // then we won't be able to inspect it this way. - if (location->PieceAt(0).type != VALUE_PIECE_LOCATION_MEMORY) - return B_OK; - + status_t result = B_OK; BMessage* message = NULL; - status_t result = _AddContextAction("Inspect", MSG_SHOW_INSPECTOR_WINDOW, - actions, message); - if (result != B_OK) - return result; - message->AddUInt64("address", location->PieceAt(0).address); + // only show the Inspect option if the value is in fact located + // in memory. + if (location->PieceAt(0).type == VALUE_PIECE_LOCATION_MEMORY) { + result = _AddContextAction("Inspect", MSG_SHOW_INSPECTOR_WINDOW, + actions, message); + if (result != B_OK) + return result; + message->AddUInt64("address", location->PieceAt(0).address); + } + + ValueNode* valueNode = node->NodeChild()->Node(); + + if (valueNode != NULL) { + AddressType* type = dynamic_cast(valueNode->GetType()); + if (type != NULL && type->BaseType() != NULL) { + result = _AddContextAction("Cast to array", MSG_TYPECAST_TO_ARRAY, + actions, message); + if (result != B_OK) + return result; + message->AddPointer("node", node); + } + } result = _AddContextAction("Cast as" B_UTF8_ELLIPSIS, MSG_SHOW_TYPECAST_NODE_PROMPT, actions, message); @@ -1882,6 +2066,23 @@ VariablesView::_GetContextActionsForNode(ModelNode* node, if (result != B_OK) return result; + if (valueNode == NULL) + return B_OK; + + if (!valueNode->IsRangedContainer()) { + if (node->CountChildren() == 1 && node->ChildAt(0)->IsHidden()) { + valueNode = node->ChildAt(0)->NodeChild()->Node(); + if (valueNode == NULL || !valueNode->IsRangedContainer()) + return B_OK; + } else + return B_OK; + } + + result = _AddContextAction("Set visible range" B_UTF8_ELLIPSIS, + MSG_SHOW_CONTAINER_RANGE_PROMPT, actions, message); + if (result != B_OK) + return result; + return B_OK; } diff --git a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp index 8464582e1f..34ae3beb88 100644 --- a/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/WatchPromptWindow.cpp @@ -101,7 +101,7 @@ WatchPromptWindow::_Init() BLayoutItem* labelItem = fTypeField->CreateLabelLayoutItem(); labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BLayoutBuilder::Group<>(this, B_VERTICAL) - .SetInsets(4.0f, 4.0f, 4.0f, 4.0f) + .SetInsets(B_USE_DEFAULT_SPACING) .AddGroup(B_HORIZONTAL, 4.0f) .Add(fAddressInput) .End() diff --git a/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.cpp b/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.cpp new file mode 100644 index 0000000000..149bacd028 --- /dev/null +++ b/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.cpp @@ -0,0 +1,164 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#include "StartTeamWindow.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MessageCodes.h" +#include "UserInterface.h" + + +enum { + MSG_BROWSE_TEAM = 'brte', + MSG_SET_TEAM_PATH = 'setp' +}; + + +StartTeamWindow::StartTeamWindow() + : + BWindow(BRect(), "Start new team", B_TITLED_WINDOW, + B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), + fGuideText(NULL), + fTeamTextControl(NULL), + fArgumentsTextControl(NULL), + fBrowseTeamButton(NULL), + fBrowseTeamPanel(NULL), + fStartButton(NULL), + fCancelButton(NULL) +{ +} + + +StartTeamWindow::~StartTeamWindow() +{ + delete fBrowseTeamPanel; +} + + +StartTeamWindow* +StartTeamWindow::Create() +{ + StartTeamWindow* self = new StartTeamWindow; + + try { + self->_Init(); + } catch (...) { + delete self; + throw; + } + + return self; + +} + +void +StartTeamWindow::_Init() +{ + fGuideText = new BStringView("guide", "Set new team parameters below."); + fTeamTextControl = new BTextControl("Path: ", NULL, NULL); + fArgumentsTextControl = new BTextControl("Arguments: ", NULL, NULL); + fBrowseTeamButton = new BButton("Browse" B_UTF8_ELLIPSIS, new BMessage( + MSG_BROWSE_TEAM)); + fStartButton = new BButton("Start team", new BMessage(MSG_START_NEW_TEAM)); + fCancelButton = new BButton("Cancel", new BMessage(B_QUIT_REQUESTED)); + + BLayoutBuilder::Group<>(this, B_VERTICAL) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(fGuideText) + .AddGroup(B_HORIZONTAL, 4.0f) + .Add(fTeamTextControl) + .Add(fBrowseTeamButton) + .End() + .AddGroup(B_HORIZONTAL, 4.0f) + .Add(fArgumentsTextControl) + .End() + .AddGroup(B_HORIZONTAL, 4.0f) + .AddGlue() + .Add(fCancelButton) + .Add(fStartButton) + .End(); + + fTeamTextControl->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); + fGuideText->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + + fStartButton->SetTarget(this); + fCancelButton->SetTarget(this); +} + +void +StartTeamWindow::Show() +{ + CenterOnScreen(); + BWindow::Show(); +} + +void +StartTeamWindow::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_BROWSE_TEAM: + { + if (fBrowseTeamPanel == NULL) { + fBrowseTeamPanel = new(std::nothrow) BFilePanel(B_OPEN_PANEL, + new BMessenger(this)); + if (fBrowseTeamPanel == NULL) + break; + BMessage* message = new(std::nothrow) BMessage( + MSG_SET_TEAM_PATH); + if (message == NULL) { + delete fBrowseTeamPanel; + fBrowseTeamPanel = NULL; + break; + } + fBrowseTeamPanel->SetMessage(message); + } + + fBrowseTeamPanel->Show(); + break; + } + case MSG_SET_TEAM_PATH: + { + entry_ref ref; + if (message->FindRef("refs", &ref) == B_OK) { + BPath path(&ref); + fTeamTextControl->TextView()->SetText(path.Path()); + } + break; + } + case MSG_START_NEW_TEAM: + { + BMessage appMessage(MSG_START_NEW_TEAM); + appMessage.AddString("path", fTeamTextControl->TextView()->Text()); + appMessage.AddString("arguments", fArgumentsTextControl->TextView() + ->Text()); + BMessage reply; + be_app_messenger.SendMessage(&appMessage, &reply); + status_t error = reply.FindInt32("status"); + if (error != B_OK) { + BString messageString; + messageString.SetToFormat("Failed to start team: %s.", + strerror(error)); + BAlert* alert = new(std::nothrow) BAlert("Start team failed", + messageString.String(), "Close"); + if (alert != NULL) + alert->Go(); + } else + PostMessage(B_QUIT_REQUESTED); + break; + } + default: + BWindow::MessageReceived(message); + break; + } + +} diff --git a/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.h b/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.h new file mode 100644 index 0000000000..c81059e7b8 --- /dev/null +++ b/src/apps/debugger/user_interface/gui/teams_window/StartTeamWindow.h @@ -0,0 +1,47 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef START_TEAM_WINDOW_H +#define START_TEAM_WINDOW_H + + +#include + + +class BButton; +class BFilePanel; +class BStringView; +class BTextControl; + + +class StartTeamWindow : public BWindow +{ +public: + StartTeamWindow(); + + ~StartTeamWindow(); + + static StartTeamWindow* Create(); + // throws + + + virtual void MessageReceived(BMessage* message); + + virtual void Show(); + +private: + void _Init(); + + +private: + BStringView* fGuideText; + BTextControl* fTeamTextControl; + BTextControl* fArgumentsTextControl; + BButton* fBrowseTeamButton; + BFilePanel* fBrowseTeamPanel; + BButton* fStartButton; + BButton* fCancelButton; +}; + +#endif // START_TEAM_WINDOW_H diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp index 21543df753..2d72401f04 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009-2010, Philippe Houdoin, phoudoin@haiku-os.org. All rights reserved. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -23,6 +24,11 @@ #include "TeamsListView.h" +enum { + MSG_UPDATE_TEAMS_LIST = 'uptl' +}; + + // #pragma mark - BitmapStringField @@ -204,17 +210,17 @@ TeamRow::TeamRow(team_id team) bool TeamRow::NeedsUpdate(team_info& info) { - // Check if we need to rebuilt the row's fields because the team critical + // Check if we need to rebuilt the row's fields because the team critical // info (basically, app image running under that team ID) has changed - - if (info.argc != fTeamInfo.argc + + if (info.argc != fTeamInfo.argc || strncmp(info.args, fTeamInfo.args, sizeof(fTeamInfo.args)) != 0) { _SetTo(info); return true; } - + return false; -} +} status_t @@ -227,12 +233,12 @@ TeamRow::_SetTo(team_info& info) len >= 0 && teamInfo.args[len] == ' '; len--) { teamInfo.args[len] = 0; } - + app_info appInfo; status_t status = be_roster->GetRunningAppInfo(teamInfo.team, &appInfo); if (status != B_OK) { // Not an application known to be_roster - + if (teamInfo.team == B_SYSTEM_TEAM) { // Get icon and name from kernel image system_info systemInfo; @@ -243,7 +249,7 @@ TeamRow::_SetTo(team_info& info) kernelPath.Append(systemInfo.kernel_name); get_ref_for_path(kernelPath.Path(), &appInfo.ref); - + } else BPrivate::get_app_ref(teamInfo.team, &appInfo.ref); } @@ -279,10 +285,11 @@ TeamRow::_SetTo(team_info& info) // #pragma mark - TeamsListView -TeamsListView::TeamsListView(BRect frame, const char* name) +TeamsListView::TeamsListView(const char* name, team_id currentTeam) : - Inherited(frame, name, B_FOLLOW_ALL, 0, B_NO_BORDER, true), - fUpdateRunner(NULL) + Inherited(name, 0), + fUpdateRunner(NULL), + fCurrentTeam(currentTeam) { AddColumn(new TeamsColumn("Name", 400, 100, 600, B_TRUNCATE_BEGINNING), kNameColumn); @@ -295,9 +302,6 @@ TeamsListView::TeamsListView(BRect frame, const char* name) */ SetSortingEnabled(false); - team_info tmi; - get_team_info(B_CURRENT_TEAM, &tmi); - fThisTeam = tmi.team; /* #ifdef __HAIKU__ SetFlags(Flags() | B_SUBPIXEL_PRECISE); @@ -322,7 +326,7 @@ TeamsListView::AttachedToWindow() be_roster->StartWatching(this, B_REQUEST_LAUNCHED | B_REQUEST_QUIT); - BMessage msg(kMsgUpdateTeamsList); + BMessage msg(MSG_UPDATE_TEAMS_LIST); fUpdateRunner = new BMessageRunner(this, &msg, 100000L); // 10Hz } @@ -345,7 +349,7 @@ void TeamsListView::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgUpdateTeamsList: + case MSG_UPDATE_TEAMS_LIST: _UpdateList(); break; @@ -415,7 +419,7 @@ TeamsListView::_InitList() } if (tmi.team == B_SYSTEM_TEAM || - tmi.team == fThisTeam) { + tmi.team == fCurrentTeam) { // We don't support debugging kernel and... ourself! row->SetEnabled(false); } @@ -445,7 +449,7 @@ TeamsListView::_UpdateList() if (row != NULL && tmi.team == row->TeamID() && row->NeedsUpdate(tmi)) { - // The team image app could have change due after an exec*() call, + // The team image app could have change due after an exec*() call, UpdateRow(row); } else if (row == NULL || tmi.team != row->TeamID()) { // Team not found in previously known teams list: insert a new row diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h index 6553f825f9..43c5626d54 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.h @@ -1,8 +1,9 @@ /* - * Copyright 2009-2010 Haiku Inc. All rights reserved. + * Copyright 2009-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: + * Rene Gollent * Philippe Houdoin */ #ifndef TEAMS_LIST_ITEM_H @@ -86,7 +87,8 @@ private: class TeamsListView : public BColumnListView { typedef BColumnListView Inherited; public: - TeamsListView(BRect frame, const char* name); + TeamsListView(const char* name, + team_id currentTeam); virtual ~TeamsListView(); TeamRow* FindTeamRow(team_id teamId); @@ -103,9 +105,8 @@ private: private: BMessageRunner* fUpdateRunner; - team_id fThisTeam; + team_id fCurrentTeam; }; -static const uint32 kMsgUpdateTeamsList = 'uptl'; #endif // TEAMS_LIST_VIEW_H diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.cpp b/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.cpp index d65dacb5ea..617a3ef3df 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.cpp +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009-2010, Philippe Houdoin, phoudoin@haiku-os.org. All rights reserved. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -11,30 +12,46 @@ #include #include -#include -#include +#include #include #include +#include +#include #include +#include +#include #include "MessageCodes.h" #include "SettingsManager.h" +#include "StartTeamWindow.h" #include "TeamsWindow.h" #include "TeamsListView.h" +enum { + MSG_TEAM_SELECTION_CHANGED = 'tesc' +}; + + TeamsWindow::TeamsWindow(SettingsManager* settingsManager) : BWindow(BRect(100, 100, 500, 250), "Teams", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS), fTeamsListView(NULL), + fStartTeamWindow(NULL), + fAttachTeamButton(NULL), + fCreateTeamButton(NULL), fSettingsManager(settingsManager) { + team_info info; + get_team_info(B_CURRENT_TEAM, &info); + fCurrentTeam = info.team; } TeamsWindow::~TeamsWindow() { + BMessenger(fStartTeamWindow).SendMessage(B_QUIT_REQUESTED); } @@ -54,13 +71,44 @@ TeamsWindow::Create(SettingsManager* settingsManager) } +void +TeamsWindow::Zoom(BPoint, float, float) +{ + BSize preferredSize = fTeamsListView->PreferredSize(); + ResizeBy(preferredSize.Width() - Bounds().Width(), + 0.0); + + // if the new size would extend us past the screen border, + // move sufficiently to the left to bring us back within the bounds + // + a bit of extra margin so we're not flush against the edge. + BScreen screen; + float offset = screen.Frame().right - Frame().right; + if (offset < 0) + MoveBy(offset - 5.0, 0.0); +} + + void TeamsWindow::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgDebugThisTeam: + case MSG_START_NEW_TEAM: { - TeamRow* row = dynamic_cast(fTeamsListView->CurrentSelection()); + BMessenger messenger(fStartTeamWindow); + if (!messenger.IsValid()) { + fStartTeamWindow = StartTeamWindow::Create(); + if (fStartTeamWindow == NULL) + break; + } + + fStartTeamWindow->Show(); + break; + } + + case MSG_DEBUG_THIS_TEAM: + { + TeamRow* row = dynamic_cast( + fTeamsListView->CurrentSelection()); if (row != NULL) { BMessage message(MSG_DEBUG_THIS_TEAM); message.AddInt32("team", row->TeamID()); @@ -69,6 +117,21 @@ TeamsWindow::MessageReceived(BMessage* message) break; } + case MSG_TEAM_SELECTION_CHANGED: + { + TeamRow* row = dynamic_cast( + fTeamsListView->CurrentSelection()); + bool enabled = false; + if (row != NULL) { + team_id id = row->TeamID(); + if (id != fCurrentTeam && id != B_SYSTEM_TEAM) + enabled = true; + } + + fAttachTeamButton->SetEnabled(enabled); + break; + } + default: BWindow::MessageReceived(message); break; @@ -101,17 +164,23 @@ TeamsWindow::_Init() ResizeTo(frame.Width(), frame.Height()); } - // TODO: add button to start a team debugger - // TODO: add UI to setup arguments and environ, launch a program - // and start his team debugger + BLayoutBuilder::Group<>(this, B_VERTICAL) + .Add(fTeamsListView = new TeamsListView("TeamsList", fCurrentTeam)) + .SetInsets(1.0f, 1.0f, 1.0f, 1.0f) + .AddGroup(B_HORIZONTAL) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(fAttachTeamButton = new BButton("Attach", new BMessage( + MSG_DEBUG_THIS_TEAM))) + .Add(fCreateTeamButton = new BButton("Start new team" + B_UTF8_ELLIPSIS, new BMessage(MSG_START_NEW_TEAM))) + .End() + .End(); - // Add a teams list view - frame = Bounds(); - frame.InsetBy(-1, -1); - fTeamsListView = new TeamsListView(frame, "TeamsList"); - fTeamsListView->SetInvocationMessage(new BMessage(kMsgDebugThisTeam)); + fTeamsListView->SetInvocationMessage(new BMessage(MSG_DEBUG_THIS_TEAM)); + fTeamsListView->SetSelectionMessage(new BMessage( + MSG_TEAM_SELECTION_CHANGED)); - AddChild(fTeamsListView); + fAttachTeamButton->SetEnabled(false); } diff --git a/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.h b/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.h index 36ab8ee74c..b83083e6bf 100644 --- a/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.h +++ b/src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.h @@ -1,5 +1,6 @@ /* * Copyright 2009-2010, Philippe Houdoin, phoudoin@haiku-os.org. All rights reserved. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef TEAMS_WINDOW_H @@ -8,10 +9,12 @@ #include +class BButton; class BListView; class BFile; class BMessage; class SettingsManager; +class StartTeamWindow; class TeamsListView; class TeamsWindow : public BWindow { @@ -22,6 +25,7 @@ public: static TeamsWindow* Create(SettingsManager* settingsManager); // throws + virtual void Zoom(BPoint origin, float width, float height); virtual void MessageReceived(BMessage* message); virtual bool QuitRequested(); @@ -32,11 +36,14 @@ private: status_t _SaveSettings(); private: + team_id fCurrentTeam; TeamsListView* fTeamsListView; + StartTeamWindow* fStartTeamWindow; + BButton* fAttachTeamButton; + BButton* fCreateTeamButton; SettingsManager* fSettingsManager; }; -static const uint32 kMsgDebugThisTeam = 'dbtm'; #endif // TEAMS_WINDOW_H diff --git a/src/apps/debugger/user_interface/util/UiUtils.cpp b/src/apps/debugger/user_interface/util/UiUtils.cpp index 69d75c379a..39eee3f784 100644 --- a/src/apps/debugger/user_interface/util/UiUtils.cpp +++ b/src/apps/debugger/user_interface/util/UiUtils.cpp @@ -20,6 +20,7 @@ #include "FunctionInstance.h" #include "Image.h" +#include "RangeList.h" #include "StackFrame.h" #include "Team.h" #include "TeamMemoryBlock.h" @@ -129,19 +130,19 @@ UiUtils::ImageTypeToString(image_type type, char* buffer, size_t bufferSize) { switch (type) { case B_APP_IMAGE: - snprintf(buffer, bufferSize, "Application"); + snprintf(buffer, bufferSize, "app"); break; case B_LIBRARY_IMAGE: - snprintf(buffer, bufferSize, "Library"); + snprintf(buffer, bufferSize, "lib"); break; case B_ADD_ON_IMAGE: - snprintf(buffer, bufferSize, "Add-on"); + snprintf(buffer, bufferSize, "add-on"); break; case B_SYSTEM_IMAGE: - snprintf(buffer, bufferSize, "System"); + snprintf(buffer, bufferSize, "system"); break; default: - snprintf(buffer, bufferSize, "Unknown"); + snprintf(buffer, bufferSize, "unknown"); break; } @@ -155,28 +156,28 @@ UiUtils::AreaLockingFlagsToString(uint32 flags, char* buffer, { switch (flags) { case B_NO_LOCK: - snprintf(buffer, bufferSize, "None"); + snprintf(buffer, bufferSize, "none"); break; case B_LAZY_LOCK: - snprintf(buffer, bufferSize, "Lazy"); + snprintf(buffer, bufferSize, "lazy"); break; case B_FULL_LOCK: - snprintf(buffer, bufferSize, "Full"); + snprintf(buffer, bufferSize, "full"); break; case B_CONTIGUOUS: - snprintf(buffer, bufferSize, "Contiguous"); + snprintf(buffer, bufferSize, "contiguous"); break; case B_LOMEM: - snprintf(buffer, bufferSize, "Lo-mem"); + snprintf(buffer, bufferSize, "lo-mem"); break; case B_32_BIT_FULL_LOCK: - snprintf(buffer, bufferSize, "32-bit Full"); + snprintf(buffer, bufferSize, "32-bit full"); break; case B_32_BIT_CONTIGUOUS: - snprintf(buffer, bufferSize, "32-bit Contiguous"); + snprintf(buffer, bufferSize, "32-bit contig."); break; default: - snprintf(buffer, bufferSize, "Unknown"); + snprintf(buffer, bufferSize, "unknown"); break; } @@ -188,56 +189,54 @@ UiUtils::AreaLockingFlagsToString(uint32 flags, char* buffer, UiUtils::AreaProtectionFlagsToString(uint32 protection, BString& _output) { #undef ADD_AREA_FLAG_IF_PRESENT - #define ADD_AREA_FLAG_IF_PRESENT(flag, protection, name, output) \ + #define ADD_AREA_FLAG_IF_PRESENT(flag, protection, name, output, missing)\ if ((protection & flag) != 0) { \ _output += name; \ protection &= ~flag; \ - } + } else \ + _output += missing; \ _output.Truncate(0); uint32 userFlags = protection & B_USER_PROTECTION; - if ((protection & B_USER_PROTECTION) != 0) { - ADD_AREA_FLAG_IF_PRESENT(B_READ_AREA, protection, "r", _output); - ADD_AREA_FLAG_IF_PRESENT(B_WRITE_AREA, protection, "w", _output); - ADD_AREA_FLAG_IF_PRESENT(B_EXECUTE_AREA, protection, "x", _output); - ADD_AREA_FLAG_IF_PRESENT(B_STACK_AREA, protection, "s", _output); - ADD_AREA_FLAG_IF_PRESENT(B_OVERCOMMITTING_AREA, protection, " overcommitting", - _output); - _output += ", "; + bool userProtectionPresent = userFlags != 0; + ADD_AREA_FLAG_IF_PRESENT(B_READ_AREA, protection, "r", _output, + userProtectionPresent ? "-" : " "); + ADD_AREA_FLAG_IF_PRESENT(B_WRITE_AREA, protection, "w", _output, + userProtectionPresent ? "-" : " "); + ADD_AREA_FLAG_IF_PRESENT(B_EXECUTE_AREA, protection, "x", _output, + userProtectionPresent ? "-" : " "); - // if the user versions of these flags are present, - // filter out their kernel equivalents since they're implied. - if ((userFlags & B_READ_AREA) != 0) - protection &= ~B_KERNEL_READ_AREA; - if ((userFlags & B_WRITE_AREA) != 0) - protection &= ~B_KERNEL_WRITE_AREA; - if ((userFlags & B_EXECUTE_AREA) != 0) - protection &= ~B_KERNEL_EXECUTE_AREA; - if ((userFlags & B_STACK_AREA) != 0) - protection &= ~B_KERNEL_STACK_AREA; - } - if ((protection & B_KERNEL_AREA_FLAGS) != 0) { - _output += "kernel:"; - ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_READ_AREA, protection, "r", _output); + // if the user versions of these flags are present, + // filter out their kernel equivalents since they're implied. + if ((userFlags & B_READ_AREA) != 0) + protection &= ~B_KERNEL_READ_AREA; + if ((userFlags & B_WRITE_AREA) != 0) + protection &= ~B_KERNEL_WRITE_AREA; + if ((userFlags & B_EXECUTE_AREA) != 0) + protection &= ~B_KERNEL_EXECUTE_AREA; + + if ((protection & B_KERNEL_PROTECTION) != 0) { + ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_READ_AREA, protection, "r", + _output, "-"); ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_WRITE_AREA, protection, "w", - _output); + _output, "-"); ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_EXECUTE_AREA, protection, "x", - _output); - ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_STACK_AREA, protection, "s", - _output); - ADD_AREA_FLAG_IF_PRESENT(B_USER_CLONEABLE_AREA, protection, " cloneable", - _output); - ADD_AREA_FLAG_IF_PRESENT(B_SHARED_AREA, protection, " shared", _output); - _output += ", "; + _output, "-"); } + ADD_AREA_FLAG_IF_PRESENT(B_STACK_AREA, protection, "s", _output, ""); + ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_STACK_AREA, protection, "s", _output, ""); + ADD_AREA_FLAG_IF_PRESENT(B_OVERCOMMITTING_AREA, protection, _output, "o", + ""); + ADD_AREA_FLAG_IF_PRESENT(B_SHARED_AREA, protection, "S", _output, ""); + ADD_AREA_FLAG_IF_PRESENT(B_KERNEL_AREA, protection, "k", _output, ""); + if (protection != 0) { char buffer[32]; - snprintf(buffer, sizeof(buffer), " Unknown (%#04" B_PRIx32 ")", + snprintf(buffer, sizeof(buffer), ", u:(%#04" B_PRIx32 ")", protection); _output += buffer; - } else if (!_output.IsEmpty()) - _output.Truncate(_output.Length() - 2); + } return _output; } @@ -390,3 +389,67 @@ UiUtils::DumpMemory(BString& _output, int32 indentLevel, _output.Append("\n"); } + + +static status_t ParseRangeString(BString& rangeString, int32& lowerBound, + int32& upperBound) +{ + lowerBound = atoi(rangeString.String()); + int32 index = rangeString.FindFirst('-'); + if (index >= 0) { + rangeString.Remove(0, index + 1); + upperBound = atoi(rangeString.String()); + } else + upperBound = lowerBound; + + if (lowerBound > upperBound) + return B_BAD_VALUE; + + return B_OK; +} + + +/*static*/ status_t +UiUtils::ParseRangeExpression(const BString& rangeExpression, int32 lowerBound, + int32 upperBound, bool fixedRange, RangeList& _output) +{ + if (rangeExpression.IsEmpty()) + return B_BAD_DATA; + + BString dataString = rangeExpression; + dataString.RemoveAll(" "); + + // first, tokenize the range list to its constituent child ranges. + int32 index; + int32 lowValue; + int32 highValue; + BString tempRange; + while (!dataString.IsEmpty()) { + index = dataString.FindFirst(','); + if (index == 0) + return B_BAD_VALUE; + else if (index > 0) { + dataString.MoveInto(tempRange, 0, index); + dataString.Remove(0, 1); + } else { + tempRange = dataString; + dataString.Truncate(0); + } + + status_t result = ParseRangeString(tempRange, lowValue, highValue); + if (result != B_OK) + return result; + + + if (fixedRange && (lowValue < lowerBound || highValue > upperBound)) + return B_BAD_VALUE; + + result = _output.AddRange(lowValue, highValue); + if (result != B_OK) + return result; + + tempRange.Truncate(0); + } + + return B_OK; +} diff --git a/src/apps/debugger/user_interface/util/UiUtils.h b/src/apps/debugger/user_interface/util/UiUtils.h index 69480242b5..7b11be9a18 100644 --- a/src/apps/debugger/user_interface/util/UiUtils.h +++ b/src/apps/debugger/user_interface/util/UiUtils.h @@ -14,6 +14,7 @@ class BString; class BVariant; +class RangeList; class StackFrame; class Team; class TeamMemoryBlock; @@ -50,6 +51,12 @@ public: TeamMemoryBlock* block, target_addr_t address, int32 itemSize, int32 displayWidth, int32 count); + + static status_t ParseRangeExpression( + const BString& rangeString, + int32 lowerBound, int32 upperBound, + bool fixedRange, + RangeList& _output); }; diff --git a/src/apps/debugger/util/RangeList.cpp b/src/apps/debugger/util/RangeList.cpp new file mode 100644 index 0000000000..8ab7f80bac --- /dev/null +++ b/src/apps/debugger/util/RangeList.cpp @@ -0,0 +1,142 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ + + +#include "RangeList.h" + +#include + + +RangeList::RangeList() + : BObjectList(20, true) +{ +} + + +RangeList::~RangeList() +{ +} + + +status_t +RangeList::AddRange(int32 lowValue, int32 highValue) +{ + if (lowValue > highValue) + return B_BAD_VALUE; + + int32 i = 0; + if (CountItems() != 0) { + for (; i < CountItems(); i++) { + Range* range = ItemAt(i); + if (lowValue < range->lowerBound) { + if (highValue < range->lowerBound) { + // the new range is completely below the bounds + // of the ranges we currently contain, + // insert it here. + break; + } else if (highValue <= range->upperBound) { + // the new range partly overlaps the lower + // current range + range->lowerBound = lowValue; + return B_OK; + } else { + // the new range completely encompasses + // the current range + range->lowerBound = lowValue; + range->upperBound = highValue; + _CollapseOverlappingRanges(i +1, highValue); + } + + } else if (lowValue < range->upperBound) { + if (highValue <= range->upperBound) { + // the requested range is already completely contained + // within our existing range list + return B_OK; + } else { + range->upperBound = highValue; + _CollapseOverlappingRanges(i + 1, highValue); + return B_OK; + } + } + } + } + + Range* range = new(std::nothrow) Range(lowValue, highValue); + if (range == NULL) + return B_NO_MEMORY; + + BPrivate::ObjectDeleter rangeDeleter(range); + if (!AddItem(range, i)) + return B_NO_MEMORY; + + rangeDeleter.Detach(); + return B_OK; +} + + +status_t +RangeList::AddRange(const Range& range) +{ + return AddRange(range.lowerBound, range.upperBound); +} + + +void +RangeList::RemoveRangeAt(int32 index) +{ + if (index < 0 || index >= CountItems()) + return; + + RemoveItem(ItemAt(index)); +} + + +bool +RangeList::Contains(int32 value) const +{ + for (int32 i = 0; i < CountItems(); i++) { + const Range* range = ItemAt(i); + if (value < range->lowerBound || value > range->upperBound) + break; + else if (value >= range->lowerBound && value <= range->upperBound) + return true; + } + + return false; +} + + +int32 +RangeList::CountRanges() const +{ + return CountItems(); +} + + +const Range* +RangeList::RangeAt(int32 index) const +{ + return ItemAt(index); +} + + +void +RangeList::_CollapseOverlappingRanges(int32 startIndex, int32 highValue) +{ + for (int32 i = startIndex; i < CountItems();) { + // check if it also overlaps any of the following + // ranges. + Range* nextRange = ItemAt(i); + if (nextRange->lowerBound > highValue) + return; + else if (nextRange->upperBound < highValue) { + RemoveItem(nextRange); + continue; + } else { + nextRange->lowerBound = highValue + 1; + return; + } + } +} diff --git a/src/apps/debugger/util/RangeList.h b/src/apps/debugger/util/RangeList.h new file mode 100644 index 0000000000..b37fc1ba50 --- /dev/null +++ b/src/apps/debugger/util/RangeList.h @@ -0,0 +1,55 @@ +/* + * Copyright 2013, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef RANGE_LIST_H +#define RANGE_LIST_H + + +#include +#include + + +struct Range { + int32 lowerBound; + int32 upperBound; + + Range() + : + lowerBound(-1), + upperBound(-1) + { + } + + Range(int32 lowValue, int32 highValue) + : + lowerBound(lowValue), + upperBound(highValue) + { + } +}; + + +class RangeList : private BObjectList +{ +public: + RangeList(); + virtual ~RangeList(); + + + status_t AddRange(int32 lowValue, int32 highValue); + status_t AddRange(const Range& range); + + void RemoveRangeAt(int32 index); + + int32 CountRanges() const; + const Range* RangeAt(int32 index) const; + + bool Contains(int32 value) const; + +private: + void _CollapseOverlappingRanges(int32 startIndex, + int32 highValue); +}; + +#endif // RANGE_LIST_H diff --git a/src/apps/debugger/value/ValueNode.cpp b/src/apps/debugger/value/ValueNode.cpp index a88ce6dfe1..33bde4f59c 100644 --- a/src/apps/debugger/value/ValueNode.cpp +++ b/src/apps/debugger/value/ValueNode.cpp @@ -63,6 +63,41 @@ ValueNode::SetContainer(ValueNodeContainer* container) } +bool +ValueNode::IsRangedContainer() const +{ + return false; +} + + +bool +ValueNode::IsContainerRangeFixed() const +{ + return false; +} + + +void +ValueNode::ClearChildren() +{ + // do nothing +} + + +status_t +ValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex) +{ + return B_NOT_SUPPORTED; +} + + +status_t +ValueNode::SupportedChildRange(int32& lowIndex, int32& highIndex) const +{ + return B_NOT_SUPPORTED; +} + + void ValueNode::SetLocationAndValue(ValueLocation* location, Value* value, status_t resolutionState) diff --git a/src/apps/debugger/value/ValueNode.h b/src/apps/debugger/value/ValueNode.h index 449aba779d..c61f252159 100644 --- a/src/apps/debugger/value/ValueNode.h +++ b/src/apps/debugger/value/ValueNode.h @@ -51,10 +51,27 @@ public: { return false; } bool ChildrenCreated() const { return fChildrenCreated; } + virtual status_t CreateChildren() = 0; virtual int32 CountChildren() const = 0; virtual ValueNodeChild* ChildAt(int32 index) const = 0; + // optional virtual hooks for container type value nodes such as + // arrays that may contain a variable (and potentially quite large) + // number of children. The calls below should be implemented for such + // node types to allow the upper layers to be aware of this, and to be + // able to request that only a subset of children be created. + virtual bool IsRangedContainer() const; + virtual bool IsContainerRangeFixed() const; + // indicates that the user can't + // arbitrarily go outside of the + // specified/supported range. + virtual void ClearChildren(); + virtual status_t CreateChildrenInRange(int32 lowIndex, + int32 highIndex); + virtual status_t SupportedChildRange(int32& lowIndex, + int32& highIndex) const; + status_t LocationAndValueResolutionState() const { return fLocationResolutionState; } void SetLocationAndValue(ValueLocation* location, diff --git a/src/apps/debugger/value/value_nodes/ArrayValueNode.cpp b/src/apps/debugger/value/value_nodes/ArrayValueNode.cpp index e8f5c62cf2..bc05323c02 100644 --- a/src/apps/debugger/value/value_nodes/ArrayValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/ArrayValueNode.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -30,7 +31,10 @@ AbstractArrayValueNode::AbstractArrayValueNode(ValueNodeChild* nodeChild, : ValueNode(nodeChild), fType(type), - fDimension(dimension) + fDimension(dimension), + fLowerBound(0), + fUpperBound(0), + fBoundsInitialized(false) { fType->AcquireReference(); } @@ -76,18 +80,72 @@ AbstractArrayValueNode::CreateChildren() if (!fChildren.IsEmpty()) return B_OK; + return CreateChildrenInRange(0, kMaxArrayElementCount - 1); +} + + +int32 +AbstractArrayValueNode::CountChildren() const +{ + return fChildren.CountItems(); +} + + +ValueNodeChild* +AbstractArrayValueNode::ChildAt(int32 index) const +{ + return fChildren.ItemAt(index); +} + + +bool +AbstractArrayValueNode::IsRangedContainer() const +{ + return true; +} + + +void +AbstractArrayValueNode::ClearChildren() +{ + fChildren.MakeEmpty(); + fLowerBound = 0; + fUpperBound = 0; + if (fContainer != NULL) + fContainer->NotifyValueNodeChildrenDeleted(this); +} + + +status_t +AbstractArrayValueNode::CreateChildrenInRange(int32 lowIndex, + int32 highIndex) +{ + // TODO: ensure that we don't already have children in the specified + // index range. These need to be skipped if so. TRACE_LOCALS("TYPE_ARRAY\n"); int32 dimensionCount = fType->CountDimensions(); bool isFinalDimension = fDimension + 1 == dimensionCount; + status_t error = B_OK; - ArrayDimension* dimension = fType->DimensionAt(fDimension); - uint64 elementCount = dimension->CountElements(); - if (elementCount == 0 || elementCount > kMaxArrayElementCount) - elementCount = kMaxArrayElementCount; + if (!fBoundsInitialized) { + int32 lowerBound, upperBound; + error = SupportedChildRange(lowerBound, upperBound); + if (error != B_OK) + return error; + + fLowerBound = lowerBound; + fUpperBound = upperBound; + fBoundsInitialized = true; + } else { + if (lowIndex < fLowerBound) + fLowerBound = lowIndex; + if (highIndex > fUpperBound) + fUpperBound = highIndex; + } // create children for the array elements - for (int32 i = 0; i < (int32)elementCount; i++) { + for (int32 i = lowIndex; i <= highIndex; i++) { BString name(Name()); name << '[' << i << ']'; if (name.Length() <= Name().Length()) @@ -117,17 +175,27 @@ AbstractArrayValueNode::CreateChildren() } -int32 -AbstractArrayValueNode::CountChildren() const +status_t +AbstractArrayValueNode::SupportedChildRange(int32& lowIndex, + int32& highIndex) const { - return fChildren.CountItems(); -} + if (!fBoundsInitialized) { + ArrayDimension* dimension = fType->DimensionAt(fDimension); + SubrangeType* dimensionType = dynamic_cast( + dimension->GetType()); -ValueNodeChild* -AbstractArrayValueNode::ChildAt(int32 index) const -{ - return fChildren.ItemAt(index); + if (dimensionType != NULL) { + lowIndex = dimensionType->LowerBound().ToInt32(); + highIndex = dimensionType->UpperBound().ToInt32(); + } else + return B_UNSUPPORTED; + } else { + lowIndex = fLowerBound; + highIndex = fUpperBound; + } + + return B_OK; } diff --git a/src/apps/debugger/value/value_nodes/ArrayValueNode.h b/src/apps/debugger/value/value_nodes/ArrayValueNode.h index dcef1e95d0..242954dfcf 100644 --- a/src/apps/debugger/value/value_nodes/ArrayValueNode.h +++ b/src/apps/debugger/value/value_nodes/ArrayValueNode.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -40,6 +41,12 @@ public: virtual int32 CountChildren() const; virtual ValueNodeChild* ChildAt(int32 index) const; + virtual bool IsRangedContainer() const; + virtual void ClearChildren(); + virtual status_t CreateChildrenInRange(int32 lowIndex, + int32 highIndex); + virtual status_t SupportedChildRange(int32& lowIndex, + int32& highIndex) const; protected: typedef BObjectList ChildList; @@ -47,6 +54,9 @@ protected: ArrayType* fType; ChildList fChildren; int32 fDimension; + int32 fLowerBound; + int32 fUpperBound; + bool fBoundsInitialized; }; diff --git a/src/apps/debugger/value/value_nodes/BListValueNode.cpp b/src/apps/debugger/value/value_nodes/BListValueNode.cpp index 86f3c8e4c9..147dccde2f 100644 --- a/src/apps/debugger/value/value_nodes/BListValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BListValueNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com + * Copyright 2012-2013, Rene Gollent, rene@gollent.com * Distributed under the terms of the MIT License. */ @@ -165,7 +165,8 @@ BListValueNode::BListValueNode(ValueNodeChild* nodeChild, fType(type), fLoader(NULL), fItemCountType(NULL), - fItemCount(0) + fItemCount(0), + fCountChildCreated(false) { fType->AcquireReference(); } @@ -304,19 +305,67 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, status_t BListValueNode::CreateChildren() { - if (fChildrenCreated) - return B_OK; + return CreateChildrenInRange(0, kMaxArrayElementCount); +} + +int32 +BListValueNode::CountChildren() const +{ + return fChildren.CountItems(); +} + + +ValueNodeChild* +BListValueNode::ChildAt(int32 index) const +{ + return fChildren.ItemAt(index); +} + + +bool +BListValueNode::IsRangedContainer() const +{ + return true; +} + + +bool +BListValueNode::IsContainerRangeFixed() const +{ + return true; +} + + +void +BListValueNode::ClearChildren() +{ + fChildren.MakeEmpty(); + fCountChildCreated = false; + if (fContainer != NULL) + fContainer->NotifyValueNodeChildrenDeleted(this); +} + + +status_t +BListValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex) +{ if (fLocationResolutionState != B_OK) return fLocationResolutionState; - if (fItemCountType != NULL) { + if (lowIndex < 0) + lowIndex = 0; + if (highIndex >= fItemCount) + highIndex = fItemCount - 1; + + if (!fCountChildCreated && fItemCountType != NULL) { BListItemCountNodeChild* countChild = new(std::nothrow) BListItemCountNodeChild(fItemCountLocation, this, fItemCountType); if (countChild == NULL) return B_NO_MEMORY; + fCountChildCreated = true; countChild->SetContainer(fContainer); fChildren.AddItem(countChild); } @@ -343,7 +392,7 @@ BListValueNode::CreateChildren() return result; } - for (int32 i = 0; i < fItemCount && i < kMaxArrayElementCount; i++) + for (int32 i = lowIndex; i <= highIndex; i++) { BListElementNodeChild* child = new(std::nothrow) BListElementNodeChild(this, i, type); @@ -362,15 +411,12 @@ BListValueNode::CreateChildren() } -int32 -BListValueNode::CountChildren() const +status_t +BListValueNode::SupportedChildRange(int32& lowIndex, int32& highIndex) const { - return fChildren.CountItems(); + lowIndex = 0; + highIndex = fItemCount - 1; + + return B_OK; } - -ValueNodeChild* -BListValueNode::ChildAt(int32 index) const -{ - return fChildren.ItemAt(index); -} diff --git a/src/apps/debugger/value/value_nodes/BListValueNode.h b/src/apps/debugger/value/value_nodes/BListValueNode.h index 697c666726..ce34e013e0 100644 --- a/src/apps/debugger/value/value_nodes/BListValueNode.h +++ b/src/apps/debugger/value/value_nodes/BListValueNode.h @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef BLIST_VALUE_NODE_H @@ -36,6 +36,13 @@ public: virtual int32 CountChildren() const; virtual ValueNodeChild* ChildAt(int32 index) const; + virtual bool IsRangedContainer() const; + virtual bool IsContainerRangeFixed() const; + virtual void ClearChildren(); + virtual status_t CreateChildrenInRange(int32 lowIndex, + int32 highIndex); + virtual status_t SupportedChildRange(int32& lowIndex, + int32& highIndex) const; private: class BListElementNodeChild; class BListItemCountNodeChild; @@ -55,6 +62,7 @@ private: BVariant fItemCountLocation; Type* fItemCountType; int32 fItemCount; + bool fCountChildCreated; }; diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp index 6460544715..9f1ed5f230 100644 --- a/src/apps/deskbar/ExpandoMenuBar.cpp +++ b/src/apps/deskbar/ExpandoMenuBar.cpp @@ -369,7 +369,7 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message) case B_INSIDE_VIEW: { - BMenuItem* menuItem; + BMenuItem* menuItem = NULL; TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem); TWindowMenuItem* windowMenuItem = dynamic_cast(menuItem); diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index db300550c3..c9a0f9c400 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -183,10 +183,6 @@ CalcView::~CalcView() delete fKeypad; delete fOptions; free(fKeypadDescription); - - // replicant deleted, destroy the about window - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } @@ -270,32 +266,30 @@ CalcView::MessageReceived(BMessage* message) // (replicant) about box requested case B_ABOUT_REQUESTED: - if (fAboutWindow == NULL) { - // create the about window - const char* extraCopyrights[] = { - "1997, 1998 R3 Software Ltd.", - NULL - }; + { + BAboutWindow* window = new BAboutWindow(kAppName, kSignature); - const char* authors[] = { - "Stephan Aßmus", - "John Scipione", - "Timothy Wayper", - "Ingo Weinhold", - NULL - }; + // create the about window + const char* extraCopyrights[] = { + "1997, 1998 R3 Software Ltd.", + NULL + }; - fAboutWindow = new BAboutWindow(kAppName, kSignature); - fAboutWindow->AddCopyright(2006, "Haiku, Inc.", - extraCopyrights); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + const char* authors[] = { + "Stephan Aßmus", + "John Scipione", + "Timothy Wayper", + "Ingo Weinhold", + NULL + }; + + window->AddCopyright(2006, "Haiku, Inc.", extraCopyrights); + window->AddAuthors(authors); + + window->Show(); break; + } case MSG_UNFLASH_KEY: { @@ -1006,8 +1000,6 @@ CalcView::_Init(BMessage* settings) // fetch the calc icon for compact view _FetchAppIcon(fCalcIcon); - - fAboutWindow = NULL; } diff --git a/src/apps/deskcalc/CalcView.h b/src/apps/deskcalc/CalcView.h index 446d44dfd9..1dd1cff296 100644 --- a/src/apps/deskcalc/CalcView.h +++ b/src/apps/deskcalc/CalcView.h @@ -31,7 +31,6 @@ static const float kMaximumWidthBasic = 400.0f; static const float kMinimumHeightBasic = 130.0f; static const float kMaximumHeightBasic = 400.0f; -class BAboutWindow; class BString; class BMenuItem; class BMessage; @@ -161,9 +160,6 @@ class CalcView : public BView { // calculator options. CalcOptions* fOptions; - - // about window for replicant - BAboutWindow* fAboutWindow; }; #endif // _CALC_VIEW_H diff --git a/src/apps/diskprobe/DataEditor.cpp b/src/apps/diskprobe/DataEditor.cpp index 2fd85a28df..97539ad9a5 100644 --- a/src/apps/diskprobe/DataEditor.cpp +++ b/src/apps/diskprobe/DataEditor.cpp @@ -236,8 +236,10 @@ void ReplaceChange::Apply(off_t bufferOffset, uint8 *buffer, size_t bufferSize) { // is it in our range? - if (fOffset > bufferOffset + bufferSize || fOffset + fSize < bufferOffset) + if (fOffset > (bufferOffset + (off_t)bufferSize) + || (fOffset + (off_t)fSize) < bufferOffset) { return; + } // don't change anything outside the supplied buffer off_t offset = fOffset; @@ -263,8 +265,10 @@ void ReplaceChange::Revert(off_t bufferOffset, uint8 *buffer, size_t bufferSize) { // is it in our range? - if (fOffset - bufferOffset > bufferSize || fOffset + fSize < bufferOffset) + if (fOffset - bufferOffset > (off_t)bufferSize + || fOffset + (off_t)fSize < bufferOffset) { return; + } // don't change anything outside the supplied buffer off_t offset = fOffset; @@ -307,8 +311,8 @@ ReplaceChange::Merge(DataChange *_change) // are the changes adjacent? - if (change->fOffset + change->fSize != fOffset - && fOffset + fSize != change->fOffset) + if (change->fOffset + (off_t)change->fSize != fOffset + && fOffset + (off_t)fSize != change->fOffset) return false; // okay, we can try to merge the two changes @@ -560,7 +564,7 @@ DataEditor::Replace(off_t offset, const uint8 *data, size_t length) if (offset >= fSize) return B_BAD_VALUE; - if (offset + length > fSize) + if (offset + (off_t)length > fSize) length = fSize - offset; if (fNeedsUpdate) { @@ -705,7 +709,7 @@ DataEditor::Save() // don't try to change the file size size_t size = fRealViewSize; - if (fRealViewOffset + fRealViewSize > fSize) + if (fRealViewOffset + (off_t)fRealViewSize > (off_t)fSize) size = fSize - fRealViewOffset; ssize_t bytesWritten; @@ -1125,7 +1129,7 @@ DataEditor::Find(off_t startPosition, const uint8 *data, size_t dataSize, } for (size_t i = firstByte; i < fRealViewSize; i++) { - if (position + i + dataSize > fSize) + if (position + (off_t)(i + dataSize) > (off_t)fSize) break; if (!compareFunc(fView + i, data, 1)) { diff --git a/src/apps/diskprobe/DataView.cpp b/src/apps/diskprobe/DataView.cpp index bd01742cd8..59589437ad 100644 --- a/src/apps/diskprobe/DataView.cpp +++ b/src/apps/diskprobe/DataView.cpp @@ -163,19 +163,19 @@ DataView::UpdateFromEditor(BMessage *message) if (message != NULL && message->FindInt64("offset", &offset) == B_OK && message->FindInt64("size", &size) == B_OK) { - if (offset > fOffset + fDataSize - || offset + size < fOffset) { + if (offset > fOffset + (off_t)fDataSize + || offset + (off_t)size < fOffset) { // the changes are not within our scope, so we can ignore them return; } if (offset > fOffset) start = offset - fOffset; - if (offset + size < fOffset + fDataSize) + if (offset + (off_t)size < fOffset + (off_t)fDataSize) end = offset + size - fOffset; } - if (fOffset + fDataSize > fFileSize) + if (fOffset + (off_t)fDataSize > fFileSize) fSizeInView = fFileSize - fOffset; else fSizeInView = fDataSize; @@ -356,8 +356,8 @@ DataView::ConvertLine(char *line, off_t offset, const uint8 *buffer, size_t size return; } - line += sprintf(line, fBase == kHexBase ? "%0*Lx: " : "%0*Ld: ", - (int)fPositionLength, offset); + line += sprintf(line, fBase == kHexBase ? "%0*" B_PRIxOFF": " : "%0*" + B_PRIdOFF": ", (int)fPositionLength, offset); for (uint32 i = 0; i < kBlockSize; i++) { if (i >= size) { diff --git a/src/apps/diskprobe/ProbeView.cpp b/src/apps/diskprobe/ProbeView.cpp index 2aef09dcaa..943889fcd6 100644 --- a/src/apps/diskprobe/ProbeView.cpp +++ b/src/apps/diskprobe/ProbeView.cpp @@ -216,7 +216,7 @@ get_type_string(char *buffer, size_t bufferSize, type_code type) for (int32 i = 0; i < 4; i++) { buffer[i] = type >> (24 - 8 * i); if (buffer[i] < ' ' || buffer[i] == 0x7f) { - snprintf(buffer, bufferSize, "0x%04lx", type); + snprintf(buffer, bufferSize, "0x%04" B_PRIx32, type); break; } else if (i == 3) buffer[4] = '\0'; @@ -705,7 +705,8 @@ HeaderView::UpdateIcon() void HeaderView::FormatValue(char *buffer, size_t bufferSize, off_t value) { - snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%Lx" : "%Ld", value); + snprintf(buffer, bufferSize, fBase == kHexBase ? "0x%" B_PRIxOFF : "%" + B_PRIdOFF, value); } @@ -1550,7 +1551,7 @@ ProbeView::AttachedToWindow() const uint32 blockSizes[] = {512, 1024, 2048}; for (uint32 i = 0; i < sizeof(blockSizes) / sizeof(blockSizes[0]); i++) { char buffer[32]; - snprintf(buffer, sizeof(buffer), "%ld%s", blockSizes[i], + snprintf(buffer, sizeof(buffer), "%" B_PRId32 "%s", blockSizes[i], fEditor.IsDevice() && fEditor.BlockSize() == blockSizes[i] ? B_TRANSLATE(" (native)") : ""); subMenu->AddItem(item = new BMenuItem(buffer, @@ -1582,7 +1583,7 @@ ProbeView::AttachedToWindow() fontSize = 0; for (uint32 i = 0; i < sizeof(fontSizes) / sizeof(fontSizes[0]); i++) { char buffer[16]; - snprintf(buffer, sizeof(buffer), "%ld", fontSizes[i]); + snprintf(buffer, sizeof(buffer), "%" B_PRId32, fontSizes[i]); subMenu->AddItem(item = new BMenuItem(buffer, message = new BMessage(kMsgFontSize))); message->AddFloat("font_size", fontSizes[i]); @@ -1653,23 +1654,30 @@ ProbeView::_UpdateSelectionMenuItems(int64 start, int64 end) // update menu items char buffer[128]; - if (fDataView->Base() == kHexBase) - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: 0x%0*Lx"), size * 2, position); - else - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: %Ld (0x%0*Lx)"), position, size * 2, position); + if (fDataView->Base() == kHexBase) { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: 0x%0*Lx"), + size * 2, position); + } else { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Native: %Ld (0x%0*Lx)"), + position, size * 2, position); + } fNativeMenuItem->SetLabel(buffer); - fNativeMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize()); + fNativeMenuItem->SetEnabled(position >= 0 + && (off_t)(position * fEditor.BlockSize()) < fEditor.FileSize()); fNativeMenuItem->Message()->ReplaceInt64("block", position); position = B_SWAP_INT64(position) >> (8 * (8 - size)); - if (fDataView->Base() == kHexBase) - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: 0x%0*Lx"), size * 2, position); - else - snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: %Ld (0x%0*Lx)"), position, size * 2, position); + if (fDataView->Base() == kHexBase) { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: 0x%0*Lx"), + size * 2, position); + } else { + snprintf(buffer, sizeof(buffer), B_TRANSLATE("Swapped: %Ld (0x%0*Lx)"), + position, size * 2, position); + } fSwappedMenuItem->SetLabel(buffer); - fSwappedMenuItem->SetEnabled(position >= 0 && (position * fEditor.BlockSize()) < fEditor.FileSize()); + fSwappedMenuItem->SetEnabled(position >= 0 && (off_t)(position * fEditor.BlockSize()) < fEditor.FileSize()); fSwappedMenuItem->Message()->ReplaceInt64("block", position); } diff --git a/src/apps/diskprobe/TypeEditors.cpp b/src/apps/diskprobe/TypeEditors.cpp index 2183ff81c2..39bfbf8cb2 100644 --- a/src/apps/diskprobe/TypeEditors.cpp +++ b/src/apps/diskprobe/TypeEditors.cpp @@ -226,7 +226,7 @@ StringEditor::_UpdateText() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *buffer; @@ -486,7 +486,7 @@ NumberEditor::_UpdateText() bool NumberEditor::TypeMatches() { - return fEditor.FileSize() >= _Size(); + return fEditor.FileSize() >= (off_t)_Size(); // we only look at as many bytes we need to } @@ -949,7 +949,7 @@ ImageView::_UpdateImage() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *data; @@ -1169,7 +1169,7 @@ MessageView::_TypeToString(type_code type) for (int32 i = 0; i < 4; i++) { text[i] = type >> (24 - 8 * i); if (text[i] < ' ' || text[i] == 0x7f) { - snprintf(text, sizeof(text), "0x%04lx", type); + snprintf(text, sizeof(text), "0x%04" B_PRIx32, type); break; } else if (i == 3) text[4] = '\0'; @@ -1226,16 +1226,16 @@ MessageView::SetTo(BMessage& message) switch (type) { case B_INT64_TYPE: - snprintf(text, sizeof(text), "%Ld", *(int64*)data); + snprintf(text, sizeof(text), "%" B_PRId64, *(int64*)data); break; case B_UINT64_TYPE: - snprintf(text, sizeof(text), "%Lu", *(uint64*)data); + snprintf(text, sizeof(text), "%" B_PRIu64, *(uint64*)data); break; case B_INT32_TYPE: - snprintf(text, sizeof(text), "%ld", *(int32*)data); + snprintf(text, sizeof(text), "%" B_PRId32, *(int32*)data); break; case B_UINT32_TYPE: - snprintf(text, sizeof(text), "%lu", *(uint32*)data); + snprintf(text, sizeof(text), "%" B_PRIu32, *(uint32*)data); break; case B_BOOL_TYPE: if (*(uint8*)data) @@ -1255,7 +1255,7 @@ MessageView::SetTo(BMessage& message) fTextView->Insert("\t\t"); if (count > 1) { char index[16]; - snprintf(index, sizeof(index), "%ld.\t", j); + snprintf(index, sizeof(index), "%" B_PRId32 ".\t", j); fTextView->Insert(index); } fTextView->Insert(text); @@ -1273,7 +1273,7 @@ MessageView::_UpdateMessage() size_t viewSize = fEditor.ViewSize(); // that may need some more memory... - if (viewSize < fEditor.FileSize()) + if ((off_t)viewSize < fEditor.FileSize()) fEditor.SetViewSize(fEditor.FileSize()); const char *buffer; diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index d8ac569860..ee5a4ce07d 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -176,7 +176,7 @@ MainWindow::MessageReceived(BMessage* message) if (message->WasDropped()) { const rgb_color* color; - int32 length; + ssize_t length; // create styles from dropped colors for (int32 i = 0; message->FindData("RGBColor", B_RGB_COLOR_TYPE, i, (const void**)&color, &length) == B_OK; i++) { diff --git a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorField.cpp b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorField.cpp index 93aae006c5..7ddbde7de5 100644 --- a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorField.cpp +++ b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorField.cpp @@ -315,7 +315,8 @@ ColorField::SetModeAndValue(selected_color_mode mode, float fixed_value) R *= 255.0; G *= 255.0; B *= 255.0; } - rgb_color color = { round(R), round(G), round(B), 255 }; + rgb_color color = { (uint8)round(R), (uint8)round(G), (uint8)round(B), + 255 }; fBgBitmap[0]->Unlock(); diff --git a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp index 4633d2e36c..d4c7b4558b 100644 --- a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp +++ b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorPickerView.cpp @@ -82,7 +82,8 @@ ColorPickerView::layout(BRect frame) void ColorPickerView::AttachedToWindow() { - rgb_color color = { (int)(r * 255), (int)(g * 255), (int)(b * 255), 255 }; + rgb_color color = { (uint8)(r * 255), (uint8)(g * 255), (uint8)(b * 255), + 255 }; BView::AttachedToWindow(); @@ -266,7 +267,8 @@ ColorPickerView::MessageReceived(BMessage *message) HSV_to_RGB(h, s, v, r, g, b); } - rgb_color color = { round(r*255), round(g*255), round(b*255), 255 }; + rgb_color color = { (uint8)round(r * 255), (uint8)round(g * 255), + (uint8)round(b * 255), 255 }; SetColor(color); @@ -275,7 +277,8 @@ ColorPickerView::MessageReceived(BMessage *message) case MSG_HEXTEXTCONTROL: { if (fHexTextControl->TextView()->TextLength()==6) { const char *string = fHexTextControl->TextView()->Text(); - rgb_color color = { hexdec(string, 0), hexdec(string, 2), hexdec(string, 4), 255 }; + rgb_color color = { (uint8)hexdec(string, 0), (uint8)hexdec(string, 2), + (uint8)hexdec(string, 4), 255 }; SetColor(color); } } break; @@ -449,7 +452,8 @@ ColorPickerView::_UpdateColor(float value, float value1, float value2) else HSV_to_RGB(h, s, v, r, g, b); - rgb_color color = { (int)(r*255), (int)(g*255), (int)(b*255), 255 }; + rgb_color color = { (uint8)round(r * 255), (uint8)round(g*255), + (uint8)round(b * 255), 255 }; fColorPreview->SetColor(color); } diff --git a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp index 83aa2f4f8a..1a961399e8 100644 --- a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp +++ b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp @@ -439,7 +439,8 @@ ColorSlider::SetModeAndValues(selected_color_mode mode, R*=255.0; G*=255.0; B*=255.0; } - rgb_color color = { round(R), round(G), round(B), 255 }; + rgb_color color = {(uint8)round(R), (uint8)round(G), + (uint8)round(B), 255 }; fMode = mode; SetOtherValues(value1, value2); @@ -638,7 +639,7 @@ void ColorSlider::_DrawColorLineY(BView *view, float y, int r, int g, int b) { - rgb_color color = { r, g, b, 255 }; + rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 }; y = 255.0 - y; view->AddLine( BPoint(8.0, y + 5.0), BPoint(27.0, y + 5.0), color ); } @@ -648,7 +649,7 @@ void ColorSlider::_DrawColorLineX(BView *view, float x, int r, int g, int b) { - rgb_color color = { r, g, b, 255 }; + rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 }; BRect bounds(view->Bounds()); x = (255.0 - x) * (bounds.Width() - 2.0) / 255.0 + 2.0; view->AddLine( BPoint(x, bounds.top + 2.0), BPoint(x, bounds.bottom - 2.0), color ); diff --git a/src/apps/icon-o-matic/generic/listener/Observable.cpp b/src/apps/icon-o-matic/generic/listener/Observable.cpp index 36d198c388..f1694685f3 100644 --- a/src/apps/icon-o-matic/generic/listener/Observable.cpp +++ b/src/apps/icon-o-matic/generic/listener/Observable.cpp @@ -29,8 +29,8 @@ Observable::~Observable() if (fObservers.CountItems() > 0) { char message[256]; Observer* o = (Observer*)fObservers.ItemAt(0); - sprintf(message, "Observable::~Observable() - %ld " - "observers still watching, first: %s\n", + sprintf(message, "Observable::~Observable() - %" B_PRId32 + " observers still watching, first: %s\n", fObservers.CountItems(), typeid(*o).name()); debugger(message); } diff --git a/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp b/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp index dfb220df21..8550dc9222 100644 --- a/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp +++ b/src/apps/icon-o-matic/generic/property/view/PropertyListView.cpp @@ -399,7 +399,7 @@ PropertyListView::SetTo(PropertyObject* object) // unkown to the PropertyEditorFactory and therefor // there is no editor view at this item fprintf(stderr, "PropertyListView::_SetTo() - " - "property mismatch at %ld\n", i); + "property mismatch at %" B_PRId32 "\n", i); error = true; break; } @@ -425,7 +425,7 @@ PropertyListView::SetTo(PropertyObject* object) int32 focused = -1; for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { if (item->IsSelected()) - selection.AddItem((void*)i); + selection.AddItem((void*)(long)i); if (item->IsFocused()) focused = i; } @@ -449,7 +449,7 @@ PropertyListView::SetTo(PropertyObject* object) // restore scroll pos, selection and focus SetScrollOffset(scrollOffset); for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) { - if (selection.HasItem((void*)i)) + if (selection.HasItem((void*)(long)i)) item->SetSelected(true); if (i == focused) item->MakeFocus(true); diff --git a/src/apps/icon-o-matic/generic/support/support.cpp b/src/apps/icon-o-matic/generic/support/support.cpp index 77e1e3298e..f2f7fc9de8 100644 --- a/src/apps/icon-o-matic/generic/support/support.cpp +++ b/src/apps/icon-o-matic/generic/support/support.cpp @@ -111,7 +111,7 @@ append_float(BString& string, float n, int32 maxDigits) n = n - rounded; rounded = (int32)(n * pow(10, maxDigits)); char tmp[maxDigits + 1]; - sprintf(tmp, "%0*ld", (int)maxDigits, rounded); + sprintf(tmp, "%0*" B_PRId32, (int)maxDigits, rounded); tmp[maxDigits] = 0; int32 digits = strlen(tmp); for (int32 i = strlen(tmp) - 1; i >= 0; i--) { diff --git a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp index 10ac43fbde..a0eb7b8c24 100644 --- a/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp +++ b/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp @@ -51,12 +51,12 @@ FlatIconExporter::~FlatIconExporter() { #if PRINT_STATISTICS printf("Statistics\n" - "--style section size: %ld\n" - " gradients: %ld\n" - " gradient transforms: %ld\n" - "---path section size: %ld\n" - "--shape section size: %ld\n" - "---total/different points: %ld/%lu\n", + "--style section size: %" B_PRId32 "\n" + " gradients: %" B_PRId32 "\n" + " gradient transforms: %" B_PRId32 "\n" + "---path section size: %" B_PRId32 "\n" + "--shape section size: %" B_PRId32 "\n" + "---total/different points: %" B_PRId32 "/%" B_PRIdSSIZE "\n", fStyleSectionSize, fGradientSize, fGradientTransformSize, diff --git a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp index 0d6b10f5a1..eaa9902265 100644 --- a/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp +++ b/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp @@ -186,14 +186,14 @@ StyledTextImporter::Import(Icon* icon, BMessage* clipping) { CALLED(); const char *text; - int32 textLength; + ssize_t textLength; if (clipping == NULL) return ENOENT; if (clipping->FindData("text/plain", B_MIME_TYPE, (const void **)&text, &textLength) == B_OK) { text_run_array *runs = NULL; - int32 runsLength; + ssize_t runsLength; if (clipping->FindData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, (const void **)&runs, &runsLength) < B_OK) runs = NULL; diff --git a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp index 0b57dc7bc0..ee9fcec11c 100644 --- a/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp +++ b/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp @@ -490,7 +490,7 @@ SVGExporter::_GetFill(const Style* style, char* string, status_t ret = B_OK; if (Gradient* gradient = style->Gradient()) { ret = _ExportGradient(gradient, stream); - sprintf(string, "url(#gradient%ld)", fGradientCount++); + sprintf(string, "url(#gradient%" B_PRId32 ")", fGradientCount++); } else { sprintf(string, "#%.2x%.2x%.2x", style->Color().red, style->Color().green, diff --git a/src/apps/icon-o-matic/shape/PathManipulator.cpp b/src/apps/icon-o-matic/shape/PathManipulator.cpp index 4a06a510a5..fa30575a61 100644 --- a/src/apps/icon-o-matic/shape/PathManipulator.cpp +++ b/src/apps/icon-o-matic/shape/PathManipulator.cpp @@ -143,21 +143,21 @@ public: break; } } - BList::AddItem((void*)value, index); + BList::AddItem((void*)(long)value, index); } } inline bool Remove(int32 value) - { return BList::RemoveItem((void*)value); } + { return BList::RemoveItem((void*)(long)value); } inline bool Contains(int32 value) const - { return BList::HasItem((void*)value); } + { return BList::HasItem((void*)(long)value); } inline bool IsEmpty() const { return BList::IsEmpty(); } inline int32 IndexAt(int32 index) const - { return (int32)BList::ItemAt(index); } + { return (int32)(long)BList::ItemAt(index); } inline void MakeEmpty() { BList::MakeEmpty(); } diff --git a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp index b7a43f4f3b..105479227a 100644 --- a/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/FreezeTransformationCommand.cpp @@ -147,7 +147,7 @@ FreezeTransformationCommand::_ApplyTransformation(Shape* shape, path->ApplyTransform(transform); } else { printf("Not transfering transformation of \"%s\" onto " - "path \"%s\", because %ld other shapes " + "path \"%s\", because %" B_PRId32 " other shapes " "have it assigned.\n", shape->Name(), path->Name(), shapes - 1); } diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index b4f4eca84b..144a85dc01 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -431,14 +431,14 @@ CopyEngine::_CopyFolder(const char* _source, const char* _destination, uint8 buffer[size]; off_t offset = 0; ssize_t read = sourceNode.ReadAttr(attrName, info.type, - offset, buffer, min_c(size, info.size)); + offset, buffer, std::min((off_t)size, info.size)); // NOTE: It's important to still write the attribute even if // we have read 0 bytes! while (read >= 0) { targetNode.WriteAttr(attrName, info.type, offset, buffer, read); offset += read; read = sourceNode.ReadAttr(attrName, info.type, - offset, buffer, min_c(size, info.size - offset)); + offset, buffer, std::min((off_t)size, info.size - offset)); if (read == 0) break; } diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp index c757b637a9..85184c99bd 100644 --- a/src/apps/magnify/Magnify.cpp +++ b/src/apps/magnify/Magnify.cpp @@ -873,8 +873,8 @@ TInfoView::Draw(BRect updateRect) float h = Bounds().Height(); if (ch2Showing) { MovePenTo(10, h-12); - sprintf(str, "2) x: %li y: %li y: %i", (int32)pt2.x, (int32)pt2.y, - abs((int)(pt1.y - pt2.y))); + sprintf(str, "2) x: %" B_PRIi32 " y: %" B_PRIi32 " y: %d", + (int32)pt2.x, (int32)pt2.y, abs((int)(pt1.y - pt2.y))); invalRect.Set(10, h-12-fFontHeight, 10 + StringWidth(fCH2Str), h-10); SetHighColor(ViewColor()); FillRect(invalRect); @@ -886,8 +886,8 @@ TInfoView::Draw(BRect updateRect) if (ch1Showing && ch2Showing) { MovePenTo(10, h-10-fFontHeight-2); - sprintf(str, "1) x: %li y: %li x: %i", (int32)pt1.x, (int32)pt1.y, - abs((int)(pt1.x - pt2.x))); + sprintf(str, "1) x: %" B_PRIi32 " y: %" B_PRIi32 " x: %d", + (int32)pt1.x, (int32)pt1.y, abs((int)(pt1.x - pt2.x))); invalRect.Set(10, h-10-2*fFontHeight-2, 10 + StringWidth(fCH1Str), h-10-fFontHeight); SetHighColor(ViewColor()); FillRect(invalRect); @@ -897,7 +897,7 @@ TInfoView::Draw(BRect updateRect) DrawString(fCH1Str); } else if (ch1Showing) { MovePenTo(10, h-10); - sprintf(str, "x: %li y: %li", (int32)pt1.x, (int32)pt1.y); + sprintf(str, "x: %" B_PRIi32 " y: %" B_PRIi32, (int32)pt1.x, (int32)pt1.y); invalRect.Set(10, h-10-fFontHeight, 10 + StringWidth(fCH1Str), h-8); SetHighColor(ViewColor()); FillRect(invalRect); @@ -1410,7 +1410,7 @@ void TMagnify::NudgeMouse(float x, float y) { BPoint loc; - ulong button; + uint32 button; GetMouse(&loc, &button); ConvertToScreen(&loc); @@ -1429,7 +1429,7 @@ TMagnify::WindowActivated(bool active) } -long +status_t TMagnify::MagnifyTask(void *arg) { TMagnify* view = (TMagnify*)arg; @@ -1456,7 +1456,7 @@ void TMagnify::Update(bool force) { BPoint loc; - ulong button; + uint32 button; static long counter = 0; if (!fStickCoordinates) { @@ -1697,11 +1697,14 @@ TMagnify::SaveBits(BFile* file, const BBitmap *bitmap, const char* name) const char str[1024]; // stream out the width, height and ColorSpace - sprintf(str, "const int32 k%sWidth = %ld;\n", name, (int32)bitmap->Bounds().Width()+1); + sprintf(str, "const int32 k%sWidth = %" B_PRIi32 ";\n", name, + (int32)bitmap->Bounds().Width()+1); file->Write(str, strlen(str)); - sprintf(str, "const int32 k%sHeight = %ld;\n", name, (int32)bitmap->Bounds().Height()+1); + sprintf(str, "const int32 k%sHeight = %" B_PRIi32 ";\n", name, + (int32)bitmap->Bounds().Height()+1); file->Write(str, strlen(str)); - sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name, kColorSpaceName); + sprintf(str, "const color_space k%sColorSpace = %s;\n\n", name, + kColorSpaceName); file->Write(str, strlen(str)); // stream out the constant name for this array diff --git a/src/apps/magnify/Magnify.h b/src/apps/magnify/Magnify.h index c4d468caee..ae19a719d9 100644 --- a/src/apps/magnify/Magnify.h +++ b/src/apps/magnify/Magnify.h @@ -119,7 +119,7 @@ class TMagnify : public BView { void EndSave(); private: - static long MagnifyTask(void *); + static status_t MagnifyTask(void *); bool fNeedToUpdate; long fThread; // magnify thread id diff --git a/src/apps/mail/Content.cpp b/src/apps/mail/Content.cpp index 54927c2441..21b5cd7570 100644 --- a/src/apps/mail/Content.cpp +++ b/src/apps/mail/Content.cpp @@ -148,7 +148,7 @@ FilterHTMLTag(int32 &first, char **t, char *end) // check for some common entities (in ISO-Latin-1) if (first == '&') { // filter out and convert decimal values - if (a[1] == '#' && sscanf(a + 2, "%ld;", &first) == 1) { + if (a[1] == '#' && sscanf(a + 2, "%" B_SCNd32 ";", &first) == 1) { t[0] += strchr(a, ';') - a; return false; } @@ -932,11 +932,11 @@ TTextView::UpdateFont(const BFont* newFont) fFont = *newFont; // update the text run array safely with new font - text_run_array *runArray = RunArray(0, LONG_MAX); + text_run_array *runArray = RunArray(0, INT32_MAX); for (int i = 0; i < runArray->count; i++) runArray->runs[i].font = *newFont; - SetRunArray(0, LONG_MAX, runArray); + SetRunArray(0, INT32_MAX, runArray); FreeRunArray(runArray); } @@ -1917,7 +1917,7 @@ TTextView::Open(hyper_text *enclosure) strcpy(baseName, enclosure->name ? enclosure->name : "enclosure"); strcpy(name, baseName); for (int32 index = 0; dir.Contains(name); index++) - sprintf(name, "%s_%ld", baseName, index); + sprintf(name, "%s_%" B_PRId32, baseName, index); BEntry entry(path.Path()); entry_ref ref; diff --git a/src/apps/mail/Header.cpp b/src/apps/mail/Header.cpp index 60530c83b7..2fc6165461 100644 --- a/src/apps/mail/Header.cpp +++ b/src/apps/mail/Header.cpp @@ -348,7 +348,7 @@ THeaderView::THeaderView(BRect rect, BRect windowRect, bool incoming, fAccountMenu->AddItem( item = new BMenuItem(B_TRANSLATE(""), NULL)); item->SetEnabled(false); - fAccountID = ~0UL; + fAccountID = ~(int32)0; } // default account is invalid, set to marked // TODO: do this differently, no casting and knowledge @@ -1093,7 +1093,7 @@ QPopupMenu::AddPersonItem(const entry_ref *ref, ino_t node, BString &name, if (!parentMenu->AddItem(newItem, index + 1)) { fprintf (stderr, "QPopupMenu::AddPersonItem: Unable to add menu " - "item \"%s\" at index %ld.\n", sortKey.String(), index + 1); + "item \"%s\" at index %" B_PRId32 ".\n", sortKey.String(), index + 1); delete newItem; } } diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp index f9879d6825..28620739ac 100644 --- a/src/apps/mail/MailWindow.cpp +++ b/src/apps/mail/MailWindow.cpp @@ -2396,7 +2396,7 @@ TMailWindow::Send(bool now) char versionString[255]; sprintf(versionString, - "Mail/Haiku %ld.%ld.%ld", + "Mail/Haiku %" B_PRIu32 ".%" B_PRIu32 ".%" B_PRIu32, info.major, info.middle, info.minor); fMail->SetHeaderField("X-Mailer", versionString); } @@ -2578,7 +2578,7 @@ TMailWindow::SaveAsDraft() if (status == B_OK) break; char appendix[B_FILE_NAME_LENGTH]; - sprintf(appendix, " %ld", i++); + sprintf(appendix, " %" B_PRId32, i++); int32 pos = min_c(sizeof(fileName) - strlen(appendix), originalLength); sprintf(fileName + pos, "%s", appendix); @@ -2746,8 +2746,8 @@ TMailWindow::TrainMessageAs(const char *CommandWord) ErrorExit: beep(); sprintf(errorString, "Unable to train the message file \"%s\" as %s. " - "Possibly useful error code: %s (%ld).", - filePath.Path(), CommandWord, strerror (errorCode), errorCode); + "Possibly useful error code: %s (%" B_PRId32 ").", + filePath.Path(), CommandWord, strerror(errorCode), errorCode); BAlert* alert = new BAlert("", errorString, B_TRANSLATE("OK")); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); @@ -2921,7 +2921,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding) // Put the addresses in the 'Save Address' Menu // BMenuItem *item; - while ((item = fSaveAddrMenu->RemoveItem(0L)) != NULL) + while ((item = fSaveAddrMenu->RemoveItem((int32)0)) != NULL) delete item; // create the list of addresses @@ -2935,7 +2935,7 @@ TMailWindow::OpenMessage(const entry_ref *ref, uint32 characterSetForDecoding) BMessage *msg; for (int32 i = addressList.CountItems(); i-- > 0;) { - char *address = (char *)addressList.RemoveItem(0L); + char *address = (char *)addressList.RemoveItem((int32)0); // insert the new address in alphabetical order int32 index = 0; diff --git a/src/apps/mail/Prefs.cpp b/src/apps/mail/Prefs.cpp index 8611f1f917..45b32cd151 100644 --- a/src/apps/mail/Prefs.cpp +++ b/src/apps/mail/Prefs.cpp @@ -338,7 +338,7 @@ TPrefsWindow::MessageReceived(BMessage* msg) fNewFont->SetSize(old_size); if (revert) { - sprintf(label, "%ld", old_size); + sprintf(label, "%" B_PRId32, old_size); item = fSizeMenu->FindItem(label); if (item != NULL) item->SetMarked(true); @@ -759,7 +759,7 @@ TPrefsWindow::_BuildSizeMenu(BFont* font) for (loop = 0; loop < sizeof(sizes) / sizeof(int32); loop++) { msg = new BMessage(P_SIZE); msg->AddInt32("size", sizes[loop]); - sprintf(label, "%ld", sizes[loop]); + sprintf(label, "%" B_PRId32, sizes[loop]); menu->AddItem(item = new BMenuItem(label, msg)); if (sizes[loop] == (int32)size) item->SetMarked(true); diff --git a/src/apps/mail/Signature.cpp b/src/apps/mail/Signature.cpp index 48a02034f1..dc8bcf949e 100644 --- a/src/apps/mail/Signature.cpp +++ b/src/apps/mail/Signature.cpp @@ -369,7 +369,7 @@ TSignatureWindow::Save() fFile = new BFile(); while(true) { - sprintf(name, "signature_%ld", index++); + sprintf(name, "signature_%" B_PRId32, index++); if ((result = dir.CreateFile(name, fFile, true)) == B_NO_ERROR) break; if (result != EEXIST) diff --git a/src/apps/mail/Status.cpp b/src/apps/mail/Status.cpp index 544646f9d1..7acee481a2 100644 --- a/src/apps/mail/Status.cpp +++ b/src/apps/mail/Status.cpp @@ -165,7 +165,7 @@ TStatusWindow::MessageReceived(BMessage* msg) break; if (result != EEXIST) goto err_exit; - sprintf(newName, "%s_%ld", name, index++); + sprintf(newName, "%s_%" B_PRId32, name, index++); } dir.FindEntry(newName, &entry); node = new BNodeInfo(&file); diff --git a/src/apps/mandelbrot/tsb.cpp b/src/apps/mandelbrot/tsb.cpp index c77b9a8f93..f62daf14e8 100644 --- a/src/apps/mandelbrot/tsb.cpp +++ b/src/apps/mandelbrot/tsb.cpp @@ -243,7 +243,7 @@ char t2_done; /*------------------------------------------------------------*/ -long __calc1(void *arg) +int32 __calc1(void *arg) { tsbb->manda(vvx, vvy, ssx, ssx); return B_NO_ERROR; @@ -251,7 +251,7 @@ long __calc1(void *arg) /*------------------------------------------------------------*/ -long __calc2(void *arg) +int32 __calc2(void *arg) { tsbb->mandb(vvx, vvy, ssx, ssx); return B_NO_ERROR; @@ -526,7 +526,7 @@ char TShowBit::has_selection() void TShowBit::change_selection(long h, long v) { - ulong buttons; + uint32 buttons; long h0; long v0; BRect new_select; diff --git a/src/apps/mediaplayer/InfoWin.cpp b/src/apps/mediaplayer/InfoWin.cpp index 2316481d6f..b9d6c30750 100644 --- a/src/apps/mediaplayer/InfoWin.cpp +++ b/src/apps/mediaplayer/InfoWin.cpp @@ -293,7 +293,7 @@ InfoWin::ResizeToPreferred() void InfoWin::Update(uint32 which) { -printf("InfoWin::Update(0x%08lx)\n", which); +printf("InfoWin::Update(0x%08" B_PRIx32 ")\n", which); fLabelsView->SetText(""); fContentsView->SetText(""); fLabelsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kBlue); diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index bdce0485db..d2754a84b1 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -1529,7 +1529,7 @@ MainWin::_CreateMenu() fAttributesMenu->AddItem(fRatingMenu); for (int32 i = 1; i <= 10; i++) { char label[16]; - snprintf(label, sizeof(label), "%ld", i); + snprintf(label, sizeof(label), "%" B_PRId32, i); BMessage* setRatingMsg = new BMessage(M_SET_RATING); setRatingMsg->AddInt32("rating", i); fRatingMenu->AddItem(new BMenuItem(label, setRatingMsg)); @@ -1541,7 +1541,7 @@ void MainWin::_SetupVideoAspectItems(BMenu* menu) { BMenuItem* item; - while ((item = menu->RemoveItem(0L)) != NULL) + while ((item = menu->RemoveItem((int32)0)) != NULL) delete item; int width; @@ -2440,7 +2440,7 @@ MainWin::_UpdatePlaylistItemFile() int32 bitrate = (int32)(format.u.encoded_audio.bit_rate / 1000); char text[256]; - snprintf(text, sizeof(text), "%ld kbit", bitrate); + snprintf(text, sizeof(text), "%" B_PRId32 " kbit", bitrate); node.WriteAttr("Audio:Bitrate", B_STRING_TYPE, 0, text, strlen(text) + 1); } @@ -2457,7 +2457,7 @@ MainWin::_UpdatePlaylistItemFile() int32 bitrate = (int32)(format.u.encoded_video.avg_bit_rate / 1000); char text[256]; - snprintf(text, sizeof(text), "%ld kbit", bitrate); + snprintf(text, sizeof(text), "%" B_PRId32 " kbit", bitrate); node.WriteAttr("Video:Bitrate", B_STRING_TYPE, 0, text, strlen(text) + 1); } diff --git a/src/apps/mediaplayer/media_node_framework/NodeManager.cpp b/src/apps/mediaplayer/media_node_framework/NodeManager.cpp index 0e976b617b..8809fb4888 100644 --- a/src/apps/mediaplayer/media_node_framework/NodeManager.cpp +++ b/src/apps/mediaplayer/media_node_framework/NodeManager.cpp @@ -118,8 +118,8 @@ NodeManager::SetPlayMode(int32 mode, bool continuePlaying) status_t ret = fMediaRoster->SetRunModeNode(fVideoConnection.consumer, runMode); if (ret != B_OK) { - printf("NodeManager::SetPlayMode(%ld), setting run mode failed: " - "%s\n", mode, strerror(ret)); + printf("NodeManager::SetPlayMode(%" B_PRId32 "), setting run mode " + "failed: %s\n", mode, strerror(ret)); } fMediaRoster->Unlock(); } @@ -393,12 +393,12 @@ NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat, format.type = B_MEDIA_RAW_VIDEO; media_raw_video_format videoFormat = { FramesPerSecond(), 1, 0, - fVideoBounds.IntegerWidth(), + (uint32)fVideoBounds.IntegerWidth(), B_VIDEO_TOP_LEFT_RIGHT, 1, 1, { preferredVideoFormat, - fVideoBounds.IntegerWidth() + 1, - fVideoBounds.IntegerHeight() + 1, + (uint32)(fVideoBounds.IntegerWidth() + 1), + (uint32)(fVideoBounds.IntegerHeight() + 1), 0, 0, 0 } }; diff --git a/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp b/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp index 253e695266..d870dfefef 100644 --- a/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp +++ b/src/apps/mediaplayer/media_node_framework/audio/AudioProducer.cpp @@ -817,7 +817,7 @@ AudioProducer::_FillNextBuffer(bigtime_t eventTime) static bool errorPrinted = false; if (!errorPrinted) { ERROR("AudioProducer::_FillNextBuffer() - no buffer " - "(size: %ld, duration: %lld)\n", + "(size: %" B_PRIuSIZE ", duration: %" B_PRIiBIGTIME ")\n", fOutput.format.u.raw_audio.buffer_size, BufferDuration()); errorPrinted = true; } diff --git a/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp b/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp index 8d04b1509f..5dad0ad49a 100644 --- a/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp +++ b/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.cpp @@ -86,7 +86,7 @@ VideoConsumer::~VideoConsumer() BMediaAddOn* -VideoConsumer::AddOn(long* cookie) const +VideoConsumer::AddOn(int32* cookie) const { FUNCTION("VideoConsumer::AddOn\n"); // do the right thing if we're ever used with an add-on @@ -239,7 +239,7 @@ VideoConsumer::CreateBuffers(const media_format& format) BBuffer* buffer = NULL; if ((status = fBuffers->AddBuffer(info, &buffer)) != B_OK) { ERROR("VideoConsumer::CreateBuffers - ERROR ADDING BUFFER " - "TO GROUP (%ld): %s\n", i, strerror(status)); + "TO GROUP (%" B_PRId32 "): %s\n", i, strerror(status)); return status; } else { PROGRESS("VideoConsumer::CreateBuffers - SUCCESSFUL ADD " @@ -248,8 +248,9 @@ VideoConsumer::CreateBuffers(const media_format& format) fBufferMap[i] = buffer; } else { ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING " - "BUFFER (Index %ld Width %ld Height %ld Colorspace %d: %s\n", - i, width, height, colorSpace, strerror(status)); + "BUFFER (Index %" B_PRId32 " Width %" B_PRId32 " Height %" + B_PRId32 " Colorspace %d: %s\n", i, width, height, colorSpace, + strerror(status)); return status; } } diff --git a/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h b/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h index 7140b18d19..e52f5c307d 100644 --- a/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h +++ b/src/apps/mediaplayer/media_node_framework/video/VideoConsumer.h @@ -36,7 +36,7 @@ public: // BMediaNode interface public: - virtual BMediaAddOn* AddOn(long* cookie) const; + virtual BMediaAddOn* AddOn(int32* cookie) const; protected: virtual void NodeRegistered(); @@ -100,7 +100,7 @@ private: void _UnsetTargetBuffer(); private: - uint32 fInternalID; + int32 fInternalID; BMediaAddOn* fAddOn; bool fConnectionActive; diff --git a/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp b/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp index a8a28befb5..48b5c9186d 100644 --- a/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp +++ b/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp @@ -697,8 +697,10 @@ VideoProducer::_FrameGeneratorThread() && nextWaitUntil < system_time() - fBufferLatency && droppedFrames < kMaxDroppedFrames) { // Drop frame if it's at least a frame late. - if (playingDirection > 0) - printf("VideoProducer: dropped frame (%Ld)\n", fFrame); + if (playingDirection > 0) { + printf("VideoProducer: dropped frame (%" B_PRId64 + ")\n", fFrame); + } // next frame droppedFrames++; fFrame++; diff --git a/src/apps/mediaplayer/playlist/ListViews.cpp b/src/apps/mediaplayer/playlist/ListViews.cpp index c5dbbb6e0f..032ffeaa07 100644 --- a/src/apps/mediaplayer/playlist/ListViews.cpp +++ b/src/apps/mediaplayer/playlist/ListViews.cpp @@ -328,7 +328,7 @@ DragSortableListView::MessageReceived(BMessage* message) BList indices; int32 index; for (int32 i = 0; message->FindInt32("index", i, &index) == B_OK; i++) - indices.AddItem((void*)index); + indices.AddItem((void*)(addr_t)index); if (indices.CountItems() > 0) { if (modifiers() & B_SHIFT_KEY) CopyItems(indices, fDropIndex); @@ -636,7 +636,7 @@ DragSortableListView::MoveItems(const BList& indices, int32 index) BList removedItems; int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 removeIndex = (int32)indices.ItemAtFast(i) - i; + int32 removeIndex = (int32)(addr_t)indices.ItemAtFast(i) - i; BListItem* item = RemoveItem(removeIndex); if (item && removedItems.AddItem((void*)item)) { if (removeIndex < index) @@ -669,9 +669,9 @@ DragSortableListView::CopyItems(const BList& indices, int32 toIndex) BList clonedItems; int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 index = (int32)indices.ItemAtFast(i); + int32 index = (int32)(addr_t)indices.ItemAtFast(i); BListItem* item = CloneItem(index); - if (item && !clonedItems.AddItem((void*)item)) + if (item && !clonedItems.AddItem((void*)(addr_t)item)) delete item; } count = clonedItems.CountItems(); @@ -693,7 +693,7 @@ DragSortableListView::RemoveItemList(const BList& indices) { int32 count = indices.CountItems(); for (int32 i = 0; i < count; i++) { - int32 index = (int32)indices.ItemAtFast(i) - i; + int32 index = (int32)(addr_t)indices.ItemAtFast(i) - i; delete RemoveItem(index); } } @@ -706,7 +706,7 @@ DragSortableListView::GetSelectedItems(BList& indices) int32 index = CurrentSelection(i); if (index < 0) break; - if (!indices.AddItem((void*)index)) + if (!indices.AddItem((void*)(addr_t)index)) break; } } @@ -731,7 +731,7 @@ DragSortableListView::RemoveAll() BList indices; int32 count = CountItems(); for (int32 i = 0; i < count; i++) { - if (!indices.AddItem((void*)i)) + if (!indices.AddItem((void*)(addr_t)i)) break; } diff --git a/src/apps/mediaplayer/playlist/Playlist.cpp b/src/apps/mediaplayer/playlist/Playlist.cpp index 35fabad63d..18e17227c9 100644 --- a/src/apps/mediaplayer/playlist/Playlist.cpp +++ b/src/apps/mediaplayer/playlist/Playlist.cpp @@ -559,8 +559,10 @@ Playlist::AppendPlaylistToPlaylist(const entry_ref& ref, Playlist* playlist) = new (std::nothrow) FilePlaylistItem(refPath); if (item == NULL || !playlist->AddItem(item)) delete item; - } else - printf("Error - %s: [%lx]\n", strerror(err), (int32) err); + } else { + printf("Error - %s: [%" B_PRIx32 "]\n", strerror(err), + err); + } } else printf("Error - No File Found in playlist\n"); } diff --git a/src/apps/mediaplayer/playlist/PlaylistListView.cpp b/src/apps/mediaplayer/playlist/PlaylistListView.cpp index df2e04811b..940b5a2462 100644 --- a/src/apps/mediaplayer/playlist/PlaylistListView.cpp +++ b/src/apps/mediaplayer/playlist/PlaylistListView.cpp @@ -425,7 +425,7 @@ PlaylistListView::Randomize() int32 index = CurrentSelection(count); if (index < 0) break; - if (!indices.AddItem((void*)index)) + if (!indices.AddItem((void*)(addr_t)index)) return; count++; } @@ -435,7 +435,7 @@ PlaylistListView::Randomize() // no selection, simply add all items count = CountItems(); for (int32 i = 0; i < count; i++) { - if (!indices.AddItem((void*)i)) + if (!indices.AddItem((void*)(addr_t)i)) return; } } @@ -458,7 +458,7 @@ void PlaylistListView::RemoveToTrash(int32 index) { BList indices; - indices.AddItem((void*)index); + indices.AddItem((void*)(addr_t)index); RemoveItemList(indices, true); } diff --git a/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp b/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp index 3f9ad41129..da6eec2538 100644 --- a/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp +++ b/src/apps/mediaplayer/playlist/RandomizePLItemsCommand.cpp @@ -48,7 +48,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist, BList indexSet; for (int32 i = 0; i < fCount; i++) { fItems[i] = fPlaylist->ItemAt(fListIndices[i]); - if (fItems[i] == NULL || !indexSet.AddItem((void*)i)) { + if (fItems[i] == NULL || !indexSet.AddItem((void*)(addr_t)i)) { // indicate a bad object state delete[] fItems; fItems = NULL; @@ -59,7 +59,7 @@ RandomizePLItemsCommand::RandomizePLItemsCommand(Playlist* playlist, // remove the indices from the set in random order for (int32 i = 0; i < fCount; i++) { int32 randomSetIndex = rand() % indexSet.CountItems(); - fRandomInternalIndices[i] = (int32)indexSet.RemoveItem(randomSetIndex); + fRandomInternalIndices[i] = (int32)(addr_t)indexSet.RemoveItem(randomSetIndex); } } diff --git a/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.cpp b/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.cpp index 973f3d9d5f..200cf76834 100644 --- a/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.cpp +++ b/src/apps/mediaplayer/supplier/MediaTrackAudioSupplier.cpp @@ -143,7 +143,7 @@ MediaTrackAudioSupplier::Read(void* buffer, int64 pos, int64 frames) pos += fOutOffset; // Fill the frames after the end of the track with silence. if (fCountFrames > 0 && pos + frames > fCountFrames) { - int64 size = max(0LL, fCountFrames - pos); + int64 size = max((int64)0, fCountFrames - pos); ReadSilence(SkipFrames(buffer, size), frames - size); frames = size; } @@ -276,10 +276,10 @@ MediaTrackAudioSupplier::_InitFromTrack() // get the length of the track fCountFrames = fMediaTrack->CountFrames(); - TRACE("_InitFromTrack(): keyframes: %d, frame count: %lld\n", - fHasKeyFrames, fCountFrames); - printf("_InitFromTrack(): keyframes: %d, frame count: %lld\n", - fHasKeyFrames, fCountFrames); + TRACE("_InitFromTrack(): keyframes: %" B_PRId16 ", frame count: %" B_PRId64 + "\n", fHasKeyFrames, fCountFrames); + printf("_InitFromTrack(): keyframes: %" B_PRId16 ", frame count: %" + B_PRId64 "\n", fHasKeyFrames, fCountFrames); } // _FramesPerBuffer @@ -698,9 +698,9 @@ MediaTrackAudioSupplier::_SeekToKeyFrameBackward(int64& position) if (error != B_OK) { position = fMediaTrack->CurrentFrame(); // if (fReportSeekError) { - printf(" seek to key frame backward: %lld -> %lld (%lld) " - "- %s\n", wantedPosition, position, - fMediaTrack->CurrentFrame(), strerror(error)); + printf(" seek to key frame backward: %" B_PRId64 " -> %" + B_PRId64 " (%" B_PRId64 ") - %s\n", wantedPosition, + position, fMediaTrack->CurrentFrame(), strerror(error)); fReportSeekError = false; // } } else { diff --git a/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp b/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp index c136958e6d..e83c09e0c2 100644 --- a/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp +++ b/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp @@ -169,8 +169,10 @@ bigtime_t _performanceTime = *performanceTime; ret = fVideoTrack->SeekToTime(performanceTime); if (ret == B_OK) { -if (_performanceTime != *performanceTime) -printf("seeked by time: %lld -> %lld\n", _performanceTime, *performanceTime); + if (_performanceTime != *performanceTime) { + printf("seeked by time: %" B_PRIdBIGTIME " -> %" B_PRIdBIGTIME + "\n", _performanceTime, *performanceTime); + } fPerformanceTime = *performanceTime; fCurrentFrame = fVideoTrack->CurrentFrame(); } @@ -333,7 +335,7 @@ MediaTrackVideoSupplier::_SwitchFormat(color_space format, uint32 bytesPerRow) } if (fFormat.u.raw_video.last_active != height - 1) { - printf("should skip %ld lines at bottom!\n", + printf("should skip %" B_PRId32 " lines at bottom!\n", (height - 1) - fFormat.u.raw_video.last_active); } diff --git a/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp b/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp index df566c2018..cbeb5ad818 100644 --- a/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp +++ b/src/apps/mediaplayer/supplier/ProxyAudioSupplier.cpp @@ -90,7 +90,8 @@ status_t ProxyAudioSupplier::GetFrames(void* buffer, int64 frameCount, bigtime_t startTime, bigtime_t endTime) { - TRACE("GetFrames(%p, frameCount: %lld, time interval: %lld - %lld)\n", + TRACE("GetFrames(%p, frameCount: %" B_PRId64 ", time interval: %" + B_PRIdBIGTIME " - %" B_PRIdBIGTIME ")\n", buffer, frameCount, startTime, endTime); // Create a list of playing intervals which compose the supplied @@ -114,7 +115,7 @@ ProxyAudioSupplier::GetFrames(void* buffer, int64 frameCount, delete interval; error = B_ERROR; ERROR("GetFrames() - zero duration audio interval! start " - "time: %lld\n", intervalStartTime); + "time: %" B_PRIdBIGTIME "\n", intervalStartTime); break; } if (!playingIntervals.AddItem(interval)) { @@ -144,7 +145,7 @@ ProxyAudioSupplier::GetFrames(void* buffer, int64 frameCount, int64 framesRead = 0; while (!playingIntervals.IsEmpty()) { PlayingInterval* interval - = (PlayingInterval*)playingIntervals.RemoveItem(0L); + = (PlayingInterval*)playingIntervals.RemoveItem((int32)0); if (error != B_OK) { delete interval; continue; diff --git a/src/apps/mediaplayer/supplier/SubTitlesSRT.cpp b/src/apps/mediaplayer/supplier/SubTitlesSRT.cpp index af3dcb2554..55eb48a565 100644 --- a/src/apps/mediaplayer/supplier/SubTitlesSRT.cpp +++ b/src/apps/mediaplayer/supplier/SubTitlesSRT.cpp @@ -52,8 +52,9 @@ SubTitlesSRT::SubTitlesSRT(BFile* file, const char* name) int32 sequenceNumber = atoi(line.String()); if (sequenceNumber != lastSequenceNumber + 1) { fprintf(stderr, "Warning: Wrong sequence number in SRT " - "file: %ld, expected: %ld, line %ld\n", sequenceNumber, - lastSequenceNumber + 1, currentLine); + "file: %" B_PRId32 ", expected: %" B_PRId32 ", line %" + B_PRId32 "\n", sequenceNumber, lastSequenceNumber + 1, + currentLine); } state = EXPECT_TIME_CODE; lastSequenceNumber = sequenceNumber; @@ -65,14 +66,14 @@ SubTitlesSRT::SubTitlesSRT(BFile* file, const char* name) line.Trim(); int32 separatorPos = line.FindFirst(" --> "); if (separatorPos < 0) { - fprintf(stderr, "Error: Time code expected on line %ld, " - "got '%s'\n", currentLine, line.String()); + fprintf(stderr, "Error: Time code expected on line %" + B_PRId32 ", got '%s'\n", currentLine, line.String()); return; } BString timeCode(line.String(), separatorPos); if (separatorPos != 12) { - fprintf(stderr, "Warning: Time code broken on line %ld " - "(%s)?\n", currentLine, timeCode.String()); + fprintf(stderr, "Warning: Time code broken on line %" + B_PRId32 " (%s)?\n", currentLine, timeCode.String()); } int hours; int minutes; @@ -81,7 +82,7 @@ SubTitlesSRT::SubTitlesSRT(BFile* file, const char* name) if (sscanf(timeCode.String(), "%d:%d:%d,%d", &hours, &minutes, &seconds, &milliSeconds) != 4) { fprintf(stderr, "Error: Failed to parse start time on " - "line %ld\n", currentLine); + "line %" B_PRId32 "\n", currentLine); return; } subTitle.startTime = (bigtime_t)hours * 60 * 60 * 1000000LL @@ -94,7 +95,7 @@ SubTitlesSRT::SubTitlesSRT(BFile* file, const char* name) if (sscanf(timeCode.String(), "%d:%d:%d,%d", &hours, &minutes, &seconds, &milliSeconds) != 4) { fprintf(stderr, "Error: Failed to parse end time on " - "line %ld\n", currentLine); + "line %" B_PRId32 "\n", currentLine); return; } bigtime_t endTime = (bigtime_t)hours * 60 * 60 * 1000000LL diff --git a/src/apps/mediaplayer/support/DurationToString.cpp b/src/apps/mediaplayer/support/DurationToString.cpp index 1f1d0b4316..d3da3e0877 100644 --- a/src/apps/mediaplayer/support/DurationToString.cpp +++ b/src/apps/mediaplayer/support/DurationToString.cpp @@ -22,10 +22,10 @@ duration_to_string(int32 seconds, char* string, size_t stringSize) seconds = seconds % 60; if (hours > 0) { - snprintf(string, stringSize, "%s%ld:%02ld:%02ld", - negative ? "-" : "", hours, minutes, seconds); + snprintf(string, stringSize, "%s%" B_PRId32 ":%02" B_PRId32 ":%02" + B_PRId32, negative ? "-" : "", hours, minutes, seconds); } else { - snprintf(string, stringSize, "%s%ld:%02ld", + snprintf(string, stringSize, "%s%" B_PRId32 ":%02" B_PRId32, negative ? "-" : "", minutes, seconds); } } diff --git a/src/apps/mediaplayer/support/Event.cpp b/src/apps/mediaplayer/support/Event.cpp index 91d887b8c0..e20fc4dcde 100644 --- a/src/apps/mediaplayer/support/Event.cpp +++ b/src/apps/mediaplayer/support/Event.cpp @@ -51,6 +51,6 @@ Event::SetAutoDelete(bool autoDelete) void Event::Execute() { - printf("Event::Execute() - %Ld\n", fTime); + printf("Event::Execute() - %" B_PRIdBIGTIME "\n", fTime); } diff --git a/src/apps/mediaplayer/support/EventQueue.cpp b/src/apps/mediaplayer/support/EventQueue.cpp index 030a8c9f19..2d8acf5787 100644 --- a/src/apps/mediaplayer/support/EventQueue.cpp +++ b/src/apps/mediaplayer/support/EventQueue.cpp @@ -42,7 +42,7 @@ EventQueue::~EventQueue() { if (delete_sem(fThreadControl) == B_OK) wait_for_thread(fEventExecutor, &fEventExecutor); - while (Event *event = (Event*)fEvents.RemoveItem(0L)) { + while (Event *event = (Event*)fEvents.RemoveItem((int32)0)) { if (event->AutoDelete()) delete event; } @@ -174,7 +174,7 @@ EventQueue::_ExecuteEvents() if (Lock()) { while (!fEvents.IsEmpty() && system_time() >= _EventAt(0)->Time()) { - Event* event = (Event*)fEvents.RemoveItem(0L); + Event* event = (Event*)fEvents.RemoveItem((int32)0); bool deleteEvent = event->AutoDelete(); event->Execute(); if (deleteEvent) diff --git a/src/apps/mediaplayer/support/Notifier.cpp b/src/apps/mediaplayer/support/Notifier.cpp index 40d0e95391..80b487ae90 100644 --- a/src/apps/mediaplayer/support/Notifier.cpp +++ b/src/apps/mediaplayer/support/Notifier.cpp @@ -29,8 +29,8 @@ Notifier::~Notifier() if (fListeners.CountItems() > 0) { char message[256]; Listener* o = (Listener*)fListeners.ItemAt(0); - sprintf(message, "Notifier::~Notifier() - %ld " - "listeners still watching, first: %s\n", + sprintf(message, "Notifier::~Notifier() - %" B_PRId32 + " listeners still watching, first: %s\n", fListeners.CountItems(), typeid(*o).name()); debugger(message); } diff --git a/src/apps/midiplayer/MidiPlayerWindow.cpp b/src/apps/midiplayer/MidiPlayerWindow.cpp index e098f584a0..95dbe958e9 100644 --- a/src/apps/midiplayer/MidiPlayerWindow.cpp +++ b/src/apps/midiplayer/MidiPlayerWindow.cpp @@ -394,7 +394,7 @@ void MidiPlayerWindow::StartSynth() { synth.Start(); - synth.SetFileHook(_StopHook, (int32) this); + synth.SetFileHook(_StopHook, (int32)(addr_t)this); playing = true; } @@ -412,7 +412,7 @@ MidiPlayerWindow::StopSynth() void MidiPlayerWindow::_StopHook(int32 arg) { - ((MidiPlayerWindow*)arg)->StopHook(); + ((MidiPlayerWindow*)(addr_t)arg)->StopHook(); } diff --git a/src/apps/networkstatus/NetworkStatusView.cpp b/src/apps/networkstatus/NetworkStatusView.cpp index 8738aace42..cdff48eb65 100644 --- a/src/apps/networkstatus/NetworkStatusView.cpp +++ b/src/apps/networkstatus/NetworkStatusView.cpp @@ -139,16 +139,12 @@ NetworkStatusView::NetworkStatusView(BMessage* archive) NetworkStatusView::~NetworkStatusView() { - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } void NetworkStatusView::_Init() { - fAboutWindow = NULL; - for (int i = 0; i < kStatusCount; i++) { fTrayIcons[i] = NULL; fNotifyIcons[i] = NULL; @@ -508,22 +504,19 @@ NetworkStatusView::MouseDown(BPoint point) void NetworkStatusView::_AboutRequested() { - if (fAboutWindow == NULL) { - const char* authors[] = { - "Axel Dörfler", - "Hugo Santos", - NULL - }; + BAboutWindow* window = new BAboutWindow( + B_TRANSLATE_SYSTEM_NAME("NetworkStatus"), kSignature); + + const char* authors[] = { + "Axel Dörfler", + "Hugo Santos", + NULL + }; - fAboutWindow = new BAboutWindow( - B_TRANSLATE_SYSTEM_NAME("NetworkStatus"), kSignature); - fAboutWindow->AddCopyright(2007, "Haiku, Inc."); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + window->AddCopyright(2007, "Haiku, Inc."); + window->AddAuthors(authors); + + window->Show(); } diff --git a/src/apps/networkstatus/NetworkStatusView.h b/src/apps/networkstatus/NetworkStatusView.h index 53e6b3ab37..543bdcf6f0 100644 --- a/src/apps/networkstatus/NetworkStatusView.h +++ b/src/apps/networkstatus/NetworkStatusView.h @@ -17,7 +17,6 @@ #include -class BAboutWindow; class BMessageRunner; class BNetworkInterface; @@ -66,7 +65,6 @@ class NetworkStatusView : public BView { std::map fInterfaceStatuses; - BAboutWindow* fAboutWindow; bool fInDeskbar; BBitmap* fTrayIcons[kStatusCount]; BBitmap* fNotifyIcons[kStatusCount]; diff --git a/src/apps/packageinstaller/PackageInfo.cpp b/src/apps/packageinstaller/PackageInfo.cpp index 22cfe55e35..93549344ad 100644 --- a/src/apps/packageinstaller/PackageInfo.cpp +++ b/src/apps/packageinstaller/PackageInfo.cpp @@ -73,7 +73,7 @@ PackageInfo::~PackageInfo() { pkg_profile *iter = 0; while (1) { - iter = static_cast(fProfiles.RemoveItem((long int)0)); + iter = static_cast(fProfiles.RemoveItem((int32)0)); if (iter == NULL) break; @@ -82,7 +82,7 @@ PackageInfo::~PackageInfo() PackageItem *file = 0; while (true) { - file = static_cast(fFiles.RemoveItem((long int)0)); + file = static_cast(fFiles.RemoveItem((int32)0)); if (file == NULL) break; @@ -90,7 +90,7 @@ PackageInfo::~PackageInfo() } while (true) { - file = static_cast(fScripts.RemoveItem((long int)0)); + file = static_cast(fScripts.RemoveItem((int32)0)); if (file == NULL) break; diff --git a/src/apps/people/PersonView.cpp b/src/apps/people/PersonView.cpp index 9dc3165ef1..656bef1021 100644 --- a/src/apps/people/PersonView.cpp +++ b/src/apps/people/PersonView.cpp @@ -217,7 +217,7 @@ PersonView::BuildGroupMenu() if (file.InitCheck() == B_OK && file.GetAttrInfo(fCategoryAttribute, &info) == B_OK && info.size > 1) { - if (info.size > sizeof(buffer)) + if (info.size > (off_t)sizeof(buffer)) info.size = sizeof(buffer); if (file.ReadAttr(fCategoryAttribute.String(), B_STRING_TYPE, diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index d8c23bae59..c7a6968243 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -77,8 +77,6 @@ PowerStatusView::PowerStatusView(BMessage* archive) PowerStatusView::~PowerStatusView() { - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } @@ -98,8 +96,6 @@ PowerStatusView::_Init() { SetViewColor(B_TRANSPARENT_COLOR); - fAboutWindow = NULL; - fShowLabel = true; fShowTime = false; fShowStatusIcon = true; @@ -325,10 +321,11 @@ PowerStatusView::_SetLabel(char* buffer, size_t bufferLength) close = ")"; } - if (!fShowTime && fPercent >= 0) - snprintf(buffer, bufferLength, "%s%ld%%%s", open, fPercent, close); - else if (fShowTime && fTimeLeft >= 0) { - snprintf(buffer, bufferLength, "%s%ld:%02ld%s", + if (!fShowTime && fPercent >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 "%%%s", open, fPercent, + close); + } else if (fShowTime && fTimeLeft >= 0) { + snprintf(buffer, bufferLength, "%s%" B_PRId32 ":%02" B_PRId32 "%s", open, fTimeLeft / 3600, (fTimeLeft / 60) % 60, close); } } @@ -376,11 +373,12 @@ PowerStatusView::Update(bool force) close = ")"; } if (fHasBattery) { - size_t length = snprintf(text, sizeof(text), "%s%ld%%%s", - open, fPercent, close); + size_t length = snprintf(text, sizeof(text), "%s%" B_PRId32 + "%%%s", open, fPercent, close); if (fTimeLeft) { length += snprintf(text + length, sizeof(text) - length, - "\n%ld:%02ld", fTimeLeft / 3600, (fTimeLeft / 60) % 60); + "\n%" B_PRId32 ":%02" B_PRId32, fTimeLeft / 3600, + (fTimeLeft / 60) % 60); } const char* state = NULL; @@ -514,9 +512,6 @@ PowerStatusReplicant::~PowerStatusReplicant() fDriverInterface->Disconnect(); fDriverInterface->ReleaseReference(); - if (fAboutWindow != NULL) - fAboutWindow->Quit(); - _SaveSettings(); } @@ -627,23 +622,20 @@ PowerStatusReplicant::MouseDown(BPoint point) void PowerStatusReplicant::_AboutRequested() { - if (fAboutWindow == NULL) { - const char* authors[] = { - "Axel Dörfler", - "Alexander von Gluck", - "Clemens Zeidler", - NULL - }; + BAboutWindow* window = new BAboutWindow( + B_TRANSLATE_SYSTEM_NAME("PowerStatus"), kSignature); - fAboutWindow = new BAboutWindow( - B_TRANSLATE_SYSTEM_NAME("PowerStatus"), kSignature); - fAboutWindow->AddCopyright(2006, "Haiku, Inc."); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + const char* authors[] = { + "Axel Dörfler", + "Alexander von Gluck", + "Clemens Zeidler", + NULL + }; + + window->AddCopyright(2006, "Haiku, Inc."); + window->AddAuthors(authors); + + window->Show(); } diff --git a/src/apps/powerstatus/PowerStatusView.h b/src/apps/powerstatus/PowerStatusView.h index 6661b47504..837bb2d3e1 100644 --- a/src/apps/powerstatus/PowerStatusView.h +++ b/src/apps/powerstatus/PowerStatusView.h @@ -15,7 +15,6 @@ #include "DriverInterface.h" -class BAboutWindow; class BFile; @@ -54,7 +53,6 @@ private: protected: PowerStatusDriverInterface* fDriverInterface; - BAboutWindow* fAboutWindow; bool fShowLabel; bool fShowTime; diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index 5a4b2ff8e0..eadb0c0edb 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -1,7 +1,7 @@ /* ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved. Copyright (C) 2004 beunited.org - Copyright (c) 2006-2012, Haiku, Inc. All rights reserved. + Copyright (c) 2006-2013, Haiku, Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -69,6 +69,9 @@ const char* kFrameColorPref = "deskbar_frame_color"; const char* kIdleColorPref = "deskbar_idle_color"; const char* kActiveColorPref = "deskbar_active_color"; +static const char* const kDebuggerSignature + = "application/x-vnd.Haiku-Debugger"; + const rgb_color kKernelBlue = {20, 20, 231, 255}; const rgb_color kIdleGreen = {110, 190,110, 255}; @@ -204,10 +207,6 @@ ProcessController::~ProcessController() delete fMessageRunner; gPCView = NULL; - - // replicant deleted, destroy the about window - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } @@ -221,7 +220,23 @@ ProcessController::Init() memset(fCPUTimes, 0, sizeof(fCPUTimes)); memset(fPrevActive, 0, sizeof(fPrevActive)); fPrevTime = 0; - fAboutWindow = NULL; +} + + +void +ProcessController::_HandleDebugRequest(team_id team, thread_id thread) +{ + char *argv[2]; + char paramString[16]; + char idString[16]; + strlcpy(paramString, thread > 0 ? "--thread" : "--team", sizeof(paramString)); + snprintf(idString, sizeof(idString), "%" B_PRId32, thread > 0 ? thread : team); + argv[0] = paramString; + argv[1] = idString; + status_t error = be_roster->Launch(kDebuggerSignature, 2, argv); + if (error != B_OK) { + // TODO: notify user + } } @@ -272,14 +287,24 @@ ProcessController::MessageReceived(BMessage *message) if (get_team_info(team, &infos.team_info) == B_OK) { get_team_name_and_icon(infos); snprintf(question, sizeof(question), - B_TRANSLATE("Do you really want to kill the team \"%s\"?"), + B_TRANSLATE("What do you want to do with the team \"%s\"?"), infos.team_name); alert = new BAlert(B_TRANSLATE("Please confirm"), question, - B_TRANSLATE("Cancel"), B_TRANSLATE("Yes, kill this team!"), - NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + B_TRANSLATE("Cancel"), B_TRANSLATE("Debug this team!"), + B_TRANSLATE("Kill this team!"), B_WIDTH_AS_USUAL, + B_STOP_ALERT); alert->SetShortcut(0, B_ESCAPE); - if (alert->Go()) - kill_team(team); + int result = alert->Go(); + switch (result) { + case 1: + _HandleDebugRequest(team, -1); + break; + case 2: + kill_team(team); + break; + default: + break; + } } else { alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("This team is already gone"B_UTF8_ELLIPSIS), @@ -322,17 +347,8 @@ ProcessController::MessageReceived(BMessage *message) if (r == KILL) kill_thread(thread); #if DEBUG_THREADS - else if (r == 1) { - Tdebug_thead_param* param = new Tdebug_thead_param; - param->thread = thread; - if (thinfo.state == B_THREAD_WAITING) - param->sem = thinfo.sem; - else - param->sem = -1; - param->totalTime = thinfo.user_time+thinfo.kernel_time; - resume_thread(spawn_thread(thread_debug_thread, - B_TRANSLATE("Debug thread"), B_NORMAL_PRIORITY, param)); - } + else if (r == 1) + _HandleDebugRequest(thinfo.team, thinfo.thread); #endif } else { alert = new BAlert(B_TRANSLATE("Info"), @@ -438,27 +454,24 @@ ProcessController::MessageReceived(BMessage *message) void ProcessController::AboutRequested() { - if (fAboutWindow == NULL) { - const char* extraCopyrights[] = { - "2004 beunited.org", - "1997-2001 Georges-Edouard Berenger", - NULL - }; + BAboutWindow* window = new BAboutWindow( + B_TRANSLATE_SYSTEM_NAME("ProcessController"), kSignature); - const char* authors[] = { - "Georges-Edouard Berenger", - NULL - }; + const char* extraCopyrights[] = { + "2004 beunited.org", + "1997-2001 Georges-Edouard Berenger", + NULL + }; - fAboutWindow = new BAboutWindow( - B_TRANSLATE_SYSTEM_NAME("ProcessController"), kSignature); - fAboutWindow->AddCopyright(2007, "Haiku, Inc.", extraCopyrights); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + const char* authors[] = { + "Georges-Edouard Berenger", + NULL + }; + + window->AddCopyright(2007, "Haiku, Inc.", extraCopyrights); + window->AddAuthors(authors); + + window->Show(); } diff --git a/src/apps/processcontroller/ProcessController.h b/src/apps/processcontroller/ProcessController.h index 78d1212741..02cd76f067 100644 --- a/src/apps/processcontroller/ProcessController.h +++ b/src/apps/processcontroller/ProcessController.h @@ -1,21 +1,21 @@ /* ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved. Copyright (C) 2004 beunited.org - Copyright (c) 2006-2012, Haiku, Inc. All rights reserved. + Copyright (c) 2006-2013, Haiku, Inc. All rights reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PCVIEW_H_ #define _PCVIEW_H_ @@ -26,7 +26,6 @@ #include -class BAboutWindow; class BMessageRunner; class ThreadBarMenu; @@ -59,8 +58,8 @@ class ProcessController : public BView { private: void Init(); + void _HandleDebugRequest(team_id team, thread_id thread); - BAboutWindow* fAboutWindow; bool fTemp; float fMemoryUsage; float fLastBarHeight[B_MAX_CPU_COUNT]; diff --git a/src/apps/showimage/Filter.cpp b/src/apps/showimage/Filter.cpp index 6c5769abdd..c8e7fc7735 100644 --- a/src/apps/showimage/Filter.cpp +++ b/src/apps/showimage/Filter.cpp @@ -829,6 +829,7 @@ Scaler::Dither(int32 fromRow, int32 toRow) color.red = Limit(srcData[2] + error[0] / 16); color.green = Limit(srcData[1] + error[1] / 16); color.blue = Limit(srcData[0] + error[2] / 16); + color.alpha = UINT8_MAX; index = screen.IndexForColor(color); actualColor = screen.ColorForIndex(index); @@ -879,6 +880,7 @@ Scaler::Dither(int32 fromRow, int32 toRow) color.red = Limit(srcData[2] + error[0] / 16); color.green = Limit(srcData[1] + error[1] / 16); color.blue = Limit(srcData[0] + error[2] / 16); + color.alpha = UINT8_MAX; index = screen.IndexForColor(color); actualColor = screen.ColorForIndex(index); diff --git a/src/apps/soundrecorder/FileUtils.cpp b/src/apps/soundrecorder/FileUtils.cpp index 6200866867..70e90082a4 100644 --- a/src/apps/soundrecorder/FileUtils.cpp +++ b/src/apps/soundrecorder/FileUtils.cpp @@ -9,6 +9,7 @@ ******************************************************************************/ #include "FileUtils.h" +#include #include #include #include @@ -95,7 +96,7 @@ CopyAttributes(BNode& dst, BNode& src) uint8 buffer[size]; off_t offset = 0; ssize_t read = src.ReadAttr(attrName, info.type, offset, buffer, - min_c(size, info.size)); + std::min((off_t)size, info.size)); if (read < 0) { fprintf(stderr, "Error reading attribute '%s'\n", attrName); return (status_t)read; @@ -113,7 +114,7 @@ CopyAttributes(BNode& dst, BNode& src) } offset += read; read = src.ReadAttr(attrName, info.type, offset, buffer, - min_c(size, info.size - offset)); + std::min((off_t)size, info.size - offset)); if (read < 0) { fprintf(stderr, "Error reading attribute '%s'\n", attrName); return (status_t)read; diff --git a/src/apps/stylededit/FindWindow.cpp b/src/apps/stylededit/FindWindow.cpp index 2f4eb61fd7..20187d7b3a 100644 --- a/src/apps/stylededit/FindWindow.cpp +++ b/src/apps/stylededit/FindWindow.cpp @@ -25,6 +25,7 @@ #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FindandReplaceWindow" + FindWindow::FindWindow(BRect frame, BHandler* _handler, BString* searchString, bool caseState, bool wrapState, bool backState) : BWindow(frame, "FindWindow", B_MODAL_WINDOW, @@ -125,5 +126,3 @@ FindWindow::_SendMessage() PostMessage(B_QUIT_REQUESTED); } - - diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index cf0e856537..4469d1d2f8 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -850,11 +850,6 @@ StyledEditWindow::SaveAs(BMessage* message) if (message != NULL) fSavePanel->SetMessage(message); - // Move the save panel to the middle of the window - fSavePanel->Window()->MoveTo(Frame().LeftTop().x + Frame().Width() / 2 - - fSavePanel->Window()->Frame().Width() / 2, - Frame().LeftTop().y + Frame().Height() / 4); - fSavePanel->Show(); return B_OK; } @@ -1847,10 +1842,6 @@ StyledEditWindow::_ShowStatistics() BAlert* alert = new BAlert("Statistics", result, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - // Move the alert to the middle of the window - alert->MoveTo(Frame().LeftTop().x + Frame().Width() / 2 - - alert->Frame().Width() / 2, - Frame().LeftTop().y + Frame().Height() / 4); return alert->Go(); } @@ -1906,10 +1897,6 @@ StyledEditWindow::_ShowAlert(const BString& text, const BString& label, BAlert* alert = new BAlert("Alert", text.String(), label.String(), button2, button3, B_WIDTH_AS_USUAL, spacing, type); alert->SetShortcut(0, B_ESCAPE); - // Move the alert to the middle of the window - alert->MoveTo(Frame().LeftTop().x + Frame().Width() / 2 - - alert->Frame().Width() / 2, - Frame().LeftTop().y + Frame().Height() / 4); return alert->Go(); } diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp b/src/apps/terminal/BasicTerminalBuffer.cpp index f5bcd6199a..dfbb54e28d 100644 --- a/src/apps/terminal/BasicTerminalBuffer.cpp +++ b/src/apps/terminal/BasicTerminalBuffer.cpp @@ -431,48 +431,31 @@ BasicTerminalBuffer::FindWord(const TermPos& pos, TermPos start(x, y); TermPos end(x + (IS_WIDTH(line->cells[x].attributes) ? FULL_WIDTH : HALF_WIDTH), y); - while (true) { - if (--x < 0) { - // Hit the beginning of the line -- continue at the end of the - // previous line, if it soft-breaks. - y--; - if ((line = _HistoryLineAt(y, lineBuffer)) == NULL - || !line->softBreak || line->length == 0) { - break; - } - x = line->length - 1; - } - if (x > 0 && IS_WIDTH(line->cells[x - 1].attributes)) - x--; - - if (classifier->Classify(line->cells[x].character) != type) + for (;;) { + TermPos previousPos = start; + if (!_PreviousLinePos(lineBuffer, line, previousPos) + || classifier->Classify(line->cells[previousPos.x].character) + != type) { break; + } - start.SetTo(x, y); + start = previousPos; } // find the end - x = end.x; - y = end.y; - line = _HistoryLineAt(y, lineBuffer); + line = _HistoryLineAt(end.y, lineBuffer); - while (true) { - if (x >= line->length) { - // Hit the end of the line -- if it soft-breaks continue with the - // next line. - if (!line->softBreak) - break; - y++; - x = 0; - if ((line = _HistoryLineAt(y, lineBuffer)) == NULL) - break; - } - - if (classifier->Classify(line->cells[x].character) != type) + for (;;) { + TermPos nextPos = end; + if (!_NormalizeLinePos(lineBuffer, line, nextPos)) break; - x += IS_WIDTH(line->cells[x].attributes) ? FULL_WIDTH : HALF_WIDTH; - end.SetTo(x, y); + if (classifier->Classify(line->cells[nextPos.x].character) != type) + break; + + nextPos.x += IS_WIDTH(line->cells[nextPos.x].attributes) + ? FULL_WIDTH : HALF_WIDTH; + end = nextPos; } _start = start; @@ -481,6 +464,34 @@ BasicTerminalBuffer::FindWord(const TermPos& pos, } +bool +BasicTerminalBuffer::PreviousLinePos(TermPos& pos) const +{ + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(pos.y, lineBuffer); + if (line == NULL || pos.x < 0 || pos.x >= fWidth) + return false; + + return _PreviousLinePos(lineBuffer, line, pos); +} + + +bool +BasicTerminalBuffer::NextLinePos(TermPos& pos, bool normalize) const +{ + TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth); + TerminalLine* line = _HistoryLineAt(pos.y, lineBuffer); + if (line == NULL || pos.x < 0 || pos.x > fWidth) + return false; + + if (!_NormalizeLinePos(lineBuffer, line, pos)) + return false; + + pos.x += IS_WIDTH(line->cells[pos.x].attributes) ? FULL_WIDTH : HALF_WIDTH; + return !normalize || _NormalizeLinePos(lineBuffer, line, pos); +} + + int32 BasicTerminalBuffer::LineLength(int32 index) const { @@ -1692,6 +1703,46 @@ BasicTerminalBuffer::_NextChar(TermPos& pos, UTF8Char& c) const } +bool +BasicTerminalBuffer::_PreviousLinePos(TerminalLine* lineBuffer, + TerminalLine*& line, TermPos& pos) const +{ + if (--pos.x < 0) { + // Hit the beginning of the line -- continue at the end of the + // previous line, if it soft-breaks. + pos.y--; + if ((line = _HistoryLineAt(pos.y, lineBuffer)) == NULL + || !line->softBreak || line->length == 0) { + return false; + } + pos.x = line->length - 1; + } + if (pos.x > 0 && IS_WIDTH(line->cells[pos.x - 1].attributes)) + pos.x--; + + return true; +} + + +bool +BasicTerminalBuffer::_NormalizeLinePos(TerminalLine* lineBuffer, + TerminalLine*& line, TermPos& pos) const +{ + if (pos.x < line->length) + return true; + + // Hit the end of the line -- if it soft-breaks continue with the + // next line. + if (!line->softBreak) + return false; + + pos.y++; + pos.x = 0; + line = _HistoryLineAt(pos.y, lineBuffer); + return line != NULL; +} + + #ifdef USE_DEBUG_SNAPSHOTS void diff --git a/src/apps/terminal/BasicTerminalBuffer.h b/src/apps/terminal/BasicTerminalBuffer.h index ed30bb09f2..757984f6b2 100644 --- a/src/apps/terminal/BasicTerminalBuffer.h +++ b/src/apps/terminal/BasicTerminalBuffer.h @@ -107,6 +107,14 @@ public: int32 LineLength(int32 index) const; int32 GetLineColor(int32 index) const; + bool PreviousLinePos(TermPos& pos) const; + bool NextLinePos(TermPos& pos, bool normalize) const; + // normalize specifies that the returned + // position must be a valid position, i.e. + // actually point to a character (as opposed + // to just pointing to the position after a + // character). + bool Find(const char* pattern, const TermPos& start, bool forward, bool caseSensitive, bool matchWord, TermPos& matchStart, @@ -205,6 +213,11 @@ protected: bool _PreviousChar(TermPos& pos, UTF8Char& c) const; bool _NextChar(TermPos& pos, UTF8Char& c) const; + bool _PreviousLinePos(TerminalLine* lineBuffer, + TerminalLine*& line, TermPos& pos) const; + bool _NormalizeLinePos(TerminalLine* lineBuffer, + TerminalLine*& line, TermPos& pos) const; + protected: // screen width/height int32 fWidth; diff --git a/src/apps/terminal/FindWindow.cpp b/src/apps/terminal/FindWindow.cpp index 181ddf2f69..02bd9c0fea 100644 --- a/src/apps/terminal/FindWindow.cpp +++ b/src/apps/terminal/FindWindow.cpp @@ -1,8 +1,11 @@ /* - * Copyright 2007-2010, Haiku, Inc. All rights reserved. + * Copyright 2007-2013 Haiku, Inc. All rights reserved. * Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai. * All rights reserved. Distributed under the terms of the MIT license. + * + * Authors: + * John Scipione, jscipione@gmail.com */ #include "FindWindow.h" @@ -18,6 +21,7 @@ #include #include #include +#include #include #include @@ -26,11 +30,13 @@ const uint32 MSG_FIND_HIDE = 'Fhid'; const uint32 TOGGLE_FIND_CONTROL = 'MTFG'; const BRect kWindowFrame(10, 30, 250, 200); + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "Terminal FindWindow" + FindWindow::FindWindow(BMessenger messenger, const BString& str, - bool findSelection, bool matchWord, bool matchCase, bool forwardSearch) + bool findSelection, bool matchWord, bool matchCase, bool forwardSearch) : BWindow(kWindowFrame, B_TRANSLATE("Find"), B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE @@ -39,26 +45,31 @@ FindWindow::FindWindow(BMessenger messenger, const BString& str, { SetLayout(new BGroupLayout(B_VERTICAL)); - BBox *separator = new BBox("separator"); + BBox* separator = new BBox("separator"); separator->SetExplicitMinSize(BSize(250.0, B_SIZE_UNSET)); separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1.0)); BRadioButton* useSelection = NULL; const float spacing = be_control_look->DefaultItemSpacing(); - AddChild(BGroupLayoutBuilder(B_VERTICAL, 5.0) + AddChild(BGroupLayoutBuilder(B_VERTICAL, B_USE_SMALL_SPACING) .SetInsets(spacing, spacing, spacing, spacing) - .Add(BGridLayoutBuilder() + .Add(BGridLayoutBuilder(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING) .Add(fTextRadio = new BRadioButton(B_TRANSLATE("Use text:"), new BMessage(TOGGLE_FIND_CONTROL)), 0, 0) .Add(fFindLabel = new BTextControl(NULL, NULL, NULL), 1, 0) .Add(useSelection = new BRadioButton(B_TRANSLATE("Use selection"), new BMessage(TOGGLE_FIND_CONTROL)), 0, 1)) + .Add(BSpaceLayoutItem::CreateVerticalStrut(spacing / 4)) .Add(separator) + .Add(BSpaceLayoutItem::CreateVerticalStrut(spacing / 4)) .Add(fForwardSearchBox = new BCheckBox(B_TRANSLATE("Search forward"))) .Add(fMatchCaseBox = new BCheckBox(B_TRANSLATE("Match case"))) .Add(fMatchWordBox = new BCheckBox(B_TRANSLATE("Match word"))) - .Add(fFindButton = new BButton(B_TRANSLATE("Find"), + .AddGroup(B_HORIZONTAL) + .AddGlue() + .Add(fFindButton = new BButton(B_TRANSLATE("Find"), new BMessage(MSG_FIND))) + .End() .TopView()); fFindLabel->SetDivider(0.0); @@ -87,8 +98,6 @@ FindWindow::FindWindow(BMessenger messenger, const BString& str, fFindButton->MakeDefault(true); AddShortcut((uint32)'W', B_COMMAND_KEY, new BMessage(MSG_FIND_HIDE)); - - Show(); } diff --git a/src/apps/terminal/FindWindow.h b/src/apps/terminal/FindWindow.h index f3c9bb3776..f2b6e3cf7a 100644 --- a/src/apps/terminal/FindWindow.h +++ b/src/apps/terminal/FindWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku, Inc. + * Copyright 2007-2013 Haiku, Inc. All rights reserved. * Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai. * All rights reserved. Distributed under the terms of the MIT license. @@ -29,8 +29,8 @@ public: bool matchCase, bool forwardSearch); virtual ~FindWindow(); - virtual void Quit(); virtual void MessageReceived(BMessage* msg); + virtual void Quit(); private: void _SendFindMessage(); diff --git a/src/apps/terminal/HyperLink.cpp b/src/apps/terminal/HyperLink.cpp new file mode 100644 index 0000000000..e3eab2843a --- /dev/null +++ b/src/apps/terminal/HyperLink.cpp @@ -0,0 +1,53 @@ +/* + * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "HyperLink.h" + +#include +#include + +#include "TermConst.h" + + +HyperLink::HyperLink() + : + fAddress(), + fType(TYPE_URL) +{ +} + + +HyperLink::HyperLink(const BString& address, Type type) + : + fText(address), + fAddress(address), + fType(type) +{ +} + + +HyperLink::HyperLink(const BString& text, const BString& address, Type type) + : + fText(text), + fAddress(address), + fType(type) +{ +} + + +status_t +HyperLink::Open() +{ + if (!IsValid()) + return B_BAD_VALUE; + + // open with the "open" program + BString address(fAddress); + address.CharacterEscape(kShellEscapeCharacters, '\\'); + BString commandLine; + commandLine.SetToFormat("/bin/open %s", address.String()); + return system(commandLine) == 0 ? B_OK : errno; +} diff --git a/src/apps/terminal/HyperLink.h b/src/apps/terminal/HyperLink.h new file mode 100644 index 0000000000..ba7d58a13e --- /dev/null +++ b/src/apps/terminal/HyperLink.h @@ -0,0 +1,42 @@ +/* + * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef HYPER_LINK_H +#define HYPER_LINK_H + + +#include + + +class HyperLink { +public: + enum Type { + TYPE_URL, + TYPE_PATH, + TYPE_PATH_WITH_LINE, + TYPE_PATH_WITH_LINE_AND_COLUMN + }; + +public: + HyperLink(); + HyperLink(const BString& address, Type type); + HyperLink(const BString& text, + const BString& address, Type type); + + bool IsValid() const { return !fAddress.IsEmpty(); } + + const BString& Text() const { return fText; } + const BString& Address() const { return fAddress; } + Type GetType() const { return fType; } + + status_t Open(); + +private: + BString fText; + BString fAddress; + Type fType; +}; + + +#endif // HYPER_LINK_H diff --git a/src/apps/terminal/Jamfile b/src/apps/terminal/Jamfile index c8a114e927..98a062afa8 100644 --- a/src/apps/terminal/Jamfile +++ b/src/apps/terminal/Jamfile @@ -16,6 +16,7 @@ Application Terminal : FindWindow.cpp Globals.cpp HistoryBuffer.cpp + HyperLink.cpp InlineInput.cpp PatternEvaluator.cpp PrefHandler.cpp @@ -33,6 +34,8 @@ Application Terminal : TermParse.cpp TermScrollView.cpp TermView.cpp + TermViewHighlight.cpp + TermViewStates.cpp TermWindow.cpp TitlePlaceholderMapper.cpp VTKeyTbl.c diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index b6c70ff8ad..5dd91d47dd 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -119,8 +119,8 @@ typedef struct { int status; /* status of child */ char msg[128]; /* error message */ - int row; /* terminal rows */ - int col; /* Terminal columns */ + unsigned short row; /* terminal rows */ + unsigned short col; /* Terminal columns */ } handshake_t; /* status of handshake */ diff --git a/src/apps/terminal/TermConst.cpp b/src/apps/terminal/TermConst.cpp index 1b88bc0493..2e2c9cdf6a 100644 --- a/src/apps/terminal/TermConst.cpp +++ b/src/apps/terminal/TermConst.cpp @@ -31,3 +31,7 @@ const char* const kTooTipSetWindowTitlePlaceholders = B_TRANSLATE( "\t%p\t-\tThe name of the active process in the current tab.\n" "\t%t\t-\tThe title of the current tab.\n" "\t%%\t-\tThe character '%'."); + +const char* const kShellEscapeCharacters = " ~`#$&*()\\|[]{};'\"<>?!"; +const char* const kDefaultAdditionalWordCharacters = ":@-./_~"; +const char* const kURLAdditionalWordCharacters = ":/-._~[]?#@!$&'()*+,;="; diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index 942d9215d8..9d1c942f15 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -145,6 +145,10 @@ static const char* const PREF_WINDOW_TITLE = "Window title"; extern const char* const kTooTipSetTabTitlePlaceholders; extern const char* const kTooTipSetWindowTitlePlaceholders; +extern const char* const kShellEscapeCharacters; +extern const char* const kDefaultAdditionalWordCharacters; +extern const char* const kURLAdditionalWordCharacters; + // Cursor style enum { diff --git a/src/apps/terminal/TermParse.cpp b/src/apps/terminal/TermParse.cpp index c2b1edacd9..b86fbe52f3 100644 --- a/src/apps/terminal/TermParse.cpp +++ b/src/apps/terminal/TermParse.cpp @@ -1048,8 +1048,19 @@ TermParse::EscParse() uchar params[512]; // fill the buffer until BEL, ST or something else. bool isParsed = false; + int32 skipCount = 0; // take care about UTF-8 characters for (uint i = 0; !isParsed && i < sizeof(params); i++) { params[i] = _NextParseChar(); + + if (skipCount > 0) { + skipCount--; + continue; + } + + skipCount = UTF8Char::ByteCount(params[i]) - 1; + if (skipCount > 0) + continue; + switch (params[i]) { // BEL case 0x07: @@ -1074,6 +1085,9 @@ TermParse::EscParse() params[i] = '\0'; } + // watchdog for the 'end of buffer' case + params[sizeof(params) - 1] = '\0'; + if (isParsed) _ProcessOperatingSystemControls(params); diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 89faf10feb..610208e931 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -16,7 +16,6 @@ #include "TermView.h" -#include #include #include #include @@ -62,22 +61,13 @@ #include "TermConst.h" #include "TerminalBuffer.h" #include "TerminalCharClassifier.h" +#include "TermViewStates.h" #include "VTkeymap.h" -// defined in VTKeyTbl.c -extern int function_keycode_table[]; -extern char *function_key_char_table[]; - #define ROWS_DEFAULT 25 #define COLUMNS_DEFAULT 80 -// selection granularity -enum { - SELECT_CHARS, - SELECT_WORDS, - SELECT_LINES -}; #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "Terminal TermView" @@ -101,7 +91,6 @@ static property_info sPropList[] = { static const uint32 kUpdateSigWinch = 'Rwin'; static const uint32 kBlinkCursor = 'BlCr'; -static const uint32 kAutoScroll = 'AScr'; static const bigtime_t kSyncUpdateGranularity = 100000; // 0.1 s @@ -112,9 +101,6 @@ static const bigtime_t kCursorBlinkInterval = 500000; static const rgb_color kBlackColor = { 0, 0, 0, 255 }; static const rgb_color kWhiteColor = { 255, 255, 255, 255 }; -static const char* kDefaultSpecialWordChars = ":@-./_~"; -static const char* kEscapeCharacters = " ~`#$&*()\\|[]{};'\"<>?!"; - // secondary mouse button drop const int32 kSecondaryMouseDropAction = 'SMDA'; @@ -135,40 +121,28 @@ restrict_value(const Type& value, const Type& min, const Type& max) } -// #pragma mark - CharClassifier +// #pragma mark - TextBufferSyncLocker -class TermView::CharClassifier : public TerminalCharClassifier { +class TermView::TextBufferSyncLocker { public: - CharClassifier(const char* specialWordChars) + TextBufferSyncLocker(TermView* view) + : + fView(view) { - const char* p = specialWordChars; - while (p != NULL && *p) { - int count = UTF8Char::ByteCount(*p); - if (count <= 0 || count > 4) - break; - fSpecialWordChars.push_back(UTF8Char(p, count)); - p += count; - } + fView->fTextBuffer->Lock(); } - virtual int Classify(const UTF8Char& character) + ~TextBufferSyncLocker() { - if (character.IsSpace()) - return CHAR_TYPE_SPACE; + fView->fTextBuffer->Unlock(); - if (character.IsAlNum()) - return CHAR_TYPE_WORD_CHAR; - - if (std::find(fSpecialWordChars.begin(), fSpecialWordChars.end(), - character) != fSpecialWordChars.end()) - return CHAR_TYPE_WORD_CHAR; - - return CHAR_TYPE_WORD_DELIMITER; + if (fView->fVisibleTextBufferChanged) + fView->_VisibleTextBufferChanged(); } private: - std::vector fSpecialWordChars; + TermView* fView; }; @@ -309,6 +283,7 @@ TermView::_InitObject(const ShellParameters& shellParameters) fCursor = TermPos(0, 0); fTextBuffer = NULL; fVisibleTextBuffer = NULL; + fVisibleTextBufferChanged = false; fScrollBar = NULL; fInline = NULL; fSelectForeColor = kWhiteColor; @@ -318,16 +293,19 @@ TermView::_InitObject(const ShellParameters& shellParameters) fScrolledSinceLastSync = 0; fSyncRunner = NULL; fConsiderClockedSync = false; - fSelStart = TermPos(-1, -1); - fSelEnd = TermPos(-1, -1); - fMouseTracking = false; - fCheckMouseTracking = false; + fSelection.SetHighlighter(this); + fSelection.SetRange(TermPos(0, 0), TermPos(0, 0)); fPrevPos = TermPos(-1, - 1); fReportX10MouseEvent = false; fReportNormalMouseEvent = false; fReportButtonMouseEvent = false; fReportAnyMouseEvent = false; fMouseClipboard = be_clipboard; + fDefaultState = new(std::nothrow) DefaultState(this); + fSelectState = new(std::nothrow) SelectState(this); + fHyperLinkState = new(std::nothrow) HyperLinkState(this); + fHyperLinkMenuState = new(std::nothrow) HyperLinkMenuState(this); + fActiveState = NULL; fTextBuffer = new(std::nothrow) TerminalBuffer; if (fTextBuffer == NULL) @@ -338,8 +316,8 @@ TermView::_InitObject(const ShellParameters& shellParameters) return B_NO_MEMORY; // TODO: Make the special word chars user-settable! - fCharClassifier = new(std::nothrow) CharClassifier( - kDefaultSpecialWordChars); + fCharClassifier = new(std::nothrow) DefaultCharClassifier( + kDefaultAdditionalWordCharacters); if (fCharClassifier == NULL) return B_NO_MEMORY; @@ -371,9 +349,18 @@ TermView::_InitObject(const ShellParameters& shellParameters) if (error < B_OK) return error; + fHighlights.AddItem(&fSelection); + + if (fDefaultState == NULL || fSelectState == NULL || fHyperLinkState == NULL + || fHyperLinkMenuState == NULL) { + return B_NO_MEMORY; + } + SetLowColor(fTextBackColor); SetViewColor(B_TRANSPARENT_32_BIT); + _NextState(fDefaultState); + return B_OK; } @@ -385,6 +372,10 @@ TermView::~TermView() _DetachShell(); + delete fDefaultState; + delete fSelectState; + delete fHyperLinkState; + delete fHyperLinkMenuState; delete fSyncRunner; delete fAutoScrollRunner; delete fCharClassifier; @@ -459,6 +450,20 @@ TermView::Archive(BMessage* data, bool deep) const } +rgb_color +TermView::ForegroundColor() +{ + return fSelectForeColor; +} + + +rgb_color +TermView::BackgroundColor() +{ + return fSelectBackColor; +} + + inline int32 TermView::_LineAt(float y) { @@ -480,7 +485,7 @@ TermView::_LineOffset(int32 index) // convert view coordinates to terminal text buffer position -inline TermPos +TermPos TermView::_ConvertToTerminal(const BPoint &p) { return TermPos(p.x >= 0 ? (int32)p.x / fFontWidth : -1, _LineAt(p.y)); @@ -584,12 +589,13 @@ TermView::SetTermSize(int rows, int columns, bool notifyShell) // synchronize the visible text buffer { - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); _SynchronizeWithTextBuffer(0, -1); int32 offset = _LineAt(0); fVisibleTextBuffer->SynchronizeWith(fTextBuffer, offset, offset, offset + rows + 2); + fVisibleTextBufferChanged = true; } if (notifyShell) @@ -786,7 +792,8 @@ TermView::Copy(BClipboard *clipboard) return; BString copyStr; - fTextBuffer->GetStringFromRegion(copyStr, fSelStart, fSelEnd); + fTextBuffer->GetStringFromRegion(copyStr, fSelection.Start(), + fSelection.End()); if (clipboard->Lock()) { BMessage *clipMsg = NULL; @@ -936,8 +943,11 @@ TermView::_Deactivate() //! Draw part of a line in the given view. void TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf, - int32 width, bool mouse, bool cursor, BView *inView) + int32 width, Highlight* highlight, bool cursor, BView *inView) { + if (highlight != NULL) + attr = highlight->Highlighter()->AdjustTextAttributes(attr); + inView->SetFont(IS_BOLD(attr) && !fEmulateBold ? &fBoldFont : &fHalfFont); // Set pen point @@ -960,9 +970,9 @@ TermView::_DrawLinePart(int32 x1, int32 y1, uint32 attr, char *buf, if (cursor) { rgb_fore = fCursorForeColor; rgb_back = fCursorBackColor; - } else if (mouse) { - rgb_fore = fSelectForeColor; - rgb_back = fSelectBackColor; + } else if (highlight != NULL) { + rgb_fore = highlight->Highlighter()->ForegroundColor(); + rgb_back = highlight->Highlighter()->BackgroundColor(); } else { // Reverse attribute(If selected area, don't reverse color). if (IS_INVERSE(attr)) { @@ -1027,7 +1037,7 @@ TermView::_DrawCursor() } } - bool selected = _CheckSelectedRegion(TermPos(fCursor.x, fCursor.y)); + Highlight* highlight = _CheckHighlightRegion(TermPos(fCursor.x, fCursor.y)); if (fVisibleTextBuffer->GetChar(fCursor.y - firstVisible, fCursor.x, character, attr) == A_CHAR && (fCursorStyle == BLOCK_CURSOR || !cursorVisible)) { @@ -1039,11 +1049,11 @@ TermView::_DrawCursor() buffer[bytes] = '\0'; _DrawLinePart(fCursor.x * fFontWidth, (int32)rect.top, attr, buffer, - width, selected, cursorVisible, this); + width, highlight, cursorVisible, this); } else { - if (selected) - SetHighColor(fSelectBackColor); - else if (cursorVisible ) + if (highlight != NULL) + SetHighColor(highlight->Highlighter()->BackgroundColor()); + else if (cursorVisible) SetHighColor(fCursorBackColor ); else { uint32 count = 0; @@ -1146,6 +1156,7 @@ void TermView::AttachedToWindow() { fMouseButtons = 0; + fModifiers = modifiers(); // update the terminal size because it may have changed while the TermView // was detached from the window. On such conditions FrameResized was not @@ -1164,7 +1175,7 @@ TermView::AttachedToWindow() &message, 500000); { - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); fTextBuffer->SetListener(thisMessenger); _SynchronizeWithTextBuffer(0, -1); } @@ -1242,15 +1253,15 @@ TermView::Draw(BRect updateRect) for (int32 i = k; i <= x2;) { int32 lastColumn = x2; - bool insideSelection = _CheckSelectedRegion(j, i, lastColumn); + Highlight* highlight = _CheckHighlightRegion(j, i, lastColumn); // This will clip lastColumn to the selection start or end // to ensure the selection is not drawn at the same time as // something else int32 count = fVisibleTextBuffer->GetString(j - firstVisible, i, lastColumn, buf, attr); -// debug_printf(" fVisibleTextBuffer->GetString(%ld, %ld, %ld) -> (%ld, \"%.*s\"), selected: %d\n", -// j - firstVisible, i, lastColumn, count, (int)count, buf, insideSelection); +// debug_printf(" fVisibleTextBuffer->GetString(%ld, %ld, %ld) -> (%ld, \"%.*s\"), highlight: %p\n", +// j - firstVisible, i, lastColumn, count, (int)count, buf, highlight); if (count == 0) { // No chars to draw : we just fill the rectangle with the @@ -1260,8 +1271,9 @@ TermView::Draw(BRect updateRect) fFontWidth * nextColumn - 1, 0); rect.bottom = rect.top + fFontHeight - 1; - rgb_color rgb_back = insideSelection - ? fSelectBackColor : fTextBackColor; + rgb_color rgb_back = highlight != NULL + ? highlight->Highlighter()->BackgroundColor() + : fTextBackColor; if (fTextBuffer->IsAlternateScreenActive()) { // alternate screen uses cell attributes @@ -1296,7 +1308,7 @@ TermView::Draw(BRect updateRect) count = FULL_WIDTH; _DrawLinePart(fFontWidth * i, (int32)_LineOffset(j), - attr, buf, count, insideSelection, false, this); + attr, buf, count, highlight, false, this); i += count; } } @@ -1367,6 +1379,15 @@ TermView::WindowActivated(bool active) if (fActive) _Deactivate(); } + + fActiveState->WindowActivated(active); + + if (active) { + int32 oldModifiers = fModifiers; + fModifiers = modifiers(); + if (fModifiers != oldModifiers) + fActiveState->ModifiersChanged(oldModifiers, fModifiers); + } } @@ -1388,165 +1409,7 @@ TermView::MakeFocus(bool focusState) void TermView::KeyDown(const char *bytes, int32 numBytes) { - int32 key, mod, rawChar; - BMessage *currentMessage = Looper()->CurrentMessage(); - if (currentMessage == NULL) - return; - - currentMessage->FindInt32("modifiers", &mod); - currentMessage->FindInt32("key", &key); - currentMessage->FindInt32("raw_char", &rawChar); - - _ActivateCursor(true); - - // handle multi-byte chars - if (numBytes > 1) { - if (fEncoding != M_UTF8) { - char destBuffer[16]; - int32 destLen = sizeof(destBuffer); - int32 state = 0; - convert_from_utf8(fEncoding, bytes, &numBytes, destBuffer, - &destLen, &state, '?'); - _ScrollTo(0, true); - fShell->Write(destBuffer, destLen); - return; - } - - _ScrollTo(0, true); - fShell->Write(bytes, numBytes); - return; - } - - // Terminal filters RET, ENTER, F1...F12, and ARROW key code. - const char *toWrite = NULL; - - switch (*bytes) { - case B_RETURN: - if (rawChar == B_RETURN) - toWrite = "\r"; - break; - - case B_DELETE: - toWrite = DELETE_KEY_CODE; - break; - - case B_BACKSPACE: - // Translate only the actual backspace key to the backspace - // code. CTRL-H shall just be echoed. - if (!((mod & B_CONTROL_KEY) && rawChar == 'h')) - toWrite = BACKSPACE_KEY_CODE; - break; - - case B_LEFT_ARROW: - if (rawChar == B_LEFT_ARROW) { - if ((mod & B_SHIFT_KEY) != 0) { - if (fListener != NULL) - fListener->PreviousTermView(this); - return; - } - if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) - toWrite = CTRL_LEFT_ARROW_KEY_CODE; - else - toWrite = LEFT_ARROW_KEY_CODE; - } - break; - - case B_RIGHT_ARROW: - if (rawChar == B_RIGHT_ARROW) { - if ((mod & B_SHIFT_KEY) != 0) { - if (fListener != NULL) - fListener->NextTermView(this); - return; - } - if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) - toWrite = CTRL_RIGHT_ARROW_KEY_CODE; - else - toWrite = RIGHT_ARROW_KEY_CODE; - } - break; - - case B_UP_ARROW: - if (mod & B_SHIFT_KEY) { - _ScrollTo(fScrollOffset - fFontHeight, true); - return; - } - if (rawChar == B_UP_ARROW) { - if (mod & B_CONTROL_KEY) - toWrite = CTRL_UP_ARROW_KEY_CODE; - else - toWrite = UP_ARROW_KEY_CODE; - } - break; - - case B_DOWN_ARROW: - if (mod & B_SHIFT_KEY) { - _ScrollTo(fScrollOffset + fFontHeight, true); - return; - } - - if (rawChar == B_DOWN_ARROW) { - if (mod & B_CONTROL_KEY) - toWrite = CTRL_DOWN_ARROW_KEY_CODE; - else - toWrite = DOWN_ARROW_KEY_CODE; - } - break; - - case B_INSERT: - if (rawChar == B_INSERT) - toWrite = INSERT_KEY_CODE; - break; - - case B_HOME: - if (rawChar == B_HOME) - toWrite = HOME_KEY_CODE; - break; - - case B_END: - if (rawChar == B_END) - toWrite = END_KEY_CODE; - break; - - case B_PAGE_UP: - if (mod & B_SHIFT_KEY) { - _ScrollTo(fScrollOffset - fFontHeight * fRows, true); - return; - } - if (rawChar == B_PAGE_UP) - toWrite = PAGE_UP_KEY_CODE; - break; - - case B_PAGE_DOWN: - if (mod & B_SHIFT_KEY) { - _ScrollTo(fScrollOffset + fFontHeight * fRows, true); - return; - } - if (rawChar == B_PAGE_DOWN) - toWrite = PAGE_DOWN_KEY_CODE; - break; - - case B_FUNCTION_KEY: - for (int32 i = 0; i < 12; i++) { - if (key == function_keycode_table[i]) { - toWrite = function_key_char_table[i]; - break; - } - } - break; - } - - // If the above code proposed an alternative string to write, we get it's - // length. Otherwise we write exactly the bytes passed to this method. - size_t toWriteLen; - if (toWrite != NULL) { - toWriteLen = strlen(toWrite); - } else { - toWrite = bytes; - toWriteLen = numBytes; - } - - _ScrollTo(0, true); - fShell->Write(toWrite, toWriteLen); + fActiveState->KeyDown(bytes, numBytes); } @@ -1593,6 +1456,9 @@ TermView::FrameResized(float width, float height) void TermView::MessageReceived(BMessage *msg) { + if (fActiveState->MessageReceived(msg)) + return; + entry_ref ref; const char *ctrl_l = "\x0c"; @@ -1733,6 +1599,15 @@ TermView::MessageReceived(BMessage *msg) break; } + case B_MODIFIERS_CHANGED: + { + int32 oldModifiers = fModifiers; + fModifiers = msg->GetInt32("modifiers", 0); + if (fModifiers != oldModifiers) + fActiveState->ModifiersChanged(oldModifiers, fModifiers); + break; + } + case B_INPUT_METHOD_EVENT: { int32 opcode; @@ -1829,15 +1704,12 @@ TermView::MessageReceived(BMessage *msg) case kUpdateSigWinch: _UpdateSIGWINCH(); break; - case kAutoScroll: - _AutoScrollUpdate(); - break; case kSecondaryMouseDropAction: _DoSecondaryMouseDropAction(msg); break; case MSG_TERMINAL_BUFFER_CHANGED: { - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); _SynchronizeWithTextBuffer(0, -1); break; } @@ -2002,7 +1874,7 @@ TermView::ScrollTo(BPoint where) //debug_printf("fVisibleTextBuffer->ScrollBy(%ld)\n", newFirstLine - oldFirstLine); fVisibleTextBuffer->ScrollBy(newFirstLine - oldFirstLine); } - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); if (diff < 0) _SynchronizeWithTextBuffer(newFirstLine, oldFirstLine - 1); else @@ -2164,11 +2036,11 @@ TermView::_DoSecondaryMouseDropAction(BMessage* msg) int32 slash = string.FindLast("/"); string.Truncate(slash); } - string.CharacterEscape(kEscapeCharacters, '\\'); + string.CharacterEscape(kShellEscapeCharacters, '\\'); itemString += string; break; } - string.CharacterEscape(kEscapeCharacters, '\\'); + string.CharacterEscape(kShellEscapeCharacters, '\\'); itemString += string; } @@ -2195,7 +2067,7 @@ TermView::_DoFileDrop(entry_ref& ref) BPath path(&ent); BString string(path.Path()); - string.CharacterEscape(kEscapeCharacters, '\\'); + string.CharacterEscape(kShellEscapeCharacters, '\\'); _WritePTY(string.String(), string.Length()); } @@ -2259,7 +2131,9 @@ TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, // sync time not passed yet -- keep counting fScrolledSinceLastSync += linesScrolled; return; - } else if (fScrolledSinceLastSync + linesScrolled <= fRows) { + } + + if (fScrolledSinceLastSync + linesScrolled <= fRows) { // time's up, but not enough happened delete fSyncRunner; fSyncRunner = NULL; @@ -2271,6 +2145,8 @@ TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, fScrolledSinceLastSync = 0; } + fVisibleTextBufferChanged = true; + // Simple case first -- complete invalidation. if (info.invalidateAll) { Invalidate(); @@ -2354,15 +2230,23 @@ TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, fVisibleTextBuffer->ScrollBy(linesScrolled); } - // move selection - if (fSelStart != fSelEnd) { - fSelStart.y -= linesScrolled; - fSelEnd.y -= linesScrolled; - fInitialSelectionStart.y -= linesScrolled; - fInitialSelectionEnd.y -= linesScrolled; + // move highlights + for (int32 i = 0; Highlight* highlight = fHighlights.ItemAt(i); i++) { + if (highlight->IsEmpty()) + continue; - if (fSelStart.y < -historySize) - _Deselect(); + highlight->ScrollRange(linesScrolled); + if (highlight == &fSelection) { + fInitialSelectionStart.y -= linesScrolled; + fInitialSelectionEnd.y -= linesScrolled; + } + + if (highlight->Start().y < -historySize) { + if (highlight == &fSelection) + _Deselect(); + else + _ClearHighlight(highlight); + } } } @@ -2372,12 +2256,13 @@ TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, info.dirtyBottom); // clear the selection, if affected - if (fSelStart != fSelEnd) { + if (!fSelection.IsEmpty()) { // TODO: We're clearing the selection more often than necessary -- // to avoid that, we'd also need to track the x coordinates of the // dirty range. - int32 selectionBottom = fSelEnd.x > 0 ? fSelEnd.y : fSelEnd.y - 1; - if (fSelStart.y <= info.dirtyBottom + int32 selectionBottom = fSelection.End().x > 0 + ? fSelection.End().y : fSelection.End().y - 1; + if (fSelection.Start().y <= info.dirtyBottom && info.dirtyTop <= selectionBottom) { _Deselect(); } @@ -2407,6 +2292,17 @@ TermView::_SynchronizeWithTextBuffer(int32 visibleDirtyTop, } +void +TermView::_VisibleTextBufferChanged() +{ + if (!fVisibleTextBufferChanged) + return; + + fVisibleTextBufferChanged = false; + fActiveState->VisibleTextBufferChanged(); +} + + /*! Write strings to PTY device. If encoding system isn't UTF8, change encoding to UTF8 before writing PTY. */ @@ -2480,98 +2376,12 @@ TermView::MouseDown(BPoint where) if (!IsFocus()) MakeFocus(); - int32 buttons; - int32 modifier; - Window()->CurrentMessage()->FindInt32("buttons", &buttons); - Window()->CurrentMessage()->FindInt32("modifiers", &modifier); + BMessage* currentMessage = Window()->CurrentMessage(); + int32 buttons = currentMessage->GetInt32("buttons", 0); + + fActiveState->MouseDown(where, buttons, fModifiers); fMouseButtons = buttons; - - if (fReportAnyMouseEvent || fReportButtonMouseEvent - || fReportNormalMouseEvent || fReportX10MouseEvent) { - TermPos clickPos = _ConvertToTerminal(where); - _SendMouseEvent(buttons, modifier, clickPos.x, clickPos.y, false); - return; - } - - // paste button - if ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0) { - Paste(fMouseClipboard); - fLastClickPoint = where; - return; - } - - // Select Region - if (buttons == B_PRIMARY_MOUSE_BUTTON) { - int32 clicks; - Window()->CurrentMessage()->FindInt32("clicks", &clicks); - - if (_HasSelection()) { - TermPos inPos = _ConvertToTerminal(where); - if (_CheckSelectedRegion(inPos)) { - if (modifier & B_CONTROL_KEY) { - BPoint p; - uint32 bt; - do { - GetMouse(&p, &bt); - - if (bt == 0) { - _Deselect(); - return; - } - - snooze(40000); - - } while (abs((int)(where.x - p.x)) < 4 - && abs((int)(where.y - p.y)) < 4); - - InitiateDrag(); - return; - } - } - } - - // If mouse has moved too much, disable double/triple click. - if (_MouseDistanceSinceLastClick(where) > 8) - clicks = 1; - - SetMouseEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, - B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS); - - TermPos clickPos = _ConvertToTerminal(where); - - if (modifier & B_SHIFT_KEY) { - fInitialSelectionStart = clickPos; - fInitialSelectionEnd = clickPos; - _ExtendSelection(fInitialSelectionStart, true, false); - } else { - _Deselect(); - fInitialSelectionStart = clickPos; - fInitialSelectionEnd = clickPos; - } - - // If clicks larger than 3, reset mouse click counter. - clicks = (clicks - 1) % 3 + 1; - - switch (clicks) { - case 1: - fCheckMouseTracking = true; - fSelectGranularity = SELECT_CHARS; - break; - - case 2: - _SelectWord(where, (modifier & B_SHIFT_KEY) != 0, false); - fMouseTracking = true; - fSelectGranularity = SELECT_WORDS; - break; - - case 3: - _SelectLine(where, (modifier & B_SHIFT_KEY) != 0, false); - fMouseTracking = true; - fSelectGranularity = SELECT_LINES; - break; - } - } fLastClickPoint = where; } @@ -2579,111 +2389,17 @@ TermView::MouseDown(BPoint where) void TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message) { - if (fReportAnyMouseEvent || fReportButtonMouseEvent) { - int32 modifier; - Window()->CurrentMessage()->FindInt32("modifiers", &modifier); - - TermPos clickPos = _ConvertToTerminal(where); - - if (fReportButtonMouseEvent) { - if (fPrevPos.x != clickPos.x || fPrevPos.y != clickPos.y) { - _SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y, - true); - } - fPrevPos = clickPos; - return; - } - _SendMouseEvent(fMouseButtons, modifier, clickPos.x, clickPos.y, true); - return; - } - - if (fCheckMouseTracking) { - if (_MouseDistanceSinceLastClick(where) > 9) - fMouseTracking = true; - } - if (!fMouseTracking) - return; - - bool doAutoScroll = false; - - if (where.y < 0) { - doAutoScroll = true; - fAutoScrollSpeed = where.y; - where.x = 0; - where.y = 0; - } - - BRect bounds(Bounds()); - if (where.y > bounds.bottom) { - doAutoScroll = true; - fAutoScrollSpeed = where.y - bounds.bottom; - where.x = bounds.right; - where.y = bounds.bottom; - } - - if (doAutoScroll) { - if (fAutoScrollRunner == NULL) { - BMessage message(kAutoScroll); - fAutoScrollRunner = new (std::nothrow) BMessageRunner( - BMessenger(this), &message, 10000); - } - } else { - delete fAutoScrollRunner; - fAutoScrollRunner = NULL; - } - - switch (fSelectGranularity) { - case SELECT_CHARS: - { - // If we just start selecting, we first select the initially - // hit char, so that we get a proper initial selection -- the char - // in question, which will thus always be selected, regardless of - // whether selecting forward or backward. - if (fInitialSelectionStart == fInitialSelectionEnd) { - _Select(fInitialSelectionStart, fInitialSelectionEnd, true, - true); - } - - _ExtendSelection(_ConvertToTerminal(where), true, true); - break; - } - case SELECT_WORDS: - _SelectWord(where, true, true); - break; - case SELECT_LINES: - _SelectLine(where, true, true); - break; - } + fActiveState->MouseMoved(where, transit, message, fModifiers); } void TermView::MouseUp(BPoint where) { - fCheckMouseTracking = false; - fMouseTracking = false; + int32 buttons = Window()->CurrentMessage()->GetInt32("buttons", 0); - if (fAutoScrollRunner != NULL) { - delete fAutoScrollRunner; - fAutoScrollRunner = NULL; - } + fActiveState->MouseUp(where, buttons); - // When releasing the first mouse button, we copy the selected text to the - // clipboard. - int32 buttons; - Window()->CurrentMessage()->FindInt32("buttons", &buttons); - - if (fReportAnyMouseEvent || fReportButtonMouseEvent - || fReportNormalMouseEvent) { - TermPos clickPos = _ConvertToTerminal(where); - _SendMouseEvent(0, 0, clickPos.x, clickPos.y, false); - } else { - if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0 - && (fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) { - Copy(fMouseClipboard); - } - - } fMouseButtons = buttons; } @@ -2693,7 +2409,7 @@ void TermView::_Select(TermPos start, TermPos end, bool inclusive, bool setInitialSelection) { - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); _SynchronizeWithTextBuffer(0, -1); @@ -2735,18 +2451,17 @@ TermView::_Select(TermPos start, TermPos end, bool inclusive, end.x = fColumns; } - if (fSelStart != fSelEnd) - _InvalidateTextRange(fSelStart, fSelEnd); + if (!fSelection.IsEmpty()) + _InvalidateTextRange(fSelection.Start(), fSelection.End()); - fSelStart = start; - fSelEnd = end; + fSelection.SetRange(start, end); if (setInitialSelection) { - fInitialSelectionStart = fSelStart; - fInitialSelectionEnd = fSelEnd; + fInitialSelectionStart = fSelection.Start(); + fInitialSelectionEnd = fSelection.End(); } - _InvalidateTextRange(fSelStart, fSelEnd); + _InvalidateTextRange(fSelection.Start(), fSelection.End()); } @@ -2758,8 +2473,8 @@ TermView::_ExtendSelection(TermPos pos, bool inclusive, if (!useInitialSelection && !_HasSelection()) return; - TermPos start = fSelStart; - TermPos end = fSelEnd; + TermPos start = fSelection.Start(); + TermPos end = fSelection.End(); if (useInitialSelection) { start = fInitialSelectionStart; @@ -2785,22 +2500,17 @@ void TermView::_Deselect() { //debug_printf("TermView::_Deselect(): has selection: %d\n", _HasSelection()); - if (!_HasSelection()) - return; - - _InvalidateTextRange(fSelStart, fSelEnd); - - fSelStart.SetTo(0, 0); - fSelEnd.SetTo(0, 0); - fInitialSelectionStart.SetTo(0, 0); - fInitialSelectionEnd.SetTo(0, 0); + if (_ClearHighlight(&fSelection)) { + fInitialSelectionStart.SetTo(0, 0); + fInitialSelectionEnd.SetTo(0, 0); + } } bool TermView::_HasSelection() const { - return fSelStart != fSelEnd; + return !fSelection.IsEmpty(); } @@ -2815,11 +2525,15 @@ TermView::_SelectWord(BPoint where, bool extend, bool useInitialSelection) return; if (extend) { - if (start < (useInitialSelection ? fInitialSelectionStart : fSelStart)) + if (start + < (useInitialSelection + ? fInitialSelectionStart : fSelection.Start())) { _ExtendSelection(start, false, useInitialSelection); - else if (end > (useInitialSelection ? fInitialSelectionEnd : fSelEnd)) + } else if (end + > (useInitialSelection + ? fInitialSelectionEnd : fSelection.End())) { _ExtendSelection(end, false, useInitialSelection); - else if (useInitialSelection) + } else if (useInitialSelection) _Select(start, end, false, false); } else _Select(start, end, false, !useInitialSelection); @@ -2833,11 +2547,15 @@ TermView::_SelectLine(BPoint where, bool extend, bool useInitialSelection) TermPos end = TermPos(0, start.y + 1); if (extend) { - if (start < (useInitialSelection ? fInitialSelectionStart : fSelStart)) + if (start + < (useInitialSelection + ? fInitialSelectionStart : fSelection.Start())) { _ExtendSelection(start, false, useInitialSelection); - else if (end > (useInitialSelection ? fInitialSelectionEnd : fSelEnd)) + } else if (end + > (useInitialSelection + ? fInitialSelectionEnd : fSelection.End())) { _ExtendSelection(end, false, useInitialSelection); - else if (useInitialSelection) + } else if (useInitialSelection) _Select(start, end, false, false); } else _Select(start, end, false, !useInitialSelection); @@ -2845,51 +2563,85 @@ TermView::_SelectLine(BPoint where, bool extend, bool useInitialSelection) void -TermView::_AutoScrollUpdate() +TermView::_AddHighlight(Highlight* highlight) { - if (fMouseTracking && fAutoScrollRunner != NULL && fScrollBar != NULL) { - float value = fScrollBar->Value(); - _ScrollTo(value + fAutoScrollSpeed, true); - if (fAutoScrollSpeed < 0) { - _ExtendSelection(_ConvertToTerminal(BPoint(0, 0)), true, true); - } else { - _ExtendSelection(_ConvertToTerminal(Bounds().RightBottom()), true, - true); - } + fHighlights.AddItem(highlight); + + if (!highlight->IsEmpty()) + _InvalidateTextRange(highlight->Start(), highlight->End()); +} + + +void +TermView::_RemoveHighlight(Highlight* highlight) +{ + fHighlights.RemoveItem(highlight); + + if (!highlight->IsEmpty()) + _InvalidateTextRange(highlight->Start(), highlight->End()); +} + + +bool +TermView::_ClearHighlight(Highlight* highlight) +{ + if (highlight->IsEmpty()) + return false; + + _InvalidateTextRange(highlight->Start(), highlight->End()); + + highlight->SetRange(TermPos(0, 0), TermPos(0, 0)); + return true; +} + + +TermView::Highlight* +TermView::_CheckHighlightRegion(const TermPos &pos) const +{ + for (int32 i = 0; Highlight* highlight = fHighlights.ItemAt(i); i++) { + if (highlight->RangeContains(pos)) + return highlight; } + + return NULL; } -bool -TermView::_CheckSelectedRegion(const TermPos &pos) const -{ - return pos >= fSelStart && pos < fSelEnd; -} - - -bool -TermView::_CheckSelectedRegion(int32 row, int32 firstColumn, +TermView::Highlight* +TermView::_CheckHighlightRegion(int32 row, int32 firstColumn, int32& lastColumn) const { - if (fSelStart == fSelEnd) - return false; + Highlight* nextHighlight = NULL; - if (row == fSelStart.y && firstColumn < fSelStart.x - && lastColumn >= fSelStart.x) { - // region starts before the selection, but intersects with it - lastColumn = fSelStart.x - 1; - return false; + for (int32 i = 0; Highlight* highlight = fHighlights.ItemAt(i); i++) { + if (highlight->IsEmpty()) + continue; + + if (row == highlight->Start().y && firstColumn < highlight->Start().x + && lastColumn >= highlight->Start().x) { + // region starts before the highlight, but intersects with it + if (nextHighlight == NULL + || highlight->Start().x < nextHighlight->Start().x) { + nextHighlight = highlight; + } + continue; + } + + if (row == highlight->End().y && firstColumn < highlight->End().x + && lastColumn >= highlight->End().x) { + // region starts in the highlight, but exceeds the end + lastColumn = highlight->End().x - 1; + return highlight; + } + + TermPos pos(firstColumn, row); + if (highlight->RangeContains(pos)) + return highlight; } - if (row == fSelEnd.y && firstColumn < fSelEnd.x - && lastColumn >= fSelEnd.x) { - // region starts in the selection, but exceeds the end - lastColumn = fSelEnd.x - 1; - return true; - } - - TermPos pos(firstColumn, row); - return pos >= fSelStart && pos < fSelEnd; + if (nextHighlight != NULL) + lastColumn = nextHighlight->Start().x - 1; + return NULL; } @@ -2915,15 +2667,15 @@ bool TermView::Find(const BString &str, bool forwardSearch, bool matchCase, bool matchWord) { - BAutolock _(fTextBuffer); + TextBufferSyncLocker _(this); _SynchronizeWithTextBuffer(0, -1); TermPos start; if (_HasSelection()) { if (forwardSearch) - start = fSelEnd; + start = fSelection.End(); else - start = fSelStart; + start = fSelection.Start(); } else { // search from the very beginning/end if (forwardSearch) @@ -2939,7 +2691,7 @@ TermView::Find(const BString &str, bool forwardSearch, bool matchCase, } _Select(matchStart, matchEnd, false, true); - _ScrollToRange(fSelStart, fSelEnd); + _ScrollToRange(fSelection.Start(), fSelection.End()); return true; } @@ -2951,7 +2703,7 @@ TermView::GetSelection(BString &str) { str.SetTo(""); BAutolock _(fTextBuffer); - fTextBuffer->GetStringFromRegion(str, fSelStart, fSelEnd); + fTextBuffer->GetStringFromRegion(str, fSelection.Start(), fSelection.End()); } @@ -2974,17 +2726,18 @@ TermView::InitiateDrag() BAutolock _(fTextBuffer); BString copyStr(""); - fTextBuffer->GetStringFromRegion(copyStr, fSelStart, fSelEnd); + fTextBuffer->GetStringFromRegion(copyStr, fSelection.Start(), + fSelection.End()); BMessage message(B_MIME_DATA); message.AddData("text/plain", B_MIME_TYPE, copyStr.String(), copyStr.Length()); - BPoint start = _ConvertFromTerminal(fSelStart); - BPoint end = _ConvertFromTerminal(fSelEnd); + BPoint start = _ConvertFromTerminal(fSelection.Start()); + BPoint end = _ConvertFromTerminal(fSelection.End()); BRect rect; - if (fSelStart.y == fSelEnd.y) + if (fSelection.Start().y == fSelection.End().y) rect.Set(start.x, start.y, end.x + fFontWidth, end.y + fFontHeight); else rect.Set(0, start.y, fColumns * fFontWidth, end.y + fFontHeight); @@ -3222,6 +2975,18 @@ TermView::_CancelInputMethod() } +void +TermView::_NextState(State* state) +{ + if (state != fActiveState) { + if (fActiveState != NULL) + fActiveState->Exited(); + fActiveState = state; + fActiveState->Entered(); + } +} + + // #pragma mark - Listener @@ -3254,6 +3019,9 @@ TermView::Listener::NextTermView(TermView* view) } +// #pragma mark - + + #ifdef USE_DEBUG_SNAPSHOTS void diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index 9e0721511a..a1ab24ed22 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -16,10 +16,12 @@ #include #include +#include #include #include #include "TermPos.h" +#include "TermViewHighlight.h" class ActiveProcessInfo; @@ -30,6 +32,7 @@ class BScrollView; class BString; class BStringView; class BasicTerminalBuffer; +class DefaultCharClassifier; class InlineInput; class ResizeWindow; class ShellInfo; @@ -38,10 +41,14 @@ class TermBuffer; class TerminalBuffer; class Shell; -class TermView : public BView { + +class TermView : public BView, private TermViewHighlighter { public: class Listener; + typedef TermViewHighlighter Highlighter; + typedef TermViewHighlight Highlight; + public: TermView(BRect frame, const ShellParameters& shellParameters, @@ -141,13 +148,35 @@ protected: const char* property); private: - class CharClassifier; + class TextBufferSyncLocker; + friend class TextBufferSyncLocker; + + class State; + class StandardBaseState; + class DefaultState; + class SelectState; + class HyperLinkState; + class HyperLinkMenuState; + + friend class State; + friend class StandardBaseState; + friend class DefaultState; + friend class SelectState; + friend class HyperLinkState; + friend class HyperLinkMenuState; + + typedef BObjectList HighlightList; + +private: + // TermViewHighlighter + virtual rgb_color ForegroundColor(); + virtual rgb_color BackgroundColor(); private: // point and text offset conversion inline int32 _LineAt(float y); inline float _LineOffset(int32 index); - inline TermPos _ConvertToTerminal(const BPoint& point); + TermPos _ConvertToTerminal(const BPoint& point); inline BPoint _ConvertFromTerminal(const TermPos& pos); inline void _InvalidateTextRect(int32 x1, int32 y1, @@ -164,8 +193,9 @@ private: void _SwitchCursorBlinking(bool blinkingOn); void _DrawLinePart(int32 x1, int32 y1, uint32 attr, - char* buffer, int32 width, bool mouse, - bool cursor, BView* inView); + char* buffer, int32 width, + Highlight* highlight, bool cursor, + BView* inView); void _DrawCursor(); void _InvalidateTextRange(TermPos start, TermPos end); @@ -183,6 +213,7 @@ private: void _SynchronizeWithTextBuffer( int32 visibleDirtyTop, int32 visibleDirtyBottom); + void _VisibleTextBufferChanged(); void _WritePTY(const char* text, int32 numBytes); @@ -199,10 +230,12 @@ private: void _SelectLine(BPoint where, bool extend, bool useInitialSelection); - void _AutoScrollUpdate(); + void _AddHighlight(Highlight* highlight); + void _RemoveHighlight(Highlight* highlight); + bool _ClearHighlight(Highlight* highlight); - bool _CheckSelectedRegion(const TermPos& pos) const; - bool _CheckSelectedRegion(int32 row, + Highlight* _CheckHighlightRegion(const TermPos& pos) const; + Highlight* _CheckHighlightRegion(int32 row, int32 firstColumn, int32& lastColumn) const; void _UpdateSIGWINCH(); @@ -218,6 +251,8 @@ private: void _HandleInputMethodLocationRequest(); void _CancelInputMethod(); + void _NextState(State* state); + private: Listener* fListener; Shell* fShell; @@ -227,7 +262,7 @@ private: BMessageRunner* fAutoScrollRunner; BMessageRunner* fResizeRunner; BStringView* fResizeView; - CharClassifier* fCharClassifier; + DefaultCharClassifier* fCharClassifier; // Font and Width BFont fHalfFont; @@ -252,8 +287,6 @@ private: // Cursor position. TermPos fCursor; - int32 fMouseButtons; - // Terminal rows and columns. int fColumns; int fRows; @@ -264,6 +297,7 @@ private: // Object pointer. TerminalBuffer* fTextBuffer; BasicTerminalBuffer* fVisibleTextBuffer; + bool fVisibleTextBufferChanged; BScrollBar* fScrollBar; InlineInput* fInline; @@ -289,22 +323,29 @@ private: bool fConsiderClockedSync; // selection - TermPos fSelStart; - TermPos fSelEnd; + Highlight fSelection; TermPos fInitialSelectionStart; TermPos fInitialSelectionEnd; - bool fMouseTracking; - bool fCheckMouseTracking; - int fSelectGranularity; BPoint fLastClickPoint; + HighlightList fHighlights; + // mouse + int32 fMouseButtons; + int32 fModifiers; TermPos fPrevPos; bool fReportX10MouseEvent; bool fReportNormalMouseEvent; bool fReportButtonMouseEvent; bool fReportAnyMouseEvent; BClipboard* fMouseClipboard; + + // states + DefaultState* fDefaultState; + SelectState* fSelectState; + HyperLinkState* fHyperLinkState; + HyperLinkMenuState* fHyperLinkMenuState; + State* fActiveState; }; diff --git a/src/apps/terminal/TermViewHighlight.cpp b/src/apps/terminal/TermViewHighlight.cpp new file mode 100644 index 0000000000..b14f3c9e6f --- /dev/null +++ b/src/apps/terminal/TermViewHighlight.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "TermViewHighlight.h" + + +TermViewHighlighter::~TermViewHighlighter() +{ +} + + +uint32 +TermViewHighlighter::AdjustTextAttributes(uint32 attributes) +{ + return attributes; +} diff --git a/src/apps/terminal/TermViewHighlight.h b/src/apps/terminal/TermViewHighlight.h new file mode 100644 index 0000000000..1e9e5736bd --- /dev/null +++ b/src/apps/terminal/TermViewHighlight.h @@ -0,0 +1,83 @@ +/* + * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef TERMVIEW_HIGHLIGHT_H +#define TERMVIEW_HIGHLIGHT_H + + +#include + +#include "TermPos.h" + + +class TermViewHighlighter { +public: + virtual ~TermViewHighlighter(); + + virtual rgb_color ForegroundColor() = 0; + virtual rgb_color BackgroundColor() = 0; + virtual uint32 AdjustTextAttributes(uint32 attributes); +}; + + +class TermViewHighlight { +public: + TermViewHighlight() + : + fHighlighter(NULL), + fStart(-1, -1), + fEnd(-1, -1) + { + } + + TermViewHighlighter* Highlighter() const + { + return fHighlighter; + } + + void SetHighlighter(TermViewHighlighter* highligher) + { + fHighlighter = highligher; + } + + const TermPos& Start() const + { + return fStart; + } + + const TermPos& End() const + { + return fEnd; + } + + bool IsEmpty() const + { + return fStart == fEnd; + } + + bool RangeContains(const TermPos& pos) const + { + return pos >= fStart && pos < fEnd; + } + + void SetRange(const TermPos& start, const TermPos& end) + { + fStart = start; + fEnd = end; + } + + void ScrollRange(int32 byLines) + { + fStart.y -= byLines; + fEnd.y -= byLines; + } + +private: + TermViewHighlighter* fHighlighter; + TermPos fStart; + TermPos fEnd; +}; + + +#endif // TERMVIEW_HIGHLIGHT_H diff --git a/src/apps/terminal/TermViewStates.cpp b/src/apps/terminal/TermViewStates.cpp new file mode 100644 index 0000000000..e0f33b24ee --- /dev/null +++ b/src/apps/terminal/TermViewStates.cpp @@ -0,0 +1,1094 @@ +/* + * Copyright 2001-2013, Haiku, Inc. + * Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net + * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai. + * All rights reserved. Distributed under the terms of the MIT license. + * + * Authors: + * Stefano Ceccherini, stefano.ceccherini@gmail.com + * Kian Duffy, myob@users.sourceforge.net + * Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp + * Ingo Weinhold, ingo_weinhold@gmx.de + * Clemens Zeidler, haiku@Clemens-Zeidler.de + * Siarzhuk Zharski, zharik@gmx.li + */ + + +#include "TermViewStates.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ActiveProcessInfo.h" +#include "Shell.h" +#include "TermConst.h" +#include "TerminalBuffer.h" +#include "VTkeymap.h" +#include "VTKeyTbl.h" + + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Terminal TermView" + + +// selection granularity +enum { + SELECT_CHARS, + SELECT_WORDS, + SELECT_LINES +}; + +static const uint32 kAutoScroll = 'AScr'; + +static const uint32 kMessageOpenLink = 'OLnk'; +static const uint32 kMessageCopyLink = 'CLnk'; +static const uint32 kMessageCopyAbsolutePath = 'CAbs'; +static const uint32 kMessageMenuClosed = 'MClo'; + + +static const char* const kKnownURLProtocols = "http:https:ftp:mailto"; + + +// #pragma mark - State + + +TermView::State::State(TermView* view) + : + fView(view) +{ +} + + +TermView::State::~State() +{ +} + + +void +TermView::State::Entered() +{ +} + + +void +TermView::State::Exited() +{ +} + + +bool +TermView::State::MessageReceived(BMessage* message) +{ + return false; +} + + +void +TermView::State::ModifiersChanged(int32 oldModifiers, int32 modifiers) +{ +} + + +void +TermView::State::KeyDown(const char* bytes, int32 numBytes) +{ +} + + +void +TermView::State::MouseDown(BPoint where, int32 buttons, int32 modifiers) +{ +} + + +void +TermView::State::MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers) +{ +} + + +void +TermView::State::MouseUp(BPoint where, int32 buttons) +{ +} + + +void +TermView::State::WindowActivated(bool active) +{ +} + + +void +TermView::State::VisibleTextBufferChanged() +{ +} + + +// #pragma mark - StandardBaseState + + +TermView::StandardBaseState::StandardBaseState(TermView* view) + : + State(view) +{ +} + + +bool +TermView::StandardBaseState::_StandardMouseMoved(BPoint where, int32 modifiers) +{ + if (!fView->fReportAnyMouseEvent && !fView->fReportButtonMouseEvent) + return false; + + TermPos clickPos = fView->_ConvertToTerminal(where); + + if (fView->fReportButtonMouseEvent) { + if (fView->fPrevPos.x != clickPos.x + || fView->fPrevPos.y != clickPos.y) { + fView->_SendMouseEvent(fView->fMouseButtons, modifiers, + clickPos.x, clickPos.y, true); + } + fView->fPrevPos = clickPos; + } else { + fView->_SendMouseEvent(fView->fMouseButtons, modifiers, clickPos.x, + clickPos.y, true); + } + + return true; +} + + +// #pragma mark - DefaultState + + +TermView::DefaultState::DefaultState(TermView* view) + : + StandardBaseState(view) +{ +} + + +void +TermView::DefaultState::ModifiersChanged(int32 oldModifiers, int32 modifiers) +{ + _CheckEnterHyperLinkState(modifiers); +} + + +void +TermView::DefaultState::KeyDown(const char* bytes, int32 numBytes) +{ + int32 key, mod, rawChar; + BMessage *currentMessage = fView->Looper()->CurrentMessage(); + if (currentMessage == NULL) + return; + + currentMessage->FindInt32("modifiers", &mod); + currentMessage->FindInt32("key", &key); + currentMessage->FindInt32("raw_char", &rawChar); + + fView->_ActivateCursor(true); + + // handle multi-byte chars + if (numBytes > 1) { + if (fView->fEncoding != M_UTF8) { + char destBuffer[16]; + int32 destLen = sizeof(destBuffer); + int32 state = 0; + convert_from_utf8(fView->fEncoding, bytes, &numBytes, destBuffer, + &destLen, &state, '?'); + fView->_ScrollTo(0, true); + fView->fShell->Write(destBuffer, destLen); + return; + } + + fView->_ScrollTo(0, true); + fView->fShell->Write(bytes, numBytes); + return; + } + + // Terminal filters RET, ENTER, F1...F12, and ARROW key code. + const char *toWrite = NULL; + + switch (*bytes) { + case B_RETURN: + if (rawChar == B_RETURN) + toWrite = "\r"; + break; + + case B_DELETE: + toWrite = DELETE_KEY_CODE; + break; + + case B_BACKSPACE: + // Translate only the actual backspace key to the backspace + // code. CTRL-H shall just be echoed. + if (!((mod & B_CONTROL_KEY) && rawChar == 'h')) + toWrite = BACKSPACE_KEY_CODE; + break; + + case B_LEFT_ARROW: + if (rawChar == B_LEFT_ARROW) { + if ((mod & B_SHIFT_KEY) != 0) { + if (fView->fListener != NULL) + fView->fListener->PreviousTermView(fView); + return; + } + if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) + toWrite = CTRL_LEFT_ARROW_KEY_CODE; + else + toWrite = LEFT_ARROW_KEY_CODE; + } + break; + + case B_RIGHT_ARROW: + if (rawChar == B_RIGHT_ARROW) { + if ((mod & B_SHIFT_KEY) != 0) { + if (fView->fListener != NULL) + fView->fListener->NextTermView(fView); + return; + } + if ((mod & B_CONTROL_KEY) || (mod & B_COMMAND_KEY)) + toWrite = CTRL_RIGHT_ARROW_KEY_CODE; + else + toWrite = RIGHT_ARROW_KEY_CODE; + } + break; + + case B_UP_ARROW: + if (mod & B_SHIFT_KEY) { + fView->_ScrollTo(fView->fScrollOffset - fView->fFontHeight, + true); + return; + } + if (rawChar == B_UP_ARROW) { + if (mod & B_CONTROL_KEY) + toWrite = CTRL_UP_ARROW_KEY_CODE; + else + toWrite = UP_ARROW_KEY_CODE; + } + break; + + case B_DOWN_ARROW: + if (mod & B_SHIFT_KEY) { + fView->_ScrollTo(fView->fScrollOffset + fView->fFontHeight, + true); + return; + } + + if (rawChar == B_DOWN_ARROW) { + if (mod & B_CONTROL_KEY) + toWrite = CTRL_DOWN_ARROW_KEY_CODE; + else + toWrite = DOWN_ARROW_KEY_CODE; + } + break; + + case B_INSERT: + if (rawChar == B_INSERT) + toWrite = INSERT_KEY_CODE; + break; + + case B_HOME: + if (rawChar == B_HOME) + toWrite = HOME_KEY_CODE; + break; + + case B_END: + if (rawChar == B_END) + toWrite = END_KEY_CODE; + break; + + case B_PAGE_UP: + if (mod & B_SHIFT_KEY) { + fView->_ScrollTo( + fView->fScrollOffset - fView->fFontHeight * fView->fRows, + true); + return; + } + if (rawChar == B_PAGE_UP) + toWrite = PAGE_UP_KEY_CODE; + break; + + case B_PAGE_DOWN: + if (mod & B_SHIFT_KEY) { + fView->_ScrollTo( + fView->fScrollOffset + fView->fFontHeight * fView->fRows, + true); + return; + } + if (rawChar == B_PAGE_DOWN) + toWrite = PAGE_DOWN_KEY_CODE; + break; + + case B_FUNCTION_KEY: + for (int32 i = 0; i < 12; i++) { + if (key == function_keycode_table[i]) { + toWrite = function_key_char_table[i]; + break; + } + } + break; + } + + // If the above code proposed an alternative string to write, we get it's + // length. Otherwise we write exactly the bytes passed to this method. + size_t toWriteLen; + if (toWrite != NULL) { + toWriteLen = strlen(toWrite); + } else { + toWrite = bytes; + toWriteLen = numBytes; + } + + fView->_ScrollTo(0, true); + fView->fShell->Write(toWrite, toWriteLen); +} + + +void +TermView::DefaultState::MouseDown(BPoint where, int32 buttons, int32 modifiers) +{ + if (fView->fReportAnyMouseEvent || fView->fReportButtonMouseEvent + || fView->fReportNormalMouseEvent || fView->fReportX10MouseEvent) { + TermPos clickPos = fView->_ConvertToTerminal(where); + fView->_SendMouseEvent(buttons, modifiers, clickPos.x, clickPos.y, + false); + return; + } + + // paste button + if ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0) { + fView->Paste(fView->fMouseClipboard); + return; + } + + // Select Region + if (buttons == B_PRIMARY_MOUSE_BUTTON) { + fView->fSelectState->Prepare(where, modifiers); + fView->_NextState(fView->fSelectState); + } +} + + +void +TermView::DefaultState::MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers) +{ + if (_CheckEnterHyperLinkState(modifiers)) + return; + + _StandardMouseMoved(where, modifiers); +} + + +void +TermView::DefaultState::WindowActivated(bool active) +{ + if (active) + _CheckEnterHyperLinkState(fView->fModifiers); +} + + +bool +TermView::DefaultState::_CheckEnterHyperLinkState(int32 modifiers) +{ + if ((modifiers & B_COMMAND_KEY) != 0 && fView->Window()->IsActive()) { + fView->_NextState(fView->fHyperLinkState); + return true; + } + + return false; +} + + +// #pragma mark - SelectState + + +TermView::SelectState::SelectState(TermView* view) + : + StandardBaseState(view), + fSelectGranularity(SELECT_CHARS), + fCheckMouseTracking(false), + fMouseTracking(false) +{ +} + + +void +TermView::SelectState::Prepare(BPoint where, int32 modifiers) +{ + int32 clicks; + fView->Window()->CurrentMessage()->FindInt32("clicks", &clicks); + + if (fView->_HasSelection()) { + TermPos inPos = fView->_ConvertToTerminal(where); + if (fView->fSelection.RangeContains(inPos)) { + if (modifiers & B_CONTROL_KEY) { + BPoint p; + uint32 bt; + do { + fView->GetMouse(&p, &bt); + + if (bt == 0) { + fView->_Deselect(); + return; + } + + snooze(40000); + + } while (abs((int)(where.x - p.x)) < 4 + && abs((int)(where.y - p.y)) < 4); + + fView->InitiateDrag(); + return; + } + } + } + + // If mouse has moved too much, disable double/triple click. + if (fView->_MouseDistanceSinceLastClick(where) > 8) + clicks = 1; + + fView->SetMouseEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, + B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS); + + TermPos clickPos = fView->_ConvertToTerminal(where); + + if (modifiers & B_SHIFT_KEY) { + fView->fInitialSelectionStart = clickPos; + fView->fInitialSelectionEnd = clickPos; + fView->_ExtendSelection(fView->fInitialSelectionStart, true, false); + } else { + fView->_Deselect(); + fView->fInitialSelectionStart = clickPos; + fView->fInitialSelectionEnd = clickPos; + } + + // If clicks larger than 3, reset mouse click counter. + clicks = (clicks - 1) % 3 + 1; + + switch (clicks) { + case 1: + fCheckMouseTracking = true; + fSelectGranularity = SELECT_CHARS; + break; + + case 2: + fView->_SelectWord(where, (modifiers & B_SHIFT_KEY) != 0, false); + fMouseTracking = true; + fSelectGranularity = SELECT_WORDS; + break; + + case 3: + fView->_SelectLine(where, (modifiers & B_SHIFT_KEY) != 0, false); + fMouseTracking = true; + fSelectGranularity = SELECT_LINES; + break; + } +} + + +bool +TermView::SelectState::MessageReceived(BMessage* message) +{ + if (message->what == kAutoScroll) { + _AutoScrollUpdate(); + return true; + } + + return false; +} + + +void +TermView::SelectState::MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers) +{ + if (_StandardMouseMoved(where, modifiers)) + return; + + if (fCheckMouseTracking) { + if (fView->_MouseDistanceSinceLastClick(where) > 9) + fMouseTracking = true; + } + if (!fMouseTracking) + return; + + bool doAutoScroll = false; + + if (where.y < 0) { + doAutoScroll = true; + fView->fAutoScrollSpeed = where.y; + where.x = 0; + where.y = 0; + } + + BRect bounds(fView->Bounds()); + if (where.y > bounds.bottom) { + doAutoScroll = true; + fView->fAutoScrollSpeed = where.y - bounds.bottom; + where.x = bounds.right; + where.y = bounds.bottom; + } + + if (doAutoScroll) { + if (fView->fAutoScrollRunner == NULL) { + BMessage message(kAutoScroll); + fView->fAutoScrollRunner = new (std::nothrow) BMessageRunner( + BMessenger(fView), &message, 10000); + } + } else { + delete fView->fAutoScrollRunner; + fView->fAutoScrollRunner = NULL; + } + + switch (fSelectGranularity) { + case SELECT_CHARS: + { + // If we just start selecting, we first select the initially + // hit char, so that we get a proper initial selection -- the char + // in question, which will thus always be selected, regardless of + // whether selecting forward or backward. + if (fView->fInitialSelectionStart == fView->fInitialSelectionEnd) { + fView->_Select(fView->fInitialSelectionStart, + fView->fInitialSelectionEnd, true, true); + } + + fView->_ExtendSelection(fView->_ConvertToTerminal(where), true, + true); + break; + } + case SELECT_WORDS: + fView->_SelectWord(where, true, true); + break; + case SELECT_LINES: + fView->_SelectLine(where, true, true); + break; + } +} + + +void +TermView::SelectState::MouseUp(BPoint where, int32 buttons) +{ + fCheckMouseTracking = false; + fMouseTracking = false; + + if (fView->fAutoScrollRunner != NULL) { + delete fView->fAutoScrollRunner; + fView->fAutoScrollRunner = NULL; + } + + // When releasing the first mouse button, we copy the selected text to the + // clipboard. + + if (fView->fReportAnyMouseEvent || fView->fReportButtonMouseEvent + || fView->fReportNormalMouseEvent) { + TermPos clickPos = fView->_ConvertToTerminal(where); + fView->_SendMouseEvent(0, 0, clickPos.x, clickPos.y, false); + } else { + if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0 + && (fView->fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) { + fView->Copy(fView->fMouseClipboard); + } + + } + + fView->_NextState(fView->fDefaultState); +} + + +void +TermView::SelectState::_AutoScrollUpdate() +{ + if (fMouseTracking && fView->fAutoScrollRunner != NULL + && fView->fScrollBar != NULL) { + float value = fView->fScrollBar->Value(); + fView->_ScrollTo(value + fView->fAutoScrollSpeed, true); + if (fView->fAutoScrollSpeed < 0) { + fView->_ExtendSelection( + fView->_ConvertToTerminal(BPoint(0, 0)), true, true); + } else { + fView->_ExtendSelection( + fView->_ConvertToTerminal(fView->Bounds().RightBottom()), true, + true); + } + } +} + + +// #pragma mark - HyperLinkState + + +TermView::HyperLinkState::HyperLinkState(TermView* view) + : + State(view), + fURLCharClassifier(kURLAdditionalWordCharacters), + fPathComponentCharClassifier( + BString(kDefaultAdditionalWordCharacters).RemoveFirst("/")), + fCurrentDirectory(), + fHighlight(), + fHighlightActive(false) +{ + fHighlight.SetHighlighter(this); +} + + +void +TermView::HyperLinkState::Entered() +{ + ActiveProcessInfo activeProcessInfo; + if (fView->GetActiveProcessInfo(activeProcessInfo)) + fCurrentDirectory = activeProcessInfo.CurrentDirectory(); + else + fCurrentDirectory.Truncate(0); + + _UpdateHighlight(); +} + + +void +TermView::HyperLinkState::Exited() +{ + _DeactivateHighlight(); +} + + +void +TermView::HyperLinkState::ModifiersChanged(int32 oldModifiers, int32 modifiers) +{ + if ((modifiers & B_COMMAND_KEY) == 0) + fView->_NextState(fView->fDefaultState); + else + _UpdateHighlight(); +} + + +void +TermView::HyperLinkState::MouseDown(BPoint where, int32 buttons, + int32 modifiers) +{ + TermPos start; + TermPos end; + HyperLink link; + bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0; + if (!_GetHyperLinkAt(where, pathPrefixOnly, link, start, end)) + return; + + if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0) { + link.Open(); + } else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) { + fView->fHyperLinkMenuState->Prepare(where, link); + fView->_NextState(fView->fHyperLinkMenuState); + } +} + + +void +TermView::HyperLinkState::MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers) +{ + _UpdateHighlight(where, modifiers); +} + + +void +TermView::HyperLinkState::WindowActivated(bool active) +{ + if (!active) + fView->_NextState(fView->fDefaultState); +} + + +void +TermView::HyperLinkState::VisibleTextBufferChanged() +{ + _UpdateHighlight(); +} + + +rgb_color +TermView::HyperLinkState::ForegroundColor() +{ + return make_color(0, 0, 255); +} + + +rgb_color +TermView::HyperLinkState::BackgroundColor() +{ + return fView->fTextBackColor; +} + + +uint32 +TermView::HyperLinkState::AdjustTextAttributes(uint32 attributes) +{ + return attributes | UNDERLINE; +} + + +bool +TermView::HyperLinkState::_GetHyperLinkAt(BPoint where, bool pathPrefixOnly, + HyperLink& _link, TermPos& _start, TermPos& _end) +{ + TerminalBuffer* textBuffer = fView->fTextBuffer; + BAutolock textBufferLocker(textBuffer); + + TermPos pos = fView->_ConvertToTerminal(where); + + // try to get a URL first + BString text; + if (!textBuffer->FindWord(pos, &fURLCharClassifier, false, _start, _end)) + return false; + + text.Truncate(0); + textBuffer->GetStringFromRegion(text, _start, _end); + text.Trim(); + + // We're only happy, if it has a protocol part which we know. + int32 colonIndex = text.FindFirst(':'); + if (colonIndex >= 0) { + BString protocol(text, colonIndex); + if (strstr(kKnownURLProtocols, protocol) != NULL) { + _link = HyperLink(text, HyperLink::TYPE_URL); + return true; + } + } + + // no obvious URL -- try file name + if (!textBuffer->FindWord(pos, fView->fCharClassifier, false, _start, _end)) + return false; + + // In path-prefix-only mode we determine the end position anew by omitting + // the '/' in the allowed word chars. + if (pathPrefixOnly) { + TermPos componentStart; + TermPos componentEnd; + if (textBuffer->FindWord(pos, &fPathComponentCharClassifier, false, + componentStart, componentEnd)) { + _end = componentEnd; + } else { + // That means pos points to a '/'. We simply use the previous + // position. + _end = pos; + if (_start == _end) { + // Well, must be just "/". Advance to the next position. + if (!textBuffer->NextLinePos(_end, false)) + return false; + } + } + } + + text.Truncate(0); + textBuffer->GetStringFromRegion(text, _start, _end); + text.Trim(); + if (text.IsEmpty()) + return false; + + // Collect a list of colons in the string and their respective positions in + // the text buffer. We do this up-front so we can unlock the text buffer + // while we're doing all the entry existence tests. + typedef Array ColonList; + ColonList colonPositions; + TermPos searchPos = _start; + for (int32 index = 0; (index = text.FindFirst(':', index)) >= 0;) { + TermPos foundStart; + TermPos foundEnd; + if (!textBuffer->Find(":", searchPos, true, true, false, foundStart, + foundEnd)) { + return false; + } + + CharPosition colonPosition; + colonPosition.index = index; + colonPosition.position = foundStart; + if (!colonPositions.Add(colonPosition)) + return false; + + index++; + searchPos = foundEnd; + } + + textBufferLocker.Unlock(); + + // Since we also want to consider ':' a potential path delimiter, in two + // nested loops we chop off components from the beginning respective the + // end. + BString originalText = text; + TermPos originalStart = _start; + TermPos originalEnd = _end; + + int32 colonCount = colonPositions.Count(); + for (int32 startColonIndex = -1; startColonIndex < colonCount; + startColonIndex++) { + int32 startIndex; + if (startColonIndex < 0) { + startIndex = 0; + _start = originalStart; + } else { + startIndex = colonPositions[startColonIndex].index + 1; + _start = colonPositions[startColonIndex].position; + if (_start >= pos) + break; + _start.x++; + // Note: This is potentially a non-normalized position (i.e. + // the end of a soft-wrapped line). While not that nice, it + // works anyway. + } + + for (int32 endColonIndex = colonCount; endColonIndex > startColonIndex; + endColonIndex--) { + int32 endIndex; + if (endColonIndex == colonCount) { + endIndex = originalText.Length(); + _end = originalEnd; + } else { + endIndex = colonPositions[endColonIndex].index; + _end = colonPositions[endColonIndex].position; + if (_end <= pos) + break; + } + + originalText.CopyInto(text, startIndex, endIndex - startIndex); + if (text.IsEmpty()) + continue; + + // check, whether the file exists + BString actualPath; + if (_EntryExists(text, actualPath)) { + _link = HyperLink(text, actualPath, HyperLink::TYPE_PATH); + return true; + } + + // As such this isn't an existing path. We also want to recognize: + // * ":" + // * "::" + + BString path = text; + + for (int32 i = 0; i < 2; i++) { + int32 colonIndex = path.FindLast(':'); + if (colonIndex <= 0 || colonIndex == path.Length() - 1) + break; + + char* numberEnd; + strtol(path.String() + colonIndex + 1, &numberEnd, 0); + if (*numberEnd != '\0') + break; + + path.Truncate(colonIndex); + if (_EntryExists(path, actualPath)) { + BString address = path == actualPath + ? text : BString(fCurrentDirectory) << '/' << text; + _link = HyperLink(text, address, + i == 0 + ? HyperLink::TYPE_PATH_WITH_LINE + : HyperLink::TYPE_PATH_WITH_LINE_AND_COLUMN); + return true; + } + } + } + } + + return false; +} + + +bool +TermView::HyperLinkState::_EntryExists(const BString& path, + BString& _actualPath) const +{ + if (path.IsEmpty()) + return false; + + if (path[0] == '/' || fCurrentDirectory.IsEmpty()) { + _actualPath = path; + } else { + _actualPath.Truncate(0); + _actualPath << fCurrentDirectory << '/' << path; + } + + struct stat st; + return lstat(_actualPath, &st) == 0; +} + + +void +TermView::HyperLinkState::_UpdateHighlight() +{ + BPoint where; + uint32 buttons; + fView->GetMouse(&where, &buttons, false); + _UpdateHighlight(where, fView->fModifiers); +} + +void +TermView::HyperLinkState::_UpdateHighlight(BPoint where, int32 modifiers) +{ + TermPos start; + TermPos end; + HyperLink link; + bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0; + if (_GetHyperLinkAt(where, pathPrefixOnly, link, start, end)) + _ActivateHighlight(start, end); + else + _DeactivateHighlight(); +} + + +void +TermView::HyperLinkState::_ActivateHighlight(const TermPos& start, + const TermPos& end) +{ + if (fHighlightActive) { + if (fHighlight.Start() == start && fHighlight.End() == end) + return; + _DeactivateHighlight(); + } + + fHighlight.SetRange(start, end); + fView->_AddHighlight(&fHighlight); + BCursor cursor(B_CURSOR_ID_FOLLOW_LINK); + fView->SetViewCursor(&cursor); + fHighlightActive = true; +} + + +void +TermView::HyperLinkState::_DeactivateHighlight() +{ + if (fHighlightActive) { + fView->_RemoveHighlight(&fHighlight); + BCursor cursor(B_CURSOR_ID_SYSTEM_DEFAULT); + fView->SetViewCursor(&cursor); + fHighlightActive = false; + } +} + + +// #pragma mark - HyperLinkMenuState + + +class TermView::HyperLinkMenuState::PopUpMenu : public BPopUpMenu { +public: + PopUpMenu(const BMessenger& messageTarget) + : + BPopUpMenu("open hyperlink"), + fMessageTarget(messageTarget) + { + SetAsyncAutoDestruct(true); + } + + ~PopUpMenu() + { + fMessageTarget.SendMessage(kMessageMenuClosed); + } + +private: + BMessenger fMessageTarget; +}; + + +TermView::HyperLinkMenuState::HyperLinkMenuState(TermView* view) + : + State(view), + fLink() +{ +} + + +void +TermView::HyperLinkMenuState::Prepare(BPoint point, const HyperLink& link) +{ + fLink = link; + + // open context menu + PopUpMenu* menu = new PopUpMenu(fView); + BLayoutBuilder::Menu<> menuBuilder(menu); + switch (link.GetType()) { + case HyperLink::TYPE_URL: + menuBuilder + .AddItem(B_TRANSLATE("Open link"), kMessageOpenLink) + .AddItem(B_TRANSLATE("Copy link location"), kMessageCopyLink); + break; + + case HyperLink::TYPE_PATH: + case HyperLink::TYPE_PATH_WITH_LINE: + case HyperLink::TYPE_PATH_WITH_LINE_AND_COLUMN: + menuBuilder.AddItem(B_TRANSLATE("Open path"), kMessageOpenLink); + menuBuilder.AddItem(B_TRANSLATE("Copy path"), kMessageCopyLink); + if (fLink.Text() != fLink.Address()) { + menuBuilder.AddItem(B_TRANSLATE("Copy absolute path"), + kMessageCopyAbsolutePath); + } + break; + } + menu->SetTargetForItems(fView); + menu->Go(fView->ConvertToScreen(point), true, true, true); +} + + +void +TermView::HyperLinkMenuState::Exited() +{ + fLink = HyperLink(); +} + + +bool +TermView::HyperLinkMenuState::MessageReceived(BMessage* message) +{ + switch (message->what) { + case kMessageOpenLink: + if (fLink.IsValid()) + fLink.Open(); + return true; + + case kMessageCopyLink: + case kMessageCopyAbsolutePath: + { + if (fLink.IsValid()) { + BString toCopy = message->what == kMessageCopyLink + ? fLink.Text() : fLink.Address(); + + if (!be_clipboard->Lock()) + return true; + + be_clipboard->Clear(); + + if (BMessage *data = be_clipboard->Data()) { + data->AddData("text/plain", B_MIME_TYPE, toCopy.String(), + toCopy.Length()); + be_clipboard->Commit(); + } + + be_clipboard->Unlock(); + } + return true; + } + + case kMessageMenuClosed: + fView->_NextState(fView->fDefaultState); + return true; + } + + return false; +} + diff --git a/src/apps/terminal/TermViewStates.h b/src/apps/terminal/TermViewStates.h new file mode 100644 index 0000000000..106f2af195 --- /dev/null +++ b/src/apps/terminal/TermViewStates.h @@ -0,0 +1,177 @@ +/* + * Copyright 2001-2013, Haiku, Inc. + * Copyright (c) 2003-4 Kian Duffy + * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. + * + * Distributed under the terms of the MIT license. + * Authors: + * Stefano Ceccherini, stefano.ceccherini@gmail.com + * Kian Duffy, myob@users.sourceforge.net + * Ingo Weinhold, ingo_weinhold@gmx.de + * Siarzhuk Zharski, zharik@gmx.li + */ +#ifndef TERMVIEW_STATES_H +#define TERMVIEW_STATES_H + + +#include "HyperLink.h" +#include "TerminalCharClassifier.h" +#include "TermView.h" + + +class TermView::State { +public: + State(TermView* view); + virtual ~State(); + + virtual void Entered(); + virtual void Exited(); + + virtual bool MessageReceived(BMessage* message); + // returns true, if handled + + virtual void ModifiersChanged(int32 oldModifiers, + int32 modifiers); + virtual void KeyDown(const char* bytes, int32 numBytes); + + virtual void MouseDown(BPoint where, int32 buttons, + int32 modifiers); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers); + virtual void MouseUp(BPoint where, int32 buttons); + + virtual void WindowActivated(bool active); + + virtual void VisibleTextBufferChanged(); + +protected: + TermView* fView; +}; + + +class TermView::StandardBaseState : public TermView::State { +public: + StandardBaseState(TermView* view); + +protected: + bool _StandardMouseMoved(BPoint where, + int32 modifiers); +}; + + +class TermView::DefaultState : public TermView::StandardBaseState { +public: + DefaultState(TermView* view); + + virtual void ModifiersChanged(int32 oldModifiers, + int32 modifiers); + + virtual void KeyDown(const char* bytes, int32 numBytes); + + virtual void MouseDown(BPoint where, int32 buttons, + int32 modifiers); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers); + + virtual void WindowActivated(bool active); + +private: + bool _CheckEnterHyperLinkState(int32 modifiers); +}; + + +class TermView::SelectState : public TermView::StandardBaseState { +public: + SelectState(TermView* view); + + void Prepare(BPoint where, int32 modifiers); + + virtual bool MessageReceived(BMessage* message); + + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers); + virtual void MouseUp(BPoint where, int32 buttons); + +private: + void _AutoScrollUpdate(); + +private: + int32 fSelectGranularity; + bool fCheckMouseTracking; + bool fMouseTracking; +}; + + +class TermView::HyperLinkState : public TermView::State, + private TermViewHighlighter { +public: + HyperLinkState(TermView* view); + + virtual void Entered(); + virtual void Exited(); + + virtual void ModifiersChanged(int32 oldModifiers, + int32 modifiers); + + virtual void MouseDown(BPoint where, int32 buttons, + int32 modifiers); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* message, int32 modifiers); + + virtual void WindowActivated(bool active); + + virtual void VisibleTextBufferChanged(); + +private: + // TermViewHighlighter + virtual rgb_color ForegroundColor(); + virtual rgb_color BackgroundColor(); + virtual uint32 AdjustTextAttributes(uint32 attributes); + +private: + struct CharPosition { + int32 index; + TermPos position; + }; + +private: + bool _GetHyperLinkAt(BPoint where, + bool pathPrefixOnly, HyperLink& _link, + TermPos& _start, TermPos& _end); + bool _EntryExists(const BString& path, + BString& _actualPath) const; + + void _UpdateHighlight(); + void _UpdateHighlight(BPoint where, int32 modifiers); + void _ActivateHighlight(const TermPos& start, + const TermPos& end); + void _DeactivateHighlight(); + +private: + DefaultCharClassifier fURLCharClassifier; + DefaultCharClassifier fPathComponentCharClassifier; + BString fCurrentDirectory; + TermViewHighlight fHighlight; + bool fHighlightActive; +}; + + +class TermView::HyperLinkMenuState : public TermView::State { +public: + HyperLinkMenuState(TermView* view); + + void Prepare(BPoint point, const HyperLink& link); + + virtual void Exited(); + + virtual bool MessageReceived(BMessage* message); + +private: + class PopUpMenu; + +private: + HyperLink fLink; +}; + + +#endif // TERMVIEW_STATES_H diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 5c734312c1..9b57d18dd6 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -9,6 +9,7 @@ * Authors: * Kian Duffy, myob@users.sourceforge.net * Daniel Furrer, assimil8or@users.sourceforge.net + * John Scipione, jscipione@gmail.com * Siarzhuk Zharski, zharik@gmx.li */ @@ -38,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -729,9 +731,13 @@ TermWindow::MessageReceived(BMessage *message) break; case MENU_FIND_STRING: - if (!fFindPanel) { + if (fFindPanel == NULL) { fFindPanel = new FindWindow(this, fFindString, fFindSelection, fMatchWord, fMatchCase, fForwardSearch); + + fFindPanel->CenterIn(Frame()); + _MoveWindowInScreen(fFindPanel); + fFindPanel->Show(); } else fFindPanel->Activate(); break; @@ -885,7 +891,7 @@ TermWindow::MessageReceived(BMessage *message) // done before ResizeTo to work around a Dano bug // (not erasing the decor) SetLook(B_NO_BORDER_WINDOW_LOOK); - ResizeTo(screen.Frame().Width()+1, screen.Frame().Height()+1); + ResizeTo(screen.Frame().Width() + 1, screen.Frame().Height() + 1); MoveTo(screen.Frame().left, screen.Frame().top); SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_MOVABLE)); fFullScreen = true; @@ -1844,10 +1850,8 @@ TermWindow::_OpenSetTabTitleDialog(int32 index) // place the dialog window directly under the tab, but keep it on screen BPoint location = fTabView->ConvertToScreen( fTabView->TabFrame(index).LeftBottom() + BPoint(0, 1)); - BRect frame(fSetTabTitleDialog->Frame().OffsetToCopy(location)); - BSize screenSize(BScreen(fSetTabTitleDialog).Frame().Size()); - fSetTabTitleDialog->MoveTo( - BLayoutUtils::MoveIntoFrame(frame, screenSize).LeftTop()); + fSetTabTitleDialog->MoveTo(location); + _MoveWindowInScreen(fSetTabTitleDialog); fSetTabTitleDialog->Go(title, userDefined, this); } @@ -1867,10 +1871,7 @@ TermWindow::_OpenSetWindowTitleDialog() // center the dialog in the window frame, but keep it on screen fSetWindowTitleDialog->CenterIn(Frame()); - BRect frame(fSetWindowTitleDialog->Frame()); - BSize screenSize(BScreen(fSetWindowTitleDialog).Frame().Size()); - fSetWindowTitleDialog->MoveTo( - BLayoutUtils::MoveIntoFrame(frame, screenSize).LeftTop()); + _MoveWindowInScreen(fSetWindowTitleDialog); fSetWindowTitleDialog->Go(fTitle.pattern, fTitle.patternUserDefined, this); } @@ -1982,3 +1983,12 @@ TermWindow::_NewSessionIndex() return id; } } + + +void +TermWindow::_MoveWindowInScreen(BWindow* window) +{ + BRect frame = window->Frame(); + BSize screenSize(BScreen(window).Frame().Size()); + window->MoveTo(BLayoutUtils::MoveIntoFrame(frame, screenSize).LeftTop()); +} diff --git a/src/apps/terminal/TermWindow.h b/src/apps/terminal/TermWindow.h index 542603a6ef..5740595445 100644 --- a/src/apps/terminal/TermWindow.h +++ b/src/apps/terminal/TermWindow.h @@ -185,6 +185,8 @@ private: SessionID _NewSessionID(); int32 _NewSessionIndex(); + void _MoveWindowInScreen(BWindow* window); + private: TerminalRoster fTerminalRoster; diff --git a/src/apps/terminal/TerminalCharClassifier.cpp b/src/apps/terminal/TerminalCharClassifier.cpp index acdd2f59fb..86a3c9c606 100644 --- a/src/apps/terminal/TerminalCharClassifier.cpp +++ b/src/apps/terminal/TerminalCharClassifier.cpp @@ -1,11 +1,52 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2013, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #include "TerminalCharClassifier.h" +#include + +#include + + +// #pragma mark - TerminalCharClassifier + TerminalCharClassifier::~TerminalCharClassifier() { } + + +// #pragma mark - DefaultCharClassifier + + +DefaultCharClassifier::DefaultCharClassifier(const char* additionalWordChars) +{ + const char* p = additionalWordChars; + while (p != NULL && *p != '\0') { + int count = UTF8Char::ByteCount(*p); + if (count <= 0 || count > 4) + break; + fAdditionalWordChars.push_back(UTF8Char(p, count)); + p += count; + } +} + + +int +DefaultCharClassifier::Classify(const UTF8Char& character) +{ + if (character.IsSpace()) + return CHAR_TYPE_SPACE; + + if (character.IsAlNum()) + return CHAR_TYPE_WORD_CHAR; + + if (std::find(fAdditionalWordChars.begin(), fAdditionalWordChars.end(), + character) != fAdditionalWordChars.end()) { + return CHAR_TYPE_WORD_CHAR; + } + + return CHAR_TYPE_WORD_DELIMITER; +} diff --git a/src/apps/terminal/TerminalCharClassifier.h b/src/apps/terminal/TerminalCharClassifier.h index 236f31c3aa..de0d36411f 100644 --- a/src/apps/terminal/TerminalCharClassifier.h +++ b/src/apps/terminal/TerminalCharClassifier.h @@ -1,11 +1,16 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2013, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef TERMINAL_CHAR_CLASSIFIER_H #define TERMINAL_CHAR_CLASSIFIER_H +#include + +#include "UTF8Char.h" + + enum { CHAR_TYPE_SPACE, CHAR_TYPE_WORD_CHAR, @@ -23,4 +28,16 @@ public: }; +class DefaultCharClassifier: public TerminalCharClassifier { +public: + DefaultCharClassifier( + const char* additionalWordChars); + + virtual int Classify(const UTF8Char& character); + +private: + std::vector fAdditionalWordChars; +}; + + #endif // TERMINAL_CHAR_CLASSIFIER_H diff --git a/src/apps/terminal/VTKeyTbl.c b/src/apps/terminal/VTKeyTbl.c index 51e877a611..ff5ada40f0 100644 --- a/src/apps/terminal/VTKeyTbl.c +++ b/src/apps/terminal/VTKeyTbl.c @@ -28,8 +28,12 @@ * */ + +#include "VTKeyTbl.h" + #include "VTkeymap.h" + int function_keycode_table[] = { F1_KEY, diff --git a/src/apps/terminal/VTKeyTbl.h b/src/apps/terminal/VTKeyTbl.h new file mode 100644 index 0000000000..8f4c284203 --- /dev/null +++ b/src/apps/terminal/VTKeyTbl.h @@ -0,0 +1,13 @@ +/* + * Copyright 2013 Ingo Weinhold, ingo_weinhold@gmx.de. All rights reserved. + * Distributed under the terms of the MIT license. + */ +#ifndef VT_KEY_TABLE_H +#define VT_KEY_TABLE_H + + +extern int function_keycode_table[]; +extern char* function_key_char_table[]; + + +#endif // VT_KEY_TABLE_H diff --git a/src/apps/text_search/Grepper.cpp b/src/apps/text_search/Grepper.cpp index a20103e7d0..00b6657a86 100644 --- a/src/apps/text_search/Grepper.cpp +++ b/src/apps/text_search/Grepper.cpp @@ -69,8 +69,8 @@ strdup_to_utf8(uint32 encode, const char* src, int32 length) char* dup = strdup(dst); delete[] dst; if (srcLen != length) { - fprintf(stderr, "strdup_to_utf8(%ld, %ld) dst allocate smalled(%ld)\n", - encode, length, dstLen); + fprintf(stderr, "strdup_to_utf8(%" B_PRId32 ", %" B_PRId32 + ") dst allocate smalled(%" B_PRId32 ")\n", encode, length, dstLen); } return dup; } @@ -91,8 +91,8 @@ strdup_from_utf8(uint32 encode, const char* src, int32 length) char* dup = strdup(dst); delete[] dst; if (srcLen != length) { - fprintf(stderr, "strdup_from_utf8(%ld, %ld) dst allocate " - "smalled(%ld)\n", encode, length, dstLen); + fprintf(stderr, "strdup_from_utf8(%" B_PRId32 ", %" B_PRId32 + ") dst allocate smalled(%" B_PRId32 ")\n", encode, length, dstLen); } return dup; } @@ -183,7 +183,7 @@ Grepper::_GrepperThread() char command[B_PATH_NAME_LENGTH + 32]; BPath tempFile; - sprintf(fileName, "/tmp/SearchText%ld", fThreadId); + sprintf(fileName, "/tmp/SearchText%" B_PRId32, fThreadId); tempFile.SetTo(fileName); while (!fMustQuit && fIterator->GetNextName(fileName)) { diff --git a/src/apps/text_search/Model.cpp b/src/apps/text_search/Model.cpp index d90d6e3873..eb847a963b 100644 --- a/src/apps/text_search/Model.cpp +++ b/src/apps/text_search/Model.cpp @@ -29,7 +29,7 @@ using std::nothrow; Model::Model() : fDirectory(), - fSelectedFiles(0UL), + fSelectedFiles((uint32)0), fRecurseDirs(true), fRecurseLinks(false), @@ -204,7 +204,7 @@ Model::AddToHistory(const char* text) } while (items.CountItems() >= HISTORY_LIMIT) - delete static_cast(items.RemoveItem(0L)); + delete static_cast(items.RemoveItem((int32)0)); _SaveHistory(items); _FreeHistory(items); diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index fe99ec9e5f..131952d1fb 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -76,8 +76,7 @@ BrowserApp::BrowserApp() fCookies(NULL), fCookieJar(NULL), fDownloadWindow(NULL), - fSettingsWindow(NULL), - fAboutWindow(NULL) + fSettingsWindow(NULL) { } @@ -88,45 +87,39 @@ BrowserApp::~BrowserApp() delete fSettings; delete fCookies; delete fCookieJar; - - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } void BrowserApp::AboutRequested() { - if (fAboutWindow == NULL) { - // create the about window + BAboutWindow* window = new BAboutWindow(kApplicationName, + kApplicationSignature); + + // create the about window - const char* authors[] = { - "Andrea Anzani", - "Stephan Aßmus", - "Alexandre Deckner", - "Rene Gollent", - "Ryan Leavengood", - "Michael Lotz", - "Maxime Simon", - NULL - }; + const char* authors[] = { + "Andrea Anzani", + "Stephan Aßmus", + "Alexandre Deckner", + "Rene Gollent", + "Ryan Leavengood", + "Michael Lotz", + "Maxime Simon", + NULL + }; - BString aboutText(""); - aboutText << "HaikuWebKit " << WebKitInfo::HaikuWebKitVersion(); - aboutText << " (" << WebKitInfo::HaikuWebKitRevision() << ")"; - aboutText << "\nWebKit " << WebKitInfo::WebKitVersion(); - aboutText << " (" << WebKitInfo::WebKitRevision() << ")"; + BString aboutText(""); + aboutText << "HaikuWebKit " << WebKitInfo::HaikuWebKitVersion(); + aboutText << " (" << WebKitInfo::HaikuWebKitRevision() << ")"; + aboutText << "\nWebKit " << WebKitInfo::WebKitVersion(); + aboutText << " (" << WebKitInfo::WebKitRevision() << ")"; - fAboutWindow = new BAboutWindow(kApplicationName, - kApplicationSignature); - fAboutWindow->AddCopyright(2007, "Haiku, Inc."); - fAboutWindow->AddAuthors(authors); - fAboutWindow->AddExtraInfo(aboutText.String()); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + window->AddCopyright(2007, "Haiku, Inc."); + window->AddAuthors(authors); + window->AddExtraInfo(aboutText.String()); + + window->Show(); } diff --git a/src/apps/webpositive/BrowserApp.h b/src/apps/webpositive/BrowserApp.h index 19e4860969..2836627eb3 100644 --- a/src/apps/webpositive/BrowserApp.h +++ b/src/apps/webpositive/BrowserApp.h @@ -34,7 +34,6 @@ #include -class BAboutWindow; class BNetworkCookieJar; class DownloadWindow; class BrowserWindow; @@ -79,8 +78,6 @@ private: DownloadWindow* fDownloadWindow; SettingsWindow* fSettingsWindow; - - BAboutWindow* fAboutWindow; }; diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index ab923e7332..7785796913 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/src/apps/webwatch/WatchView.cpp b/src/apps/webwatch/WatchView.cpp index 3488baecc4..ad5f3b441a 100644 --- a/src/apps/webwatch/WatchView.cpp +++ b/src/apps/webwatch/WatchView.cpp @@ -97,7 +97,7 @@ void WatchView::Draw(BRect updateRect) super::Draw(updateRect); char string[5]; - sprintf(string, "@%03ld", GetInternetTime()); + sprintf(string, "@%03" B_PRId32, GetInternetTime()); font_height height; // center the text horizontally GetFontHeight(&height); // and vertically in the Deskbar diff --git a/src/apps/workspaces/Workspaces.cpp b/src/apps/workspaces/Workspaces.cpp index 3dd2af7b0a..30f8f16dc2 100644 --- a/src/apps/workspaces/Workspaces.cpp +++ b/src/apps/workspaces/Workspaces.cpp @@ -119,7 +119,6 @@ class WorkspacesView : public BView { BView* fParentWhichDrawsOnChildren; BRect fCurrentFrame; - BAboutWindow* fAboutWindow; }; class WorkspacesWindow : public BWindow { @@ -342,8 +341,7 @@ WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true) BView(frame, kDeskbarItemName, B_FOLLOW_ALL, kWorkspacesViewFlag | B_FRAME_EVENTS), fParentWhichDrawsOnChildren(NULL), - fCurrentFrame(frame), - fAboutWindow(NULL) + fCurrentFrame(frame) { if(showDragger) { frame.OffsetTo(B_ORIGIN); @@ -360,8 +358,7 @@ WorkspacesView::WorkspacesView(BMessage* archive) : BView(archive), fParentWhichDrawsOnChildren(NULL), - fCurrentFrame(Frame()), - fAboutWindow(NULL) + fCurrentFrame(Frame()) { // Just in case we are instantiated from an older archive... SetFlags(Flags() | B_FRAME_EVENTS); @@ -374,8 +371,6 @@ WorkspacesView::WorkspacesView(BMessage* archive) WorkspacesView::~WorkspacesView() { - if (fAboutWindow != NULL && fAboutWindow->Lock()) - fAboutWindow->Quit(); } @@ -405,34 +400,31 @@ WorkspacesView::Archive(BMessage* archive, bool deep) const void WorkspacesView::_AboutRequested() { - if (fAboutWindow == NULL) { - const char* authors[] = { - "Axel Dörfler", - "Oliver \"Madison\" Kohl", - "Matt Madia", - "François Revol", - NULL - }; + BAboutWindow* window = new BAboutWindow( + B_TRANSLATE_SYSTEM_NAME("Workspaces"), kSignature); - const char* extraCopyrights[] = { - "2002 François Revol", - NULL - }; + const char* authors[] = { + "Axel Dörfler", + "Oliver \"Madison\" Kohl", + "Matt Madia", + "François Revol", + NULL + }; - const char* extraInfo = "Send windows behind using the Option key. " - "Move windows to front using the Control key.\n"; + const char* extraCopyrights[] = { + "2002 François Revol", + NULL + }; - fAboutWindow = new BAboutWindow( - B_TRANSLATE_SYSTEM_NAME("Workspaces"), kSignature); - fAboutWindow->AddCopyright(2002, "Haiku, Inc.", + const char* extraInfo = "Send windows behind using the Option key. " + "Move windows to front using the Control key.\n"; + + window->AddCopyright(2002, "Haiku, Inc.", extraCopyrights); - fAboutWindow->AddAuthors(authors); - fAboutWindow->AddExtraInfo(extraInfo); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + window->AddAuthors(authors); + window->AddExtraInfo(extraInfo); + + window->Show(); } diff --git a/src/bin/Jamfile b/src/bin/Jamfile index ee517b1777..c4c932b3a2 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -10,7 +10,6 @@ UsePrivateHeaders app interface shared storage support tracker usb ; UsePrivateSystemHeaders ; SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_cache ; UseLibraryHeaders ncurses ; -UseLibraryHeaders termcap ; local haiku-utils_rsrc = [ FGristFiles haiku-utils.rsrc ] ; @@ -69,11 +68,10 @@ StdBinCommands : : $(haiku-utils_rsrc) ; } -# standard commands that need libtermcap.a +# standard commands that need libncurses.a StdBinCommands top.c - tput.c - : libtermcap.a : $(haiku-utils_rsrc) ; + : libncurses.a : $(haiku-utils_rsrc) ; # standard commands that need libbe.so StdBinCommands diff --git a/src/bin/bash/Jamfile b/src/bin/bash/Jamfile index d5de2d3041..5adda6b3b6 100644 --- a/src/bin/bash/Jamfile +++ b/src/bin/bash/Jamfile @@ -88,7 +88,7 @@ BinCommand bash : $(jobControlSources) : libreadline.a libglob.a libbuiltins.a libtilde.a libsh.a - libtermcap.a $(TARGET_SELECT_UNAME_ETC_LIB) + libncurses.a $(TARGET_SELECT_UNAME_ETC_LIB) : bash.rdef ; # trap.c includes signames.h diff --git a/src/bin/bash/builtins/common.c b/src/bin/bash/builtins/common.c index 2c75b8419b..4e4361820e 100644 --- a/src/bin/bash/builtins/common.c +++ b/src/bin/bash/builtins/common.c @@ -64,7 +64,7 @@ #endif #if !defined (errno) -extern int errno; +extern int errno; #endif /* !errno */ extern int indirection_level, subshell_environment; @@ -494,7 +494,7 @@ get_exitstat (list) list = list->next; if (list == 0) - return (last_command_exit_value); + return (last_command_exit_value); arg = list->word->word; if (arg == 0 || legal_number (arg, &sval) == 0) @@ -760,7 +760,7 @@ display_signal_list (list, forcecols) list = list->next; continue; } -#if defined (JOB_CONTROL) && defined(HAVE_KILL_BUILTIN) +#if defined (JOB_CONTROL) /* POSIX.2 says that `kill -l signum' prints the signal name without the `SIG' prefix. */ printf ("%s\n", (this_shell_builtin == kill_builtin) ? name + 3 : name); @@ -771,10 +771,8 @@ display_signal_list (list, forcecols) else { dflags = DSIG_NOCASE; -#if defined(HAVE_KILL_BUILTIN) if (posixly_correct == 0 || this_shell_builtin != kill_builtin) dflags |= DSIG_SIGPREFIX; -#endif signum = decode_signal (list->word->word, dflags); if (signum == NO_SIG) { @@ -869,7 +867,7 @@ find_special_builtin (name) current_builtin->function : (sh_builtin_func_t *)NULL); } - + static int shell_builtin_compare (sbp1, sbp2) struct builtin *sbp1, *sbp2; diff --git a/src/bin/bash/builtins/kill.def b/src/bin/bash/builtins/kill.def index 4cff928360..d4a415bd2d 100644 --- a/src/bin/bash/builtins/kill.def +++ b/src/bin/bash/builtins/kill.def @@ -22,7 +22,6 @@ $PRODUCES kill.c $BUILTIN kill $FUNCTION kill_builtin -$DEPENDS_ON HAVE_KILL_BUILTIN $SHORT_DOC kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] Send a signal to a job. @@ -55,6 +54,8 @@ $END # include #endif +#include + #include "../bashansi.h" #include "../bashintl.h" @@ -78,6 +79,46 @@ static void kill_error __P((pid_t, int)); # define CONTINUE_OR_FAIL goto continue_killing #endif /* CONTINUE_AFTER_KILL_ERROR */ + +int kill_by_name(int signum, const char *name) +{ + team_info teamInfo; + uint32 cookie = 0; + int status = EXECUTION_SUCCESS; + int found = 0; + + while (get_next_team_info(&cookie, &teamInfo) >= B_OK) { + char *token, *args; + + args = teamInfo.args; + token = strchr(args, ' '); + if (token) { + /* remove process argument */ + *token = 0; + } + + /* skip the path if any */ + token = basename(args); + + if (!strncmp(name, token, strlen(token))) { + found = 1; + /* name matched */ + if (kill((pid_t)teamInfo.team, signum) != 0) { + kill_error (teamInfo.team, errno); + status = EXECUTION_FAILURE; + } + } + } + + if (!found) + builtin_error (_("(%s) - %s"), name, strerror(ESRCH)); + + return status; +} + + + + /* Here is the kill builtin. We only have it so that people can type kill -KILL %1? No, if you fill up the process table this way you can still kill some. */ @@ -177,20 +218,27 @@ kill_builtin (list) word++; /* Use the entire argument in case of minus sign presence. */ - if (*word && legal_number (list->word->word, &pid_value) && (pid_value == (pid_t)pid_value)) - { - pid = (pid_t) pid_value; + if (*word) + { + if (legal_number (list->word->word, &pid_value) + && (pid_value == (pid_t)pid_value)) + { + pid = (pid_t) pid_value; - if (kill_pid (pid, sig, pid < -1) < 0) - { - if (errno == EINVAL) - sh_invalidsig (sigspec); - else - kill_error (pid, errno); - CONTINUE_OR_FAIL; - } - else - any_succeeded++; + if (kill_pid (pid, sig, pid < -1) < 0) + { + if (errno == EINVAL) + sh_invalidsig (sigspec); + else + kill_error (pid, errno); + CONTINUE_OR_FAIL; + } + else + any_succeeded++; + } else { + errno = kill_by_name(sig, word); + CONTINUE_OR_FAIL; + } } #if defined (JOB_CONTROL) else if (*list->word->word && *list->word->word != '%') diff --git a/src/bin/bash/lib/readline/Jamfile b/src/bin/bash/lib/readline/Jamfile index f9218da6c2..178e35541a 100644 --- a/src/bin/bash/lib/readline/Jamfile +++ b/src/bin/bash/lib/readline/Jamfile @@ -8,7 +8,7 @@ TARGET_WARNING_CCFLAGS = [ FFilter $(TARGET_WARNING_CCFLAGS) SubDirCcFlags -DHAVE_CONFIG_H -DSHELL ; -UseLibraryHeaders termcap ; +UseLibraryHeaders ncurses ; SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) ] ; SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) include ] ; diff --git a/src/bin/bfs_tools/bfsinfo.cpp b/src/bin/bfs_tools/bfsinfo.cpp index 44b64ccda4..306b709eac 100644 --- a/src/bin/bfs_tools/bfsinfo.cpp +++ b/src/bin/bfs_tools/bfsinfo.cpp @@ -37,10 +37,10 @@ dump_bplustree(Disk &disk, BPositionIO *file, off_t size, bool hexDump) dump_bplustree_header(header); bplustree_node *node = (bplustree_node *)(buffer + nodeSize); - while ((int32)node < (int32)buffer + size) { + while ((addr_t)node < (addr_t)buffer + size) { printf("\n\n-------------------\n" - "** node at offset: %ld\n** used: %ld bytes\n", - int32(node) - int32(buffer), node->Used()); + "** node at offset: %" B_PRIuADDR "\n** used: %" B_PRId32 " bytes" + "\n", (addr_t)node - (addr_t)buffer, node->Used()); dump_bplustree_node(node, header, &disk); if (hexDump) { @@ -48,7 +48,7 @@ dump_bplustree(Disk &disk, BPositionIO *file, off_t size, bool hexDump) dump_block((char *)node, header->node_size, 0); } - node = (bplustree_node *)(int32(node) + nodeSize); + node = (bplustree_node *)((addr_t)node + nodeSize); } } @@ -79,11 +79,11 @@ dump_indirect_stream(Disk &disk, bfs_inode *node, bool showOffsets) if (runs[i].IsZero()) return; - printf(" indirect[%02ld] = ", i); + printf(" indirect[%04" B_PRId32 "] = ", i); char buffer[256]; if (showOffsets) - snprintf(buffer, sizeof(buffer), " %16lld", offset); + snprintf(buffer, sizeof(buffer), " %16" B_PRIdOFF, offset); else buffer[0] = '\0'; @@ -94,6 +94,68 @@ dump_indirect_stream(Disk &disk, bfs_inode *node, bool showOffsets) } +void +dump_double_indirect_stream(Disk& disk, bfs_inode* node, bool showOffsets) +{ + if (node->data.max_double_indirect_range == 0) + return; + + int32 bytes = node->data.double_indirect.length * disk.BlockSize(); + int32 count = bytes / sizeof(block_run); + block_run runs[count]; + + off_t offset = node->data.max_indirect_range; + + ssize_t bytesRead = disk.ReadAt(disk.ToOffset(node->data.double_indirect), + (uint8*)runs, bytes); + if (bytesRead < bytes) { + fprintf(stderr, "couldn't read double indirect runs: %s\n", + strerror(bytesRead)); + return; + } + + puts("double indirect stream:"); + + for (int32 i = 0; i < count; i++) { + if (runs[i].IsZero()) + return; + + printf(" double_indirect[%02" B_PRId32 "] = ", i); + + dump_block_run("", runs[i], ""); + + int32 indirectBytes = runs[i].length * disk.BlockSize(); + int32 indirectCount = indirectBytes / sizeof(block_run); + block_run indirectRuns[indirectCount]; + + bytesRead = disk.ReadAt(disk.ToOffset(runs[i]), (uint8*)indirectRuns, + indirectBytes); + if (bytesRead < indirectBytes) { + fprintf(stderr, "couldn't read double indirect runs: %s\n", + strerror(bytesRead)); + continue; + } + + for (int32 j = 0; j < indirectCount; j++) { + if (indirectRuns[j].IsZero()) + break; + + printf(" [%04" B_PRId32 "] = ", j); + + char buffer[256]; + if (showOffsets) + snprintf(buffer, sizeof(buffer), " %16" B_PRIdOFF, offset); + else + buffer[0] = '\0'; + + dump_block_run("", indirectRuns[j], buffer); + + offset += indirectRuns[j].length * disk.BlockSize(); + } + } +} + + block_run parseBlockRun(Disk &disk, char *first, char *last) { @@ -184,25 +246,27 @@ main(int argc, char **argv) printf(" Name:\t\t\t\"%s\"\n", disk.SuperBlock()->name); printf(" (disk is %s)\n\n", disk.ValidateSuperBlock() == B_OK ? "valid" : "invalid!!"); - printf(" Block Size:\t\t%ld bytes\n", disk.BlockSize()); - printf(" Number of Blocks:\t%12Lu\t%10g MB\n", disk.NumBlocks(), - disk.NumBlocks() * disk.BlockSize() / (1024.0*1024)); + printf(" Block Size:\t\t%" B_PRIu32 " bytes\n", disk.BlockSize()); + printf(" Number of Blocks:\t%12" B_PRIdOFF "\t%10g MB\n", + disk.NumBlocks(), disk.NumBlocks() * disk.BlockSize() + / (1024.0*1024)); if (disk.BlockBitmap() != NULL) { - printf(" Used Blocks:\t\t%12Lu\t%10g MB\n", + printf(" Used Blocks:\t\t%12" B_PRIdOFF "\t%10g MB\n", disk.BlockBitmap()->UsedBlocks(), disk.BlockBitmap()->UsedBlocks() * disk.BlockSize() / (1024.0*1024)); - printf(" Free Blocks:\t\t%12Lu\t%10g MB\n", + printf(" Free Blocks:\t\t%12" B_PRIdOFF "\t%10g MB\n", disk.BlockBitmap()->FreeBlocks(), disk.BlockBitmap()->FreeBlocks() * disk.BlockSize() / (1024.0*1024)); } int32 size = (disk.AllocationGroups() * disk.SuperBlock()->blocks_per_ag); - printf(" Bitmap Size:\t\t%ld bytes (%ld blocks, %ld per allocation " - "group)\n", disk.BlockSize() * size, size, + printf(" Bitmap Size:\t\t%" B_PRIu32 " bytes (%" B_PRId32 " blocks, %" + B_PRId32 " per allocation group)\n", disk.BlockSize() * size, size, disk.SuperBlock()->blocks_per_ag); - printf(" Allocation Groups:\t%lu\n\n", disk.AllocationGroups()); + printf(" Allocation Groups:\t%" B_PRIu32 "\n\n", + disk.AllocationGroups()); dump_block_run(" Log:\t\t\t", disk.Log()); printf(" (was %s)\n\n", disk.SuperBlock()->flags == SUPER_BLOCK_CLEAN ? "cleanly unmounted" : "not unmounted cleanly!"); @@ -233,6 +297,7 @@ main(int argc, char **argv) } char buffer[disk.BlockSize()]; + bfs_inode* bfsInode = (bfs_inode*)buffer; block_run run; Inode *inode = NULL; @@ -251,7 +316,7 @@ main(int argc, char **argv) return -1; } - inode = Inode::Factory(&disk, (bfs_inode *)buffer, false); + inode = Inode::Factory(&disk, bfsInode, false); if (inode == NULL || inode->InitCheck() < B_OK) { fprintf(stderr,"Not a valid inode!\n"); delete inode; @@ -260,17 +325,18 @@ main(int argc, char **argv) } if (dumpInode) { - printf("Inode at block %Ld:\n-----------------------------------------" - "\n", disk.ToBlock(run)); - dump_inode(inode, (bfs_inode *)buffer, showOffsets); - dump_indirect_stream(disk, (bfs_inode *)buffer, showOffsets); + printf("Inode at block %" B_PRIdOFF ":\n------------------------------" + "-----------\n", disk.ToBlock(run)); + dump_inode(inode, bfsInode, showOffsets); + dump_indirect_stream(disk, bfsInode, showOffsets); + dump_double_indirect_stream(disk, bfsInode, showOffsets); dump_small_data(inode); putchar('\n'); } - if (dumpBTree && inode) { - printf("B+Tree at block %Ld:\n----------------------------------------" - "-\n", disk.ToBlock(run)); + if (dumpBTree && inode != NULL) { + printf("B+Tree at block %" B_PRIdOFF ":\n-----------------------------" + "------------\n", disk.ToBlock(run)); if (inode->IsDirectory() || inode->IsAttributeDirectory()) { dump_bplustree(disk, (Directory *)inode, inode->Size(), dumpHex); putchar('\n'); @@ -278,9 +344,9 @@ main(int argc, char **argv) fprintf(stderr, "Inode is not a directory!\n"); } - if (validateBTree && inode) { - printf("Validating B+Tree at block %Ld:\n-----------------------------" - "------------\n", disk.ToBlock(run)); + if (validateBTree && inode != NULL) { + printf("Validating B+Tree at block %" B_PRIdOFF ":\n------------------" + "-----------------------\n", disk.ToBlock(run)); if (inode->IsDirectory() || inode->IsAttributeDirectory()) { BPlusTree *tree; if (((Directory *)inode)->GetTree(&tree) == B_OK) { @@ -294,8 +360,8 @@ main(int argc, char **argv) } if (dumpHex) { - printf("Hexdump from inode at block %Ld:\n-----------------------------" - "------------\n", disk.ToBlock(run)); + printf("Hexdump from inode at block %" B_PRIdOFF ":\n-----------------" + "------------------------\n", disk.ToBlock(run)); dump_block(buffer, disk.BlockSize()); putchar('\n'); } diff --git a/src/bin/bfs_tools/lib/BPlusTree.cpp b/src/bin/bfs_tools/lib/BPlusTree.cpp index 9493593332..60255ebd4f 100644 --- a/src/bin/bfs_tools/lib/BPlusTree.cpp +++ b/src/bin/bfs_tools/lib/BPlusTree.cpp @@ -250,14 +250,14 @@ BPlusTree::Validate(bool verbose) while (true) { if (!stack.Pop(&info)) { if (verbose) { - printf(" %ld B+tree node(s) processed (%ld free node(s)).\n", - count, freeCount); + printf(" %" B_PRId32 " B+tree node(s) processed (%" B_PRId32 + " free node(s)).\n", count, freeCount); } return B_OK; } if (!info.free && verbose && ++count % 10 == 0) - printf(" %ld%s1A\n", count, escape); + printf(" %" B_PRId32 "%s1A\n", count, escape); else if (info.free) freeCount++; @@ -265,7 +265,9 @@ BPlusTree::Validate(bool verbose) if ((node = fCache.Get(info.offset)) == NULL || !info.free && !CheckNode(node)) { if (verbose) { - fprintf(stderr," B+Tree: Could not get data at position %Ld (referenced by node at %Ld)\n",info.offset,info.from); + fprintf(stderr," B+Tree: Could not get data at position %" + B_PRIdOFF " (referenced by node at %" B_PRIdOFF ")\n", + info.offset, info.from); if ((node = fCache.Get(info.from)) != NULL) dump_bplustree_node(node,fHeader); } @@ -350,7 +352,8 @@ status_t BPlusTree::Goto(int8 to) else { if (node->all_key_length > fNodeSize - || (uint32)node->Values() > (uint32)node + fNodeSize - 8 * node->all_key_count) + || (addr_t)node->Values() > (addr_t)node + fNodeSize + - 8 * node->all_key_count) return B_ERROR; pos = *node->Values(); diff --git a/src/bin/bfs_tools/lib/Bitmap.cpp b/src/bin/bfs_tools/lib/Bitmap.cpp index 53567dadca..8fbe8c439c 100644 --- a/src/bin/bfs_tools/lib/Bitmap.cpp +++ b/src/bin/bfs_tools/lib/Bitmap.cpp @@ -138,8 +138,8 @@ Bitmap::BackupSetAt(off_t block, bool used) { uint32 index = block / 32; if (index > fByteSize / 4) { - fprintf(stderr, "Bitmap::BackupSetAt(): Block %Ld outside bitmap!\n", - block); + fprintf(stderr, "Bitmap::BackupSetAt(): Block %" B_PRIdOFF " outside " + "bitmap!\n", block); return false; } @@ -251,7 +251,9 @@ Bitmap::CompareWithBackup() { for (int32 i = fByteSize / 4;i-- > 0;) { if (fBitmap[i] != fBackupBitmap[i]) { - printf("differ at %ld (block %ld) -> bitmap = %08lx, backup = %08lx\n",i,i*32,fBitmap[i],fBackupBitmap[i]); + printf("differ at %" B_PRId32 " (block %" B_PRId32 ") -> bitmap = " + "%08" B_PRIx32 ", backup = %08" B_PRIx32 "\n", i, i * 32, + fBitmap[i], fBackupBitmap[i]); } } return B_OK; diff --git a/src/bin/bfs_tools/lib/Disk.cpp b/src/bin/bfs_tools/lib/Disk.cpp index 5d0fd07f73..b082938ea6 100644 --- a/src/bin/bfs_tools/lib/Disk.cpp +++ b/src/bin/bfs_tools/lib/Disk.cpp @@ -147,8 +147,10 @@ Disk::Disk(const char *deviceName, bool rawMode, off_t start, off_t stop) } close(device); - if (fSize == 0LL) - fprintf(stderr,"Disk: Invalid file size (%Ld bytes)!\n",fSize); + if (fSize == 0LL) { + fprintf(stderr,"Disk: Invalid file size (%" B_PRIdOFF " bytes)!\n", + fSize); + } if (rawMode && ScanForSuperBlock(start, stop) < B_OK) { fFile.Unset(); @@ -240,7 +242,8 @@ Disk::DumpBootBlockToFile() status_t Disk::ScanForSuperBlock(off_t start, off_t stop) { - printf("Disk size %Ld bytes, %.2f GB\n", fSize, 1.0 * fSize / (1024*1024*1024)); + printf("Disk size %" B_PRIdOFF " bytes, %.2f GB\n", fSize, 1.0 * fSize + / (1024*1024*1024)); uint32 blockSize = 4096; char buffer[blockSize + 1024]; @@ -252,12 +255,15 @@ Disk::ScanForSuperBlock(off_t start, off_t stop) BList superBlocks; - printf("Scanning Disk from %Ld to %Ld\n", start, stop); + printf("Scanning Disk from %" B_PRIdOFF " to %" B_PRIdOFF "\n", start, + stop); for (off_t offset = start; offset < stop; offset += blockSize) { - if (((offset-start) % (blockSize * 100)) == 0) - printf(" %12Ld, %.2f GB %s1A\n",offset,1.0 * offset / (1024*1024*1024),escape); + if (((offset-start) % (blockSize * 100)) == 0) { + printf(" %12" B_PRIdOFF ", %.2f GB %s1A\n", offset, + 1.0 * offset / (1024*1024*1024),escape); + } ssize_t bytes = fBufferedFile->ReadAt(offset, buffer, blockSize + 1024); if (bytes < B_OK) @@ -274,7 +280,8 @@ Disk::ScanForSuperBlock(off_t start, off_t stop) && super->magic2 == (int32)SUPER_BLOCK_MAGIC2 && super->magic3 == (int32)SUPER_BLOCK_MAGIC3) { - printf("\n(%ld) *** BFS superblock found at: %Ld\n",superBlocks.CountItems() + 1,offset); + printf("\n(%" B_PRId32 ") *** BFS superblock found at: %" + B_PRIdOFF "\n", superBlocks.CountItems() + 1, offset); dump_super_block(super); // add a copy of the superblock to the list @@ -302,9 +309,10 @@ Disk::ScanForSuperBlock(off_t start, off_t stop) for (int32 i = 0; i < superBlocks.CountItems(); i++) { bfs_disk_info *info = (bfs_disk_info *)superBlocks.ItemAt(i); - printf("%ld) %s, offset %Ld, size %g GB (%svalid)\n", i + 1, - info->super_block.name, info->offset, - 1.0 * info->super_block.num_blocks * info->super_block.block_size / (1024*1024*1024), + printf("%" B_PRId32 ") %s, offset %" B_PRIdOFF ", size %g GB (%svalid)" + "\n", i + 1, info->super_block.name, info->offset, + 1.0 * info->super_block.num_blocks * info->super_block.block_size + / (1024*1024*1024), ValidateSuperBlock(info->super_block) < B_OK ? "in" : ""); } @@ -375,7 +383,7 @@ Disk::ValidateSuperBlock() status_t Disk::RecreateSuperBlock() { - memset(&fSuperBlock,0,sizeof(disk_super_block)); + memset(&fSuperBlock, 0, sizeof(disk_super_block)); puts("\n*** Determine block size"); @@ -383,7 +391,7 @@ Disk::RecreateSuperBlock() if (status < B_OK) return status; - printf("\tblock size = %ld\n",BlockSize()); + printf("\tblock size = %" B_PRId32 "\n", BlockSize()); strcpy(fSuperBlock.name,"recovered"); fSuperBlock.magic1 = SUPER_BLOCK_MAGIC1; @@ -450,7 +458,7 @@ Disk::RecreateSuperBlock() if (fLogStart != ((indexDir.inode_num.allocation_group << fSuperBlock.ag_shift) + indexDir.inode_num.start - LogSize())) { fprintf(stderr,"ERROR: start of logging area doesn't fit assumed value " - "(%Ld blocks before indices)!\n", LogSize()); + "(%" B_PRIdOFF " blocks before indices)!\n", LogSize()); //gErrors++; } @@ -492,8 +500,8 @@ Disk::DetermineBlockSize() // read a quarter of the drive at maximum for (; offset < (fSize >> 2); offset += 1024) { if (fBufferedFile->ReadAt(offset, buffer, sizeof(buffer)) < B_OK) { - fprintf(stderr, "could not read from device (offset = %Ld, " - "size = %ld)!\n", offset, sizeof(buffer)); + fprintf(stderr, "could not read from device (offset = %" B_PRIdOFF + ", size = %ld)!\n", offset, sizeof(buffer)); status = B_IO_ERROR; break; } @@ -551,7 +559,8 @@ Disk::GetNextSpecialInode(char *buffer, off_t *_offset, off_t end, for (; offset < end; offset += BlockSize()) { if (fBufferedFile->ReadAt(offset, buffer, 1024) < B_OK) { - fprintf(stderr,"could not read from device (offset = %Ld, size = %d)!\n",offset,1024); + fprintf(stderr,"could not read from device (offset = %" B_PRIdOFF + ", size = %d)!\n", offset, 1024); *_offset = offset; return B_IO_ERROR; } @@ -576,7 +585,7 @@ Disk::GetNextSpecialInode(char *buffer, off_t *_offset, off_t end, // is the inode a special root inode (parent == self)? if (!memcmp(&inode->parent, &inode->inode_num, sizeof(inode_addr))) { - printf("\t special inode found at %Ld\n", offset); + printf("\t special inode found at %" B_PRIdOFF "\n", offset); *_offset = offset; return B_OK; @@ -596,10 +605,12 @@ Disk::SaveInode(bfs_inode *inode, bool *indices, bfs_inode *indexDir, printf("\troot node found!\n"); if (inode->inode_num.allocation_group != 8 || inode->inode_num.start != 0 - || inode->inode_num.length != 1) - printf("WARNING: root node has unexpected position: (ag = %ld, " - "start = %d, length = %d)\n", inode->inode_num.allocation_group, + || inode->inode_num.length != 1) { + printf("WARNING: root node has unexpected position: (ag = %" + B_PRId32 ", start = %d, length = %d)\n", + inode->inode_num.allocation_group, inode->inode_num.start, inode->inode_num.length); + } if (rootDir) memcpy(rootDir, inode, sizeof(bfs_inode)); } else if (inode->mode & S_INDEX_DIR) { @@ -662,7 +673,8 @@ Disk::ScanForIndexAndRoot(bfs_inode *indexDir,bfs_inode *rootDir) { SaveInode(inode,&indices,indexDir,&root,rootDir); - printf("root node at: 0x%Lx (DiskProbe)\n",logOffset / 512); + printf("root node at: 0x%" B_PRIxOFF " (DiskProbe)\n", + logOffset / 512); //fBufferedFile->ReadAt(logOffset + BlockSize(),buffer,1024); //if (*(uint32 *)buffer == BPLUSTREE_MAGIC) //{ diff --git a/src/bin/bfs_tools/lib/Inode.cpp b/src/bin/bfs_tools/lib/Inode.cpp index 4fab2fd07b..f13b615cc9 100644 --- a/src/bin/bfs_tools/lib/Inode.cpp +++ b/src/bin/bfs_tools/lib/Inode.cpp @@ -276,17 +276,18 @@ Inode::SetName(const char *name) int32 oldLength = nameData == NULL ? 0 : nameData->data_size; int32 newLength = strlen(name) + (nameData == NULL ? sizeof(small_data) + 5 : 0); - if (int32(data) + newLength - oldLength >= (int32)(fInode + fDisk->BlockSize())) + if ((addr_t)data + newLength - oldLength >= (addr_t)(fInode + + fDisk->BlockSize())) return B_NO_MEMORY; if (nameData == NULL) { memmove(newLength + (uint8 *)fInode->small_data_start, fInode->small_data_start, - int32(data) - int32(fInode->small_data_start)); + (addr_t)data - (addr_t)fInode->small_data_start); nameData = fInode->small_data_start; } else { memmove(newLength + (uint8 *)nameData, nameData, - int32(data) - int32(fInode->small_data_start)); + (addr_t)data - (addr_t)fInode->small_data_start); } memset(nameData, 0, sizeof(small_data) + 5 + strlen(name)); @@ -766,7 +767,7 @@ DataStream::ReadAt(off_t pos, void *buffer, size_t size) //printf("DataStream::ReadAt(pos = %Ld,buffer = %p,size = %ld);\n",pos,buffer,size); // truncate size to read - if (pos + size > fInode->data.size) { + if (pos + (off_t)size > fInode->data.size) { if (pos > fInode->data.size) // reading outside the file return B_ERROR; @@ -782,14 +783,14 @@ DataStream::ReadAt(off_t pos, void *buffer, size_t size) if (status < B_OK) return status; - ssize_t bytes = min_c(size, fRunBlockEnd - pos); + ssize_t bytes = min_c((off_t)size, fRunBlockEnd - pos); //printf("### read %ld bytes from %Ld\n### --\n",bytes,fDisk->ToOffset(fRun) + pos - fRunFileOffset); bytes = fDisk->ReadAt(fDisk->ToOffset(fRun) + pos - fRunFileOffset, buffer, bytes); if (bytes <= 0) { if (bytes == 0) { - printf("could not read bytes at: %ld,%d\n", + printf("could not read bytes at: %" B_PRId32 ",%d\n", fRun.allocation_group, fRun.start); } return bytes < 0 ? bytes : B_BAD_DATA; @@ -813,7 +814,7 @@ DataStream::WriteAt(off_t pos, const void *buffer, size_t size) NodeGetter _(this); // FIXME: truncate size -> should enlargen the file - if (pos + size > fInode->data.size) { + if (pos + (off_t)size > fInode->data.size) { if (pos > fInode->data.size) // writing outside the file return B_ERROR; @@ -829,7 +830,7 @@ DataStream::WriteAt(off_t pos, const void *buffer, size_t size) if (status < B_OK) return status; - ssize_t bytes = min_c(size,fRunBlockEnd - pos); + ssize_t bytes = min_c((off_t)size, fRunBlockEnd - pos); //printf("### write %ld bytes to %Ld\n### --\n",bytes,fDisk->ToOffset(fRun) + pos - fRunFileOffset); bytes = fDisk->WriteAt(fDisk->ToOffset(fRun) + pos - fRunFileOffset,buffer,bytes); @@ -959,8 +960,8 @@ File::CopyTo(const char *root, bool fullPath, Inode::Source *source) << (int32)BlockRun().start; path.Append(sub.String()); } - printf("%ld,%d -> %s\n", BlockRun().allocation_group, BlockRun().start, - path.Path()); + printf("%" B_PRId32 ",%d -> %s\n", BlockRun().allocation_group, + BlockRun().start, path.Path()); BFile file; status = file.SetTo(path.Path(), diff --git a/src/bin/bfs_tools/lib/bfs.h b/src/bin/bfs_tools/lib/bfs.h index f2ac852b4b..224e3a0ef3 100644 --- a/src/bin/bfs_tools/lib/bfs.h +++ b/src/bin/bfs_tools/lib/bfs.h @@ -251,7 +251,7 @@ inline small_data *small_data::Next() inline bool small_data::IsLast(bfs_inode *inode) { - return (uint32)this > (uint32)inode + inode->inode_size - sizeof(small_data) + return (addr_t)this > (addr_t)inode + inode->inode_size - sizeof(small_data) || name_size == 0; } diff --git a/src/bin/bfs_tools/lib/dump.cpp b/src/bin/bfs_tools/lib/dump.cpp index 651eeda5fa..caaf851562 100644 --- a/src/bin/bfs_tools/lib/dump.cpp +++ b/src/bin/bfs_tools/lib/dump.cpp @@ -38,7 +38,7 @@ get_tupel(uint32 id) void dump_block_run(const char *prefix, const block_run &run, const char *postfix) { - Print("%s(%ld, %d, %d)%s\n", prefix, run.allocation_group, + Print("%s(%" B_PRId32 ", %d, %d)%s\n", prefix, run.allocation_group, run.start, run.length, postfix); } @@ -48,29 +48,29 @@ dump_super_block(const disk_super_block *superBlock) { Print("disk_super_block:\n"); Print(" name = %s\n", superBlock->name); - Print(" magic1 = %#08lx (%s) %s\n", superBlock->magic1, + Print(" magic1 = %#08" B_PRIx32 " (%s) %s\n", superBlock->magic1, get_tupel(superBlock->magic1), superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID"); - Print(" fs_byte_order = %#08lx (%s, %s endian)\n", + Print(" fs_byte_order = %#08" B_PRIx32 " (%s, %s endian)\n", superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order), superBlock->fs_byte_order == SUPER_BLOCK_FS_LENDIAN ? "little" : "big"); - Print(" block_size = %lu\n", superBlock->block_size); - Print(" block_shift = %lu\n", superBlock->block_shift); - Print(" num_blocks = %Lu\n", superBlock->num_blocks); - Print(" used_blocks = %Lu\n", superBlock->used_blocks); - Print(" inode_size = %lu\n", superBlock->inode_size); - Print(" magic2 = %#08lx (%s) %s\n", superBlock->magic2, + Print(" block_size = %" B_PRIu32 "\n", superBlock->block_size); + Print(" block_shift = %" B_PRIu32 "\n", superBlock->block_shift); + Print(" num_blocks = %" B_PRIdOFF "\n", superBlock->num_blocks); + Print(" used_blocks = %" B_PRIdOFF "\n", superBlock->used_blocks); + Print(" inode_size = %" B_PRId32 "\n", superBlock->inode_size); + Print(" magic2 = %#08" B_PRIx32 " (%s) %s\n", superBlock->magic2, get_tupel(superBlock->magic2), superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID"); - Print(" blocks_per_ag = %lu\n", superBlock->blocks_per_ag); - Print(" ag_shift = %lu\n", superBlock->ag_shift); - Print(" num_ags = %lu\n", superBlock->num_ags); - Print(" flags = %#08lx (%s)\n", superBlock->flags, + Print(" blocks_per_ag = %" B_PRId32 "\n", superBlock->blocks_per_ag); + Print(" ag_shift = %" B_PRId32 "\n", superBlock->ag_shift); + Print(" num_ags = %" B_PRId32 "\n", superBlock->num_ags); + Print(" flags = %#08" B_PRIx32 " (%s)\n", superBlock->flags, get_tupel(superBlock->flags)); dump_block_run(" log_blocks = ", superBlock->log_blocks); - Print(" log_start = %Lu\n", superBlock->log_start); - Print(" log_end = %Lu\n", superBlock->log_end); - Print(" magic3 = %#08lx (%s) %s\n", superBlock->magic3, + Print(" log_start = %" B_PRIdOFF "\n", superBlock->log_start); + Print(" log_end = %" B_PRIdOFF "\n", superBlock->log_end); + Print(" magic3 = %#08" B_PRIx32 " (%s) %s\n", superBlock->magic3, get_tupel(superBlock->magic3), superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID"); dump_block_run(" root_dir = ", superBlock->root_dir); @@ -91,7 +91,7 @@ dump_data_stream(const bfs_inode *inode, const data_stream *stream, bool showOff char buffer[256]; if (showOffsets) - snprintf(buffer, sizeof(buffer), " %16lld", offset); + snprintf(buffer, sizeof(buffer), " %16" B_PRIdOFF, offset); else buffer[0] = '\0'; @@ -100,21 +100,23 @@ dump_data_stream(const bfs_inode *inode, const data_stream *stream, bool showOff offset += stream->direct[i].length * inode->inode_size; } } - Print(" max_direct_range = %Lu\n", stream->max_direct_range); + Print(" max_direct_range = %" B_PRIdOFF "\n", + stream->max_direct_range); if (!stream->indirect.IsZero()) dump_block_run(" indirect = ", stream->indirect); - Print(" max_indirect_range = %Lu\n", stream->max_indirect_range); + Print(" max_indirect_range = %" B_PRIdOFF "\n", + stream->max_indirect_range); if (!stream->double_indirect.IsZero()) { dump_block_run(" double_indirect = ", stream->double_indirect); } - Print(" max_double_indirect_range = %Lu\n", + Print(" max_double_indirect_range = %" B_PRIdOFF "\n", stream->max_double_indirect_range); - Print(" size = %Lu\n", stream->size); + Print(" size = %" B_PRIdOFF "\n", stream->size); } @@ -126,13 +128,14 @@ dump_inode(const Inode *nameNode, const bfs_inode *inode, bool showOffsets) else Print("inode:\n"); - Print(" magic1 = %08lx (%s) %s\n",inode->magic1, - get_tupel(inode->magic1), (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID")); + Print(" magic1 = %08" B_PRIx32 " (%s) %s\n",inode->magic1, + get_tupel(inode->magic1), + (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID")); dump_block_run( " inode_num = ",inode->inode_num); - Print(" uid = %lu\n",inode->uid); - Print(" gid = %lu\n",inode->gid); - Print(" mode = %10lo (octal)\n",inode->mode); - Print(" flags = %08lx\n",inode->flags); + Print(" uid = %" B_PRIu32 "\n",inode->uid); + Print(" gid = %" B_PRIu32 "\n",inode->gid); + Print(" mode = %10" B_PRIo32 " (octal)\n",inode->mode); + Print(" flags = %08" B_PRIx32 "\n",inode->flags); time_t time; time = (time_t)(inode->create_time >> 16); @@ -142,9 +145,9 @@ dump_inode(const Inode *nameNode, const bfs_inode *inode, bool showOffsets) dump_block_run( " parent = ",inode->parent); dump_block_run( " attributes = ",inode->attributes); - Print(" type = %lu\n",inode->type); - Print(" inode_size = %lu\n",inode->inode_size); - Print(" etc = %#08lx\n",inode->etc); + Print(" type = %" B_PRIu32 "\n",inode->type); + Print(" inode_size = %" B_PRId32 "\n",inode->inode_size); + Print(" etc = %#08" B_PRIx32 "\n",inode->etc); Print(" short_symlink = %s\n", S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0 ? inode->short_symlink : "-"); @@ -172,7 +175,8 @@ dump_small_data(Inode *inode) inode->InodeBuffer()->inode_size - sizeof(struct bfs_inode)); while (inode->GetNextSmallData(&item) == B_OK) { - printf("%#08lx (%s), name = \"%s\", ", item->type, get_tupel(item->type), item->Name()); + printf("%#08" B_PRIx32 " (%s), name = \"%s\", ", item->type, + get_tupel(item->type), item->Name()); if (item->type == FILE_NAME_TYPE || item->type == B_STRING_TYPE || item->type == B_MIME_STRING_TYPE) @@ -187,15 +191,19 @@ void dump_bplustree_header(const bplustree_header* header) { printf("bplustree_header:\n"); - printf(" magic = %#08lx (%s) %s\n", header->magic, - get_tupel(header->magic), + printf(" magic = %#08" B_PRIx32 " (%s) %s\n", + header->magic, get_tupel(header->magic), header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID"); - printf(" node_size = %lu\n", header->node_size); - printf(" max_number_of_levels = %lu\n", header->max_number_of_levels); - printf(" data_type = %lu\n", header->data_type); - printf(" root_node_pointer = %Ld\n", header->root_node_pointer); - printf(" free_node_pointer = %Ld\n", header->free_node_pointer); - printf(" maximum_size = %Lu\n", header->maximum_size); + printf(" node_size = %" B_PRIu32 "\n", header->node_size); + printf(" max_number_of_levels = %" B_PRIu32 "\n", + header->max_number_of_levels); + printf(" data_type = %" B_PRIu32 "\n", header->data_type); + printf(" root_node_pointer = %" B_PRIdOFF "\n", + header->root_node_pointer); + printf(" free_node_pointer = %" B_PRIdOFF "\n", + header->free_node_pointer); + printf(" maximum_size = %" B_PRIdOFF "\n", + header->maximum_size); } @@ -205,9 +213,9 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header, { Print("bplustree_node (%s node):\n", node->overflow_link == BPLUSTREE_NULL ? "leaf" : "index"); - Print(" left_link = %Ld\n", node->left_link); - Print(" right_link = %Ld\n", node->right_link); - Print(" overflow_link = %Ld\n", node->overflow_link); + Print(" left_link = %" B_PRIdOFF "\n", node->left_link); + Print(" right_link = %" B_PRIdOFF "\n", node->right_link); + Print(" overflow_link = %" B_PRIdOFF "\n", node->overflow_link); Print(" all_key_count = %u\n", node->all_key_count); Print(" all_key_length = %u\n", node->all_key_length); @@ -226,7 +234,7 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header, uint16 length; char* key = (char *)node->KeyAt(i, &length); if (length > 255) { - Print(" %2ld. Invalid length (%u)!!\n", i, length); + Print(" %2" B_PRId32 ". Invalid length (%u)!!\n", i, length); dump_block((char *)node, header->node_size, sizeof(off_t)); break; } @@ -236,33 +244,35 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header, buffer[length] = '\0'; off_t *value = node->Values() + i; - if ((uint32)value < (uint32)node || (uint32)value > (uint32)node + header->node_size) - Print(" %2ld. Invalid Offset!!\n",i); - else { - Print(" %2ld. ",i); + if ((addr_t)value < (addr_t)node + || (addr_t)value > (addr_t)node + header->node_size) { + Print(" %2" B_PRId32 ". Invalid Offset!!\n", i); + } else { + Print(" %2" B_PRId32 ". ",i); if (header->data_type == BPLUSTREE_STRING_TYPE) Print("\"%s\"",buffer); else if (header->data_type == BPLUSTREE_INT32_TYPE) { - Print("int32 = %ld (0x%lx)", *(int32 *)&buffer, - *(int32 *)&buffer); + Print("int32 = %" B_PRId32 " (0x%" B_PRIx32 ")", + *(int32 *)&buffer, *(int32 *)&buffer); } else if (header->data_type == BPLUSTREE_UINT32_TYPE) { - Print("uint32 = %lu (0x%lx)", *(uint32 *)&buffer, - *(uint32 *)&buffer); + Print("uint32 = %" B_PRIu32 " (0x%" B_PRIx32 ")", + *(uint32 *)&buffer, *(uint32 *)&buffer); } else if (header->data_type == BPLUSTREE_INT64_TYPE) { - Print("int64 = %Ld (0x%Lx)", *(int64 *)&buffer, - *(int64 *)&buffer); + Print("int64 = %" B_PRId64 " (0x%" B_PRIx64 ")", + *(int64 *)&buffer, *(int64 *)&buffer); } else Print("???"); off_t offset = *value & 0x3fffffffffffffffLL; - Print(" (%d bytes) -> %Ld",length,offset); + Print(" (%d bytes) -> %" B_PRIdOFF,length,offset); if (disk != NULL) { block_run run = disk->ToBlockRun(offset); - Print(" (%ld, %d)", run.allocation_group, run.start); + Print(" (%" B_PRId32 ", %d)", run.allocation_group, run.start); } if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_FRAGMENT) { - Print(" (duplicate fragment %Ld)\n", *value & 0x3ff); + Print(" (duplicate fragment %" B_PRIdOFF ")\n", + *value & 0x3ff); } else if (bplustree_node::LinkType(*value) == BPLUSTREE_DUPLICATE_NODE) { Print(" (duplicate node)\n"); @@ -310,7 +320,7 @@ dump_block(const char *buffer, uint32 size, int8 valueSize) for (uint32 offset = start; offset < start + kBlockSize; offset += valueSize) { if (valueSize == sizeof(off_t)) - Print("%s%Ld", offset == start ? "" : ", ", + Print("%s%" B_PRIdOFF, offset == start ? "" : ", ", *(off_t *)(buffer + offset)); } Print(")"); diff --git a/src/bin/coreutils/src/kill.c b/src/bin/coreutils/src/kill.c index f65b0cad12..dab4fa834e 100644 --- a/src/bin/coreutils/src/kill.c +++ b/src/bin/coreutils/src/kill.c @@ -21,7 +21,6 @@ #include #include #include -#include #if HAVE_SYS_WAIT_H # include @@ -37,7 +36,6 @@ #include "error.h" #include "sig2str.h" #include "operand2sig.h" -#include "OS.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "kill" @@ -87,7 +85,7 @@ usage (int status) else { printf (_("\ -Usage: %s [-s SIGNAL | -SIGNAL] ...\n\ +Usage: %s [-s SIGNAL | -SIGNAL] PID...\n\ or: %s -l [SIGNAL]...\n\ or: %s -t [SIGNAL]...\n\ "), @@ -111,8 +109,6 @@ Mandatory arguments to long options are mandatory for short options too.\n\ SIGNAL may be a signal name like `HUP', or a signal number like `1',\n\ or the exit status of a process terminated by a signal.\n\ PID is an integer; if negative it identifies a process group.\n\ -PROCESS is name of the process to be killed. The signal will be sent \n\ -to all of the processes matching the given PROCESS name.\n\ "), stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); emit_ancillary_info (); @@ -200,115 +196,38 @@ list_signals (bool table, char *const *argv) return status; } - - -/* - * Checks if passed string is a valid number - * - * Returns: - * true: on valid number - * The converted number is returned in NUM if it is not NULL - * - * false: on invalid number - * - */ -bool is_number(const char *str, intmax_t *_number) -{ - char *end; - intmax_t number; - - if (!str) - return 0; - - errno = 0; - number = strtoimax(str, &end, 10); - if (errno == ERANGE || str == end) { - /* not a valid number */ - return false; - } - - /* skip all whitespace if there are any */ - while (*end == ' ' || *end == '\t') - end++; - - if (*end == '\0') { - if (_number) - *_number = number; - return true; - } - return false; -} - - -/* - * kill the processes if they match given name - * - * Returns EXIT_SUCCESS signal was successfully sent to all matched processes, - * otherwise EXIT_FAILURE is returned. - */ -int kill_by_name(int signum, const char *name) -{ - team_info teamInfo; - uint32 cookie = 0; - int status = EXIT_SUCCESS; - int found = 0; - - while (get_next_team_info(&cookie, &teamInfo) >= B_OK) { - char *token, *args; - - args = teamInfo.args; - token = strchr(args, ' '); - if (token) { - /* remove process argument */ - *token = 0; - } - - /* skip the path if any */ - token = basename(args); - - if (!strncmp(name, token, strlen(token))) { - found = 1; - /* name matched */ - if (kill((pid_t)teamInfo.team, signum) != 0) { - error (0, errno, "%s", name); - status = EXIT_FAILURE; - } - } - } - - if (!found) - error (0, ESRCH, "%s", name); - - return status; -} - - + /* Send signal SIGNUM to all the processes or process groups specified by ARGV. Return a suitable exit status. */ static int send_signals (int signum, char *const *argv) { - int status = EXIT_SUCCESS; - char const *arg = *argv; - pid_t pid; + int status = EXIT_SUCCESS; + char const *arg = *argv; - do { - bool is_pid = is_number(arg, (intmax_t *) &pid); - if (is_pid) { - if (kill(pid, signum) != 0) { - error (0, errno, "%s", arg); - status = EXIT_FAILURE; - } - } else if (kill_by_name(signum, arg) != EXIT_SUCCESS) - status = EXIT_FAILURE; + do + { + char *endp; + intmax_t n = (errno = 0, strtoimax (arg, &endp, 10)); + pid_t pid = n; - } while ((arg = *++argv)); + if (errno == ERANGE || pid != n || arg == endp || *endp) + { + error (0, 0, _("%s: invalid process id"), arg); + status = EXIT_FAILURE; + } + else if (kill (pid, signum) != 0) + { + error (0, errno, "%s", arg); + status = EXIT_FAILURE; + } + } + while ((arg = *++argv)); - return status; + return status; } - - + int main (int argc, char **argv) { diff --git a/src/bin/debug/profile/BasicProfileResult.cpp b/src/bin/debug/profile/BasicProfileResult.cpp index 15e8fa3f85..52f707fbd2 100644 --- a/src/bin/debug/profile/BasicProfileResult.cpp +++ b/src/bin/debug/profile/BasicProfileResult.cpp @@ -6,6 +6,9 @@ #include "BasicProfileResult.h" +#if __GNUC__ > 2 +#include +#endif #include #include @@ -210,10 +213,23 @@ BasicProfileResult::PrintResults(ImageProfileResultContainer* container) for (int32 i = 0; i < hitSymbolCount; i++) { const HitSymbol& hitSymbol = hitSymbols[i]; const Symbol* symbol = hitSymbol.symbol; +#if __GNUC__ > 2 + int status; + const char* symbolName = __cxxabiv1::__cxa_demangle(symbol->Name(), + NULL, NULL, &status); + if (symbolName == NULL) + symbolName = symbol->Name(); +#else + const char* symbolName = symbol->Name(); +#endif fprintf(gOptions.output, " %10lld %10lld %6.2f %6ld %s\n", hitSymbol.hits, hitSymbol.hits * fInterval, 100.0 * hitSymbol.hits / totalTicks, hitSymbol.imageID, - symbol->Name()); + symbolName); +#if __GNUC__ > 2 + if (status == 0) + free(const_cast(symbolName)); +#endif } } else fprintf(gOptions.output, " no functions were hit\n"); diff --git a/src/bin/debug/profile/SharedImage.cpp b/src/bin/debug/profile/SharedImage.cpp index e35a51d5fa..9d3f453e84 100644 --- a/src/bin/debug/profile/SharedImage.cpp +++ b/src/bin/debug/profile/SharedImage.cpp @@ -40,7 +40,8 @@ SharedImage::Init(team_id owner, image_id imageID) { // we need a temporary symbol lookup context debug_symbol_lookup_context* lookupContext; - status_t error = debug_create_symbol_lookup_context(owner, &lookupContext); + status_t error = debug_create_symbol_lookup_context(owner, imageID, + &lookupContext); if (error != B_OK) { fprintf(stderr, "%s: Failed to create symbol lookup context " "for team %ld: %s\n", kCommandName, owner, strerror(error)); diff --git a/src/bin/debug/profile/profile.cpp b/src/bin/debug/profile/profile.cpp index dbe0d8f20a..dd50dcd81e 100644 --- a/src/bin/debug/profile/profile.cpp +++ b/src/bin/debug/profile/profile.cpp @@ -467,7 +467,9 @@ private: error = sharedImage->Init(name.String()); } - } else + } else if (strcmp(imageInfo.name, "commpage") == 0) + error = sharedImage->Init(teamID, imageInfo.id); + else error = sharedImage->Init(imageInfo.name); if (error != B_OK) return error; diff --git a/src/bin/hey.cpp b/src/bin/hey.cpp index b311ea353b..ac464bef00 100644 --- a/src/bin/hey.cpp +++ b/src/bin/hey.cpp @@ -164,11 +164,16 @@ parse(BMessenger& the_application, int argc, char *argv[], int32 argapp) } else { if (the_reply.what == (uint32)B_MESSAGE_NOT_UNDERSTOOD || the_reply.what==(uint32)B_ERROR){ // I do it myself if (the_reply.HasString("message")){ - if (!silent) - printf("%s (error 0x%8lX)\n", the_reply.FindString("message"), the_reply.FindInt32("error")); + if (!silent) { + printf("%s (error 0x%8" B_PRIx32 ")\n", + the_reply.FindString("message"), + the_reply.FindInt32("error")); + } } else { - if (!silent) - printf("error 0x%8lX\n", the_reply.FindInt32("error")); + if (!silent) { + printf("error 0x%8" B_PRIx32 "\n", + the_reply.FindInt32("error")); + } } return 1; } else { @@ -187,7 +192,7 @@ parse(BMessenger& the_application, int argc, char *argv[], int32 argapp) } else if(tc==B_INT32_TYPE){ int32 v; the_reply.FindInt32("result", &v); - printf("%ld\n", v); + printf("%" B_PRId32 "\n", v); } else if(tc==B_UINT8_TYPE){ uint8 v; the_reply.FindInt8("result", (int8*)&v); @@ -199,7 +204,7 @@ parse(BMessenger& the_application, int argc, char *argv[], int32 argapp) } else if(tc==B_UINT32_TYPE){ uint32 v; the_reply.FindInt32("result", (int32*)&v); - printf("%lu\n", v); + printf("%" B_PRIu32 "\n", v); } else if(tc==B_STRING_TYPE){ const char* v; the_reply.FindString("result", &v); @@ -288,8 +293,8 @@ main(int argc, char *argv[]) be_roster->GetAppList(&team_list); - for (int32 i=0; iGetRunningAppInfo(teamid, &appinfo); if (strcmp(appinfo.signature, argv[argapp])==0){ the_application=BMessenger(appinfo.signature); @@ -479,7 +484,7 @@ Hey(BMessenger* target, char* argv[], int32* argx, int32 argc, BMessage* reply) // if all goes well, rply contains all kinds of property infos int32 j=0; void *voidptr; - int32 sizefound; + ssize_t sizefound; BPropertyInfo propinfo; const value_info *vinfo; int32 vinfo_index, vinfo_count; @@ -958,8 +963,9 @@ void add_message_contents(BList *textlist, BMessage *msg, int32 level) { int32 count; - int32 i, sizefound, j; - ulong typefound; + int32 i, j; + type_code typefound; + ssize_t sizefound; #ifdef HAIKU_TARGET_PLATFORM_DANO const char *namefound; #else @@ -1178,14 +1184,15 @@ format_data(int32 type, char *ptr, long size) case B_INT64_TYPE: str = new char[64]; i64 = *(int64*)ptr; - sprintf(str, "%Ld (0x%LX)", i64, i64); + sprintf(str, "%" B_PRId64 " (0x%" B_PRIx64 ")", i64, i64); break; case B_SIZE_T_TYPE: case B_INT32_TYPE: str = new char[64]; i32 = *(int32*)ptr; - sprintf(str, "%ld (0x%08lX)", i32, i32); + sprintf(str, "%" B_PRId32 " (0x%08" B_PRId32 ")", i32, + i32); break; case B_INT16_TYPE: @@ -1204,13 +1211,15 @@ format_data(int32 type, char *ptr, long size) case B_UINT64_TYPE: str = new char[64]; ui64 = *(uint64*)ptr; - sprintf(str, "%Lu (0x%LX)", ui64, ui64); + sprintf(str, "%" B_PRIu64 " (0x%" B_PRIx64 ")", ui64, + ui64); break; case B_UINT32_TYPE: str = new char[64]; ui32 = *(uint32*)ptr; - sprintf(str, "%lu (0x%08lX)", ui32, ui32); + sprintf(str, "%" B_PRIu32 " (0x%08" B_PRIx32 ")", ui32, + ui32); break; case B_UINT16_TYPE: @@ -1394,7 +1403,8 @@ format_data(int32 type, char *ptr, long size) strcat(str, vinfo[vinfo_index].name); strcat(str, " "); - sprintf(str+strlen(str), "0x%8lX (", vinfo[vinfo_index].value); + sprintf(str+strlen(str), "0x%8" B_PRIx32 " (", + vinfo[vinfo_index].value); id_to_string(vinfo[vinfo_index].value, str+strlen(str)); strcat(str, ")"); diff --git a/src/bin/keymap/Keymap.cpp b/src/bin/keymap/Keymap.cpp index 0bf6cf81d5..c90fce03bf 100644 --- a/src/bin/keymap/Keymap.cpp +++ b/src/bin/keymap/Keymap.cpp @@ -687,7 +687,7 @@ Keymap::SaveAsCppHeader(const char* fileName, const char* mapName) fputs("};\n\n", file); - fputs("const char kSystemKeyChars[] = {\n", file); + fputs("const uchar kSystemKeyChars[] = {\n", file); for (uint32 i = 0; i < fCharsSize; i++) { if (i % 10 == 0) { diff --git a/src/bin/less/Jamfile b/src/bin/less/Jamfile index 9c5c97cd85..7553613556 100644 --- a/src/bin/less/Jamfile +++ b/src/bin/less/Jamfile @@ -6,14 +6,14 @@ TARGET_WARNING_CCFLAGS = [ FFilter $(TARGET_WARNING_CCFLAGS) SubDirCcFlags -DBINDIR='\"/bin\"' -DSYSDIR='\"/etc\"' ; -UseLibraryHeaders termcap ; +UseLibraryHeaders ncurses ; SubDirSysHdrs $(SUBDIR) ; BinCommand less : main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c decode.c edit.c filename.c forwback.c help.c ifile.c input.c jump.c line.c linenum.c lsystem.c mark.c optfunc.c option.c opttbl.c os.c output.c position.c prompt.c search.c signal.c tags.c ttyin.c version.c : - libtermcap.a : less.rdef ; + libncurses.a : less.rdef ; BinCommand lesskey : lesskey.c version.c : : less.rdef ; diff --git a/src/bin/network/telnet/Jamfile b/src/bin/network/telnet/Jamfile index 67604b72ca..66595aad9d 100644 --- a/src/bin/network/telnet/Jamfile +++ b/src/bin/network/telnet/Jamfile @@ -20,5 +20,5 @@ BinCommand telnet : telnet.c terminal.c utilities.c - : libtermcap.a libncurses.a libtelnet.a libutil.a libbsd.so $(TARGET_NETWORK_LIBS) + : libncurses.a libtelnet.a libutil.a libbsd.so $(TARGET_NETWORK_LIBS) ; diff --git a/src/bin/network/telnetd/Jamfile b/src/bin/network/telnetd/Jamfile index 13e1238a64..ad3e460948 100644 --- a/src/bin/network/telnetd/Jamfile +++ b/src/bin/network/telnetd/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src bin network telnetd ; -UseLibraryHeaders termcap ; +UseLibraryHeaders ncurses ; UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) src libs ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) src libs libtelnet ] : false ; @@ -19,5 +19,5 @@ BinCommand telnetd : telnetd.c termstat.c utility.c - : libtermcap.a libtelnet.a libutil.a libbsd.so $(TARGET_NETWORK_LIBS) + : libncurses.a libtelnet.a libutil.a libbsd.so $(TARGET_NETWORK_LIBS) ; diff --git a/src/bin/reindex.cpp b/src/bin/reindex.cpp index 090fa74f4e..319e605fa3 100644 --- a/src/bin/reindex.cpp +++ b/src/bin/reindex.cpp @@ -247,7 +247,7 @@ handleFile(BEntry *entry, BNode *node) } // rewrite attrs and empty the list - while ((attr = static_cast(list.RemoveItem(0L))) != NULL) { + while ((attr = static_cast(list.RemoveItem((int32)0))) != NULL) { // write attribute back to file status = attr->WriteToFile(node); if (status != B_OK) { @@ -294,8 +294,8 @@ copyIndicesFromVolume(const char *path, BEntry &to) if (fs_create_index(targetDevice, index->d_name, indexInfo.type, 0) == -1 && errno != B_FILE_EXISTS && errno != B_BAD_VALUE) { - fprintf(stderr, "Could not create index '%s' (type = %lu): %s\n", - index->d_name, indexInfo.type, strerror(errno)); + fprintf(stderr, "Could not create index '%s' (type = %" B_PRIu32 + "): %s\n", index->d_name, indexInfo.type, strerror(errno)); } else gAttrList.AddItem(strdup(index->d_name)); } diff --git a/src/bin/roster.cpp b/src/bin/roster.cpp index ae611b3e84..9eca23be26 100644 --- a/src/bin/roster.cpp +++ b/src/bin/roster.cpp @@ -79,7 +79,7 @@ output_team(team_id id, int32 mode) if ((mode & kNoTruncateMode) == 0) truncate_string(name, kNameFieldWidth); - printf("%6ld %*s %5ld %5lx (%s)\n", + printf("%6" B_PRId32 " %*s %5" B_PRId32 " %5" B_PRIx32 " (%s)\n", id, (int)kNameFieldWidth, name.String(), info.port, info.flags, info.signature); } @@ -141,7 +141,7 @@ main(int argc, char **argv) // Iterate through the list. for (int32 i = 0; i < applicationList.CountItems(); i++) - output_team((team_id)applicationList.ItemAt(i), mode); + output_team((team_id)(addr_t)applicationList.ItemAt(i), mode); return 0; } diff --git a/src/bin/tput.c b/src/bin/tput.c deleted file mode 100644 index 1289959a04..0000000000 --- a/src/bin/tput.c +++ /dev/null @@ -1,235 +0,0 @@ -/* $NetBSD: tput.c,v 1.15 2003/08/07 11:16:46 agc Exp $ */ - -/*- - * Copyright (c) 1980, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -//#include -#define __P(x) x -#ifndef lint -static char copyright[] ="@(#) Copyright (c) 1980, 1988, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)tput.c 8.3 (Berkeley) 4/28/95"; -#endif -static char rcsid[] = "$NetBSD: tput.c,v 1.15 2003/08/07 11:16:46 agc Exp $"; -#endif /* not lint */ - -#include - -//#include -#include -#include -#include -#include -#include - - int main __P((int, char **)); -static int outc __P((int)); -static void prlongname __P((char *)); -static void setospeed __P((void)); -static void usage __P((void)); -static char **process __P((char *, char *, char **)); - -int -main(argc, argv) - int argc; - char **argv; -{ - int ch, exitval, n; - char *cptr, *p, *term, buf[1024], tbuf[1024]; - - term = NULL; - while ((ch = getopt(argc, argv, "T:")) != -1) - switch(ch) { - case 'T': - term = optarg; - break; - case '?': - default: - usage(); - } - argc -= optind; - argv += optind; - - if (!term && !(term = getenv("TERM"))) - fprintf(stderr, "no terminal type specified and no TERM environmental variable."); - if (tgetent(tbuf, term) != 1) - fprintf(stderr, "tgetent failure"); - setospeed(); - for (exitval = 0; (p = *argv) != NULL; ++argv) { - switch (*p) { - case 'c': - if (!strcmp(p, "clear")) - p = "cl"; - break; - case 'i': - if (!strcmp(p, "init")) - p = "is"; - break; - case 'l': - if (!strcmp(p, "longname")) { - prlongname(tbuf); - continue; - } - break; - case 'r': - if (!strcmp(p, "reset")) - p = "rs"; - break; - } - cptr = buf; - if (tgetstr(p, &cptr)) - argv = process(p, buf, argv); - else if ((n = tgetnum(p)) != -1) - (void)printf("%d\n", n); - else - exitval = !tgetflag(p); - - if (argv == NULL) - break; - } - exit(argv ? exitval : 2); -} - -static void -prlongname(buf) - char *buf; -{ - int savech; - char *p, *savep; - - for (p = buf; *p && *p != ':'; ++p) - continue; - savech = *(savep = p); - for (*p = '\0'; p >= buf && *p != '|'; --p) - continue; - (void)printf("%s\n", p + 1); - *savep = savech; -} - -static char ** -process(cap, str, argv) - char *cap, *str, **argv; -{ - static const char errfew[] = - "not enough arguments (%d) for capability `%s'"; - static const char errmany[] = - "too many arguments (%d) for capability `%s'"; - static const char erresc[] = - "unknown %% escape `%c' for capability `%s'"; - char *cp; - int arg_need, arg_rows, arg_cols; - - /* Count how many values we need for this capability. */ - for (cp = str, arg_need = 0; *cp != '\0'; cp++) - if (*cp == '%') - switch (*++cp) { - case 'd': - case '2': - case '3': - case '.': - case '+': - arg_need++; - break; - case '%': - case '>': - case 'i': - case 'r': - case 'n': - case 'B': - case 'D': - break; - default: - /* - * hpux has lot's of them, but we complain - */ - fprintf(stderr, erresc, *cp, cap); - } - - /* And print them. */ - switch (arg_need) { - case 0: - (void)tputs(str, 1, outc); - break; - case 1: - arg_cols = 0; - - if (*++argv == NULL || *argv[0] == '\0') - fprintf(stderr, errfew); - arg_rows = atoi(*argv); - - (void)tputs(tgoto(str, arg_cols, arg_rows), 1, outc); - break; - case 2: - if (*++argv == NULL || *argv[0] == '\0') - fprintf(stderr, errfew); - arg_rows = atoi(*argv); - - if (*++argv == NULL || *argv[0] == '\0') - fprintf(stderr, errfew); - arg_cols = atoi(*argv); - - (void) tputs(tgoto(str, arg_cols, arg_rows), arg_rows, outc); - break; - - default: - fprintf(stderr, errmany); - } - return (argv); -} - -static void -setospeed() -{ -#undef ospeed - extern short ospeed; - struct termios t; - - if (tcgetattr(STDOUT_FILENO, &t) != -1) - ospeed = 0; - else - ospeed = cfgetospeed(&t); -} - -static int -outc(c) - int c; -{ - return (putchar(c)); -} - -static void -usage() -{ - (void)fprintf(stderr, "usage: tput [-T term] attribute ...\n"); - exit(1); -} diff --git a/src/bin/translate.cpp b/src/bin/translate.cpp index 27969917c8..48de3954ad 100644 --- a/src/bin/translate.cpp +++ b/src/bin/translate.cpp @@ -131,21 +131,21 @@ print_translation_format(const translation_format &format) void TypeList::Add(uint32 type) { - fList.AddItem((void *)type, 0); + fList.AddItem((void *)(addr_t)type, 0); } bool TypeList::Remove(uint32 type) { - return fList.RemoveItem((void *)type); + return fList.RemoveItem((void *)(addr_t)type); } bool TypeList::FindType(uint32 type) { - return fList.IndexOf((void *)type) >= 0; + return fList.IndexOf((void *)(addr_t)type) >= 0; } @@ -155,7 +155,7 @@ TypeList::SetTo(TypeList &types) fList.MakeEmpty(); for (int32 i = 0; i < types.Count(); i++) - fList.AddItem((void *)types.TypeAt(i)); + fList.AddItem((void *)(addr_t)types.TypeAt(i)); } @@ -169,7 +169,7 @@ TypeList::Count() uint32 TypeList::TypeAt(int32 index) { - return (uint32)fList.ItemAt(index); + return (uint32)(addr_t)fList.ItemAt(index); } @@ -612,7 +612,8 @@ TranslateApp::ListTranslators(uint32 type) continue; } - printf("name: %s\ninfo: %s\nversion: %ld.%ld.%ld\n", name, info, + printf("name: %s\ninfo: %s\nversion: %" B_PRId32 ".%" B_PRId32 ".%" + B_PRId32 "\n", name, info, B_TRANSLATION_MAJOR_VERSION(version), B_TRANSLATION_MINOR_VERSION(version), B_TRANSLATION_REVISION_VERSION(version)); diff --git a/src/kits/Jamfile b/src/kits/Jamfile index 952701f0f5..fda63283a8 100644 --- a/src/kits/Jamfile +++ b/src/kits/Jamfile @@ -17,7 +17,7 @@ if $(RUN_WITHOUT_APP_SERVER) != 0 { SubDirC++Flags $(defines) ; } -UsePrivateHeaders app interface kernel locale shared ; +UsePrivateHeaders app interface kernel locale print shared ; # Build our libbe.so @@ -62,15 +62,9 @@ SharedLibrary libbe_test.so : $(TARGET_LIBSTDC++) ; -SEARCH on [ FGristFiles AboutMenuItem.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; -SEARCH on [ FGristFiles AboutWindow.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; -SEARCH on [ FGristFiles ColorControl.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; -SEARCH on [ FGristFiles StringForSize.cpp ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; -SEARCH on [ FGristFiles TextView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; -SEARCH on [ FGristFiles Dragger.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; -SEARCH on [ FGristFiles Menu.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; -SEARCH on [ FGristFiles PrintJob.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; -SEARCH on [ FGristFiles ZombieReplicantView.cpp ] += [ FDirName $(HAIKU_TOP) src kits interface ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) interface ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) interface textview_support ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) shared ] ; DoCatalogs libbe.so : x-vnd.Haiku-libbe diff --git a/src/kits/debug/SymbolLookup.cpp b/src/kits/debug/SymbolLookup.cpp index 2d259fb666..53f41d78ad 100644 --- a/src/kits/debug/SymbolLookup.cpp +++ b/src/kits/debug/SymbolLookup.cpp @@ -1,5 +1,6 @@ /* * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -220,11 +221,12 @@ private: // constructor -SymbolLookup::SymbolLookup(team_id team) +SymbolLookup::SymbolLookup(team_id team, image_id image) : RemoteMemoryAccessor(team), fDebugArea(NULL), - fImages() + fImages(), + fImageID(image) { } @@ -281,53 +283,23 @@ SymbolLookup::Init() } } - // create a list of the team's images image_info imageInfo; - int32 cookie = 0; - while (get_next_image_info(fTeam, &cookie, &imageInfo) == B_OK) { - Image* image; - - if (fTeam == B_SYSTEM_TEAM) { - // kernel image - KernelImage* kernelImage = new(std::nothrow) KernelImage; - if (kernelImage == NULL) - return B_NO_MEMORY; - - error = kernelImage->Init(imageInfo); - image = kernelImage; - } else if (!strcmp("commpage", imageInfo.name)) { - // commpage image - CommPageImage* commPageImage = new(std::nothrow) CommPageImage; - if (commPageImage == NULL) - return B_NO_MEMORY; - - error = commPageImage->Init(imageInfo); - image = commPageImage; - } else { - // userland image -- try to load an image file - ImageFile* imageFile = new(std::nothrow) ImageFile; - if (imageFile == NULL) - return B_NO_MEMORY; - - error = imageFile->Init(imageInfo); - image = imageFile; + if (fImageID < 0) { + // create a list of the team's images + int32 cookie = 0; + while (get_next_image_info(fTeam, &cookie, &imageInfo) == B_OK) { + error = _LoadImageInfo(imageInfo); + if (error != B_OK) + return error; } + } else { + error = get_image_info(fImageID, &imageInfo); + if (error != B_OK) + return error; - if (error != B_OK) { - // initialization error -- fall back to the loaded image - delete image; - - const image_t* loadedImage = _FindLoadedImageByID(imageInfo.id); - if (loadedImage == NULL) - continue; - - image = new(std::nothrow) LoadedImage(this, loadedImage, - Read(loadedImage->symhash[1])); - if (image == NULL) - return B_NO_MEMORY; - } - - fImages.Add(image); + error = _LoadImageInfo(imageInfo); + if (error != B_OK) + return error; } return B_OK; @@ -534,6 +506,58 @@ SymbolLookup::_SymbolNameLen(const char* address) const } +status_t +SymbolLookup::_LoadImageInfo(const image_info& imageInfo) +{ + status_t error = B_OK; + + Image* image; + if (fTeam == B_SYSTEM_TEAM) { + // kernel image + KernelImage* kernelImage = new(std::nothrow) KernelImage; + if (kernelImage == NULL) + return B_NO_MEMORY; + + error = kernelImage->Init(imageInfo); + image = kernelImage; + } else if (!strcmp("commpage", imageInfo.name)) { + // commpage image + CommPageImage* commPageImage = new(std::nothrow) CommPageImage; + if (commPageImage == NULL) + return B_NO_MEMORY; + + error = commPageImage->Init(imageInfo); + image = commPageImage; + } else { + // userland image -- try to load an image file + ImageFile* imageFile = new(std::nothrow) ImageFile; + if (imageFile == NULL) + return B_NO_MEMORY; + + error = imageFile->Init(imageInfo); + image = imageFile; + } + + if (error != B_OK) { + // initialization error -- fall back to the loaded image + delete image; + + const image_t* loadedImage = _FindLoadedImageByID(imageInfo.id); + if (loadedImage == NULL) + return B_OK; + + image = new(std::nothrow) LoadedImage(this, loadedImage, + Read(loadedImage->symhash[1])); + if (image == NULL) + return B_NO_MEMORY; + + } + + fImages.Add(image); + + return B_OK; +} + // #pragma mark - LoadedImage diff --git a/src/kits/debug/SymbolLookup.h b/src/kits/debug/SymbolLookup.h index c7890c3b68..4631c02662 100644 --- a/src/kits/debug/SymbolLookup.h +++ b/src/kits/debug/SymbolLookup.h @@ -1,5 +1,6 @@ /* * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -136,7 +137,7 @@ struct SymbolIterator { // SymbolLookup class SymbolLookup : private RemoteMemoryAccessor { public: - SymbolLookup(team_id team); + SymbolLookup(team_id team, image_id image); ~SymbolLookup(); status_t Init(); @@ -166,10 +167,12 @@ private: Image* _FindImageAtAddress(addr_t address) const; Image* _FindImageByID(image_id id) const; size_t _SymbolNameLen(const char* address) const; + status_t _LoadImageInfo(const image_info& imageInfo); private: const runtime_loader_debug_area *fDebugArea; DoublyLinkedList fImages; + image_id fImageID; }; } // namespace Debug diff --git a/src/kits/debug/debug_support.cpp b/src/kits/debug/debug_support.cpp index e5691fb6dc..fdc231d3a9 100644 --- a/src/kits/debug/debug_support.cpp +++ b/src/kits/debug/debug_support.cpp @@ -1,6 +1,6 @@ /* * Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010, Rene Gollent, rene@gollent.com. + * Copyright 2010-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -345,7 +345,7 @@ debug_get_stack_frame(debug_context *context, void *stackFrameAddress, // debug_create_symbol_lookup_context status_t -debug_create_symbol_lookup_context(team_id team, +debug_create_symbol_lookup_context(team_id team, image_id image, debug_symbol_lookup_context **_lookupContext) { if (team < 0 || !_lookupContext) @@ -359,7 +359,7 @@ debug_create_symbol_lookup_context(team_id team, ObjectDeleter contextDeleter(lookupContext); // create and init symbol lookup - SymbolLookup *lookup = new(std::nothrow) SymbolLookup(team); + SymbolLookup *lookup = new(std::nothrow) SymbolLookup(team, image); if (lookup == NULL) return B_NO_MEMORY; ObjectDeleter lookupDeleter(lookup); diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index ed53bb17d9..16231f5048 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -396,6 +396,7 @@ BAlert::QuitRequested() } +// This method is deprecated, do not use BPoint BAlert::AlertPosition(float width, float height) { @@ -405,9 +406,9 @@ BAlert::AlertPosition(float width, float height) dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); BScreen screen(window); - BRect screenFrame(0, 0, 640, 480); - if (screen.IsValid()) - screenFrame = screen.Frame(); + BRect screenFrame(0, 0, 640, 480); + if (screen.IsValid()) + screenFrame = screen.Frame(); // Horizontally, we're smack in the middle result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0); @@ -499,9 +500,11 @@ BAlert::_InitObject(const char* text, const char* button0, const char* button1, } } - float defaultButtonFrameWidth = -fButtons[buttonCount - 1]->Bounds().Width() / 2.0f; + float defaultButtonFrameWidth + = -fButtons[buttonCount - 1]->Bounds().Width() / 2.0f; SetDefaultButton(fButtons[buttonCount - 1]); - defaultButtonFrameWidth += fButtons[buttonCount - 1]->Bounds().Width() / 2.0f; + defaultButtonFrameWidth + += fButtons[buttonCount - 1]->Bounds().Width() / 2.0f; // Layout buttons @@ -525,9 +528,9 @@ BAlert::_InitObject(const char* text, const char* button0, const char* button1, int32 iconLayoutScale = icon_layout_scale(); float totalWidth = kRightOffset + fButtons[buttonCount - 1]->Frame().right - defaultButtonFrameWidth - fButtons[0]->Frame().left; - if (view->Bitmap()) { + if (view->Bitmap()) totalWidth += (kIconStripeWidth + kWindowIconOffset) * iconLayoutScale; - } else + else totalWidth += kWindowMinOffset; float width = (spacing == B_OFFSET_SPACING @@ -570,7 +573,13 @@ BAlert::_InitObject(const char* text, const char* button0, const char* button1, AddCommonFilter(new(std::nothrow) _BAlertFilter_(this)); - MoveTo(AlertPosition(Frame().Width(), Frame().Height())); + // Position the alert so that it is centered vertically but offset a bit + // horizontally in the parent window's frame or, if unavailable, the + // screen frame. + BWindow* parent = + dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + const BRect frame = parent != NULL ? parent->Frame() : BScreen(this).Frame(); + MoveTo(dynamic_cast(this)->AlertPosition(frame)); } @@ -815,4 +824,3 @@ _BAlertFilter_::Filter(BMessage* msg, BHandler** target) return B_DISPATCH_MESSAGE; } - diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 56c4efaf57..491b00d0f7 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -1,16 +1,17 @@ /* - * Copyright 2001-2009 Haiku, Inc. All rights reserved. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * Marc Flerackers (mflerackers@androme.be) - * Stephan Aßmus + * Stephan Aßmus, superstippi@gmx.de + * Marc Flerackers, mflerackers@androme.be + * John Scipione, jcipione@gmail.com */ #include -#include +#include #include #include @@ -18,10 +19,13 @@ #include #include #include -#include #include +static const float kPopUpIndicatorWidth = 10.0f; +static const float kMarginWidth = 3.0f; + + _BMCFilter_::_BMCFilter_(BMenuField* menuField, uint32 what) : BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, what), @@ -68,11 +72,11 @@ _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField) } -_BMCMenuBar_::_BMCMenuBar_(bool fixedSize, BMenuField* menuField) +_BMCMenuBar_::_BMCMenuBar_(BMenuField* menuField) : - BMenuBar("_mc_mb_", B_ITEMS_IN_ROW, !fixedSize), + BMenuBar("_mc_mb_", B_ITEMS_IN_ROW), fMenuField(menuField), - fFixedSize(fixedSize), + fFixedSize(true), fRunner(NULL), fShowPopUpMarker(true) { @@ -81,7 +85,8 @@ _BMCMenuBar_::_BMCMenuBar_(bool fixedSize, BMenuField* menuField) _BMCMenuBar_::_BMCMenuBar_(BMessage* data) - : BMenuBar(data), + : + BMenuBar(data), fMenuField(NULL), fFixedSize(true), fRunner(NULL), @@ -134,119 +139,29 @@ _BMCMenuBar_::AttachedToWindow() void _BMCMenuBar_::Draw(BRect updateRect) { - if (be_control_look != NULL) { - BRect rect(Bounds()); - rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); - uint32 flags = 0; - if (!IsEnabled()) - flags |= BControlLook::B_DISABLED; - if (IsFocus()) - flags |= BControlLook::B_FOCUSED; - be_control_look->DrawMenuFieldBackground(this, rect, - updateRect, base, fShowPopUpMarker, flags); - - _DrawItems(updateRect); - - return; + // Set the width of the menu bar because the menu bar bounds may have + // been expanded by the selected menu item. + if (fFixedSize) + ResizeTo(fMenuField->_MenuBarWidth(), Bounds().Height()); + else { + // For compatability with BeOS R5 set the height to the preferred height + // in auto-size mode ignoring the height of the menu field. + float height; + BMenuBar::GetPreferredSize(NULL, &height); + ResizeTo(std::min(Bounds().Width(), fMenuField->_MenuBarWidth()), height); } + BRect rect(Bounds()); + rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); + uint32 flags = 0; + if (!IsEnabled()) + flags |= BControlLook::B_DISABLED; + if (IsFocus()) + flags |= BControlLook::B_FOCUSED; - if (!fShowPopUpMarker) { - BMenuBar::Draw(updateRect); - return; - } + be_control_look->DrawMenuFieldBackground(this, rect, + updateRect, base, fShowPopUpMarker, flags); - // draw the right side with the popup marker - - // prevent the original BMenuBar's Draw from - // drawing in those parts - BRect bounds(Bounds()); - bounds.right -= 10.0; - bounds.bottom -= 1.0; - - BRegion clipping(bounds); - ConstrainClippingRegion(&clipping); - - BMenuBar::Draw(updateRect); - - // restore clipping - ConstrainClippingRegion(NULL); - bounds.right += 10.0; - bounds.bottom += 1.0; - - // prepare some colors - rgb_color normalNoTint = LowColor(); - rgb_color noTint = tint_color(normalNoTint, 0.74); - rgb_color darken4; - rgb_color normalDarken4; - rgb_color darken1; - rgb_color lighten1; - rgb_color lighten2; - - if (IsEnabled()) { - darken4 = tint_color(noTint, B_DARKEN_4_TINT); - normalDarken4 = tint_color(normalNoTint, B_DARKEN_4_TINT); - darken1 = tint_color(noTint, B_DARKEN_1_TINT); - lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT); - lighten2 = tint_color(noTint, B_LIGHTEN_2_TINT); - } else { - darken4 = tint_color(noTint, B_DARKEN_2_TINT); - normalDarken4 = tint_color(normalNoTint, B_DARKEN_2_TINT); - darken1 = tint_color(noTint, (B_NO_TINT + B_DARKEN_1_TINT) / 2.0); - lighten1 = tint_color(noTint, (B_NO_TINT + B_LIGHTEN_1_TINT) / 2.0); - lighten2 = tint_color(noTint, B_LIGHTEN_1_TINT); - } - - BRect r(bounds); - r.left = r.right - 10.0; - - BeginLineArray(6); - // bottom below item text, darker then BMenuBar - // would normaly draw it - AddLine(BPoint(bounds.left, r.bottom), - BPoint(r.left - 1.0, r.bottom), normalDarken4); - - // bottom below popup marker - AddLine(BPoint(r.left, r.bottom), - BPoint(r.right, r.bottom), darken4); - // right of popup marker - AddLine(BPoint(r.right, r.bottom - 1), - BPoint(r.right, r.top), darken4); - // top above popup marker - AddLine(BPoint(r.left, r.top), - BPoint(r.right - 2, r.top), lighten2); - - r.top += 1; - r.bottom -= 1; - r.right -= 1; - - // bottom below popup marker - AddLine(BPoint(r.left, r.bottom), - BPoint(r.right, r.bottom), darken1); - // right of popup marker - AddLine(BPoint(r.right, r.bottom - 1), - BPoint(r.right, r.top), darken1); - EndLineArray(); - - r.bottom -= 1; - r.right -= 1; - SetHighColor(noTint); - FillRect(r); - - // popup marker - BPoint center(roundf((r.left + r.right) / 2.0), - roundf((r.top + r.bottom) / 2.0)); - BPoint triangle[3]; - triangle[0] = center + BPoint(-2.5, -0.5); - triangle[1] = center + BPoint(2.5, -0.5); - triangle[2] = center + BPoint(0.0, 2.0); - - uint32 flags = Flags(); - SetFlags(flags | B_SUBPIXEL_PRECISE); - - SetHighColor(normalDarken4); - FillTriangle(triangle[0], triangle[1], triangle[2]); - - SetFlags(flags); + _DrawItems(updateRect); } @@ -271,7 +186,6 @@ _BMCMenuBar_::FrameResized(float width, float height) dirty = Bounds(); dirty.left = dirty.right - diff - 12; Invalidate(dirty); - } else if (diff < 0) { // clean up the dirty right line of // the menu field when shrinking @@ -287,14 +201,6 @@ _BMCMenuBar_::FrameResized(float width, float height) } } - if (!fFixedSize && ResizingMode() == (B_FOLLOW_LEFT | B_FOLLOW_TOP)) { - // we have been shrinked or enlarged and need to take care - // of the size of the parent menu field as well - // NOTE: no worries about follow mode, we follow left and top - // in autosize mode - diff = Frame().right + 2 - fMenuField->Bounds().right; - fMenuField->ResizeBy(diff, 0.0); - } BMenuBar::FrameResized(width, height); } @@ -364,7 +270,7 @@ _BMCMenuBar_::MinSize() if (fShowPopUpMarker) { // account for popup indicator + a few pixels margin - size.width += 13.0; + size.width += kPopUpIndicatorWidth + kMarginWidth; } return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); @@ -410,11 +316,12 @@ _BMCMenuBar_::_Init(bool setMaxContentWidth) if (be_control_look != NULL) left = right = be_control_look->DefaultLabelSpacing(); - SetItemMargins(left, top, right + fShowPopUpMarker ? 10 : 0, bottom); + SetItemMargins(left, top, + right + fShowPopUpMarker ? kPopUpIndicatorWidth + kMarginWidth : 0, + bottom); fPreviousWidth = Bounds().Width(); if (setMaxContentWidth) SetMaxContentWidth(fPreviousWidth - (left + right)); } - diff --git a/src/kits/interface/ColumnTypes.cpp b/src/kits/interface/ColumnTypes.cpp index 432476f23e..65ffb99746 100644 --- a/src/kits/interface/ColumnTypes.cpp +++ b/src/kits/interface/ColumnTypes.cpp @@ -159,6 +159,13 @@ BStringField::SetClippedString(const char* val) } +bool +BStringField::HasClippedString() const +{ + return !fClippedString.IsEmpty(); +} + + const char* BStringField::ClippedString() { @@ -182,17 +189,22 @@ BStringColumn::DrawField(BField* _field, BRect rect, BView* parent) { float width = rect.Width() - (2 * kTEXT_MARGIN); BStringField* field = static_cast(_field); - bool clipNeeded = width < field->Width(); + float fieldWidth = field->Width(); + bool updateNeeded = width != fieldWidth; - if (clipNeeded) { + if (updateNeeded) { BString out_string(field->String()); - - parent->TruncateString(&out_string, fTruncate, width + 2); - field->SetClippedString(out_string.String()); + float preferredWidth = parent->StringWidth(out_string.String()); + if (width < preferredWidth) { + parent->TruncateString(&out_string, fTruncate, width + 2); + field->SetClippedString(out_string.String()); + } else + field->SetClippedString(""); field->SetWidth(width); } - DrawString(clipNeeded ? field->ClippedString() : field->String(), parent, rect); + DrawString(field->HasClippedString() ? field->ClippedString() + : field->String(), parent, rect); } diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp index 0be8af3338..ccb87cb863 100644 --- a/src/kits/interface/ControlLook.cpp +++ b/src/kits/interface/ControlLook.cpp @@ -2944,7 +2944,7 @@ BControlLook::_EdgeLightColor(const rgb_color& base, float contrast, if ((flags & B_BLEND_FRAME) != 0) { uint8 alpha = uint8(20 * contrast); - uint32 white = uint8(255 * brightness); + uint8 white = uint8(255 * brightness); edgeLightColor = (rgb_color){ white, white, white, alpha }; } else { diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 4cfe417675..5c1b4baa3f 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -284,9 +284,9 @@ BListView::WindowActivated(bool state) void -BListView::MessageReceived(BMessage* msg) +BListView::MessageReceived(BMessage* message) { - switch (msg->what) { + switch (message->what) { case B_COUNT_PROPERTIES: case B_EXECUTE_PROPERTY: case B_GET_PROPERTY: @@ -296,14 +296,14 @@ BListView::MessageReceived(BMessage* msg) BMessage specifier; const char *property; - if (msg->GetCurrentSpecifier(NULL, &specifier) != B_OK + if (message->GetCurrentSpecifier(NULL, &specifier) != B_OK || specifier.FindString("property", &property) != B_OK) return; - switch (propInfo.FindMatch(msg, 0, &specifier, msg->what, + switch (propInfo.FindMatch(message, 0, &specifier, message->what, property)) { case B_ERROR: - BView::MessageReceived(msg); + BView::MessageReceived(message); break; case 0: @@ -312,7 +312,7 @@ BListView::MessageReceived(BMessage* msg) reply.AddInt32("result", CountItems()); reply.AddInt32("error", B_OK); - msg->SendReply(&reply); + message->SendReply(&reply); break; } @@ -332,7 +332,7 @@ BListView::MessageReceived(BMessage* msg) reply.AddInt32("result", count); reply.AddInt32("error", B_OK); - msg->SendReply(&reply); + message->SendReply(&reply); break; } @@ -350,7 +350,7 @@ BListView::MessageReceived(BMessage* msg) reply.AddInt32("error", B_OK); - msg->SendReply(&reply); + message->SendReply(&reply); break; } @@ -362,14 +362,14 @@ BListView::MessageReceived(BMessage* msg) BMessage reply(B_REPLY); bool select; - if (msg->FindBool("data", &select) == B_OK && select) + if (message->FindBool("data", &select) == B_OK && select) Select(0, CountItems() - 1, false); else DeselectAll(); reply.AddInt32("error", B_OK); - msg->SendReply(&reply); + message->SendReply(&reply); break; } } @@ -382,7 +382,7 @@ BListView::MessageReceived(BMessage* msg) break; default: - BView::MessageReceived(msg); + BView::MessageReceived(message); } } @@ -686,7 +686,7 @@ BListView::ScrollTo(BPoint point) bool -BListView::AddItem(BListItem *item, int32 index) +BListView::AddItem(BListItem* item, int32 index) { if (!fList.AddItem(item, index)) return false; @@ -909,7 +909,7 @@ BListView::ItemAt(int32 index) const int32 -BListView::IndexOf(BListItem *item) const +BListView::IndexOf(BListItem* item) const { if (Window()) { if (item != NULL) { diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index e8b7283e72..3b7bb02108 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1,12 +1,13 @@ /* - * Copyright 2001-2011, Haiku Inc. All rights reserved. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: - * Marc Flerackers (mflerackers@androme.be) - * Stefano Ceccherini (stefano.ceccherini@gmail.com) - * Rene Gollent (anevilyak@gmail.com) - * Stephan Aßmus + * Stephan Aßmus, superstippi@gmx.de + * Stefano Ceccherini, stefano.ceccherini@gmail.com + * Marc Flerackers, mflerackers@androme.be + * Rene Gollent, anevilyak@gmail.com + * John Scipione, jscipione@gmail.com */ @@ -733,7 +734,7 @@ BMenu::AddItem(BMenuItem* item, BRect frame) "be called if the menu layout is B_ITEMS_IN_MATRIX"); } - if (!item) + if (item == NULL) return false; item->fBounds = frame; @@ -758,7 +759,7 @@ bool BMenu::AddItem(BMenu* submenu) { BMenuItem* item = new (nothrow) BMenuItem(submenu); - if (!item) + if (item == NULL) return false; if (!AddItem(item, CountItems())) { @@ -780,7 +781,7 @@ BMenu::AddItem(BMenu* submenu, int32 index) } BMenuItem* item = new (nothrow) BMenuItem(submenu); - if (!item) + if (item == NULL) return false; if (!AddItem(item, index)) { @@ -802,7 +803,7 @@ BMenu::AddItem(BMenu* submenu, BRect frame) } BMenuItem* item = new (nothrow) BMenuItem(submenu); - if (!item) + if (item == NULL) return false; if (!AddItem(item, frame)) { @@ -2848,7 +2849,8 @@ BMenu::_UpdateWindowViewSize(const bool &move) return; bool scroll = false; - const BPoint screenLocation = move ? ScreenLocation() : window->Frame().LeftTop(); + const BPoint screenLocation = move ? ScreenLocation() + : window->Frame().LeftTop(); BRect frame = _CalcFrame(screenLocation, &scroll); ResizeTo(frame.Width(), frame.Height()); @@ -2870,7 +2872,24 @@ BMenu::_UpdateWindowViewSize(const bool &move) screen.Frame().bottom - frame.top); } - window->AttachScrollers(); + if (fLayout == B_ITEMS_IN_COLUMN) { + // we currently only support scrolling for B_ITEMS_IN_COLUMN + window->AttachScrollers(); + + BMenuItem* selectedItem = FindMarked(); + if (selectedItem != NULL) { + // scroll to the selected item + if (Supermenu() == NULL) { + window->TryScrollTo(selectedItem->Frame().top); + } else { + BPoint point = selectedItem->Frame().LeftTop(); + BPoint superPoint = Superitem()->Frame().LeftTop(); + Supermenu()->ConvertToScreen(&superPoint); + ConvertToScreen(&point); + window->TryScrollTo(point.y - superPoint.y); + } + } + } } } else { _CacheFontInfo(); @@ -3007,4 +3026,3 @@ B_IF_GCC_2(InvalidateLayout__5BMenub,_ZN5BMenu16InvalidateLayoutEb)( { menu->InvalidateLayout(); } - diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index b582d87087..987f355404 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -279,44 +279,14 @@ BMenuBar::Draw(BRect updateRect) return; } - if (be_control_look != NULL) { - BRect rect(Bounds()); - rgb_color base = LowColor(); - uint32 flags = 0; + BRect rect(Bounds()); + rgb_color base = LowColor(); + uint32 flags = 0; - be_control_look->DrawBorder(this, rect, updateRect, base, - B_PLAIN_BORDER, flags, BControlLook::B_BOTTOM_BORDER); + be_control_look->DrawBorder(this, rect, updateRect, base, + B_PLAIN_BORDER, flags, BControlLook::B_BOTTOM_BORDER); - be_control_look->DrawMenuBarBackground(this, rect, updateRect, base); - - _DrawItems(updateRect); - return; - } - - // TODO: implement additional border styles - rgb_color color = HighColor(); - - BRect bounds(Bounds()); - // Restore the background of the previously selected menuitem - DrawBackground(bounds & updateRect); - - rgb_color noTint = LowColor(); - - SetHighColor(tint_color(noTint, B_LIGHTEN_2_TINT)); - StrokeLine(BPoint(0.0f, bounds.bottom - 2.0f), BPoint(0.0f, 0.0f)); - StrokeLine(BPoint(bounds.right, 0.0f)); - - SetHighColor(tint_color(noTint, B_DARKEN_1_TINT)); - StrokeLine(BPoint(1.0f, bounds.bottom - 1.0f), - BPoint(bounds.right, bounds.bottom - 1.0f)); - - SetHighColor(tint_color(noTint, B_DARKEN_2_TINT)); - StrokeLine(BPoint(0.0f, bounds.bottom), - BPoint(bounds.right, bounds.bottom)); - StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom)); - - SetHighColor(color); - // revert to previous used color (cheap PushState()/PopState()) + be_control_look->DrawMenuBarBackground(this, rect, updateRect, base); _DrawItems(updateRect); } diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 676afbac73..cdfe7477f7 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -11,6 +11,7 @@ #include +#include #include #include @@ -134,9 +135,9 @@ static float kVMargin = 2.0f; BMenuField::BMenuField(BRect frame, const char* name, const char* label, - BMenu* menu, uint32 resize, uint32 flags) + BMenu* menu, uint32 resizingMode, uint32 flags) : - BView(frame, name, resize, flags) + BView(frame, name, resizingMode, flags) { CALLED(); @@ -152,9 +153,9 @@ BMenuField::BMenuField(BRect frame, const char* name, const char* label, BMenuField::BMenuField(BRect frame, const char* name, const char* label, - BMenu* menu, bool fixedSize, uint32 resize, uint32 flags) + BMenu* menu, bool fixedSize, uint32 resizingMode, uint32 flags) : - BView(frame, name, resize, flags) + BView(frame, name, resizingMode, flags) { InitObject(label); @@ -168,7 +169,7 @@ BMenuField::BMenuField(BRect frame, const char* name, const char* label, BMenuField::BMenuField(const char* name, const char* label, BMenu* menu, - uint32 flags) + uint32 flags) : BView(name, flags | B_FRAME_EVENTS) { @@ -353,54 +354,22 @@ BMenuField::AllUnarchived(const BMessage* from) void -BMenuField::Draw(BRect update) +BMenuField::Draw(BRect updateRect) { - BRect bounds(Bounds()); - bool active = IsFocus() && Window()->IsActive(); + DrawLabel(updateRect); - DrawLabel(bounds, update); + BRect rect(fMenuBar->Frame()); + rect.InsetBy(-kVMargin, -kVMargin); + rgb_color base = fMenuBar->LowColor(); + rgb_color background = LowColor(); + uint32 flags = 0; + if (!fMenuBar->IsEnabled()) + flags |= BControlLook::B_DISABLED; + if (IsFocus() && Window()->IsActive()) + flags |= BControlLook::B_FOCUSED; - BRect frame(fMenuBar->Frame()); - - if (be_control_look != NULL) { - frame.InsetBy(-kVMargin, -kVMargin); - rgb_color base = fMenuBar->LowColor(); - rgb_color background = LowColor(); - uint32 flags = 0; - if (!fMenuBar->IsEnabled()) - flags |= BControlLook::B_DISABLED; - if (active) - flags |= BControlLook::B_FOCUSED; - be_control_look->DrawMenuFieldFrame(this, frame, update, base, - background, flags); - return; - } - - if (frame.InsetByCopy(-kVMargin, -kVMargin).Intersects(update)) { - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT)); - StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f), - BPoint(frame.left - 1.0f, frame.bottom - 1.0f)); - StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f), - BPoint(frame.right - 1.0f, frame.top - 1.0f)); - - StrokeLine(BPoint(frame.left + 1.0f, frame.bottom + 1.0f), - BPoint(frame.right + 1.0f, frame.bottom + 1.0f)); - StrokeLine(BPoint(frame.right + 1.0f, frame.top + 1.0f)); - - SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT)); - StrokeLine(BPoint(frame.left - 1.0f, frame.bottom), - BPoint(frame.left - 1.0f, frame.bottom)); - StrokeLine(BPoint(frame.right, frame.top - 1.0f), - BPoint(frame.right, frame.top - 1.0f)); - } - - if (active || fTransition) { - SetHighColor(active ? ui_color(B_KEYBOARD_NAVIGATION_COLOR) : - ViewColor()); - StrokeRect(frame.InsetByCopy(-kVMargin, -kVMargin)); - - fTransition = false; - } + be_control_look->DrawMenuFieldFrame(this, rect, updateRect, base, + background, flags); } @@ -452,7 +421,7 @@ BMenuField::MouseDown(BPoint where) fMenuBar->StartMenuBar(-1, false, true, &bounds); fMenuTaskID = spawn_thread((thread_func)_thread_entry, - "_m_task_", B_NORMAL_PRIORITY, this); + "_m_task_", B_NORMAL_PRIORITY, this); if (fMenuTaskID >= 0) resume_thread(fMenuTaskID); } @@ -502,9 +471,9 @@ BMenuField::MakeFocus(bool state) void -BMenuField::MessageReceived(BMessage* msg) +BMenuField::MessageReceived(BMessage* message) { - BView::MessageReceived(msg); + BView::MessageReceived(message); } @@ -654,18 +623,18 @@ BMenuField::Alignment() const void -BMenuField::SetDivider(float divider) +BMenuField::SetDivider(float position) { - divider = floorf(divider + 0.5); + position = floorf(position + 0.5); - float dx = fDivider - divider; + float delta = fDivider - position; - if (dx == 0.0f) + if (delta == 0.0f) return; - fDivider = divider; + fDivider = position; - if (Flags() & B_SUPPORTS_LAYOUT) { + if ((Flags() & B_SUPPORTS_LAYOUT) != 0) { // We should never get here, since layout support means, we also // layout the divider, and don't use this method at all. Relayout(); @@ -910,7 +879,7 @@ void BMenuField::DoLayout() { // Bail out, if we shan't do layout. - if (!(Flags() & B_SUPPORTS_LAYOUT)) + if ((Flags() & B_SUPPORTS_LAYOUT) == 0) return; CALLED(); @@ -984,7 +953,7 @@ BMenuField::InitObject(const char* label) SetLabel(label); if (label) - fDivider = (float)floor(Frame().Width() / 2.0f); + fDivider = floorf(Frame().Width() / 2.0f); else fDivider = 0; } @@ -1009,42 +978,44 @@ BMenuField::InitObject2() void -BMenuField::DrawLabel(BRect bounds, BRect update) +BMenuField::DrawLabel(BRect updateRect) { CALLED(); _ValidateLayoutData(); font_height& fh = fLayoutData->font_info; - if (Label()) { - SetLowColor(ViewColor()); + const char* label = Label(); + if (label == NULL) + return; - // horizontal alignment - float x; - switch (fAlign) { - case B_ALIGN_RIGHT: - x = fDivider - fLayoutData->label_width - 3.0; - break; + SetLowColor(ViewColor()); - case B_ALIGN_CENTER: - x = fDivider - fLayoutData->label_width / 2.0; - break; + // horizontal alignment + float x; + switch (fAlign) { + case B_ALIGN_RIGHT: + x = fDivider - fLayoutData->label_width - 3.0; + break; - default: - x = 0.0; - break; - } + case B_ALIGN_CENTER: + x = fDivider - fLayoutData->label_width / 2.0; + break; - // vertical alignment - float y = Bounds().top - + (Bounds().Height() + 1 - fh.ascent - fh.descent) / 2 - + fh.ascent; - y = floor(y + 0.5); - - SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), - IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT)); - DrawString(Label(), BPoint(x, y)); + default: + x = 0.0; + break; } + + // vertical alignment + float y = Bounds().top + + (Bounds().Height() + 1 - fh.ascent - fh.descent) / 2 + + fh.ascent; + y = floor(y + 0.5); + + SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), + IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT)); + DrawString(label, BPoint(x, y)); } @@ -1136,8 +1107,8 @@ BMenuField::_InitMenuBar(BMenu* menu, BRect frame, bool fixedSize) fMenu = menu; InitMenu(menu); - if ((Flags() & B_SUPPORTS_LAYOUT)) { - fMenuBar = new _BMCMenuBar_(fixedSize, this); + if ((Flags() & B_SUPPORTS_LAYOUT) != 0) { + fMenuBar = new _BMCMenuBar_(this); } else { frame.left = _MenuBarOffset(); frame.top = kVMargin; @@ -1163,7 +1134,6 @@ BMenuField::_InitMenuBar(BMenu* menu, BRect frame, bool fixedSize) AddChild(fMenuBar); fMenuBar->AddItem(menu); - fMenuBar->SetFont(be_plain_font); } @@ -1176,7 +1146,7 @@ BMenuField::_InitMenuBar(const BMessage* archive) fFixedSizeMB = fixed; fMenuBar = (BMenuBar*)FindView("_mc_mb_"); - if (!fMenuBar) { + if (fMenuBar == NULL) { _InitMenuBar(new BMenu(""), BRect(0, 0, 100, 15), fFixedSizeMB); InitObject2(); } else { @@ -1223,8 +1193,8 @@ BMenuField::_ValidateLayoutData() divider = fLayoutData->label_width + 5; // If we shan't do real layout, we let the current divider take influence. - if (!(Flags() & B_SUPPORTS_LAYOUT)) - divider = max_c(divider, fDivider); + if ((Flags() & B_SUPPORTS_LAYOUT) == 0) + divider = std::max(divider, fDivider); // get the minimal (== preferred) menu bar size // TODO: BMenu::MinSize() is using the ResizeMode() to decide the @@ -1257,7 +1227,7 @@ BMenuField::_ValidateLayoutData() float BMenuField::_MenuBarOffset() const { - return max_c(kVMargin, fDivider + kVMargin); + return std::max(fDivider + kVMargin, kVMargin); } diff --git a/src/kits/interface/MenuItem.cpp b/src/kits/interface/MenuItem.cpp index 98f5e005f2..4e5691b2ab 100644 --- a/src/kits/interface/MenuItem.cpp +++ b/src/kits/interface/MenuItem.cpp @@ -1,12 +1,13 @@ /* - * Copyright 2001-2008, Haiku, Inc. + * Copyright 2001-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * Marc Flerackers (mflerackers@androme.be) - * Bill Hayden (haydentech@users.sourceforge.net) - * Stefano Ceccherini (stefano.ceccherini@gmail.com) + * Stefano Ceccherini, stefano.ceccherini@gmail.com + * Marc Flerackers, mflerackers@androme.be + * Bill Hayden, haydentech@users.sourceforge.net * Olivier Milla + * John Scipione, jscipione@gmail.com */ //! Display item for BMenu class @@ -55,8 +56,8 @@ const char *kUTF8ControlMap[] = { using BPrivate::MenuPrivate; -BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut, - uint32 modifiers) +BMenuItem::BMenuItem(const char* label, BMessage* message, char shortcut, + uint32 modifiers) { _InitData(); if (label != NULL) @@ -73,7 +74,7 @@ BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut, } -BMenuItem::BMenuItem(BMenu *menu, BMessage *message) +BMenuItem::BMenuItem(BMenu* menu, BMessage* message) { _InitData(); SetMessage(message); @@ -81,7 +82,7 @@ BMenuItem::BMenuItem(BMenu *menu, BMessage *message) } -BMenuItem::BMenuItem(BMessage *data) +BMenuItem::BMenuItem(BMessage* data) { _InitData(); @@ -121,9 +122,9 @@ BMenuItem::BMenuItem(BMessage *data) BMessage subMessage; if (data->FindMessage("_submenu", &subMessage) == B_OK) { - BArchivable *object = instantiate_object(&subMessage); + BArchivable* object = instantiate_object(&subMessage); if (object != NULL) { - BMenu *menu = dynamic_cast(object); + BMenu* menu = dynamic_cast(object); if (menu != NULL) _InitMenuData(menu); } @@ -131,8 +132,8 @@ BMenuItem::BMenuItem(BMessage *data) } -BArchivable * -BMenuItem::Instantiate(BMessage *data) +BArchivable* +BMenuItem::Instantiate(BMessage* data) { if (validate_instantiation(data, "BMenuItem")) return new BMenuItem(data); @@ -142,7 +143,7 @@ BMenuItem::Instantiate(BMessage *data) status_t -BMenuItem::Archive(BMessage *data, bool deep) const +BMenuItem::Archive(BMessage* data, bool deep) const { status_t ret = BArchivable::Archive(data, deep); @@ -217,7 +218,7 @@ BMenuItem::SetEnabled(bool state) if (fSubmenu != NULL) fSubmenu->SetEnabled(state); - BMenu *menu = Menu(); + BMenu* menu = fSuper; if (menu != NULL && menu->LockLooper()) { menu->Invalidate(fBounds); menu->UnlockLooper(); @@ -230,8 +231,8 @@ BMenuItem::SetMarked(bool state) { fMark = state; - if (state && Menu() != NULL) { - MenuPrivate priv(Menu()); + if (state && fSuper != NULL) { + MenuPrivate priv(fSuper); priv.ItemMarked(this); } } @@ -292,7 +293,7 @@ BMenuItem::SetShortcut(char ch, uint32 modifiers) } -const char * +const char* BMenuItem::Label() const { return fLabel; @@ -308,7 +309,7 @@ BMenuItem::IsEnabled() const if (!fEnabled) return false; - return fSuper ? fSuper->IsEnabled() : true; + return fSuper != NULL ? fSuper->IsEnabled() : true; } @@ -327,7 +328,7 @@ BMenuItem::Trigger() const char -BMenuItem::Shortcut(uint32 *modifiers) const +BMenuItem::Shortcut(uint32* modifiers) const { if (modifiers) *modifiers = fModifiers; @@ -336,14 +337,14 @@ BMenuItem::Shortcut(uint32 *modifiers) const } -BMenu * +BMenu* BMenuItem::Submenu() const { return fSubmenu; } -BMenu * +BMenu* BMenuItem::Menu() const { return fSuper; @@ -358,7 +359,7 @@ BMenuItem::Frame() const void -BMenuItem::GetContentSize(float *width, float *height) +BMenuItem::GetContentSize(float* width, float* height) { // TODO: Get rid of this. BMenu should handle this // automatically. Maybe it's not even needed, since our @@ -369,14 +370,13 @@ BMenuItem::GetContentSize(float *width, float *height) if (width) *width = (float)ceil(fCachedWidth); - if (height) { + if (height) *height = MenuPrivate(fSuper).FontHeight(); - } } void -BMenuItem::TruncateLabel(float maxWidth, char *newLabel) +BMenuItem::TruncateLabel(float maxWidth, char* newLabel) { BFont font; fSuper->GetFont(&font); @@ -399,23 +399,20 @@ BMenuItem::DrawContent() fSuper->MovePenBy(0, menuPrivate.Ascent()); BPoint lineStart = fSuper->PenLocation(); - float labelWidth, labelHeight; - GetContentSize(&labelWidth, &labelHeight); - fSuper->SetDrawingMode(B_OP_OVER); - float frameWidth = fBounds.Width(); - if (menuPrivate.State() == MENU_STATE_CLOSED) { - float rightMargin, leftMargin; - menuPrivate.GetItemMargins(&leftMargin, NULL, &rightMargin, NULL); - frameWidth = fSuper->Frame().Width() - (rightMargin + leftMargin); - } + float labelWidth; + float labelHeight; + GetContentSize(&labelWidth, &labelHeight); - // truncate if needed - if (frameWidth >= labelWidth) + const BRect& padding = menuPrivate.Padding(); + float frameWidth = fSuper->Frame().Width() - padding.left - padding.right; + + if (roundf(frameWidth) >= roundf(labelWidth)) fSuper->DrawString(fLabel); else { - char *truncatedLabel = new char[strlen(fLabel) + 4]; + // truncate label to fit + char* truncatedLabel = new char[strlen(fLabel) + 4]; TruncateLabel(frameWidth, truncatedLabel); fSuper->DrawString(truncatedLabel); delete[] truncatedLabel; @@ -451,18 +448,12 @@ BMenuItem::Draw() bool selected = IsSelected(); // set low color and fill background if selected - bool activated = selected && (enabled || Submenu()) - /*&& fSuper->fRedrawAfterSticky*/; + bool activated = selected && (enabled || Submenu()); if (activated) { - if (be_control_look != NULL) { - BRect rect = Frame(); - be_control_look->DrawMenuItemBackground(fSuper, rect, rect, - ui_color(B_MENU_SELECTED_BACKGROUND_COLOR), - BControlLook::B_ACTIVATED); - } else { - fSuper->SetLowColor(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR)); - fSuper->FillRect(Frame(), B_SOLID_LOW); - } + BRect rect = Frame(); + be_control_look->DrawMenuItemBackground(fSuper, rect, rect, + ui_color(B_MENU_SELECTED_BACKGROUND_COLOR), + BControlLook::B_ACTIVATED); } // set high color @@ -499,7 +490,7 @@ BMenuItem::Draw() void BMenuItem::Highlight(bool flag) { - Menu()->Invalidate(Frame()); + fSuper->Invalidate(Frame()); } @@ -513,10 +504,9 @@ BMenuItem::IsSelected() const BPoint BMenuItem::ContentLocation() const { - const BRect &padding = MenuPrivate(fSuper).Padding(); + const BRect& padding = MenuPrivate(fSuper).Padding(); - return BPoint(fBounds.left + padding.left, - fBounds.top + padding.top); + return BPoint(fBounds.left + padding.left, fBounds.top + padding.top); } @@ -531,7 +521,7 @@ BMenuItem::BMenuItem(const BMenuItem &) } -BMenuItem & +BMenuItem& BMenuItem::operator=(const BMenuItem &) { return *this; @@ -558,13 +548,13 @@ BMenuItem::_InitData() void -BMenuItem::_InitMenuData(BMenu *menu) +BMenuItem::_InitMenuData(BMenu* menu) { fSubmenu = menu; MenuPrivate(fSubmenu).SetSuperItem(this); - BMenuItem *item = menu->FindMarked(); + BMenuItem* item = menu->FindMarked(); if (menu->IsRadioMode() && menu->IsLabelFromMarked() && item != NULL) SetLabel(item->Label()); @@ -574,11 +564,10 @@ BMenuItem::_InitMenuData(BMenu *menu) void -BMenuItem::Install(BWindow *window) +BMenuItem::Install(BWindow* window) { - if (fSubmenu) { + if (fSubmenu != NULL) MenuPrivate(fSubmenu).Install(window); - } fWindow = window; @@ -591,7 +580,7 @@ BMenuItem::Install(BWindow *window) status_t -BMenuItem::Invoke(BMessage *message) +BMenuItem::Invoke(BMessage* message) { if (!IsEnabled()) return B_ERROR; @@ -605,21 +594,21 @@ BMenuItem::Invoke(BMessage *message) BMessage clone(kind); status_t err = B_BAD_VALUE; - if (!message && !notify) + if (message == NULL && !notify) message = Message(); - if (!message) { + if (message == NULL) { if (!fSuper->IsWatched()) return err; } else clone = *message; - clone.AddInt32("index", Menu()->IndexOf(this)); + clone.AddInt32("index", fSuper->IndexOf(this)); clone.AddInt64("when", (int64)system_time()); clone.AddPointer("source", this); clone.AddMessenger("be:sender", BMessenger(fSuper)); - if (message) + if (message != NULL) err = BInvoker::Invoke(&clone); // TODO: assynchronous messaging @@ -632,31 +621,32 @@ BMenuItem::Invoke(BMessage *message) void BMenuItem::Uninstall() { - if (fSubmenu != NULL) { + if (fSubmenu != NULL) MenuPrivate(fSubmenu).Uninstall(); - } if (Target() == fWindow) SetTarget(BMessenger()); if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) != 0 - && fWindow != NULL) + && fWindow != NULL) { fWindow->RemoveShortcut(fShortcutChar, fModifiers); + } fWindow = NULL; } void -BMenuItem::SetSuper(BMenu *super) +BMenuItem::SetSuper(BMenu* super) { - if (fSuper != NULL && super != NULL) - debugger("Error - can't add menu or menu item to more than 1 container (either menu or menubar)."); - - if (fSubmenu != NULL) { - MenuPrivate(fSubmenu).SetSuper(super); + if (fSuper != NULL && super != NULL) { + debugger("Error - can't add menu or menu item to more than 1 container" + " (either menu or menubar)."); } + if (fSubmenu != NULL) + MenuPrivate(fSubmenu).SetSuper(super); + fSuper = super; } @@ -667,7 +657,7 @@ BMenuItem::Select(bool selected) if (fSelected == selected) return; - if (Submenu() || IsEnabled()) { + if (Submenu() != NULL || IsEnabled()) { fSelected = selected; Highlight(selected); } @@ -716,7 +706,7 @@ BMenuItem::_DrawMarkSymbol() void BMenuItem::_DrawShortcutSymbol() { - BMenu *menu = Menu(); + BMenu* menu = fSuper; BFont font; menu->GetFont(&font); BPoint where = ContentLocation(); diff --git a/src/kits/interface/MenuPrivate.cpp b/src/kits/interface/MenuPrivate.cpp index 41303e6277..7e2d80f53d 100644 --- a/src/kits/interface/MenuPrivate.cpp +++ b/src/kits/interface/MenuPrivate.cpp @@ -97,7 +97,7 @@ BBitmap* MenuPrivate::sMenuItemAlt; BBitmap* MenuPrivate::sMenuItemMenu; -MenuPrivate::MenuPrivate(BMenu *menu) +MenuPrivate::MenuPrivate(BMenu* menu) : fMenu(menu) { @@ -147,22 +147,22 @@ MenuPrivate::Padding() const void -MenuPrivate::GetItemMargins(float *left, float *top, - float *right, float *bottom) const +MenuPrivate::GetItemMargins(float* left, float* top, float* right, + float* bottom) const { fMenu->GetItemMargins(left, top, right, bottom); } int -MenuPrivate::State(BMenuItem **item) const +MenuPrivate::State(BMenuItem** item) const { return fMenu->_State(item); } void -MenuPrivate::Install(BWindow *window) +MenuPrivate::Install(BWindow* window) { fMenu->_Install(window); } @@ -176,21 +176,21 @@ MenuPrivate::Uninstall() void -MenuPrivate::SetSuper(BMenu *menu) +MenuPrivate::SetSuper(BMenu* menu) { fMenu->fSuper = menu; } void -MenuPrivate::SetSuperItem(BMenuItem *item) +MenuPrivate::SetSuperItem(BMenuItem* item) { fMenu->fSuperitem = item; } void -MenuPrivate::InvokeItem(BMenuItem *item, bool now) +MenuPrivate::InvokeItem(BMenuItem* item, bool now) { fMenu->_InvokeItem(item, now); } diff --git a/src/kits/interface/MenuWindow.cpp b/src/kits/interface/MenuWindow.cpp index b568f75c48..9523f67178 100644 --- a/src/kits/interface/MenuWindow.cpp +++ b/src/kits/interface/MenuWindow.cpp @@ -412,6 +412,17 @@ BMenuWindow::TryScrollBy(const float& step) } +bool +BMenuWindow::TryScrollTo(const float& where) +{ + if (!fMenuFrame || !fUpperScroller || !fLowerScroller) + return false; + + _ScrollBy(where - fValue); + return true; +} + + bool BMenuWindow::_Scroll(const BPoint& where) { diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index 1379a44672..c7294145bc 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku Inc. + * Copyright 2001-2013 Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -7,6 +7,7 @@ * Axel Dörfler, axeld@pinc-software.de * Rene Gollent (rene@gollent.com) * Philippe Saint-Pierre, stpere@gmail.com + * John Scipione, jscipione@gmail.com */ //! BOutlineListView represents a "nestable" list view. @@ -18,6 +19,7 @@ #include #include +#include #include #include @@ -42,10 +44,6 @@ private: }; -const float kLatchHeight = 8.0f; -const float kLatchWidth = 4.0f; - - static void _GetSubItems(BList& sourceList, BList& destList, BListItem* parent, int32 start) { @@ -882,8 +880,14 @@ BOutlineListView::ExpandOrCollapse(BListItem* item, bool expand) BRect BOutlineListView::LatchRect(BRect itemRect, int32 level) const { - return BRect(itemRect.left, itemRect.top, itemRect.left - + (level * 10.0f + 15.0f), itemRect.bottom); + float latchWidth = be_plain_font->Size(); + float latchHeight = be_plain_font->Size(); + float indentOffset = level * be_control_look->DefaultItemSpacing(); + float heightOffset = itemRect.Height() / 2 - latchHeight / 2; + + return BRect(0, 0, latchWidth, latchHeight) + .OffsetBySelf(itemRect.left, itemRect.top) + .OffsetBySelf(indentOffset, heightOffset); } @@ -891,57 +895,25 @@ void BOutlineListView::DrawLatch(BRect itemRect, int32 level, bool collapsed, bool highlighted, bool misTracked) { - float left = level * 10.0f; + BRect latchRect(LatchRect(itemRect, level)); + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + int32 arrowDirection = collapsed ? BControlLook::B_RIGHT_ARROW + : BControlLook::B_DOWN_ARROW; - float halfHeight = itemRect.Height() / 2.0f; - - if (collapsed) { - SetHighColor(192, 192, 192); - - FillTriangle(itemRect.LeftTop() + BPoint(left + 4.0f, - halfHeight - kLatchHeight / 2.0f), - itemRect.LeftTop() + BPoint(left + 4.0f, - halfHeight + kLatchHeight / 2.0f), - itemRect.LeftTop() + BPoint(left + kLatchWidth + 4.0f, - halfHeight)); - - SetHighColor(0, 0, 0); - - StrokeTriangle(itemRect.LeftTop() + BPoint(left + 4.0f, - halfHeight - kLatchHeight / 2.0f), - itemRect.LeftTop() + BPoint(left + 4.0f, - halfHeight + kLatchHeight / 2.0f), - itemRect.LeftTop() + BPoint(left + kLatchWidth + 4.0f, - halfHeight)); - } else { - SetHighColor(192, 192, 192); - - FillTriangle(itemRect.LeftTop() + BPoint(left + 2.0f, - halfHeight - kLatchWidth + 2.0f), - itemRect.LeftTop() + BPoint(left + kLatchHeight + 2.0f, - halfHeight - kLatchWidth + 2.0f), - itemRect.LeftTop() + BPoint(left + 2.0f + kLatchHeight / 2.0f, - halfHeight + 2.0f)); - - SetHighColor(0, 0, 0); - - StrokeTriangle(itemRect.LeftTop() + BPoint(left + 2.0f, - halfHeight - kLatchWidth + 2.0f), - itemRect.LeftTop() + BPoint(left + kLatchHeight + 2.0f, - halfHeight - kLatchWidth + 2.0f), - itemRect.LeftTop() + BPoint(left + 2.0f + kLatchHeight / 2.0f, - halfHeight + 2.0f)); - } + be_control_look->DrawArrowShape(this, latchRect, itemRect, base, + arrowDirection, 0, B_DARKEN_4_TINT); } void BOutlineListView::DrawItem(BListItem* item, BRect itemRect, bool complete) { - if (item->fHasSubitems) - DrawLatch(itemRect, item->fLevel, !item->IsExpanded(), false, false); + if (item->fHasSubitems) { + DrawLatch(itemRect, item->fLevel, !item->IsExpanded(), + item->IsSelected() || complete, false); + } - itemRect.left += item->fLevel * 10.0f + 15.0f; + itemRect.left += LatchRect(itemRect, item->fLevel).right; item->DrawItem(this, itemRect, complete); } diff --git a/src/kits/interface/PopUpMenu.cpp b/src/kits/interface/PopUpMenu.cpp index ea0099e24a..aebd37394b 100644 --- a/src/kits/interface/PopUpMenu.cpp +++ b/src/kits/interface/PopUpMenu.cpp @@ -20,9 +20,9 @@ struct popup_menu_data { - BPopUpMenu *object; - BWindow *window; - BMenuItem *selected; + BPopUpMenu* object; + BWindow* window; + BMenuItem* selected; BPoint where; BRect rect; @@ -36,9 +36,10 @@ struct popup_menu_data { }; -BPopUpMenu::BPopUpMenu(const char *title, bool radioMode, bool autoRename, - menu_layout layout) - : BMenu(title, layout), +BPopUpMenu::BPopUpMenu(const char* title, bool radioMode, bool autoRename, + menu_layout layout) + : + BMenu(title, layout), fUseWhere(false), fAutoDestruct(false), fTrackThread(-1) @@ -51,8 +52,9 @@ BPopUpMenu::BPopUpMenu(const char *title, bool radioMode, bool autoRename, } -BPopUpMenu::BPopUpMenu(BMessage *archive) - : BMenu(archive), +BPopUpMenu::BPopUpMenu(BMessage* archive) + : + BMenu(archive), fUseWhere(false), fAutoDestruct(false), fTrackThread(-1) @@ -71,14 +73,14 @@ BPopUpMenu::~BPopUpMenu() status_t -BPopUpMenu::Archive(BMessage *data, bool deep) const +BPopUpMenu::Archive(BMessage* data, bool deep) const { return BMenu::Archive(data, deep); } -BArchivable * -BPopUpMenu::Instantiate(BMessage *data) +BArchivable* +BPopUpMenu::Instantiate(BMessage* data) { if (validate_instantiation(data, "BPopUpMenu")) return new BPopUpMenu(data); @@ -87,14 +89,14 @@ BPopUpMenu::Instantiate(BMessage *data) } -BMenuItem * +BMenuItem* BPopUpMenu::Go(BPoint where, bool deliversMessage, bool openAnyway, bool async) { return _Go(where, deliversMessage, openAnyway, NULL, async); } -BMenuItem * +BMenuItem* BPopUpMenu::Go(BPoint where, bool deliversMessage, bool openAnyway, BRect clickToOpen, bool async) { @@ -103,9 +105,9 @@ BPopUpMenu::Go(BPoint where, bool deliversMessage, bool openAnyway, void -BPopUpMenu::MessageReceived(BMessage *msg) +BPopUpMenu::MessageReceived(BMessage* message) { - BMenu::MessageReceived(msg); + BMenu::MessageReceived(message); } @@ -124,9 +126,9 @@ BPopUpMenu::MouseUp(BPoint point) void -BPopUpMenu::MouseMoved(BPoint point, uint32 code, const BMessage *msg) +BPopUpMenu::MouseMoved(BPoint point, uint32 code, const BMessage* message) { - BView::MouseMoved(point, code, msg); + BView::MouseMoved(point, code, message); } @@ -158,16 +160,16 @@ BPopUpMenu::FrameResized(float newWidth, float newHeight) } -BHandler * -BPopUpMenu::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, - int32 form, const char *property) +BHandler* +BPopUpMenu::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char* property) { - return BMenu::ResolveSpecifier(msg, index, specifier, form, property); + return BMenu::ResolveSpecifier(message, index, specifier, form, property); } status_t -BPopUpMenu::GetSupportedSuites(BMessage *data) +BPopUpMenu::GetSupportedSuites(BMessage* data) { return BMenu::GetSupportedSuites(data); } @@ -204,7 +206,7 @@ BPopUpMenu::Perform(perform_code code, void* _data) BPopUpMenu::GetHeightForWidth(data->width, &data->min, &data->max, &data->preferred); return B_OK; -} + } case PERFORM_CODE_SET_LAYOUT: { perform_data_set_layout* data = (perform_data_set_layout*)_data; @@ -237,7 +239,7 @@ BPopUpMenu::ResizeToPreferred() void -BPopUpMenu::GetPreferredSize(float *_width, float *_height) +BPopUpMenu::GetPreferredSize(float* _width, float* _height) { BMenu::GetPreferredSize(_width, _height); } @@ -281,18 +283,25 @@ BPopUpMenu::AsyncAutoDestruct() const BPoint BPopUpMenu::ScreenLocation() { + // This case is when the BPopUpMenu is standalone if (fUseWhere) return fWhere; - BMenuItem *superItem = Superitem(); - BMenu *superMenu = Supermenu(); - BMenuItem *selectedItem = FindItem(superItem->Label()); + // This case is when the BPopUpMenu is inside a BMenuField + BMenuItem* superItem = Superitem(); + BMenu* superMenu = Supermenu(); + BMenuItem* selectedItem = FindItem(superItem->Label()); BPoint point = superItem->Frame().LeftTop(); superMenu->ConvertToScreen(&point); - if (selectedItem != NULL) + if (selectedItem != NULL) { + while (selectedItem->Menu() != this + && selectedItem->Menu()->Superitem() != NULL) { + selectedItem = selectedItem->Menu()->Superitem(); + } point.y -= selectedItem->Frame().top; + } return point; } @@ -306,18 +315,17 @@ void BPopUpMenu::_ReservedPopUpMenu2() {} void BPopUpMenu::_ReservedPopUpMenu3() {} -BPopUpMenu & -BPopUpMenu::operator=(const BPopUpMenu &) +BPopUpMenu& +BPopUpMenu::operator=(const BPopUpMenu& other) { return *this; } -BMenuItem * +BMenuItem* BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, - BRect *_specialRect, bool async) + BRect* _specialRect, bool async) { - if (fTrackThread >= B_OK) { // we already have an active menu, wait for it to go away before // spawning another @@ -325,8 +333,9 @@ BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, while (wait_for_thread(fTrackThread, &unused) == B_INTERRUPTED) ; } - popup_menu_data *data = new (std::nothrow) popup_menu_data; - if (!data) + + popup_menu_data* data = new (std::nothrow) popup_menu_data; + if (data == NULL) return NULL; sem_id sem = create_sem(0, "window close lock"); @@ -336,14 +345,14 @@ BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, } // Get a pointer to the window from which Go() was called - BWindow *window = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + BWindow* window + = dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); data->window = window; // Asynchronous menu: we set the BWindow menu's semaphore // and let BWindow block when needed - if (async && window != NULL) { + if (async && window != NULL) _set_menu_sem_(window, sem); - } data->object = this; data->autoInvoke = autoInvoke; @@ -357,7 +366,8 @@ BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, data->lock = sem; // Spawn the tracking thread - fTrackThread = spawn_thread(_thread_entry, "popup", B_DISPLAY_PRIORITY, data); + fTrackThread = spawn_thread(_thread_entry, "popup", B_DISPLAY_PRIORITY, + data); if (fTrackThread < B_OK) { // Something went wrong. Cleanup and return NULL delete_sem(sem); @@ -378,16 +388,17 @@ BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, /* static */ int32 -BPopUpMenu::_thread_entry(void *arg) +BPopUpMenu::_thread_entry(void* menuData) { - popup_menu_data *data = static_cast(arg); - BPopUpMenu *menu = data->object; - BRect *rect = NULL; + popup_menu_data* data = static_cast(menuData); + BPopUpMenu* menu = data->object; + BRect* rect = NULL; if (data->useRect) rect = &data->rect; - data->selected = menu->_StartTrack(data->where, data->autoInvoke, data->startOpened, rect); + data->selected = menu->_StartTrack(data->where, data->autoInvoke, + data->startOpened, rect); // Reset the window menu semaphore if (data->async && data->window) @@ -408,28 +419,29 @@ BPopUpMenu::_thread_entry(void *arg) } -BMenuItem * -BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened, BRect *_specialRect) +BMenuItem* +BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened, + BRect* _specialRect) { - fWhere = where; - // I know, this doesn't look senseful, but don't be fooled, // fUseWhere is used in ScreenLocation(), which is a virtual // called by BMenu::Track() + fWhere = where; fUseWhere = true; - // Determine when mouse-down-up will be taken as a 'press', rather than a 'click' + // Determine when mouse-down-up will be taken as a 'press', + // rather than a 'click' bigtime_t clickMaxTime = 0; get_click_speed(&clickMaxTime); clickMaxTime += system_time(); - + // Show the menu's window Show(); snooze(50000); - BMenuItem *result = Track(startOpened, _specialRect); + BMenuItem* result = Track(startOpened, _specialRect); // If it was a click, keep the menu open and tracking - if (system_time() <= clickMaxTime) + if (system_time() <= clickMaxTime) result = Track(true, _specialRect); if (result != NULL && autoInvoke) result->Invoke(); @@ -443,11 +455,11 @@ BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened, BRect * } -BMenuItem * -BPopUpMenu::_WaitMenu(void *_data) +BMenuItem* +BPopUpMenu::_WaitMenu(void* _data) { - popup_menu_data *data = (popup_menu_data *)_data; - BWindow *window = data->window; + popup_menu_data* data = static_cast(_data); + BWindow* window = data->window; sem_id sem = data->lock; if (window != NULL) { while (acquire_sem_etc(sem, 1, B_TIMEOUT, 50000) != B_BAD_SEM_ID) @@ -460,7 +472,7 @@ BPopUpMenu::_WaitMenu(void *_data) fTrackThread = -1; - BMenuItem *selected = data->selected; + BMenuItem* selected = data->selected; // data->selected is filled by the tracking thread delete data; diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 10cd771a53..06d3c20700 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2584,6 +2584,10 @@ BWindow::ResizeTo(float width, float height) } +/*! + \brief Center the window in the passed in \a rect. + \param rect The rectangle to center the window in. +*/ void BWindow::CenterIn(const BRect& rect) { @@ -2596,11 +2600,23 @@ BWindow::CenterIn(const BRect& rect) } +/*! + \brief Centers the window on the screen the window is currently on. +*/ void BWindow::CenterOnScreen() { - BScreen screen(this); - CenterIn(screen.Frame()); + CenterIn(BScreen(this).Frame()); +} + + +/*! + \brief Centers the window on the screen with the passed in \a id. +*/ +void +BWindow::CenterOnScreen(screen_id id) +{ + CenterIn(BScreen(id).Frame()); } @@ -3852,6 +3868,58 @@ BWindow::_KeyboardNavigation() } +/*! + \brief Return the position of the window centered horizontally to the passed + in \a frame and vertically 3/4 from the top of \a frame. + + If the window is on the borders + + \param width The width of the window. + \param height The height of the window. + \param frame The \a frame to center the window in. + + \return The new window position. +*/ +BPoint +BWindow::AlertPosition(const BRect& frame) +{ + float width = Bounds().Width(); + float height = Bounds().Height(); + + BPoint point(frame.left + (frame.Width() / 2.0f) - (width / 2.0f), + frame.top + (frame.Height() / 4.0f) - ceil(height / 3.0f)); + + BRect screenFrame = BScreen(this).Frame(); + if (frame == screenFrame) { + // reference frame is screen frame, skip the below adjustments + return point; + } + + float borderWidth; + float tabHeight; + _GetDecoratorSize(&borderWidth, &tabHeight); + + // clip the x position within the horizontal edges of the screen + if (point.x < screenFrame.left + borderWidth) + point.x = screenFrame.left + borderWidth; + else if (point.x + width > screenFrame.right - borderWidth) + point.x = screenFrame.right - borderWidth - width; + + // lower the window down if it is covering the window tab + float tabPosition = frame.LeftTop().y + tabHeight + borderWidth; + if (point.y < tabPosition) + point.y = tabPosition; + + // clip the y position within the vertical edges of the screen + if (point.y < screenFrame.top + borderWidth) + point.y = screenFrame.top + borderWidth; + else if (point.y + height > screenFrame.bottom - borderWidth) + point.y = screenFrame.bottom - borderWidth - height; + + return point; +} + + BMessage* BWindow::ConvertToMessage(void* raw, int32 code) { diff --git a/src/kits/mail/MailAttachment.cpp b/src/kits/mail/MailAttachment.cpp index 057427e2cc..be734bfb56 100644 --- a/src/kits/mail/MailAttachment.cpp +++ b/src/kits/mail/MailAttachment.cpp @@ -320,7 +320,7 @@ BSimpleMailAttachment::SetToRFC822(BPositionIO *data, size_t length, BMailComponent::SetToRFC822(data, length, parseNow); // this actually happens... - if (data->Position() - position > length) + if (data->Position() - position > (off_t)length) return B_ERROR; length -= (data->Position() - position); @@ -519,8 +519,8 @@ BAttributedMailAttachment::SetTo(BFile *file, bool deleteFileWhenDone) // Also, we have the make up the boundary out of whole cloth // This is likely to give a completely random string BString boundary; - boundary << "BFile--" << (int32(file) ^ time(NULL)) << "-" - << ~((int32)file ^ (int32)&fStatus ^ (int32)&_attributes) << "--"; + boundary << "BFile--" << ((long)file ^ time(NULL)) << "-" + << ~((long)file ^ (long)&fStatus ^ (long)&_attributes) << "--"; fContainer->SetBoundary(boundary.String()); return fStatus = B_OK; @@ -558,8 +558,8 @@ BAttributedMailAttachment::SetTo(entry_ref *ref) buffer[i] = '_'; } buffer[32] = '\0'; - boundary << "BFile-" << buffer << "--" << ((int32)_data ^ time(NULL)) - << "-" << ~((int32)_data ^ (int32)&buffer ^ (int32)&_attributes) + boundary << "BFile-" << buffer << "--" << ((long)_data ^ time(NULL)) + << "-" << ~((long)_data ^ (long)&buffer ^ (long)&_attributes) << "--"; fContainer->SetBoundary(boundary.String()); diff --git a/src/kits/mail/MailContainer.cpp b/src/kits/mail/MailContainer.cpp index a348b41769..97f07ebadb 100644 --- a/src/kits/mail/MailContainer.cpp +++ b/src/kits/mail/MailContainer.cpp @@ -425,8 +425,10 @@ status_t BMIMEMultipartMailContainer::RenderToRFC822(BPositionIO *render_to) { ssize_t amountWritten, length; message_part *part = (message_part *)_components_in_raw.ItemAt(i); - for (off_t begin = part->start; begin < part->end; begin += sizeof(buffer)) { - length = ((part->end - begin) >= sizeof(buffer)) ? sizeof(buffer) : (part->end - begin); + for (off_t begin = part->start; begin < part->end; + begin += sizeof(buffer)) { + length = (((off_t)part->end - begin) >= (off_t)sizeof(buffer)) + ? sizeof(buffer) : (part->end - begin); _io_data->ReadAt(begin,buffer,length); amountWritten = render_to->Write(buffer,length); diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp index e91139f5b7..abf7de28b1 100644 --- a/src/kits/mail/MailMessage.cpp +++ b/src/kits/mail/MailMessage.cpp @@ -122,7 +122,7 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, BString cc; for (int32 i = list.CountItems(); i-- > 0;) { - char *address = (char *)list.RemoveItem(0L); + char *address = (char *)list.RemoveItem((int32)0); // add everything which is not the sender and not already in the list if (sender.ICompare(address) && cc.FindFirst(address) < 0) { @@ -731,7 +731,7 @@ BEmailMessage::RenderToRFC822(BPositionIO *file) BString recipients; for (int32 i = recipientList.CountItems(); i-- > 0;) { - char *address = (char *)recipientList.RemoveItem(0L); + char *address = (char *)recipientList.RemoveItem((int32)0); recipients << '<' << address << '>'; if (i) diff --git a/src/kits/mail/mail_util.cpp b/src/kits/mail/mail_util.cpp index 8d8c86e0a2..e7ea0a6cd6 100644 --- a/src/kits/mail/mail_util.cpp +++ b/src/kits/mail/mail_util.cpp @@ -681,7 +681,7 @@ utf8_to_rfc2047 (char **bufp, ssize_t length, uint32 charset, char encoding) } } - while ((currentWord = (struct word *)words.RemoveItem(0L)) != NULL) { + while ((currentWord = (struct word *)words.RemoveItem((int32)0)) != NULL) { if ((encoding != quoted_printable && encoding != base64) || !currentWord->needsEncoding) { rfc2047.Append (currentWord->convertedWord); diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp index beb41e24fb..c4c67fc96a 100644 --- a/src/kits/media/MediaNode.cpp +++ b/src/kits/media/MediaNode.cpp @@ -364,13 +364,23 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used int32 message; - ssize_t size = read_port_etc(ControlPort(), &message, data, sizeof(data), - B_ABSOLUTE_TIMEOUT, waitUntil); - if (size < 0) { + ssize_t size; + while (true) { + size = read_port_etc(ControlPort(), &message, data, + sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil); + + if (size >= 0) + break; + status_t error = (status_t)size; - if (error != B_TIMED_OUT && error != B_BAD_PORT_ID) + if (error == B_INTERRUPTED) + continue; + + if (error != B_TIMED_OUT && error != B_BAD_PORT_ID) { ERROR("BMediaNode::WaitForMessage: read_port_etc error: %s\n", strerror(error)); + } + return error; } diff --git a/src/kits/midi/MidiText.cpp b/src/kits/midi/MidiText.cpp index 2ce838f779..c3f5037aaa 100644 --- a/src/kits/midi/MidiText.cpp +++ b/src/kits/midi/MidiText.cpp @@ -164,6 +164,6 @@ BMidiText::_WaitAndPrint(uint32 time) SnoozeUntil(time); - printf("%lu: ", time - fStartTime); + printf("%" B_PRIu32 ": ", time - fStartTime); } diff --git a/src/kits/network/interfaces.cpp b/src/kits/network/interfaces.cpp index 05871ef4ca..f0a7faffdd 100644 --- a/src/kits/network/interfaces.cpp +++ b/src/kits/network/interfaces.cpp @@ -106,16 +106,27 @@ if_nameindex(void) if (interfaceArray == NULL) return NULL; - for (int i = 0; i < count; i++) { - interfaceArray[i].if_index = interfaces->ifr_index; - interfaceArray[i].if_name = strdup(interfaces->ifr_name); + int i = 0; + while (count > 0) { + // retrieve interface index + ifreq request; + strlcpy(((struct ifreq&)request).ifr_name, interfaces->ifr_name, + IF_NAMESIZE); + + if (ioctl(socket.FD(), SIOCGIFINDEX, &request, + sizeof(struct ifreq)) >= 0) { + interfaceArray[i].if_index = request.ifr_index; + interfaceArray[i].if_name = strdup(interfaces->ifr_name); + i++; + } interfaces = (ifreq*)((char*)interfaces + _SIZEOF_ADDR_IFREQ(interfaces[0])); + count--; } - interfaceArray[count].if_index = 0; - interfaceArray[count].if_name = NULL; + interfaceArray[i].if_index = 0; + interfaceArray[i].if_name = NULL; return interfaceArray; } diff --git a/src/kits/network/libnetapi/NetworkRoster.cpp b/src/kits/network/libnetapi/NetworkRoster.cpp index d847f5a24a..3171aaffaf 100644 --- a/src/kits/network/libnetapi/NetworkRoster.cpp +++ b/src/kits/network/libnetapi/NetworkRoster.cpp @@ -114,6 +114,8 @@ BNetworkRoster::AddInterface(const char* name) if (socket < 0) return errno; + FileDescriptorCloser closer(socket); + ifaliasreq request; memset(&request, 0, sizeof(ifaliasreq)); strlcpy(request.ifra_name, name, IF_NAMESIZE); @@ -139,6 +141,8 @@ BNetworkRoster::RemoveInterface(const char* name) if (socket < 0) return errno; + FileDescriptorCloser closer(socket); + ifreq request; strlcpy(request.ifr_name, name, IF_NAMESIZE); diff --git a/src/kits/shared/AboutWindow.cpp b/src/kits/shared/AboutWindow.cpp index 81e5139589..2d66bfcebf 100644 --- a/src/kits/shared/AboutWindow.cpp +++ b/src/kits/shared/AboutWindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,7 @@ AboutView::AboutView(const char* appName, const char* signature) fInfoView->SetInsets(5.0, 5.0, 5.0, 5.0); fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); fInfoView->SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR)); + fInfoView->SetStylable(true); BScrollView* infoViewScroller = new BScrollView( "infoViewScroller", fInfoView, B_WILL_DRAW | B_FRAME_EVENTS, @@ -182,6 +184,11 @@ AboutView::AboutView(const char* appName, const char* signature) fStripeView = new StripeView(_GetIconFromSignature(signature)); + const char* ok = B_TRANSLATE_MARK("Ok"); + BButton* closeButton = new BButton("ok", + gSystemCatalog.GetString(ok, "AboutWindow"), + new BMessage(B_QUIT_REQUESTED)); + GroupLayout()->SetSpacing(0); BLayoutBuilder::Group<>(this) .AddGroup(B_HORIZONTAL, 0) @@ -192,6 +199,7 @@ AboutView::AboutView(const char* appName, const char* signature) .Add(fNameView) .Add(fVersionView) .Add(infoViewScroller) + .Add(closeButton) .End() .AddGlue() .End(); @@ -352,17 +360,17 @@ AboutView::SetIcon(BBitmap* icon) BAboutWindow::BAboutWindow(const char* appName, const char* signature) - : BWindow(BRect(0.0, 0.0, 200.0, 200.0), appName, B_TITLED_WINDOW, - B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE - | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE) + : BWindow(BRect(0.0, 0.0, 200.0, 200.0), appName, B_MODAL_WINDOW, + B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE + | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE) { SetLayout(new BGroupLayout(B_VERTICAL)); - const char* about = B_TRANSLATE_MARK("About"); + const char* about = B_TRANSLATE_MARK("About %app%"); about = gSystemCatalog.GetString(about, "AboutWindow"); BString title(about); - title << " " << appName; + title.ReplaceFirst("%app%", appName); SetTitle(title.String()); fAboutView = new AboutView(appName, signature); @@ -383,15 +391,6 @@ BAboutWindow::~BAboutWindow() // #pragma mark - BAboutWindow virtual methods -bool -BAboutWindow::QuitRequested() -{ - Hide(); - - return false; -} - - void BAboutWindow::Show() { @@ -437,16 +436,7 @@ BAboutWindow::AddDescription(const char* description) if (description == NULL) return; - const char* appDesc = B_TRANSLATE_MARK(description); - appDesc = gSystemCatalog.GetString(appDesc, "AboutWindow"); - - BString desc(""); - if (fAboutView->InfoView()->TextLength() > 0) - desc << "\n\n"; - - desc << appDesc; - - fAboutView->InfoView()->Insert(desc.String()); + AddText(description); } @@ -503,16 +493,7 @@ BAboutWindow::AddAuthors(const char** authors) const char* writtenBy = B_TRANSLATE_MARK("Written by:"); writtenBy = gSystemCatalog.GetString(writtenBy, "AboutWindow"); - BString text(""); - if (fAboutView->InfoView()->TextLength() > 0) - text << "\n\n"; - - text << writtenBy; - text << "\n"; - for (int32 i = 0; authors[i]; i++) - text << " " << authors[i] << "\n"; - - fAboutView->InfoView()->Insert(text.String()); + AddText(writtenBy, authors); } @@ -525,15 +506,7 @@ BAboutWindow::AddSpecialThanks(const char** thanks) const char* specialThanks = B_TRANSLATE_MARK("Special Thanks:"); specialThanks = gSystemCatalog.GetString(specialThanks, "AboutWindow"); - BString text(""); - if (fAboutView->InfoView()->TextLength() > 0) - text << "\n\n"; - - text << specialThanks << "\n"; - for (int32 i = 0; thanks[i]; i++) - text << " " << thanks[i] << "\n"; - - fAboutView->InfoView()->Insert(text.String()); + AddText(specialThanks, thanks); } @@ -546,15 +519,7 @@ BAboutWindow::AddVersionHistory(const char** history) const char* versionHistory = B_TRANSLATE_MARK("Version history:"); versionHistory = gSystemCatalog.GetString(versionHistory, "AboutWindow"); - BString text(""); - if (fAboutView->InfoView()->TextLength() > 0) - text << "\n\n"; - - text << versionHistory << "\n"; - for (int32 i = 0; history[i]; i++) - text << " " << history[i] << "\n"; - - fAboutView->InfoView()->Insert(text.String()); + AddText(versionHistory, history); } @@ -577,6 +542,39 @@ BAboutWindow::AddExtraInfo(const char* extraInfo) } +void +BAboutWindow::AddText(const char* header, const char** contents) +{ + BTextView* infoView = fAboutView->InfoView(); + int32 textLength = infoView->TextLength(); + BString text(""); + + if (textLength > 0) { + text << "\n\n"; + textLength += 2; + } + + const char* indent = ""; + if (header != NULL) { + indent = " "; + text << header; + } + + if (contents != NULL) { + text << "\n"; + for (int32 i = 0; contents[i]; i++) + text << indent << contents[i] << "\n"; + } + + infoView->Insert(text.String()); + + if (contents != NULL && header != NULL) { + infoView->SetFontAndColor(textLength, textLength + strlen(header), + be_bold_font); + } +} + + const char* BAboutWindow::Name() { @@ -617,3 +615,4 @@ BAboutWindow::SetIcon(BBitmap* icon) { fAboutView->SetIcon(icon); } + diff --git a/src/kits/shared/PromptWindow.cpp b/src/kits/shared/PromptWindow.cpp index 33a36c7d0d..7e7715b810 100644 --- a/src/kits/shared/PromptWindow.cpp +++ b/src/kits/shared/PromptWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012, Rene Gollent, rene@gollent.com. + * Copyright 2012-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #include "PromptWindow.h" @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -14,13 +15,14 @@ static const uint32 kAcceptInput = 'acin'; PromptWindow::PromptWindow(const char* title, const char* label, - BMessenger target, BMessage* message) + const char* info, BMessenger target, BMessage* message) : BWindow(BRect(), title, B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), fTarget(target), fMessage(message) { + fInfoView = new BStringView("info", info); fTextControl = new BTextControl("promptcontrol", label, NULL, new BMessage(kAcceptInput)); BButton* cancelButton = new BButton("Cancel", new @@ -28,17 +30,26 @@ PromptWindow::PromptWindow(const char* title, const char* label, BButton* acceptButton = new BButton("Accept", new BMessage(kAcceptInput)); BLayoutBuilder::Group<>(this, B_VERTICAL) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(fInfoView) .Add(fTextControl) .AddGroup(B_HORIZONTAL) + .AddGlue() + .Add(cancelButton) .Add(acceptButton) - .Add(cancelButton); + .End() + .End(); - fTextControl->TextView()->SetExplicitMinSize(BSize( - fTextControl->TextView()->StringWidth("1234567890"), B_SIZE_UNSET)); + if (info == NULL) + fInfoView->Hide(); + + fTextControl->TextView()->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); fTextControl->SetTarget(this); acceptButton->SetTarget(this); cancelButton->SetTarget(this); fTextControl->MakeFocus(true); + + SetDefaultButton(acceptButton); } diff --git a/src/kits/support/Url.cpp b/src/kits/support/Url.cpp index eb54f8900a..dd59207b99 100644 --- a/src/kits/support/Url.cpp +++ b/src/kits/support/Url.cpp @@ -77,7 +77,9 @@ BUrl::OpenWithPreferredApplication(bool onProblemAskUser) const // TODO: BAlert // if (onProblemAskUser) // BAlert ... Too long URL! +#if DEBUG fprintf(stderr, "URL too long"); +#endif return B_NAME_TOO_LONG; } @@ -96,7 +98,9 @@ BUrl::OpenWithPreferredApplication(bool onProblemAskUser) const status = be_roster->Launch(_UrlMimeType().String(), 1, argv+1); if (status != B_OK) { +#if DEBUG fprintf(stderr, "Opening URL failed: %s\n", strerror(status)); +#endif } return status; diff --git a/src/kits/tracker/DialogPane.cpp b/src/kits/tracker/DialogPane.cpp index 8473c24d52..6f4575c3eb 100644 --- a/src/kits/tracker/DialogPane.cpp +++ b/src/kits/tracker/DialogPane.cpp @@ -497,8 +497,8 @@ PaneSwitch::Track(BPoint point, uint32) void PaneSwitch::DrawInState(PaneSwitch::State state) { - BRect rect(0, 0, 12, 12); - rect.OffsetBy(-1, -1); + BRect rect(0, 0, be_plain_font->Size(), be_plain_font->Size()); + rect.OffsetBy(1, 1); rgb_color arrowColor = state == kPressed ? kHighlightColor : kNormalColor; int32 arrowDirection = BControlLook::B_RIGHT_ARROW; diff --git a/src/kits/tracker/FilePanel.cpp b/src/kits/tracker/FilePanel.cpp index ae89580f9e..806c48f410 100644 --- a/src/kits/tracker/FilePanel.cpp +++ b/src/kits/tracker/FilePanel.cpp @@ -40,6 +40,9 @@ All rights reserved. #include #include #include +#include +#include +#include #include "AutoLock.h" #include "Commands.h" @@ -122,6 +125,13 @@ BFilePanel::Show() // window in a different workspace, reopen in current fWindow->SetWorkspaces(workspace); + // Position the file panel like an alert + BWindow* parent = + dynamic_cast(BLooper::LooperForThread(find_thread(NULL))); + const BRect frame = parent != NULL ? parent->Frame() + : BScreen(fWindow).Frame(); + fWindow->MoveTo(dynamic_cast(fWindow)->AlertPosition(frame)); + if (!IsShowing()) fWindow->Show(); diff --git a/src/kits/tracker/FindPanel.cpp b/src/kits/tracker/FindPanel.cpp index 6f92e7d1de..51790537eb 100644 --- a/src/kits/tracker/FindPanel.cpp +++ b/src/kits/tracker/FindPanel.cpp @@ -38,11 +38,15 @@ All rights reserved. #include #include #include +#include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -51,6 +55,9 @@ All rights reserved. #include #include #include +#include +#include +#include #include #include #include @@ -72,7 +79,6 @@ All rights reserved. #include "FunctionObject.h" #include "IconMenuItem.h" #include "MimeTypes.h" -#include "MiniMenuField.h" #include "Tracker.h" #include "Utilities.h" @@ -80,9 +86,10 @@ All rights reserved. #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "FindPanel" + const char* kAllMimeTypes = "mime/ALLTYPES"; -const BRect kInitialRect(100, 100, 530, 210); +const BRect kInitialRect(0, 0, 0, 0); const int32 kInitialAttrModeWindowHeight = 140; const int32 kIncrementPerAttribute = 30; const float kMoreOptionsDelta = 20; @@ -91,16 +98,40 @@ const uint32 kMoreOptionsMessage = 'mrop'; const uint32 kNameModifiedMessage = 'nmmd'; const uint32 kSwitchToQueryTemplate = 'swqt'; const uint32 kRunSaveAsTemplatePanel = 'svtm'; +const uint32 kLatchChanged = 'ltch'; -const char* kDragNDropTypes [] = { +const char* kDragNDropTypes[] = { B_QUERY_MIMETYPE, - B_QUERY_TEMPLATE_MIMETYPE }; -static const char* kDragNDropActionSpecifiers [] = { + B_QUERY_TEMPLATE_MIMETYPE +}; +static const char* kDragNDropActionSpecifiers[] = { B_TRANSLATE_MARK("Create a Query"), - B_TRANSLATE_MARK("Create a Query template") }; + B_TRANSLATE_MARK("Create a Query template") +}; const uint32 kAttachFile = 'attf'; +const int32 operators[] = { + B_CONTAINS, + B_EQ, + B_NE, + B_BEGINS_WITH, + B_ENDS_WITH, + B_GE, + B_LE +}; +static const char* operatorLabels[] = { + B_TRANSLATE_MARK("contains"), + B_TRANSLATE_MARK("is"), + B_TRANSLATE_MARK("is not"), + B_TRANSLATE_MARK("starts with"), + B_TRANSLATE_MARK("ends with"), + B_TRANSLATE_MARK("greater than"), + B_TRANSLATE_MARK("less than"), + B_TRANSLATE_MARK("before"), + B_TRANSLATE_MARK("after") +}; + namespace BPrivate { @@ -133,6 +164,7 @@ class MostUsedNames { int32 fCount; }; + MostUsedNames gMostUsedMimeTypes("MostUsedMimeTypes", "Tracker"); @@ -164,8 +196,9 @@ MoreOptionsStruct::QueryTemporary(const BNode* node) if (ReadAttr(node, kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign, B_RAW_TYPE, 0, &saveMoreOptions, sizeof(MoreOptionsStruct), - &MoreOptionsStruct::EndianSwap) == kReadAttrFailed) + &MoreOptionsStruct::EndianSwap) == kReadAttrFailed) { return false; + } return saveMoreOptions.temporary; } @@ -177,13 +210,14 @@ MoreOptionsStruct::QueryTemporary(const BNode* node) FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly) : BWindow(kInitialRect, B_TRANSLATE("Find"), B_TITLED_WINDOW, - B_NOT_RESIZABLE | B_NOT_ZOOMABLE), + B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE + | B_AUTO_UPDATE_SIZE_LIMITS), fFile(TryOpening(newRef)), fFromTemplate(false), fEditTemplateOnly(false), fSaveAsTemplatePanel(NULL) { - if (fFile) { + if (fFile != NULL) { fRef = *newRef; if (editIfTemplateOnly) { char type[B_MIME_TYPE_LENGTH]; @@ -212,16 +246,13 @@ FindWindow::FindWindow(const entry_ref* newRef, bool editIfTemplateOnly) } } - if (fFile) { - BRect initialRect(FindPanel::InitialViewSize(fFile)); - ResizeTo(initialRect.Width(), initialRect.Height()); - } - fFromTemplate = IsQueryTemplate(fFile); - fBackground = new FindPanel(Bounds(), fFile, this, fFromTemplate, + fBackground = new FindPanel(fFile, this, fFromTemplate, fEditTemplateOnly); - AddChild(fBackground); + SetLayout(new BGroupLayout(B_VERTICAL)); + GetLayout()->AddView(fBackground); + CenterOnScreen(); } @@ -279,12 +310,7 @@ FindWindow::SwitchToTemplate(const entry_ref* ref) BFile templateFile(&entry, O_RDONLY); ThrowOnInitCheckError(&templateFile); - DisableUpdates(); - // turn off updates to reduce flicker while re-populating the - // window fBackground->SwitchToTemplate(&templateFile); - EnableUpdates(); - } catch (...) { } } @@ -389,8 +415,7 @@ FindWindow::SaveQueryAttributes(BNode* file, bool queryTemplate) status_t FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, - bool queryTemplate, const BMessage* oldAttributes, - const BPoint* oldLocation) + bool queryTemplate, const BMessage* oldAttributes, const BPoint* oldLocation) { if (oldAttributes) // revive old window settings @@ -417,10 +442,10 @@ FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, // write some useful info to help locate the volume to query BMenuItem* item = fBackground->VolMenu()->FindMarked(); - if (item) { + if (item != NULL) { dev_t dev; BMessage message; - int32 count = 0; + uint32 count = 0; int32 itemCount = fBackground->VolMenu()->CountItems(); for (int32 index = 2; index < itemCount; index++) { @@ -437,7 +462,7 @@ FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, EmbedUniqueVolumeInfo(&message, &volume); } - if (count) { + if (count > 0) { // do we need to embed any volumes ssize_t size = message.FlattenedSize(); BString buffer; @@ -458,7 +483,7 @@ FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, // be reopened and edited later BView* focusedItem = CurrentFocus(); - if (focusedItem) { + if (focusedItem != NULL) { // text controls never get the focus, their internal text views do BView* parent = focusedItem->Parent(); if (dynamic_cast(parent)) @@ -477,6 +502,7 @@ FindWindow::SaveQueryAsAttributes(BNode* file, BEntry* entry, &selEnd, sizeof(selEnd)); } } + return B_OK; } @@ -500,10 +526,11 @@ FindWindow::Find() TTracker* tracker = dynamic_cast(be_app); ASSERT(tracker); for (int32 timeOut = 0; ; timeOut++) { - if (!tracker->EntryHasWindowOpen(&fRef)) + if (!tracker->EntryHasWindowOpen(&fRef)) { // window quit, we can post refs received to open a // new copy break; + } // PRINT(("waiting for query window to quit, %d\n", timeOut)); if (timeOut == 5000) { @@ -626,8 +653,7 @@ FindWindow::MessageReceived(BMessage* message) fFile = TryOpening(&tmpRef); if (fFile) { fRef = tmpRef; - SaveQueryAsAttributes(fFile, &entry, queryTemplate, - 0, 0); + SaveQueryAsAttributes(fFile, &entry, queryTemplate, 0, 0); // try to save whatever state we aleady have // to the new query so that if the user // opens it before runing it from the find panel, @@ -638,15 +664,16 @@ FindWindow::MessageReceived(BMessage* message) break; case kSwitchToQueryTemplate: - { - entry_ref ref; - if (message->FindRef("refs", &ref) == B_OK) - SwitchToTemplate(&ref); - } + { + entry_ref ref; + if (message->FindRef("refs", &ref) == B_OK) + SwitchToTemplate(&ref); + break; + } case kRunSaveAsTemplatePanel: - if (fSaveAsTemplatePanel) + if (fSaveAsTemplatePanel != NULL) fSaveAsTemplatePanel->Show(); else { BMessenger panel(BackgroundView()); @@ -669,50 +696,32 @@ FindWindow::MessageReceived(BMessage* message) // #pragma mark - -FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent, - bool , bool editTemplateOnly) - : BView(frame, "MainView", B_FOLLOW_ALL, B_WILL_DRAW), - fMode(kByNameItem), - fDraggableIcon(NULL) +FindPanel::FindPanel(BFile* node, FindWindow* parent, bool fromTemplate, + bool editTemplateOnly) + : + BView("MainView", B_WILL_DRAW), + fMode(kByNameItem), + fAttrGrid(NULL), + fDraggableIcon(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); uint32 initialMode = InitialMode(node); - BRect bounds(Bounds()); - BRect boxBounds(bounds); - - boxBounds.InsetBy(15, 30); - boxBounds.bottom -= 10; - AddChild(new BBox(boxBounds, "Box")); - - BRect rect(boxBounds); - rect.top -= 25; - rect.right = rect.left + 20; - rect.bottom = rect.top + 20; - BMessenger self(this); - fRecentQueries = new BPopUpMenu("RecentQueries"); - FindPanel::AddRecentQueries(fRecentQueries, true, &self, - kSwitchToQueryTemplate); - - AddChild(new MiniMenuField(rect, "RecentQueries", fRecentQueries)); - - rect.left = rect.right + 15; + fRecentQueries = new BPopUpMenu(B_TRANSLATE("Recent queries"), false, + false); + AddRecentQueries(fRecentQueries, true, &self, kSwitchToQueryTemplate); // add popup for mime types fMimeTypeMenu = new BPopUpMenu("MimeTypeMenu"); fMimeTypeMenu->SetRadioMode(false); AddMimeTypesToMenu(); - rect.right = rect.left + 150; - fMimeTypeField = new BMenuField(rect, "MimeTypeMenu", "", fMimeTypeMenu); + fMimeTypeField = new BMenuField("MimeTypeMenu", "", fMimeTypeMenu); fMimeTypeField->SetDivider(0.0f); - fMimeTypeField->MenuItem()->SetLabel( - B_TRANSLATE("All files and folders")); - AddChild(fMimeTypeField); - + fMimeTypeField->MenuItem()->SetLabel(B_TRANSLATE("All files and folders")); // add popup for search criteria fSearchModeMenu = new BPopUpMenu("searchMode"); fSearchModeMenu->AddItem(new BMenuItem(B_TRANSLATE("by name"), @@ -725,24 +734,17 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent, fSearchModeMenu->ItemAt(initialMode == kByNameItem ? 0 : (initialMode == kByAttributeItem ? 1 : 2))->SetMarked(true); // mark the appropriate mode - rect.left = rect.right + 10; - rect.right = rect.left + 100; - rect.bottom = rect.top + 15; - BMenuField* menuField = new BMenuField(rect, "", "", fSearchModeMenu); - menuField->SetDivider(0.0f); - AddChild(menuField); + BMenuField* searchModeField = new BMenuField("", "", fSearchModeMenu); + searchModeField->SetDivider(0.0f); // add popup for volume list - rect.right = bounds.right - 15; - rect.left = rect.right - 100; - fVolMenu = new BPopUpMenu("", false, false); // don't radioMode - menuField = new BMenuField(rect, "", B_TRANSLATE("On"), fVolMenu); - menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8); - AddChild(menuField); + fVolMenu = new BPopUpMenu("", false, false); + BMenuField* volumeField = new BMenuField("", B_TRANSLATE("On"), fVolMenu); + volumeField->SetDivider(volumeField->StringWidth(volumeField->Label()) + 8); AddVolumes(fVolMenu); if (!editTemplateOnly) { - BPoint draggableIconOrigin(15, bounds.bottom - 35); + BPoint draggableIconOrigin(0, 0); BMessage dragNDropMessage(B_SIMPLE_DATA); dragNDropMessage.AddInt32("be:actions", B_COPY_TARGET); dragNDropMessage.AddString("be:types", B_FILE_MIME_TYPE); @@ -754,88 +756,115 @@ FindPanel::FindPanel(BRect frame, BFile* node, FindWindow* parent, B_TRANSLATE_NOCOLLECT(kDragNDropActionSpecifiers[1])); BMessenger self(this); - fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect( - draggableIconOrigin, B_LARGE_ICON), "saveHere", &dragNDropMessage, - self, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); - AddChild(fDraggableIcon); + BRect draggableRect = DraggableIcon::PreferredRect(draggableIconOrigin, + B_LARGE_ICON); + fDraggableIcon = new DraggableQueryIcon(draggableRect, + "saveHere", &dragNDropMessage, self, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); + fDraggableIcon->SetExplicitMaxSize( + BSize(draggableRect.right - draggableRect.left, + draggableRect.bottom - draggableRect.top)); } - // add the more options collapsible pane - BRect paneInitialRect(bounds); - paneInitialRect.InsetBy(80, 5); - paneInitialRect.right = paneInitialRect.left + 255; - paneInitialRect.top = paneInitialRect.bottom - 30; - BRect paneExpandedRect(paneInitialRect); - paneExpandedRect.bottom += kMoreOptionsDelta; - fMoreOptionsPane = new DialogPane(paneInitialRect, paneExpandedRect, 0, - "moreOptions", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); - AddChild(fMoreOptionsPane); - - fMoreOptionsPane->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fMoreOptionsPane->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - // set up the contents of the more options pane - BRect expandedBounds(paneExpandedRect); - expandedBounds.OffsetTo(0, 0); - expandedBounds.InsetBy(5, 5); - - rect = expandedBounds; - rect.right = rect.left + 200; - rect.bottom = rect.top + 20; - fQueryName = new BTextControl(rect, "queryName", - B_TRANSLATE("Query name:"), "", B_FOLLOW_NONE, - B_NAVIGABLE | B_NAVIGABLE_JUMP); - fQueryName->SetDivider(fQueryName->StringWidth(fQueryName->Label()) + 5); - fMoreOptionsPane->AddItem(fQueryName, 1); + fQueryName = new BTextControl("query name", B_TRANSLATE("Query name:"), + "", NULL, B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); FillCurrentQueryName(fQueryName, parent); + fSearchTrashCheck = new BCheckBox("searchTrash", + B_TRANSLATE("Include trash"), NULL); + fTemporaryCheck = new BCheckBox("temporary", + B_TRANSLATE("Temporary"), NULL); + fTemporaryCheck->SetValue(B_CONTROL_ON); - rect.top = rect.bottom + 6; - rect.bottom = rect.top + 16; - rect.right = rect.left + 100; - fSearchTrashCheck = new BCheckBox(rect, "searchTrash", - B_TRANSLATE("Include trash"), 0); - fSearchTrashCheck->ResizeToPreferred(); - fMoreOptionsPane->AddItem(fSearchTrashCheck, 1); + BView* checkboxGroup = BLayoutBuilder::Group<>(B_HORIZONTAL) + .Add(fSearchTrashCheck) + .Add(fTemporaryCheck) + .View(); - rect.OffsetBy(fSearchTrashCheck->Bounds().Width() + 8, 0); - fTemporaryCheck = new BCheckBox(rect, "temporary", - B_TRANSLATE("Temporary"), 0); - fMoreOptionsPane->AddItem(fTemporaryCheck, 1); - fTemporaryCheck->SetValue(1); + // add the more options collapsible pane + fMoreOptions = new BBox(B_NO_BORDER, BLayoutBuilder::Group<>() + .AddGrid(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING) + .Add(fQueryName->CreateLabelLayoutItem(), 0, 0) + .Add(fQueryName->CreateTextViewLayoutItem(), 1, 0) + .Add(BSpaceLayoutItem::CreateHorizontalStrut(0), 0, 1) + .Add(checkboxGroup, 1, 1) + .End() + .View()); - BRect latchRect(paneInitialRect); - latchRect.left -= 20; - latchRect.right = latchRect.left + 10; - latchRect.top = paneInitialRect.top + paneInitialRect.Height() / 2 - 5; + fLatch = new PaneSwitch("optionsLatch", true, B_WILL_DRAW); + fLatch->SetLabels(B_TRANSLATE("Fewer options"), B_TRANSLATE("More options")); + fLatch->SetValue(0); + fLatch->SetMessage(new BMessage(kLatchChanged)); + fLatch->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, + B_ALIGN_VERTICAL_CENTER)); + fMoreOptions->Hide(); - latchRect.bottom = latchRect.top + 12; + // add Search button + BButton* button; + if (editTemplateOnly) { + button = new BButton("save", B_TRANSLATE("Save"), + new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); + } else { + button = new BButton("find", B_TRANSLATE("Search"), + new BMessage(kFindButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); + } + button->MakeDefault(true); - fLatch = new PaneSwitch(latchRect, "moreOptionsLatch", true, - B_FOLLOW_BOTTOM | B_FOLLOW_LEFT); - AddChild(fLatch); - fMoreOptionsPane->SetSwitch(fLatch); + BView* icon = fDraggableIcon; + if (icon == NULL) { + icon = new BBox("no draggable icon", B_WILL_DRAW, B_NO_BORDER); + icon->SetExplicitMaxSize(BSize(0, 0)); + } + + BView* mimeTypeFieldSpacer = new BBox("MimeTypeMenuSpacer", B_WILL_DRAW, + B_NO_BORDER); + mimeTypeFieldSpacer->SetExplicitMaxSize(BSize(0, 0)); + + BBox* queryControls = new BBox("Box"); + queryControls->SetBorder(B_NO_BORDER); + + BBox* queryBox = new BBox("Outer Controls"); + queryBox->SetLabel(new BMenuField("RecentQueries", NULL, fRecentQueries)); + + BGroupView* queryBoxView = new BGroupView(B_VERTICAL, B_USE_DEFAULT_SPACING); + queryBoxView->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING); + queryBox->AddChild(queryBoxView); + + icon->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_BOTTOM)); + button->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM)); + + BLayoutBuilder::Group<>(queryBoxView, B_VERTICAL, B_USE_DEFAULT_SPACING) + .SetInsets(B_USE_DEFAULT_SPACING) + .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING) + .Add(fMimeTypeField) + .Add(mimeTypeFieldSpacer) + .Add(searchModeField) + .Add(BSpaceLayoutItem::CreateHorizontalStrut(B_USE_DEFAULT_SPACING)) + .Add(volumeField) + .End() + .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) + .Add(queryControls); + BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(queryBox) + .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) + .Add(icon) + .AddGroup(B_VERTICAL) + .AddGroup(B_HORIZONTAL) + .Add(fLatch) + .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) + .End() + .Add(fMoreOptions) + .End() + .Add(button) + .End(); if (initialMode != kByAttributeItem) AddByNameOrFormulaItems(); else AddByAttributeItems(node); - // add Search button - rect = bounds; - rect.left = rect.right - 80; - rect.top = rect.bottom - 30; - rect.right = rect.left + 60; - rect.bottom = rect.top + 20; - BButton* button; - if (editTemplateOnly) { - button = new BButton(rect, "save", B_TRANSLATE("Save"), - new BMessage(kSaveButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); - } else { - button = new BButton(rect, "find", B_TRANSLATE("Search"), - new BMessage(kFindButton), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); - } - AddChild(button); - button->MakeDefault(true); + ResizeMenuField(fMimeTypeField); + ResizeMenuField(searchModeField); + ResizeMenuField(volumeField); } @@ -850,7 +879,7 @@ FindPanel::AttachedToWindow() BNode* node = dynamic_cast(Window())->QueryNode(); fSearchModeMenu->SetTargetForItems(this); fQueryName->SetTarget(this); - fLatch->SetTarget(fMoreOptionsPane); + fLatch->SetTarget(this); RestoreMimeTypeMenuSelection(node); // preselect the mime we used the last time have to do it here // because AddByAttributeItems will build different menus based @@ -861,10 +890,10 @@ FindPanel::AttachedToWindow() // try to pick a good focus if we restore to one already BTextControl* textControl = dynamic_cast(FindView("TextControl")); - if (!textControl) { + if (textControl == NULL) { // pick the last text control in the attribute view BString title("TextEntry"); - title << (fAttrViewList.CountItems() - 1); + title << (fAttrGrid->CountRows() - 1); textControl = dynamic_cast(FindView(title.String())); } @@ -872,11 +901,11 @@ FindPanel::AttachedToWindow() textControl->MakeFocus(); } - BButton* button = dynamic_cast(FindView("remove")); + BButton* button = dynamic_cast(FindView("remove button")); if (button) button->SetTarget(this); - button = dynamic_cast(FindView("add")); + button = dynamic_cast(FindView("add button")); if (button) button->SetTarget(this); @@ -890,67 +919,61 @@ FindPanel::AttachedToWindow() } fMimeTypeMenu->SetTargetForItems(this); - if (fDraggableIcon) fDraggableIcon->SetTarget(BMessenger(this)); fRecentQueries->SetTargetForItems(Window()); } -const float kAttrViewDelta = 30; -BRect -FindPanel::InitialViewSize(const BNode* node) +void +FindPanel::ResizeMenuField(BMenuField* menuField) { - if (!node || InitialMode(node) != (int32)kByAttributeItem) - return kInitialRect; + BSize size; + menuField->GetPreferredSize(&size.width, &size.height); - int32 numAttributes = InitialAttrCount(node); - if (numAttributes < 1) - numAttributes = 1; + BMenu* menu = menuField->Menu(); - BRect result = kInitialRect; - result.bottom = result.top + kInitialAttrModeWindowHeight - + (numAttributes - 1) * kIncrementPerAttribute; - - return result; -} - - -float -FindPanel::ViewHeightForMode(uint32 mode, bool moreOptions) -{ - float result = moreOptions ? kMoreOptionsDelta : 0; - switch (mode) { - case kByFormulaItem: - case kByNameItem: - return 110 + result; - - case kByAttributeItem: - return 110 + result + kAttrViewDelta; + float padding = 0.0f; + float width = 0.0f; + BMenuItem* markedItem = menu->FindMarked(); + if (markedItem != NULL) { + if (markedItem->Submenu() != NULL) { + BMenuItem* markedSubItem = markedItem->Submenu()->FindMarked(); + if (markedSubItem != NULL && markedSubItem->Label() != NULL) { + float labelWidth + = menuField->StringWidth(markedSubItem->Label()); + padding = size.width - labelWidth; + } + } else if (markedItem->Label() != NULL) { + float labelWidth = menuField->StringWidth(markedItem->Label()); + padding = size.width - labelWidth; + } } - TRESPASS(); - return 0; -} + for (int32 index = menu->CountItems(); index-- > 0; ) { + BMenuItem* item = menu->ItemAt(index); + if (item->Label() != NULL) + width = std::max(width, StringWidth(item->Label())); -float -FindPanel::BoxHeightForMode(uint32 mode, bool /*moreOptions*/) -{ - switch (mode) { - case kByFormulaItem: - case kByNameItem: - return 40; - - case kByAttributeItem: - return 40 + kAttrViewDelta; + BMenu* submenu = item->Submenu(); + if (submenu != NULL) { + for (int32 subIndex = submenu->CountItems(); subIndex-- > 0; ) { + BMenuItem* subItem = submenu->ItemAt(subIndex); + if (subItem->Label() == NULL) + continue; + width = std::max(width, + menuField->StringWidth(subItem->Label())); + } + } } - TRESPASS(); - return 0; -} + float maxWidth = be_control_look->DefaultItemSpacing() * 20; + size.width = std::min(width + padding, maxWidth); + menuField->SetExplicitSize(size); +} static void PopUpMenuSetTitle(BMenu* menu, const char* title) @@ -960,7 +983,7 @@ PopUpMenuSetTitle(BMenu* menu, const char* title) ASSERT(bar); ASSERT(bar->ItemAt(0)); - if (!bar || !bar->ItemAt(0)) + if (bar == NULL || !bar->ItemAt(0)) return; bar->ItemAt(0)->SetLabel(title); @@ -1006,11 +1029,44 @@ FindPanel::ShowVolumeMenuLabel() } +void +FindPanel::Draw(BRect) +{ + if (fAttrGrid == NULL) + return; + + for (int32 index = 0; index < fAttrGrid->CountRows(); index++) { + BMenuField* menuField + = dynamic_cast(FindAttrView("MenuField", index)); + if (menuField == NULL) + continue; + + BLayoutItem* stringView = fAttrGrid->ItemAt(1, index); + BMenuItem* item = menuField->Menu()->FindMarked(); + if (item == NULL || item->Submenu() == NULL + || item->Submenu()->FindMarked() == NULL) { + continue; + } + + if (stringView == NULL) { + stringView = fAttrGrid->AddView(new BStringView("", + item->Submenu()->FindMarked()->Label()), 1, index); + stringView->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, + B_ALIGN_VERTICAL_UNSET)); + } else { + dynamic_cast(stringView->View())->SetText( + item->Submenu()->FindMarked()->Label()); + } + } +} + + void FindPanel::MessageReceived(BMessage* message) { entry_ref dir; const char* name; + BMenuItem* item; switch (message->what) { case kVolumeItem: @@ -1065,15 +1121,21 @@ FindPanel::MessageReceived(BMessage* message) break; case kAddItem: - AddAttrView(); + AddAttrRow(); break; case kRemoveItem: - RemoveAttrView(); + RemoveAttrRow(); break; case kMIMETypeItem: { + if (fMode == kByAttributeItem) { + // the attributes for this type may be different + RemoveAttrViewItems(false); + AddAttrRow(); + } + BMenuItem* item; if (message->FindPointer("source", (void**)&item) == B_OK) { // don't add the "All files and folders" to the list @@ -1083,23 +1145,6 @@ FindPanel::MessageReceived(BMessage* message) SetCurrentMimeType(item); } - // mime type switched - if (fMode != kByAttributeItem) - break; - - // the attributes for this type may be different, - // rip out the existing ones - RemoveAttrViewItems(); - - Window()->ResizeTo(Window()->Frame().Width(), - ViewHeightForMode(kByAttributeItem, fLatch->Value() != 0)); - - BBox* box = dynamic_cast(FindView("Box")); - ASSERT(box); - box->ResizeTo(box->Bounds().Width(), - BoxHeightForMode(kByAttributeItem, fLatch->Value() != 0)); - - AddAttrView(); break; } @@ -1108,6 +1153,40 @@ FindPanel::MessageReceived(BMessage* message) fTemporaryCheck->SetValue(0); break; + case kAttributeItem: + if (message->FindPointer("source", (void**)&item) != B_OK) + return; + + item->Menu()->Superitem()->SetMarked(true); + Invalidate(); + break; + + case kAttributeItemMain: + // in case someone selected just an attribute without the + // comparator + if (message->FindPointer("source", (void**)&item) != B_OK) + return; + + if (item->Submenu()->ItemAt(0) != NULL) + item->Submenu()->ItemAt(0)->SetMarked(true); + + Invalidate(); + break; + + case kLatchChanged: + { + int32 value; + if (message->FindInt32("be:value", &value) != B_OK) + break; + + if (value == 0 && !fMoreOptions->IsHidden(this)) + fMoreOptions->Hide(); + else if (value == 1 && fMoreOptions->IsHidden(this)) + fMoreOptions->Show(); + + break; + } + case B_SAVE_REQUESTED: { // finish saving query template from a SaveAs panel @@ -1202,30 +1281,51 @@ FindPanel::SaveAsQueryOrTemplate(const entry_ref* dir, const char* name, } +BView* +FindPanel::FindAttrView(const char* name, int row) const +{ + for (int32 index = 0; index < fAttrGrid->CountColumns(); index++) { + + BLayoutItem* item = fAttrGrid->ItemAt(index, row); + if (item == NULL) + continue; + + BView* view = item->View(); + if (view == NULL) + continue; + + view = view->FindView(name); + if (view != NULL) + return view; + + } + + return NULL; +} + void FindPanel::BuildAttrQuery(BQuery* query, bool &dynamicDate) const { dynamicDate = false; // go through each attrview and add the attr and comparison info - for (int32 index = 0; index < fAttrViewList.CountItems(); index++) { + for (int32 index = 0; index < fAttrGrid->CountRows(); index++) { - TAttrView* view = fAttrViewList.ItemAt(index); BString title; title << "TextEntry" << index; BTextControl* textControl = dynamic_cast - (view->FindView(title.String())); - if (!textControl) + (FindAttrView(title, index)); + if (textControl == NULL) return; BMenuField* menuField - = dynamic_cast(view->FindView("MenuField")); - if (!menuField) + = dynamic_cast(FindAttrView("MenuField", index)); + if (menuField == NULL) return; BMenuItem* item = menuField->Menu()->FindMarked(); - if (!item) + if (item == NULL) continue; BMessage* message = item->Message(); @@ -1331,9 +1431,8 @@ FindPanel::BuildAttrQuery(BQuery* query, bool &dynamicDate) const // add logic based on selection in Logic menufield if (index > 0) { - TAttrView* prevView = fAttrViewList.ItemAt(index - 1); menuField - = dynamic_cast(prevView->FindView("Logic")); + = dynamic_cast(FindAttrView("Logic", index - 1)); if (menuField) { item = menuField->Menu()->FindMarked(); if (item) { @@ -1404,10 +1503,9 @@ FindPanel::GetDefaultName(BString &result) const BMenuItem* item = fMimeTypeMenu->FindMarked(); if (item != NULL) result << item->Label() << ": "; - - for (int32 i = 0; i < fAttrViewList.CountItems(); i++) { - fAttrViewList.ItemAt(i)->GetDefaultName(result); - if (i + 1 < fAttrViewList.CountItems()) + for (int32 i = 0; i < fAttrGrid->CountRows(); i++) { + GetDefaultAttrName(result, i); + if (i + 1 < fAttrGrid->CountRows()) result << ", "; } break; @@ -1454,9 +1552,6 @@ FindPanel::SwitchMode(uint32 mode) // no work, bail return; - BBox* box = dynamic_cast(FindView("Box")); - ASSERT(box); - uint32 oldMode = fMode; BString buffer; @@ -1477,16 +1572,6 @@ FindPanel::SwitchMode(uint32 mode) case kByNameItem: { fMode = mode; - Window()->ResizeTo(Window()->Frame().Width(), - ViewHeightForMode(mode, fLatch->Value() != 0)); - BRect bounds(Bounds()); - bounds.InsetBy(15, 30); - bounds.bottom -= 10; - if (fLatch->Value()) - bounds.bottom -= kMoreOptionsDelta; - box->ResizeTo(bounds.Width(), BoxHeightForMode(mode, - fLatch->Value() != 0)); - RemoveByAttributeItems(); ShowOrHideMimeTypeMenu(); AddByNameOrFormulaItems(); @@ -1504,12 +1589,6 @@ FindPanel::SwitchMode(uint32 mode) case kByAttributeItem: { fMode = mode; - box->ResizeTo(box->Bounds().Width(), - BoxHeightForMode(mode, fLatch->Value() != 0)); - - Window()->ResizeTo(Window()->Frame().Width(), - ViewHeightForMode(mode, fLatch->Value() != 0)); - BTextControl* textControl = dynamic_cast(FindView("TextControl")); if (textControl) { @@ -1518,7 +1597,7 @@ FindPanel::SwitchMode(uint32 mode) } ShowOrHideMimeTypeMenu(); - AddAttrView(); + AddAttrRow(); break; } } @@ -1545,9 +1624,9 @@ FindPanel::CurrentMimeType(const char** type) const } } - if (type && item != NULL) { + if (type != NULL && item != NULL) { BMessage* message = item->Message(); - if (!message) + if (message == NULL) return NULL; if (message->FindString("mimetype", type) != B_OK) @@ -1578,24 +1657,28 @@ FindPanel::SetCurrentMimeType(BMenuItem* item) BMenuItem* search; for (int32 i = 2; (search = MimeTypeMenu()->ItemAt(i)) != NULL; i++) { - if (item == search || !search->Label()) + if (item == search || search->Label() == NULL) continue; - if (!strcmp(item->Label(),search->Label())) { + + if (strcmp(item->Label(), search->Label()) == 0) { search->SetMarked(true); break; } + BMenu* submenu = search->Submenu(); - if (submenu) { - for (int32 j = submenu->CountItems();j-- > 0;) { - BMenuItem* sub = submenu->ItemAt(j); - if (!strcmp(item->Label(),sub->Label())) { - sub->SetMarked(true); - break; - } + if (submenu == NULL) + continue; + + for (int32 j = submenu->CountItems(); j-- > 0;) { + BMenuItem* sub = submenu->ItemAt(j); + if (strcmp(item->Label(), sub->Label()) == 0) { + sub->SetMarked(true); + break; } } } } + return B_OK; } @@ -1625,14 +1708,14 @@ FindPanel::SetCurrentMimeType(const char* label) for (int32 subIndex = submenu->CountItems(); subIndex-- > 0;) { BMenuItem* subItem = submenu->ItemAt(subIndex); if (subItem->Label() != NULL - && !strcmp(label, subItem->Label())) { + && strcmp(label, subItem->Label()) == 0) { subItem->SetMarked(true); found = true; } } } - if (item->Label() != NULL && !strcmp(label, item->Label())) { + if (item->Label() != NULL && strcmp(label, item->Label()) == 0) { item->SetMarked(true); return B_OK; } @@ -1710,7 +1793,7 @@ FindPanel::AddMimeTypesToMenu() const char* superType; int32 index = 0; - while (types.FindString("super_types",index++,&superType) == B_OK) { + while (types.FindString("super_types", index++, &superType) == B_OK) { BMenu* superMenu = new BMenu(superType); BMessage* message = new BMessage(kMIMETypeItem); @@ -1724,22 +1807,24 @@ FindPanel::AddMimeTypesToMenu() } } - if (tracker) + if (tracker != NULL) { tracker->MimeTypes()->EachCommonType(&FindPanel::AddOneMimeTypeToMenu, MimeTypeMenu()); + } // remove empty super type menus (and set target) - for (int32 index = MimeTypeMenu()->CountItems();index-- > 2;) { + for (int32 index = MimeTypeMenu()->CountItems(); index-- > 2;) { BMenuItem* item = MimeTypeMenu()->ItemAt(index); BMenu* submenu = item->Submenu(); - if (submenu != NULL) { - if (submenu->CountItems() == 0) { - MimeTypeMenu()->RemoveItem(item); - delete item; - } else - submenu->SetTargetForItems(this); - } + if (submenu == NULL) + continue; + + if (submenu->CountItems() == 0) { + MimeTypeMenu()->RemoveItem(item); + delete item; + } else + submenu->SetTargetForItems(this); } MimeTypeMenu()->SetTargetForItems(this); @@ -1834,7 +1919,6 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem, while (roster.GetNextVolume(&volume) == B_OK) { if (volume.IsPersistent() && volume.KnowsQuery() && volume.KnowsAttr()) { - BQuery query; query.SetVolume(&volume); query.SetPredicate("_trk/recentQuery == 1"); @@ -1861,7 +1945,6 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem, recentQueries.AddItem(new EntryWithDate(ref, changeTime)); } - } } } @@ -1877,11 +1960,13 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem, templates.EachElement(AddOneRecentItem, ¶ms); int32 count = recentQueries.CountItems(); - // show only up to 10 recent queries - if (count > 10) + if (count > 10) { + // show only up to 10 recent queries count = 10; + } else if (count < 0) + count = 0; - if (templates.CountItems() && count) + if (templates.CountItems() > 0 && count > 0) menu->AddSeparatorItem(); for (int32 index = 0; index < count; index++) @@ -1889,58 +1974,42 @@ FindPanel::AddRecentQueries(BMenu* menu, bool addSaveAsItem, if (addSaveAsItem) { // add a Save as template item - if (count || templates.CountItems()) + if (count > 0 || templates.CountItems() > 0) menu->AddSeparatorItem(); BMessage* message = new BMessage(kRunSaveAsTemplatePanel); BMenuItem* item = new BMenuItem( - B_TRANSLATE("Save Query as template" B_UTF8_ELLIPSIS), message); + B_TRANSLATE("Save query as template" B_UTF8_ELLIPSIS), message); menu->AddItem(item); } } -void -FindPanel::AddOneAttributeItem(BBox* box, BRect rect) -{ - TAttrView* attrView = new TAttrView(rect, fAttrViewList.CountItems()); - fAttrViewList.AddItem(attrView); - - box->AddChild(attrView); - attrView->MakeTextViewFocus(); -} - - void FindPanel::SetUpAddRemoveButtons(BBox* box) { - BButton* button = Window() != NULL - ? dynamic_cast(Window()->FindView("remove")) - : NULL; - if (button == NULL) { - BRect rect = box->Bounds(); - rect.InsetBy(5, 10); - rect.top = rect.bottom - 20; - rect.right = rect.left + 22 - + be_plain_font->StringWidth(B_TRANSLATE("Add")); - - button = new BButton(rect, "add", B_TRANSLATE("Add"), - new BMessage(kAddItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); - button->SetTarget(this); - box->AddChild(button); - - rect.OffsetBy(rect.Width() + 6, 0); - rect.right = rect.left + 22 - + be_plain_font->StringWidth(B_TRANSLATE("Remove")); - button = new BButton(rect, "remove", B_TRANSLATE("Remove"), - new BMessage(kRemoveItem), B_FOLLOW_RIGHT + B_FOLLOW_BOTTOM); - - button->SetEnabled(false); - button->SetTarget(this); - box->AddChild(button); + BButton* removeButton = dynamic_cast(box->FindView("remove button")); + if (removeButton != NULL) { + removeButton->SetEnabled(fAttrGrid->CountRows() > 1); + return; } - // enable remove button as needed - button->SetEnabled(fAttrViewList.CountItems() > 1); + + removeButton = new BButton("remove button", B_TRANSLATE("Remove"), + new BMessage(kRemoveItem)); + removeButton->SetEnabled(false); + removeButton->SetTarget(this); + + BButton* addButton = new BButton("add button", B_TRANSLATE("Add"), + new BMessage(kAddItem)); + addButton->SetTarget(this); + + BGroupLayout* layout = dynamic_cast(box->GetLayout()); + BLayoutBuilder::Group<>(layout) + .AddGroup(B_HORIZONTAL) + .AddGlue() + .Add(removeButton) + .Add(addButton) + .End(); } @@ -1953,81 +2022,99 @@ FindPanel::FillCurrentQueryName(BTextControl* queryName, FindWindow* window) void -FindPanel::AddAttrView() +FindPanel::AddAttrRow() { BBox* box = dynamic_cast(FindView("Box")); - BRect bounds(Bounds()); + BGridView* grid = dynamic_cast(box->FindView("AttrFields")); - TAttrView* previous = fAttrViewList.LastItem(); + if (grid == NULL) { + // reset layout + BLayoutBuilder::Group<>(box, B_VERTICAL); - if (previous) - Window()->ResizeBy(0, 30); - - bounds = Bounds(); - bounds.InsetBy(15, 30); - bounds.bottom -= 10 + (fLatch->Value() ? kAttrViewDelta : 0); - - if (previous) { - box->ResizeTo(bounds.Width(), bounds.Height()); - bounds = previous->Frame(); - bounds.OffsetBy(0, 30); - } else { - bounds = box->Bounds(); - bounds.InsetBy(5, 5); - bounds.bottom = bounds.top + 25; + grid = new BGridView("AttrFields"); + box->AddChild(grid); } - AddOneAttributeItem(box, bounds); - // add logic to previous attrview - if (previous) - previous->AddLogicMenu(); + fAttrGrid = grid->GridLayout(); + + AddAttributeControls(fAttrGrid->CountRows()); + + // add logic to previous attrview + if (fAttrGrid->CountRows() > 1) + AddLogicMenu(fAttrGrid->CountRows() - 2); SetUpAddRemoveButtons(box); - - // populate mime popup - TAttrView* last = fAttrViewList.LastItem(); - last->AddMimeTypeAttrs(); } void -FindPanel::RemoveAttrView() +FindPanel::RemoveAttrRow() { - if (fAttrViewList.CountItems() < 2) + if (fAttrGrid->CountRows() < 2) return; - BBox* box = dynamic_cast(FindView("Box")); - TAttrView* attrView = fAttrViewList.LastItem(); - if (!box || !attrView) + BView* view; + + int32 row = fAttrGrid->CountRows() - 1; + for (int32 col = fAttrGrid->CountColumns(); col > 0; col--) { + BLayoutItem* item = fAttrGrid->ItemAt(col - 1, row); + if (item == NULL) + continue; + + view = item->View(); + if (view == NULL) + continue; + + view->RemoveSelf(); + delete view; + } + + BString string = "TextEntry"; + string << (row - 1); + view = FindAttrView(string.String(), row - 1); + if (view != NULL) + view->MakeFocus(); + + if (fAttrGrid->CountRows() > 1) { + // remove the And/Or menu field of the previous row + BLayoutItem* item = fAttrGrid->ItemAt(3, row - 1); + if (item == NULL) + return; + + view = item->View(); + if (view == NULL) + return; + + view->RemoveSelf(); + delete view; return; + } - Window()->ResizeBy(0, -30); - BRect bounds(Bounds()); - bounds.InsetBy(15, 30); - bounds.bottom -= 10 + (fLatch->Value() ? kAttrViewDelta : 0); - box->ResizeTo(bounds.Width(), bounds.Height()); + // only one row remains - fAttrViewList.RemoveItem(attrView); - attrView->RemoveSelf(); - delete attrView; - - attrView = fAttrViewList.LastItem(); - attrView->RemoveLogicMenu(); - attrView->MakeTextViewFocus(); - - if (fAttrViewList.CountItems() != 1) - return; - - BButton* button = dynamic_cast(Window()->FindView("remove")); - if (button) + // disable the remove button + BButton* button = dynamic_cast(FindView("remove button")); + if (button != NULL) button->SetEnabled(false); + + // remove the And/Or menu field + BLayoutItem* item = fAttrGrid->RemoveItem(3); + if (item == NULL) + return; + + view = item->View(); + if (view == NULL) + return; + + view->RemoveSelf(); + delete view; } uint32 FindPanel::InitialMode(const BNode* node) { - if (!node || node->InitCheck() != B_OK) + if (node == NULL || node->InitCheck() != B_OK) return kByNameItem; uint32 result; @@ -2042,7 +2129,7 @@ FindPanel::InitialMode(const BNode* node) int32 FindPanel::InitialAttrCount(const BNode* node) { - if (!node || node->InitCheck() != B_OK) + if (node == NULL || node->InitCheck() != B_OK) return 1; int32 result; @@ -2107,12 +2194,12 @@ FindPanel::SaveWindowState(BNode* node, bool editTemplate) case kByAttributeItem: { BMessage message; - int32 count = fAttrViewList.CountItems(); + int32 count = fAttrGrid->CountRows(); node->WriteAttr(kAttrQueryInitialNumAttrs, B_INT32_TYPE, 0, &count, sizeof(int32)); for (int32 index = 0; index < count; index++) - fAttrViewList.ItemAt(index)->SaveState(&message, index); + SaveAttrState(&message, index); ssize_t size = message.FlattenedSize(); char* buffer = new char[size]; @@ -2143,25 +2230,12 @@ FindPanel::SaveWindowState(BNode* node, bool editTemplate) void FindPanel::SwitchToTemplate(const BNode* node) { - if (fLatch->Value()) { - // this is kind of a hack - the following code up to - // RestoreWindowState assumes the latch is closed - // Would be nicer if all the size of the window were set once - // and correctly - this is not easy thought because the latch - // controls the window size in relative increments - fLatch->SetValue(0); - fMoreOptionsPane->SetMode(0); - } - SwitchMode(InitialMode(node)); // update the menu to correspond to the mode MarkNamedMenuItem(fSearchModeMenu, InitialMode(node), true); - BRect initialRect(InitialViewSize(node)); - Window()->ResizeTo(initialRect.Width(), initialRect.Height()); if (Mode() == (int32)kByAttributeItem) { RemoveByAttributeItems(); - ResizeAttributeBox(node); AddByAttributeItems(node); } @@ -2172,8 +2246,10 @@ FindPanel::SwitchToTemplate(const BNode* node) void FindPanel::RestoreMimeTypeMenuSelection(const BNode* node) { - if (Mode() == (int32)kByFormulaItem || node == NULL || node->InitCheck() != B_OK) + if (Mode() == (int32)kByFormulaItem || node == NULL + || node->InitCheck() != B_OK) { return; + } BString buffer; if (node->ReadAttrString(kAttrQueryInitialMime, &buffer) == B_OK) @@ -2185,7 +2261,7 @@ void FindPanel::RestoreWindowState(const BNode* node) { fMode = InitialMode(node); - if (!node || node->InitCheck() != B_OK) + if (node == NULL || node->InitCheck() != B_OK) return; ShowOrHideMimeTypeMenu(); @@ -2195,7 +2271,7 @@ FindPanel::RestoreWindowState(const BNode* node) bool storesMoreOptions = ReadAttr(node, kAttrQueryMoreOptions, kAttrQueryMoreOptionsForeign, B_RAW_TYPE, 0, &saveMoreOptions, sizeof(saveMoreOptions), &MoreOptionsStruct::EndianSwap) - != kReadAttrFailed; + != kReadAttrFailed; if (storesMoreOptions) { // need to sanitize to true or false here, could have picked @@ -2205,7 +2281,10 @@ FindPanel::RestoreWindowState(const BNode* node) (saveMoreOptions.showMoreOptions != 0); fLatch->SetValue(saveMoreOptions.showMoreOptions); - fMoreOptionsPane->SetMode(saveMoreOptions.showMoreOptions); + if (saveMoreOptions.showMoreOptions == 1 && fMoreOptions->IsHidden()) + fMoreOptions->Show(); + else if (saveMoreOptions.showMoreOptions == 0 && !fMoreOptions->IsHidden()) + fMoreOptions->Hide(); fSearchTrashCheck->SetValue(saveMoreOptions.searchTrash); fTemporaryCheck->SetValue(saveMoreOptions.temporary); @@ -2270,8 +2349,7 @@ FindPanel::RestoreWindowState(const BNode* node) BMessage message; if (message.Unflatten(buffer) == B_OK) for (int32 index = 0; index < count; index++) { - fAttrViewList.ItemAt(index)->RestoreState(message, - index); + RestoreAttrState(message, index); } } delete[] buffer; @@ -2315,38 +2393,15 @@ FindPanel::RestoreWindowState(const BNode* node) } -void -FindPanel::ResizeAttributeBox(const BNode* node) -{ - BBox* box = dynamic_cast(FindView("Box")); - BRect bounds(box->Bounds()); - int32 count = InitialAttrCount(node); - - bounds.bottom = count * 30 + 40; - box->ResizeTo(bounds.Width(), bounds.Height()); -} - - void FindPanel::AddByAttributeItems(const BNode* node) { - BBox* box = dynamic_cast(FindView("Box")); - ASSERT(box); - BRect bounds(box->Bounds()); - int32 numAttributes = InitialAttrCount(node); if (numAttributes < 1) numAttributes = 1; - BRect rect(bounds); - rect.InsetBy(5, 5); - rect.bottom = rect.top + 25; - - for (int32 index = 0; index < numAttributes; index ++) { - AddOneAttributeItem(box, rect); - rect.OffsetBy(0, 30); - } - SetUpAddRemoveButtons(box); + for (int32 index = 0; index < numAttributes; index ++) + AddAttrRow(); } @@ -2354,29 +2409,36 @@ void FindPanel::AddByNameOrFormulaItems() { BBox* box = dynamic_cast(FindView("Box")); + // reset layout + BLayoutBuilder::Group<>(box, B_VERTICAL); - BRect bounds(box->Bounds()); - bounds.InsetBy(10, 10); - BTextControl* textControl = new BTextControl(bounds, "TextControl", + BTextControl* textControl = new BTextControl("TextControl", "", "", NULL); textControl->SetDivider(0.0f); + box->SetBorder(B_NO_BORDER); box->AddChild(textControl); textControl->MakeFocus(); } void -FindPanel::RemoveAttrViewItems() +FindPanel::RemoveAttrViewItems(bool removeGrid) { - for (;;) { - BView* view = FindView("AttrView"); - if (view == NULL) - break; - view->RemoveSelf(); - delete view; + if (fAttrGrid == NULL) + return; + + BView* view = fAttrGrid->View(); + for (int32 index = view->CountChildren(); index > 0; index--) { + BView* child = view->ChildAt(index - 1); + child->RemoveSelf(); + delete child; } - fAttrViewList.MakeEmpty(); + if (removeGrid) { + view->RemoveSelf(); + delete view; + fAttrGrid = NULL; + } } @@ -2384,19 +2446,19 @@ void FindPanel::RemoveByAttributeItems() { RemoveAttrViewItems(); - BView* view = FindView("add"); + BView* view = FindView("add button"); if (view) { view->RemoveSelf(); delete view; } - view = FindView("remove"); + view = FindView("remove button"); if (view) { view->RemoveSelf(); delete view; } - view = dynamic_cast(FindView("TextControl")); + view = FindView("TextControl"); if (view) { view->RemoveSelf(); delete view; @@ -2407,25 +2469,26 @@ FindPanel::RemoveByAttributeItems() void FindPanel::ShowOrHideMimeTypeMenu() { + BView* menuFieldSpacer = FindView("MimeTypeMenuSpacer"); BMenuField* menuField = dynamic_cast(FindView("MimeTypeMenu")); - if (Mode() == (int32)kByFormulaItem && !menuField->IsHidden()) + if (Mode() == (int32)kByFormulaItem && !menuField->IsHidden(this)) { + BSize size = menuField->ExplicitMinSize(); menuField->Hide(); - else if (menuField->IsHidden()) + menuFieldSpacer->SetExplicitMinSize(size); + menuFieldSpacer->SetExplicitMaxSize(size); + if (menuFieldSpacer->IsHidden(this)) + menuFieldSpacer->Show(); + } else if (menuField->IsHidden(this)) { + menuFieldSpacer->Hide(); menuField->Show(); + } } -// #pragma mark - - - -TAttrView::TAttrView(BRect frame, int32 index) - : - BView(frame, "AttrView", B_FOLLOW_NONE, B_WILL_DRAW) +void +FindPanel::AddAttributeControls(int32 gridRow) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BPopUpMenu* menu = new BPopUpMenu("PopUp"); // add NAME attribute to popup @@ -2438,27 +2501,14 @@ TAttrView::TAttrView(BRect frame, int32 index) BMenuItem* item = new BMenuItem(submenu, message); menu->AddItem(item); - const int32 operators[] = { - B_CONTAINS, - B_EQ, - B_NE, - B_BEGINS_WITH, - B_ENDS_WITH}; - static const char* operatorLabels[] = { - B_TRANSLATE_MARK("contains"), - B_TRANSLATE_MARK("is"), - B_TRANSLATE_MARK("is not"), - B_TRANSLATE_MARK("starts with"), - B_TRANSLATE_MARK("ends with")}; - for (int32 i = 0; i < 5; i++) { message = new BMessage(kAttributeItem); message->AddInt32("operator", operators[i]); - submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT( - operatorLabels[i]), message)); + submenu->AddItem(new BMenuItem( + B_TRANSLATE_NOCOLLECT(operatorLabels[i]), message)); } - // mark first item + // mark first items initially menu->ItemAt(0)->SetMarked(true); submenu->ItemAt(0)->SetMarked(true); @@ -2474,15 +2524,18 @@ TAttrView::TAttrView(BRect frame, int32 index) message = new BMessage(kAttributeItem); message->AddInt32("operator", B_GE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("greater than"), message)); + submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[5]), + message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_LE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("less than"), message)); + submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[6]), + message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_EQ); - submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message)); + submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[1]), + message)); // add "modified" field submenu = new BMenu(B_TRANSLATE("Modified")); @@ -2496,62 +2549,46 @@ TAttrView::TAttrView(BRect frame, int32 index) message = new BMessage(kAttributeItem); message->AddInt32("operator", B_LE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("before"), message)); + submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[7]), + message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_GE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("after"), message)); + submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[8]), + message)); - BRect bounds(Bounds()); - bounds.right = bounds.left + 100; - bounds.bottom = bounds.top + 15; - fMenuField = new BMenuField(bounds, "MenuField", "", menu); - fMenuField->SetDivider(0.0f); + BMenuField* menuField = new BMenuField("MenuField", "", menu); + menuField->SetDivider(0.0f); + fAttrGrid->AddView(menuField, 0, gridRow); + + BStringView* stringView = new BStringView("", + menu->FindMarked()->Submenu()->FindMarked()->Label()); + BLayoutItem* layoutItem = fAttrGrid->AddView(stringView, 1, gridRow); + layoutItem->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, + B_ALIGN_VERTICAL_UNSET)); - // add text entry box - bounds = Bounds(); - bounds.left += bounds.right - 180; - bounds.top += 2; - bounds.right -= 42; BString title("TextEntry"); - title << index; - fTextControl = new BTextControl(bounds, title.String(), "", "", NULL); - fTextControl->SetDivider(0.0f); - AddChild(fTextControl); + title << gridRow; + BTextControl* textControl = new BTextControl(title.String(), "", "", NULL); + textControl->SetDivider(0.0f); + fAttrGrid->AddView(textControl, 2, gridRow); + textControl->MakeFocus(); - AddChild(fMenuField); - // add attributes from currently selected mimetype -} - - -TAttrView::~TAttrView() -{ -} - - -void -TAttrView::AttachedToWindow() -{ - BMenu* menu = fMenuField->Menu(); // target everything menu->SetTargetForItems(this); - for (int32 index = menu->CountItems() - 1; index >= 0; index--) menu->SubmenuAt(index)->SetTargetForItems(this); + + // populate mime popup + AddMimeTypeAttrs(menu); } void -TAttrView::MakeTextViewFocus() +FindPanel::RestoreAttrState(const BMessage &message, int32 index) { - fTextControl->MakeFocus(); -} - - -void -TAttrView::RestoreState(const BMessage &message, int32 index) -{ - BMenu* menu = fMenuField->Menu(); + BMenu* menu = dynamic_cast(FindAttrView("MenuField", index)) + ->Menu(); // decode menu selections AddMimeTypeAttrs(menu); @@ -2568,27 +2605,32 @@ TAttrView::RestoreState(const BMessage &message, int32 index) } // decode attribute text - ASSERT(fTextControl); + BString bstring = "TextEntry"; + bstring << index; + BTextControl* textControl + = dynamic_cast(FindAttrView(bstring.String(), index)); + ASSERT(textControl); const char* string; if (message.FindString("attrViewText", index, &string) == B_OK) - fTextControl->TextView()->SetText(string); + textControl->TextView()->SetText(string); int32 logicMenuSelectedIndex; - BMenuField* field = dynamic_cast(FindView("Logic")); + BMenuField* field = dynamic_cast(FindAttrView("Logic", index)); if (message.FindInt32("logicalRelation", index, - &logicMenuSelectedIndex) == B_OK) { + &logicMenuSelectedIndex) == B_OK) { if (field) field->Menu()->ItemAt(logicMenuSelectedIndex)->SetMarked(true); else - AddLogicMenu(logicMenuSelectedIndex == 0); + AddLogicMenu(index, logicMenuSelectedIndex == 0); } } void -TAttrView::SaveState(BMessage* message, int32) +FindPanel::SaveAttrState(BMessage* message, int32 index) { - BMenu* menu = fMenuField->Menu(); + BMenu* menu = dynamic_cast(FindAttrView("MenuField", index)) + ->Menu(); // encode main attribute menu selection BMenuItem* item = menu->FindMarked(); @@ -2607,11 +2649,15 @@ TAttrView::SaveState(BMessage* message, int32) message->AddString("subMenuSelection", label); // encode attribute text - ASSERT(fTextControl); - message->AddString("attrViewText", fTextControl->TextView()->Text()); + BString string = "TextEntry"; + string << index; + BTextControl* textControl + = dynamic_cast(FindAttrView(string.String(), index)); + ASSERT(textControl); + message->AddString("attrViewText", textControl->TextView()->Text()); - BMenuField* field = dynamic_cast(FindView("Logic")); - if (field) { + BMenuField* field = dynamic_cast(FindAttrView("Logic", index)); + if (field != NULL) { BMenuItem* item = field->Menu()->FindMarked(); ASSERT(item); message->AddInt32("logicalRelation", @@ -2619,8 +2665,9 @@ TAttrView::SaveState(BMessage* message, int32) } } + void -TAttrView::AddLogicMenu(bool selectAnd) +FindPanel::AddLogicMenu(int32 index, bool selectAnd) { // add "AND/OR" menu BPopUpMenu* menu = new BPopUpMenu(""); @@ -2640,20 +2687,19 @@ TAttrView::AddLogicMenu(bool selectAnd) menu->SetTargetForItems(this); - BRect bounds(Bounds()); - bounds.left = bounds.right - 40; - bounds.bottom = bounds.top + 15; - BMenuField* menufield = new BMenuField(bounds, "Logic", "", menu); + BMenuField* menufield = new BMenuField("Logic", "", menu, B_WILL_DRAW); menufield->SetDivider(0.0f); - menufield->HidePopUpMarker(); - AddChild(menufield); + + ResizeMenuField(menufield); + + fAttrGrid->AddView(menufield, 3, index); } void -TAttrView::RemoveLogicMenu() +FindPanel::RemoveLogicMenu(int32 index) { - BMenuField* menufield = dynamic_cast(FindView("Logic")); + BMenuField* menufield = dynamic_cast(FindAttrView("Logic", index)); if (menufield) { menufield->RemoveSelf(); delete menufield; @@ -2662,67 +2708,7 @@ TAttrView::RemoveLogicMenu() void -TAttrView::Draw(BRect) -{ - BMenuItem* item = fMenuField->Menu()->FindMarked(); - if (!item) - return; - - if (item->Submenu()->FindMarked()) { - float width = StringWidth(item->Submenu()->FindMarked()->Label()); - BRect bounds(fTextControl->Frame()); - - // draws the is/contains, etc. string - bounds.left -= (width + 10); - bounds.bottom -= 6; - DrawString(item->Submenu()->FindMarked()->Label(), - bounds.LeftBottom()); - } -} - - -void -TAttrView::MessageReceived(BMessage* message) -{ - BMenuItem* item; - - switch (message->what) { - case kAttributeItem: - if (message->FindPointer("source", (void**)&item) != B_OK) - return; - - item->Menu()->Superitem()->SetMarked(true); - Invalidate(); - break; - - case kAttributeItemMain: - // in case someone selected just and attribute without the - // comparator - if (message->FindPointer("source", (void**)&item) != B_OK) - return; - - if (item->Submenu()->ItemAt(0)) - item->Submenu()->ItemAt(0)->SetMarked(true); - Invalidate(); - break; - - default: - _inherited::MessageReceived(message); - break; - } -} - - -void -TAttrView::AddMimeTypeAttrs() -{ - BMenu* menu = fMenuField->Menu(); - AddMimeTypeAttrs(menu); -} - - -void -TAttrView::AddAttributes(BMenu* menu, const BMimeType &mimeType) +FindPanel::AddAttributes(BMenu* menu, const BMimeType &mimeType) { // only add things to menu which have "user-visible" data BMessage attributeMessage; @@ -2767,29 +2753,25 @@ TAttrView::AddAttributes(BMenu* menu, const BMimeType &mimeType) case B_STRING_TYPE: message = new BMessage(kAttributeItem); message->AddInt32("operator", B_CONTAINS); - submenu->AddItem(new BMenuItem(B_TRANSLATE("contains"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[0], message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_EQ); - submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message)); + submenu->AddItem(new BMenuItem(operatorLabels[1], message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_NE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("is not"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[2], message)); submenu->SetTargetForItems(this); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_BEGINS_WITH); - submenu->AddItem(new BMenuItem(B_TRANSLATE("starts with"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[3], message)); submenu->SetTargetForItems(this); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_ENDS_WITH); - submenu->AddItem(new BMenuItem(B_TRANSLATE("ends with"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[4], message)); break; case B_BOOL_TYPE: @@ -2806,27 +2788,25 @@ TAttrView::AddAttributes(BMenu* menu, const BMimeType &mimeType) case B_DOUBLE_TYPE: message = new BMessage(kAttributeItem); message->AddInt32("operator", B_EQ); - submenu->AddItem(new BMenuItem(B_TRANSLATE("is"), message)); + submenu->AddItem(new BMenuItem(operatorLabels[1], message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_GE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("greater than"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[5], message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_LE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("less than"), - message)); + submenu->AddItem(new BMenuItem(operatorLabels[6], message)); break; case B_TIME_TYPE: message = new BMessage(kAttributeItem); message->AddInt32("operator", B_LE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("before"), message)); + submenu->AddItem(new BMenuItem(operatorLabels[7], message)); message = new BMessage(kAttributeItem); message->AddInt32("operator", B_GE); - submenu->AddItem(new BMenuItem(B_TRANSLATE("after"), message)); + submenu->AddItem(new BMenuItem(operatorLabels[8], message)); break; } submenu->SetTargetForItems(this); @@ -2835,15 +2815,10 @@ TAttrView::AddAttributes(BMenu* menu, const BMimeType &mimeType) void -TAttrView::AddMimeTypeAttrs(BMenu* menu) +FindPanel::AddMimeTypeAttrs(BMenu* menu) { - FindPanel* mainView = dynamic_cast(Parent()-> - Parent()->FindView("MainView")); - if (!mainView) - return; - const char* typeName; - if (mainView->CurrentMimeType(&typeName) == NULL) + if (CurrentMimeType(&typeName) == NULL) return; BMimeType mimeType(typeName); @@ -2862,11 +2837,13 @@ TAttrView::AddMimeTypeAttrs(BMenu* menu) void -TAttrView::GetDefaultName(BString &result) const +FindPanel::GetDefaultAttrName(BString &result, int32 row) const { BMenuItem* item = NULL; - if (fMenuField->Menu() != NULL) - item = fMenuField->Menu()->FindMarked(); + BMenuField* menuField + = dynamic_cast(fAttrGrid->ItemAt(0, row)->View()); + if (menuField->Menu() != NULL) + item = menuField->Menu()->FindMarked(); if (item != NULL) result << item->Label(); else @@ -2882,7 +2859,9 @@ TAttrView::GetDefaultName(BString &result) const else result << " = "; - result << fTextControl->Text(); + BTextControl* textControl + = dynamic_cast(fAttrGrid->ItemAt(2, row)->View()); + result << textControl->Text(); } @@ -3185,7 +3164,7 @@ MostUsedNames::~MostUsedNames() bool MostUsedNames::ObtainList(BList* list) { - if (!list) + if (list == NULL) return false; if (!fLoaded) @@ -3240,9 +3219,8 @@ MostUsedNames::AddName(const char* name) if (entry == NULL) { for (int32 i = 0; - (entry = static_cast(fList.ItemAt(i))) != NULL; - i++) { - if (!strcmp(entry->name, name)) + (entry = static_cast(fList.ItemAt(i))) != NULL; i++) { + if (strcmp(entry->name, name) == 0) break; } } diff --git a/src/kits/tracker/FindPanel.h b/src/kits/tracker/FindPanel.h index 5bed25d1fd..3a4c94dcd2 100644 --- a/src/kits/tracker/FindPanel.h +++ b/src/kits/tracker/FindPanel.h @@ -54,6 +54,7 @@ class BCheckBox; class BMenuField; class BFile; class BPopUpMenu; +class BGridLayout; namespace BPrivate { @@ -173,11 +174,12 @@ class FindWindow : public BWindow { class FindPanel : public BView { public: - FindPanel(BRect, BFile*, FindWindow* parent, bool fromTemplate, + FindPanel(BFile*, FindWindow* parent, bool fromTemplate, bool editTemplateOnly); virtual ~FindPanel(); virtual void AttachedToWindow(); + virtual void Draw(BRect updateRect); virtual void MessageReceived(BMessage*); void BuildAttrQuery(BQuery*, bool &dynamicDate) const; @@ -192,10 +194,6 @@ class FindPanel : public BView { uint32 Mode() const { return fMode; } - static BRect InitialViewSize(const BNode*); - // used when showing window, does not account for more options, - // those if used will force a resize later - static uint32 InitialMode(const BNode* entry); void SaveWindowState(BNode*, bool editTemplate); @@ -207,6 +205,7 @@ class FindPanel : public BView { // build up a simple query from the name we are searching for void GetDefaultName(BString &) const; + void GetDefaultAttrName(BString &, int32) const; const char* UserSpecifiedName() const; // name filled out in the query name text field @@ -216,11 +215,6 @@ class FindPanel : public BView { // queries private: - static float ViewHeightForMode(uint32 mode, bool moreOptions); - // accouts for moreOptions - // if in attributeView, only returns valid result if one attr only - static float BoxHeightForMode(uint32 mode, bool moreOptions); - void AddMimeTypesToMenu(); // populates the type menu static bool AddOneMimeTypeToMenu(const ShortMimeInfo*, void* castToMenu); @@ -229,9 +223,9 @@ class FindPanel : public BView { // populates the volume menu void ShowVolumeMenuLabel(); - void AddAttrView(); + void AddAttrRow(); // add one more attribute item to the attr view - void RemoveAttrView(); + void RemoveAttrRow(); // remove the last attribute item void AddFirstAttr(); @@ -239,20 +233,20 @@ class FindPanel : public BView { void RestoreWindowState(const BNode*); void RestoreMimeTypeMenuSelection(const BNode*); void AddByAttributeItems(const BNode*); - void ResizeAttributeBox(const BNode*); void RemoveByAttributeItems(); - void RemoveAttrViewItems(); + void RemoveAttrViewItems(bool removeGrid = true); void ShowOrHideMimeTypeMenu(); // MimeTypeWindow is only shown in kByNameItem and // kByAttributeItem modes + void AddAttributeControls(int32); + void ShowOrHideMoreOptions(bool show); // fMode gets set by this and the call relies on it being // up-to-date static int32 InitialAttrCount(const BNode*); void FillCurrentQueryName(BTextControl*, FindWindow*); void AddByNameOrFormulaItems(); - void AddOneAttributeItem(BBox* box, BRect); void SetUpAddRemoveButtons(BBox* box); void SwitchMode(uint32); @@ -262,14 +256,25 @@ class FindPanel : public BView { void SaveAsQueryOrTemplate(const entry_ref*, const char*, bool queryTemplate); + BView* FindAttrView(const char*, int row) const; + + void AddAttributes(BMenu* menu, const BMimeType &type); + void AddMimeTypeAttrs(BMenu* menu); + void RestoreAttrState(const BMessage &, int32); + void SaveAttrState(BMessage*, int32); + void AddLogicMenu(int32, bool selectAnd = true); + void RemoveLogicMenu(int32); + + void ResizeMenuField(BMenuField*); + uint32 fMode; - BObjectList fAttrViewList; + BGridLayout* fAttrGrid; BPopUpMenu* fMimeTypeMenu; BMenuField* fMimeTypeField; BPopUpMenu* fVolMenu; BPopUpMenu* fSearchModeMenu; BPopUpMenu* fRecentQueries; - DialogPane* fMoreOptionsPane; + BBox* fMoreOptions; BTextControl* fQueryName; BString fInitialQueryName; @@ -284,38 +289,6 @@ class FindPanel : public BView { friend class RecentQueriesPopUp; }; -class TAttrView : public BView { - // a single attribute item - the search by attribute view - // can add several of these - public: - TAttrView(BRect frame, int32 index); - ~TAttrView(); - - virtual void AttachedToWindow(); - - void RestoreState(const BMessage &settings, int32 index); - void SaveState(BMessage* settings, int32 index); - - virtual void Draw(BRect updateRect); - virtual void MessageReceived(BMessage* message); - - void AddLogicMenu(bool selectAnd = true); - void RemoveLogicMenu(); - void AddMimeTypeAttrs(); - void MakeTextViewFocus(); - - void GetDefaultName(BString &result) const; - - private: - void AddAttributes(BMenu* menu, const BMimeType &type); - void AddMimeTypeAttrs(BMenu* menu); - - BMenuField* fMenuField; - BTextControl* fTextControl; - - typedef BView _inherited; -}; - class DeleteTransientQueriesTask { // transient queries get deleted if they didn't get used in a while; diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index 021fff7aea..26e99b6aba 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -830,11 +830,39 @@ TTracker::RefsReceived(BMessage* message) // copy over "Poses" messenger so that refs received // recipients know where the open came from BMessage* bundleThis = NULL; + BMessage stackBundleThis; BMessenger messenger; if (message->FindMessenger("TrackerViewToken", &messenger) == B_OK) { - bundleThis = new BMessage(); + bundleThis = &stackBundleThis; bundleThis->AddMessenger("TrackerViewToken", messenger); + } else { + // copy over any "be:*" fields -- e.g. /bin/open may include + // "be:line" and "be:column" + for (int32 i = 0;; i++) { + char* name; + type_code type; + int32 count; + status_t error = message->GetInfo(B_ANY_TYPE, i, &name, + &type, &count); + if (error != B_OK) + break; + if (strncmp(name, "be:", 3) != 0) + continue; + for (int32 k = 0; k < count; k++) { + const void* data; + ssize_t size; + if (message->FindData(name, type, k, &data, &size) + != B_OK) { + break; + } + if (stackBundleThis.AddData(name, type, data, size) + != B_OK) { + break; + } + bundleThis = &stackBundleThis; + } + } } for (int32 index = 0; index < count; index++) { @@ -854,7 +882,6 @@ TTracker::RefsReceived(BMessage* message) bundleThis); } - delete bundleThis; break; } } diff --git a/src/libs/edit/Jamfile b/src/libs/edit/Jamfile index 6363d5f04b..0650210877 100644 --- a/src/libs/edit/Jamfile +++ b/src/libs/edit/Jamfile @@ -2,7 +2,7 @@ SubDir HAIKU_TOP src libs edit ; SetSubDirSupportedPlatforms $(HAIKU_BONE_COMPATIBLE_PLATFORMS) ; -UseLibraryHeaders termcap ; +UseLibraryHeaders ncurses ; UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) headers libs ncurses ] : true ; diff --git a/src/libs/gnu/xattr.cpp b/src/libs/gnu/xattr.cpp index fadb573112..9873018ac6 100644 --- a/src/libs/gnu/xattr.cpp +++ b/src/libs/gnu/xattr.cpp @@ -43,7 +43,9 @@ struct AttributeName { // printable, just use them as the type string, otherwise convert // to hex char typeString[9]; - uint8 typeBytes[4] = { type >> 24, type >> 16, type >> 8, type }; + uint8 typeBytes[4] = { (uint8)((type >> 24) & 0xff), + (uint8)((type >> 16) & 0xff), (uint8)((type >> 8) & 0xff), + (uint8)(type & 0xff) }; if (isprint(typeBytes[0]) && isprint(typeBytes[1]) && isprint(typeBytes[2]) && isprint(typeBytes[3])) { typeString[0] = typeBytes[0]; diff --git a/src/libs/ncurses/Jamfile b/src/libs/ncurses/Jamfile index 8478937872..297bbd67b6 100644 --- a/src/libs/ncurses/Jamfile +++ b/src/libs/ncurses/Jamfile @@ -1,3 +1,4 @@ SubDir HAIKU_TOP src libs ncurses ; SubInclude HAIKU_TOP src libs ncurses ncurses ; +SubInclude HAIKU_TOP src libs ncurses progs ; diff --git a/src/libs/ncurses/include/ncurses_cfg.h b/src/libs/ncurses/include/ncurses_cfg.h index dd42d03393..95a7b68828 100644 --- a/src/libs/ncurses/include/ncurses_cfg.h +++ b/src/libs/ncurses/include/ncurses_cfg.h @@ -51,12 +51,12 @@ #define HAVE_LONG_FILE_NAMES 1 #define MIXEDCASE_FILENAMES 1 #define USE_DATABASE 1 -#define TERMINFO_DIRS "/usr/local/share/terminfo" -#define TERMINFO "/usr/local/share/terminfo" +#define TERMINFO_DIRS "/boot/common/data/terminfo" +#define TERMINFO "/boot/common/data/terminfo" #define TERMPATH "/etc/termcap" #define HAVE_BIG_CORE 1 -#define PURE_TERMINFO 0 -#define USE_TERMCAP 1 +#define PURE_TERMINFO 1 +#define USE_TERMCAP 0 #define USE_HOME_TERMINFO 1 #define USE_ROOT_ENVIRON 1 #define HAVE_REMOVE 1 diff --git a/src/libs/ncurses/progs/Jamfile b/src/libs/ncurses/progs/Jamfile new file mode 100644 index 0000000000..5cb817e3e3 --- /dev/null +++ b/src/libs/ncurses/progs/Jamfile @@ -0,0 +1,32 @@ +SubDir HAIKU_TOP src libs ncurses progs ; + +SubDirCcFlags -O2 -DHAVE_CONFIG_H -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L -DNDEBUG ; + +SubDirSysHdrs $(SUBDIR) ; +SubDirSysHdrs [ FDirName $(SUBDIR) $(DOTDOT) include ] ; + +BinCommand tput : + tput.c + : libncurses.a : ; + +BinCommand infocmp : + dump_entry.c + infocmp.c + : libncurses.a : ; + +BinCommand tset : + tset.c + : libncurses.a : ; + +BinCommand clear : + clear.c + : libncurses.a : ; + +BinCommand toe : + toe.c + : libncurses.a : ; + +BinCommand tic : + dump_entry.c + tic.c + : libncurses.a : ; diff --git a/src/libs/termcap/COPYING b/src/libs/termcap/COPYING deleted file mode 100644 index d60c31a97a..0000000000 --- a/src/libs/termcap/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/src/libs/termcap/ChangeLog b/src/libs/termcap/ChangeLog deleted file mode 100644 index 335a2f7ee9..0000000000 --- a/src/libs/termcap/ChangeLog +++ /dev/null @@ -1,180 +0,0 @@ -2002-02-25 Gary Wong - - * version.c: Version 1.3.1. - - * configure.in: Update obselete macros. - - * termcap.src: Regenerated from version 11.0.1 master file. - - * tparam.c [!emacs]: Move #define of bcopy to after - #include . Reported by Oleg Kornilov and Iyer Viswanathan. - - * termcap.c [!emacs]: Replace ospeed for building standalone - libtermcap, for binary compatibility. - -2001-05-28 Gerd Moellmann - - * termcap.c (speeds): Put in #if 0. - -2000-12-08 Gerd Moellmann - - * tparam.c (tparam1): Change the way buffers are reallocated to be - portable and less obfuscated. - - * termcap.c (tgetent): Change the way buffers are reallocated to - be portable and less obfuscated. - -2000-11-19 Gerd Moellmann - - * termcap.c (ospeed): Remove. - (tputs) [!emacs]: Remove unused code. - (tgetent): Avoid a compiler warning. - -2000-06-20 Dave Love - - * tparam.c [emacs]: Include lisp.h. - - * termcap.c [emacs]: Test HAVE_FCNTL_H, not USG5. Include lisp.h - and unistd.h. - -2000-04-13 Gerd Moellmann - - * tparam.c (tparam1): Abort when encountering an unknown `%'-specifier. - -Wed Aug 16 20:45:44 1995 David J. MacKenzie - - * version.c: Version 1.3. - - * termcap.c (tgetent): Use the user-supplied buffer even if we - don't find a matching terminal, so the program can set the buffer - if they want (`less' does this). From Bob Pegram - . - -Wed Jul 26 11:44:51 1995 David J. MacKenzie - - * termcap.c: TERMCAP_NAME -> TERMCAP_FILE. - - * configure.in: Add --enable-install-termcap and --with-termcap - options. - - * Makefile.in: Add hooks for new configure options. - - * Makefile.in (DISTFILES): Add termcap.src. - (DEFS): Remove -DNO_ARG_ARRAY. - (install-data, uninstall-data): New targets. - - * tparam.c (tparam): Remove arg array version and the #ifdef. - - * termcap.c: Move #define of bcopy to after #include . - - * termcap.h: Prototype the arg to the tputs outfun arg. - - * Makefile.in: realclean -> maintainer-clean. Use @prefix@ and - @exec_prefix@. - - * Makefile.in (DISTFILES): Add install-sh. - -Fri Apr 7 14:57:45 1995 Richard Stallman - - * termcap.c (tgetent): Don't try to return the allocated address. - Always return 1 if successful. - -Tue Feb 14 02:34:43 1995 Richard Stallman - - * termcap.c (speeds): Make it ints. Add some higher speeds. - (tputs) [emacs]: If speed is high, convert to smaller units. - (tputs): Really use SPEED to calculate PADCOUNT. - -Sat Dec 17 07:20:24 1994 Richard Stallman - - * termcap.c (tgetst1): Let ^? stand for DEL character. - -Thu Jun 30 04:35:50 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * configure.in: Use AC_HAVE_HEADERS instead of AC_UNISTD_H. - Add AC_PROG_RANLIB. - * Makefile.in (AR, RANLIB): New variables. - (install, libtermcap.a): Use them instead of hard-wired commands. - -Sat Jun 4 12:21:41 1994 Roland McGrath (roland@geech.gnu.ai.mit.edu) - - * termcap.c [HAVE_CONFIG_H]: Include , and include - #ifdef USG5, so we get O_* defns. - -Wed May 25 19:05:30 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * termcap.c (O_RDONLY): Define to 0 if not already defined. - (tgetent): Use O_RDONLY instead of explicit 0 in call to open. - -Wed Jan 5 22:20:15 1993 Morten Welinder (terra@diku.dk) - - * termcap.c (tgetent) [INTERNAL_TERMINAL]: Fake internal terminal - without reading any files. - (valid_file_name, tgetent) [MSDOS]: Drive letter support. - (tgetent) [MSDOS]: Use text mode for database. - -Fri Dec 17 00:22:43 1993 Mike Long (mike.long@analog.com) - - * termcap.c (tgetent): Replaced literal filenames for termcap - database with preprocessor symbol TERMCAP_NAME. - (TERMCAP_NAME): Define if not defined. - -Fri Sep 10 00:35:07 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) - - * Makefile.in (.c.o): Put -I. before -I$(srcdir). - * termcap.c: Include instead of "config.h". - * tparam.c: Likewise. - -Thu Jul 29 20:53:30 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) - - * Makefile.in (config.status): Run config.status --recheck, not - configure, to get the right args passed. - -Thu Apr 15 12:45:10 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) - - * Version 1.2. - - * tparam.c [!emacs] (xmalloc, xrealloc, memory_out): New functions. - (tparam1): Use them. - - * termcap.c, tparam.c: Use NULL or '\0' where appropriate - instead of 0. Rename some vars. - * termcap.c (tgetent): If EOF is reached on termcap file, - free allocated resources before returning. - - * termcap.c (tgetent): Use /etc/termcap if TERMCAP is an entry - for a term type other than TERM. - From pjr@jet.UK (Paul J Rippin). - -Sat Apr 10 23:55:12 1993 Richard Stallman (rms@mole.gnu.ai.mit.edu) - - * tparam.c (tparam1): Don't set the 0200 bit on a non-0 character code. - From junio@twinsun.COM (Junio Hamano). - -Tue Dec 8 22:02:15 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) - - * termcap.c, tparam.c: Use HAVE_STRING_H instead of USG. - -Thu Dec 3 13:47:56 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) - - * termcap.c, tparam.c [HAVE_CONFIG_H]: Include config.h. - -Fri Oct 23 12:35:29 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) - - * termcap.h [__STDC__]: Add consts. From Franc,ois Pinard. - -Tue Oct 13 15:52:21 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) - - * Version 1.1. - -Tue Sep 29 21:04:39 1992 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) - - * termcap.[ch], tparam.c: Fix some lint. - - * version.c: New file. - -Local Variables: -mode: indented-text -left-margin: 8 -version-control: never -End: diff --git a/src/libs/termcap/INSTALL b/src/libs/termcap/INSTALL deleted file mode 100644 index 50dbe439d0..0000000000 --- a/src/libs/termcap/INSTALL +++ /dev/null @@ -1,183 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - diff --git a/src/libs/termcap/Jamfile b/src/libs/termcap/Jamfile index dd5667474f..4f3f7fea61 100644 --- a/src/libs/termcap/Jamfile +++ b/src/libs/termcap/Jamfile @@ -1,16 +1,5 @@ SubDir HAIKU_TOP src libs termcap ; -SetSubDirSupportedPlatformsBeOSCompatible ; - -# set some additional defines -{ - SubDirCcFlags -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DTERMCAP_FILE=\'\"/etc/termcap\"\' -w ; -} - -StaticLibrary libtermcap.a : - termcap.c tparam.c version.c -; - # Build the /etc/termcap file. It's already ready to use, but we filter out the # comments. diff --git a/src/libs/termcap/Makefile.in b/src/libs/termcap/Makefile.in deleted file mode 100644 index 66e5d02f5f..0000000000 --- a/src/libs/termcap/Makefile.in +++ /dev/null @@ -1,138 +0,0 @@ -# Makefile for GNU termcap library. -# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -#### Start of system configuration section. #### - -srcdir = @srcdir@ -VPATH = @srcdir@ - -CC = @CC@ -AR = ar -RANLIB = @RANLIB@ - -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ - -MAKEINFO = makeinfo - -DEFS = @DEFS@ -DTERMCAP_FILE=\"$(termcapfile)\" - -CFLAGS = -g - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -# Directory in which to install libtermcap.a. -libdir = $(exec_prefix)/lib - -# Directory in which to install termcap.h. -includedir = $(prefix)/include - -# Directory in which to optionally also install termcap.h, -# so compilers besides gcc can find it by default. -# If it is empty or not defined, termcap.h will only be installed in -# includedir. -oldincludedir = /usr/include - -# Directory in which to install the documentation info files. -infodir = $(prefix)/info - -# File to which `install-data' should install the data file -# if --enable-install-termcap was given. -termcapfile = @termcapfile@ - -#### End of system configuration section. #### - -SHELL = /bin/sh - -SRCS = termcap.c tparam.c version.c -OBJS = termcap.o tparam.o version.o -HDRS = termcap.h -DISTFILES = $(SRCS) $(HDRS) ChangeLog COPYING README INSTALL NEWS \ -termcap.src termcap.texi termcap.info* \ -texinfo.tex Makefile.in configure configure.in mkinstalldirs install-sh - -all: libtermcap.a info - -.c.o: - $(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $< - -install: all installdirs @installdata@ - $(INSTALL_DATA) libtermcap.a $(libdir)/libtermcap.a - -$(RANLIB) $(libdir)/libtermcap.a - cd $(srcdir); $(INSTALL_DATA) termcap.h $(includedir)/termcap.h - -cd $(srcdir); test -z "$(oldincludedir)" || \ - $(INSTALL_DATA) termcap.h $(oldincludedir)/termcap.h - cd $(srcdir); for f in termcap.info*; \ - do $(INSTALL_DATA) $$f $(infodir)/$$f; done - -uninstall: @uninstalldata@ - rm -f $(libdir)/libtermcap.a $(includedir)/termcap.h - test -z "$(oldincludedir)" || rm -f $(oldincludedir)/termcap.h - rm -f $(infodir)/termcap.info* - -# These are separate targets to avoid trashing the user's existing -# termcap file unexpectedly. -install-data: - $(INSTALL_DATA) ${srcdir}/termcap.src ${termcapfile} - -uninstall-data: - rm -f ${termcapfile} - -installdirs: - $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(libdir) \ - $(includedir) $(infodir) - -Makefile: Makefile.in config.status - $(SHELL) config.status -config.status: configure - $(SHELL) config.status --recheck -configure: configure.in - cd $(srcdir) && autoconf - -libtermcap.a: $(OBJS) - $(AR) rc $@ $(OBJS) - -$(RANLIB) $@ - -info: termcap.info - -termcap.info: termcap.texi - $(MAKEINFO) $(srcdir)/termcap.texi --output=$@ - -TAGS: $(SRCS) - etags $(SRCS) - -clean: - rm -f *.a *.o core - -mostlyclean: clean - -distclean: clean - rm -f Makefile config.status config.cache config.log - -maintainer-clean: distclean - @echo "This command is intended for maintainers to use;" - @echo "rebuilding the deleted files requires makeinfo." - rm -f TAGS *.info* - -dist: $(DISTFILES) - echo termcap-`sed -e '/version_string/!d' -e 's/[^0-9]*\([0-9a-z.]*\).*/\1/' -e q version.c` > .fname - rm -rf `cat .fname` - mkdir `cat .fname` - ln $(DISTFILES) `cat .fname` - tar chzf `cat .fname`.tar.gz `cat .fname` - rm -rf `cat .fname` .fname diff --git a/src/libs/termcap/NEWS b/src/libs/termcap/NEWS deleted file mode 100644 index 5116dd7d6f..0000000000 --- a/src/libs/termcap/NEWS +++ /dev/null @@ -1,25 +0,0 @@ -Major changes in release 1.3.1: - -Termcap data file updated. -Bug fixes and portability changes. - -Major changes in release 1.3: - -Termcap data file is now included in distribution and may optionally - be installed, or used in a non-default location. -Support for a fake internal terminal (no external files). -Higher tty speeds supported. -Portability tweaks. - -Major changes in release 1.2: - -For `%.', only set the high bit on NUL. -Fix a file descriptor and memory leak. -Add const in termcap.h prototypes. -Configuration improvements. - -Major changes in release 1.1: - -Fix portability problems. -Improve configuration and installation. -Fix compiler warnings. diff --git a/src/libs/termcap/README b/src/libs/termcap/README deleted file mode 100644 index ba1a19c93d..0000000000 --- a/src/libs/termcap/README +++ /dev/null @@ -1,34 +0,0 @@ -This is the GNU termcap library -- a library of C functions that -enable programs to send control strings to terminals in a way -independent of the terminal type. The GNU termcap library does not -place an arbitrary limit on the size of termcap entries, unlike most -other termcap libraries. - -Most of this package is also distributed with GNU Emacs, but it is -available in this separate distribution to make it easier to install -as -ltermcap. However, use of termcap is discouraged. Termcap is -being phased out in favor of the terminfo-based ncurses library, which -contains an emulation of the termcap library routines in addition to -an excellent curses implementation. ncurses is available from the -usual GNU archive sites. - -See the file INSTALL for compilation and installation instructions. -Additionally: - -This package contains termcap.src, the latest official termcap data -file. By default, it is not installed. The current version contains -some entries that are more than 1023 bytes long, which is the largest -value that is safe to use with the many historical applications that -only allocate a 1024 byte termcap buffer (telnet, for example). If -you make sure that all of your programs allocate buffers of at least -2500 bytes, or let the termcap library do it by passing a NULL -pointer, then it is safe to install the new termcap file, as described -below. - -You can give configure two special options: - --enable-install-termcap install the termcap data file - --with-termcap=FILE use data file FILE instead of /etc/termcap - -Please report any bugs in this library to bug-gnu-emacs@prep.ai.mit.edu. -You can check which version of the library you have by using the RCS -`ident' command on libtermcap.a. diff --git a/src/libs/termcap/configure b/src/libs/termcap/configure deleted file mode 100644 index 8a885fa5b4..0000000000 --- a/src/libs/termcap/configure +++ /dev/null @@ -1,998 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.4 -# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-install-termcap install the termcap data file" -ac_help="$ac_help - --with-termcap=FILE use data file FILE instead of /etc/termcap" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE - -# Initialize some other variables. -subdirs= - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -build | --build | --buil | --bui | --bu | --b) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=PREFIX install architecture-dependent files in PREFIX - [same as prefix] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR ---enable and --with options recognized:$ac_help -EOF - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.4" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LANG+set}" = set; then LANG=C; export LANG; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=termcap.h - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -# Check whether --enable-install-termcap or --disable-install-termcap was given. -enableval="$enable_install_termcap" -if test -n "$enableval"; then - if test $enableval = yes; then - installdata=install-data uninstalldata=uninstall-data - fi -fi - - -# Check whether --with-termcap or --without-termcap was given. -withval="$with_termcap" -if test -n "$withval"; then - termcapfile=$withval -else - termcapfile=/etc/termcap -fi - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5 | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_gcc_g=yes -else - ac_cv_prog_gcc_g=no -fi -rm -f conftest* - -fi - echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - fi - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_ifs" - # As a last resort, use the slow shell script. - test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh" -fi - INSTALL="$ac_cv_path_install" -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -for ac_hdr in string.h unistd.h -do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` - cat >> confdefs.h <&6 -fi -done - -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext </dev/null; then - ac_cv_c_cross=no -else - ac_cv_c_cross=yes -fi -fi -rm -fr conftest* -fi -cross_compiling=$ac_cv_c_cross -echo "$ac_t""$ac_cv_c_cross" 1>&6 - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - ac_cv_header_stdc=no -else -cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -eval $ac_link -if test -s conftest && (./conftest; exit) 2>/dev/null; then - : -else - ac_cv_header_stdc=no -fi -fi -rm -fr conftest* -fi -fi -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.4" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF -$ac_vpsub -$extrasub -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@installdata@%$installdata%g -s%@uninstalldata@%$uninstalldata%g -s%@termcapfile@%$termcapfile%g -s%@CC@%$CC%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@CPP@%$CPP%g - -CEOF -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust relative srcdir, etc. for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file -fi; done -rm -f conftest.subs - - - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/src/libs/termcap/configure.in b/src/libs/termcap/configure.in deleted file mode 100644 index f3f944f9c5..0000000000 --- a/src/libs/termcap/configure.in +++ /dev/null @@ -1,23 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(termcap.h) - -AC_ARG_ENABLE(install-termcap, -[ --enable-install-termcap install the termcap data file], -[if test $enableval = yes; then - installdata=install-data uninstalldata=uninstall-data - fi]) -AC_SUBST(installdata)dnl -AC_SUBST(uninstalldata)dnl - -AC_ARG_WITH(termcap, -[ --with-termcap=FILE use data file FILE instead of /etc/termcap], -termcapfile=$withval, termcapfile=/etc/termcap) -AC_SUBST(termcapfile)dnl - -AC_PROG_CC -AC_PROG_RANLIB -AC_PROG_INSTALL -AC_HAVE_HEADERS(string.h unistd.h) -AC_STDC_HEADERS - -AC_OUTPUT(Makefile) diff --git a/src/libs/termcap/install-sh b/src/libs/termcap/install-sh deleted file mode 100644 index 89fc9b098b..0000000000 --- a/src/libs/termcap/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/src/libs/termcap/mkinstalldirs b/src/libs/termcap/mkinstalldirs deleted file mode 100644 index cd1fe0a794..0000000000 --- a/src/libs/termcap/mkinstalldirs +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/src/libs/termcap/termcap.c b/src/libs/termcap/termcap.c deleted file mode 100644 index f44ba64a22..0000000000 --- a/src/libs/termcap/termcap.c +++ /dev/null @@ -1,818 +0,0 @@ -/* Work-alike for termcap, plus extra features. - Copyright (C) 1985, 86, 93, 94, 95, 2000, 2001 - Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Emacs config.h may rename various library functions such as malloc. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef emacs - -#include /* xmalloc is here */ -/* Get the O_* definitions for open et al. */ -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#else /* not emacs */ - -#ifdef STDC_HEADERS -#include -#include -#else -char *getenv (); -char *malloc (); -char *realloc (); -#endif - -/* Do this after the include, in case string.h prototypes bcopy. */ -#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef _POSIX_VERSION -#include -#endif - -#endif /* not emacs */ - -#ifndef NULL -#define NULL (char *) 0 -#endif - -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - -/* BUFSIZE is the initial size allocated for the buffer - for reading the termcap file. - It is not a limit. - Make it large normally for speed. - Make it variable when debugging, so can exercise - increasing the space dynamically. */ - -#ifndef BUFSIZE -#ifdef DEBUG -#define BUFSIZE bufsize - -int bufsize = 128; -#else -#define BUFSIZE 2048 -#endif -#endif - -#ifndef TERMCAP_FILE -#define TERMCAP_FILE "/etc/termcap" -#endif - -#ifndef emacs -static void -memory_out () -{ - write (2, "virtual memory exhausted\n", 25); - exit (1); -} - -static char * -xmalloc (size) - unsigned size; -{ - register char *tem = malloc (size); - - if (!tem) - memory_out (); - return tem; -} - -static char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *tem = realloc (ptr, size); - - if (!tem) - memory_out (); - return tem; -} -#endif /* not emacs */ - -/* Looking up capabilities in the entry already found. */ - -/* The pointer to the data made by tgetent is left here - for tgetnum, tgetflag and tgetstr to find. */ -static char *term_entry; - -static char *tgetst1 (); - -/* Search entry BP for capability CAP. - Return a pointer to the capability (in BP) if found, - 0 if not found. */ - -static char * -find_capability (bp, cap) - register char *bp, *cap; -{ - for (; *bp; bp++) - if (bp[0] == ':' - && bp[1] == cap[0] - && bp[2] == cap[1]) - return &bp[4]; - return NULL; -} - -int -tgetnum (cap) - char *cap; -{ - register char *ptr = find_capability (term_entry, cap); - if (!ptr || ptr[-1] != '#') - return -1; - return atoi (ptr); -} - -int -tgetflag (cap) - char *cap; -{ - register char *ptr = find_capability (term_entry, cap); - return ptr && ptr[-1] == ':'; -} - -/* Look up a string-valued capability CAP. - If AREA is non-null, it points to a pointer to a block in which - to store the string. That pointer is advanced over the space used. - If AREA is null, space is allocated with `malloc'. */ - -char * -tgetstr (cap, area) - char *cap; - char **area; -{ - register char *ptr = find_capability (term_entry, cap); - if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) - return NULL; - return tgetst1 (ptr, area); -} - -#ifdef IS_EBCDIC_HOST -/* Table, indexed by a character in range 0200 to 0300 with 0200 subtracted, - gives meaning of character following \, or a space if no special meaning. - Sixteen characters per line within the string. */ - -static char esctab[] - = " \057\026 \047\014 \ - \025 \015 \ - \005 \013 \ - "; -#else -/* Table, indexed by a character in range 0100 to 0140 with 0100 subtracted, - gives meaning of character following \, or a space if no special meaning. - Eight characters per line within the string. */ - -static char esctab[] - = " \007\010 \033\014 \ - \012 \ - \015 \011 \013 \ - "; -#endif - -/* PTR points to a string value inside a termcap entry. - Copy that value, processing \ and ^ abbreviations, - into the block that *AREA points to, - or to newly allocated storage if AREA is NULL. - Return the address to which we copied the value, - or NULL if PTR is NULL. */ - -static char * -tgetst1 (ptr, area) - char *ptr; - char **area; -{ - register char *p, *r; - register int c; - register int size; - char *ret; - register int c1; - - if (!ptr) - return NULL; - - /* `ret' gets address of where to store the string. */ - if (!area) - { - /* Compute size of block needed (may overestimate). */ - p = ptr; - while ((c = *p++) && c != ':' && c != '\n') - ; - ret = (char *) xmalloc (p - ptr + 1); - } - else - ret = *area; - - /* Copy the string value, stopping at null or colon. - Also process ^ and \ abbreviations. */ - p = ptr; - r = ret; - while ((c = *p++) && c != ':' && c != '\n') - { - if (c == '^') - { - c = *p++; - if (c == '?') - c = 0177; - else - c &= 037; - } - else if (c == '\\') - { - c = *p++; - if (c >= '0' && c <= '7') - { - c -= '0'; - size = 0; - - while (++size < 3 && (c1 = *p) >= '0' && c1 <= '7') - { - c *= 8; - c += c1 - '0'; - p++; - } - } -#ifdef IS_EBCDIC_HOST - else if (c >= 0200 && c < 0360) - { - c1 = esctab[(c & ~0100) - 0200]; - if (c1 != ' ') - c = c1; - } -#else - else if (c >= 0100 && c < 0200) - { - c1 = esctab[(c & ~040) - 0100]; - if (c1 != ' ') - c = c1; - } -#endif - } - *r++ = c; - } - *r = '\0'; - /* Update *AREA. */ - if (area) - *area = r + 1; - return ret; -} - -/* Outputting a string with padding. */ - -#ifndef emacs -short ospeed; -/* If OSPEED is 0, we use this as the actual baud rate. */ -int tputs_baud_rate; -#endif -char PC; - -#ifndef emacs -/* Actual baud rate if positive; - - baud rate / 100 if negative. */ - -static int speeds[] = - { -#ifdef VMS - 0, 50, 75, 110, 134, 150, -3, -6, -12, -18, - -20, -24, -36, -48, -72, -96, -192 -#else /* not VMS */ - 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, - -18, -24, -48, -96, -192, -288, -384, -576, -1152 -#endif /* not VMS */ - }; - -#endif /* not emacs */ - -void -tputs (str, nlines, outfun) - register char *str; - int nlines; - register int (*outfun) (); -{ - register int padcount = 0; - register int speed; - -#ifdef emacs - extern int baud_rate; - speed = baud_rate; - /* For quite high speeds, convert to the smaller - units to avoid overflow. */ - if (speed > 10000) - speed = - speed / 100; -#else - if (ospeed == 0) - speed = tputs_baud_rate; - else - speed = speeds[ospeed]; -#endif - - if (!str) - return; - - while (*str >= '0' && *str <= '9') - { - padcount += *str++ - '0'; - padcount *= 10; - } - if (*str == '.') - { - str++; - padcount += *str++ - '0'; - } - if (*str == '*') - { - str++; - padcount *= nlines; - } - while (*str) - (*outfun) (*str++); - - /* PADCOUNT is now in units of tenths of msec. - SPEED is measured in characters per 10 seconds - or in characters per .1 seconds (if negative). - We use the smaller units for larger speeds to avoid overflow. */ - padcount *= speed; - padcount += 500; - padcount /= 1000; - if (speed < 0) - padcount = -padcount; - else - { - padcount += 50; - padcount /= 100; - } - - while (padcount-- > 0) - (*outfun) (PC); -} - -/* Finding the termcap entry in the termcap data base. */ - -struct termcap_buffer - { - char *beg; - int size; - char *ptr; - int ateof; - int full; - }; - -/* Forward declarations of static functions. */ - -static int scan_file (); -static char *gobble_line (); -static int compare_contin (); -static int name_match (); - -#ifdef VMS - -#include -#include -#include - -static int -valid_filename_p (fn) - char *fn; -{ - struct FAB fab = cc$rms_fab; - struct NAM nam = cc$rms_nam; - char esa[NAM$C_MAXRSS]; - - fab.fab$l_fna = fn; - fab.fab$b_fns = strlen(fn); - fab.fab$l_nam = &nam; - fab.fab$l_fop = FAB$M_NAM; - - nam.nam$l_esa = esa; - nam.nam$b_ess = sizeof esa; - - return SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL; -} - -#else /* !VMS */ - -#ifdef MSDOS /* MW, May 1993 */ -static int -valid_filename_p (fn) - char *fn; -{ - return *fn == '/' || fn[1] == ':'; -} -#else -#define valid_filename_p(fn) (*(fn) == '/') -#endif - -#endif /* !VMS */ - -/* Find the termcap entry data for terminal type NAME - and store it in the block that BP points to. - Record its address for future use. - - If BP is null, space is dynamically allocated. - - Return -1 if there is some difficulty accessing the data base - of terminal types, - 0 if the data base is accessible but the type NAME is not defined - in it, and some other value otherwise. */ - -int -tgetent (bp, name) - char *bp, *name; -{ - register char *termcap_name; - register int fd; - struct termcap_buffer buf; - register char *bp1; - char *tc_search_point; - char *term; - int malloc_size = 0; - register int c; - char *tcenv = NULL; /* TERMCAP value, if it contains :tc=. */ - char *indirect = NULL; /* Terminal type in :tc= in TERMCAP value. */ - int filep; - -// bonefish: HACK to avoid problems. Our termcap entries are longer than the -// 2KB that are advised as the size of the buffer to be passed to tgetent(). -// This leads to nasty problems, so just always allocate a buffer. -bp = NULL; - -#ifdef INTERNAL_TERMINAL - /* For the internal terminal we don't want to read any termcap file, - so fake it. */ - if (!strcmp (name, "internal")) - { - term = INTERNAL_TERMINAL; - if (!bp) - { - malloc_size = 1 + strlen (term); - bp = (char *) xmalloc (malloc_size); - } - strcpy (bp, term); - goto ret; - } -#endif /* INTERNAL_TERMINAL */ - - /* For compatibility with programs like `less' that want to - put data in the termcap buffer themselves as a fallback. */ - if (bp) - term_entry = bp; - - termcap_name = getenv ("TERMCAP"); - if (termcap_name && *termcap_name == '\0') - termcap_name = NULL; -#if defined (MSDOS) && !defined (TEST) - if (termcap_name && (*termcap_name == '\\' - || *termcap_name == '/' - || termcap_name[1] == ':')) - dostounix_filename(termcap_name); -#endif - - filep = termcap_name && valid_filename_p (termcap_name); - - /* If termcap_name is non-null and starts with / (in the un*x case, that is), - it is a file name to use instead of /etc/termcap. - If it is non-null and does not start with /, - it is the entry itself, but only if - the name the caller requested matches the TERM variable. */ - - if (termcap_name && !filep && !strcmp (name, getenv ("TERM"))) - { - indirect = tgetst1 (find_capability (termcap_name, "tc"), (char **) 0); - if (!indirect) - { - if (!bp) - bp = termcap_name; - else - strcpy (bp, termcap_name); - goto ret; - } - else - { /* It has tc=. Need to read /etc/termcap. */ - tcenv = termcap_name; - termcap_name = NULL; - } - } - - if (!termcap_name || !filep) - termcap_name = TERMCAP_FILE; - - /* Here we know we must search a file and termcap_name has its name. */ - -#ifdef MSDOS - fd = open (termcap_name, O_RDONLY|O_TEXT, 0); -#else - fd = open (termcap_name, O_RDONLY, 0); -#endif - if (fd < 0) - return -1; - - buf.size = BUFSIZE; - /* Add 1 to size to ensure room for terminating null. */ - buf.beg = (char *) xmalloc (buf.size + 1); - term = indirect ? indirect : name; - - if (!bp) - { - malloc_size = indirect ? strlen (tcenv) + 1 : buf.size; - bp = (char *) xmalloc (malloc_size); - } - tc_search_point = bp1 = bp; - - if (indirect) - /* Copy the data from the environment variable. */ - { - strcpy (bp, tcenv); - bp1 += strlen (tcenv); - } - - while (term) - { - /* Scan the file, reading it via buf, till find start of main entry. */ - if (scan_file (term, fd, &buf) == 0) - { - close (fd); - free (buf.beg); - if (malloc_size) - free (bp); - return 0; - } - - /* Free old `term' if appropriate. */ - if (term != name) - free (term); - - /* If BP is malloc'd by us, make sure it is big enough. */ - if (malloc_size) - { - int offset1 = bp1 - bp, offset2 = tc_search_point - bp; - malloc_size = offset1 + buf.size; - bp = termcap_name = (char *) xrealloc (bp, malloc_size); - bp1 = termcap_name + offset1; - tc_search_point = termcap_name + offset2; - } - - /* Copy the line of the entry from buf into bp. */ - termcap_name = buf.ptr; - while ((*bp1++ = c = *termcap_name++) && c != '\n') - /* Drop out any \ newline sequence. */ - if (c == '\\' && *termcap_name == '\n') - { - bp1--; - termcap_name++; - } - *bp1 = '\0'; - - /* Does this entry refer to another terminal type's entry? - If something is found, copy it into heap and null-terminate it. */ - tc_search_point = find_capability (tc_search_point, "tc"); - term = tgetst1 (tc_search_point, (char **) 0); - } - - close (fd); - free (buf.beg); - - if (malloc_size) - bp = (char *) xrealloc (bp, bp1 - bp + 1); - - ret: - term_entry = bp; - return 1; -} - -/* Given file open on FD and buffer BUFP, - scan the file from the beginning until a line is found - that starts the entry for terminal type STR. - Return 1 if successful, with that line in BUFP, - or 0 if no entry is found in the file. */ - -static int -scan_file (str, fd, bufp) - char *str; - int fd; - register struct termcap_buffer *bufp; -{ - register char *end; - - bufp->ptr = bufp->beg; - bufp->full = 0; - bufp->ateof = 0; - *bufp->ptr = '\0'; - - lseek (fd, 0L, 0); - - while (!bufp->ateof) - { - /* Read a line into the buffer. */ - end = NULL; - do - { - /* if it is continued, append another line to it, - until a non-continued line ends. */ - end = gobble_line (fd, bufp, end); - } - while (!bufp->ateof && end[-2] == '\\'); - - if (*bufp->ptr != '#' - && name_match (bufp->ptr, str)) - return 1; - - /* Discard the line just processed. */ - bufp->ptr = end; - } - return 0; -} - -/* Return nonzero if NAME is one of the names specified - by termcap entry LINE. */ - -static int -name_match (line, name) - char *line, *name; -{ - register char *tem; - - if (!compare_contin (line, name)) - return 1; - /* This line starts an entry. Is it the right one? */ - for (tem = line; *tem && *tem != '\n' && *tem != ':'; tem++) - if (*tem == '|' && !compare_contin (tem + 1, name)) - return 1; - - return 0; -} - -static int -compare_contin (str1, str2) - register char *str1, *str2; -{ - register int c1, c2; - while (1) - { - c1 = *str1++; - c2 = *str2++; - while (c1 == '\\' && *str1 == '\n') - { - str1++; - while ((c1 = *str1++) == ' ' || c1 == '\t'); - } - if (c2 == '\0') - { - /* End of type being looked up. */ - if (c1 == '|' || c1 == ':') - /* If end of name in data base, we win. */ - return 0; - else - return 1; - } - else if (c1 != c2) - return 1; - } -} - -/* Make sure that the buffer <- BUFP contains a full line - of the file open on FD, starting at the place BUFP->ptr - points to. Can read more of the file, discard stuff before - BUFP->ptr, or make the buffer bigger. - - Return the pointer to after the newline ending the line, - or to the end of the file, if there is no newline to end it. - - Can also merge on continuation lines. If APPEND_END is - non-null, it points past the newline of a line that is - continued; we add another line onto it and regard the whole - thing as one line. The caller decides when a line is continued. */ - -static char * -gobble_line (fd, bufp, append_end) - int fd; - register struct termcap_buffer *bufp; - char *append_end; -{ - register char *end; - register int nread; - register char *buf = bufp->beg; - register char *tem; - - if (!append_end) - append_end = bufp->ptr; - - while (1) - { - end = append_end; - while (*end && *end != '\n') end++; - if (*end) - break; - if (bufp->ateof) - return buf + bufp->full; - if (bufp->ptr == buf) - { - if (bufp->full == bufp->size) - { - bufp->size *= 2; - /* Add 1 to size to ensure room for terminating null. */ - tem = (char *) xrealloc (buf, bufp->size + 1); - bufp->ptr = (bufp->ptr - buf) + tem; - append_end = (append_end - buf) + tem; - bufp->beg = buf = tem; - } - } - else - { - append_end -= bufp->ptr - buf; - bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf); - bufp->ptr = buf; - } - if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full))) - bufp->ateof = 1; - bufp->full += nread; - buf[bufp->full] = '\0'; - } - return end + 1; -} - -#ifdef TEST - -#ifdef NULL -#undef NULL -#endif - -#include - -main (argc, argv) - int argc; - char **argv; -{ - char *term; - char *buf; - - term = argv[1]; - printf ("TERM: %s\n", term); - - buf = (char *) tgetent (0, term); - if ((int) buf <= 0) - { - printf ("No entry.\n"); - return 0; - } - - printf ("Entry: %s\n", buf); - - tprint ("cm"); - tprint ("AL"); - - printf ("co: %d\n", tgetnum ("co")); - printf ("am: %d\n", tgetflag ("am")); -} - -tprint (cap) - char *cap; -{ - char *x = tgetstr (cap, 0); - register char *y; - - printf ("%s: ", cap); - if (x) - { - for (y = x; *y; y++) - if (*y <= ' ' || *y == 0177) - printf ("\\%0o", *y); - else - putchar (*y); - free (x); - } - else - printf ("none"); - putchar ('\n'); -} - -#endif /* TEST */ diff --git a/src/libs/termcap/termcap.h b/src/libs/termcap/termcap.h deleted file mode 100644 index b19fb0a17b..0000000000 --- a/src/libs/termcap/termcap.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Declarations for termcap library. - Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _TERMCAP_H -#define _TERMCAP_H 1 - -#if __STDC__ - -extern int tgetent (char *buffer, const char *termtype); - -extern int tgetnum (const char *name); -extern int tgetflag (const char *name); -extern char *tgetstr (const char *name, char **area); - -extern char PC; -extern short ospeed; -extern void tputs (const char *string, int nlines, int (*outfun) (int)); - -extern char *tparam (const char *ctlstring, char *buffer, int size, ...); - -extern char *UP; -extern char *BC; - -extern char *tgoto (const char *cstring, int hpos, int vpos); - -#else /* not __STDC__ */ - -extern int tgetent (); - -extern int tgetnum (); -extern int tgetflag (); -extern char *tgetstr (); - -extern char PC; -extern short ospeed; - -extern void tputs (); - -extern char *tparam (); - -extern char *UP; -extern char *BC; - -extern char *tgoto (); - -#endif /* not __STDC__ */ - -#endif /* not _TERMCAP_H */ diff --git a/src/libs/termcap/termcap.info b/src/libs/termcap/termcap.info deleted file mode 100644 index f663195a33..0000000000 --- a/src/libs/termcap/termcap.info +++ /dev/null @@ -1,80 +0,0 @@ -This is Info file ./termcap.info, produced by Makeinfo-1.55 from the -input file ./termcap.texi. - - This file documents the termcap library of the GNU system. - - Copyright (C) 1988 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -Indirect: -termcap.info-1: 874 -termcap.info-2: 47411 -termcap.info-3: 90390 -termcap.info-4: 138827 - -Tag Table: -(Indirect) -Node: Top874 -Node: Introduction4105 -Node: Library5832 -Node: Preparation6851 -Node: Find8034 -Node: Interrogate11492 -Node: Initialize16800 -Node: Padding18440 -Node: Why Pad19146 -Node: Not Enough20768 -Node: Describe Padding23336 -Node: Output Padding24826 -Node: Parameters28441 -Node: Encode Parameters30101 -Node: Using Parameters36185 -Node: tparam36780 -Node: tgoto38806 -Node: Data Base41361 -Node: Format42257 -Node: Capability Format44346 -Node: Naming47411 -Node: Inheriting51980 -Node: Changing54224 -Node: Capabilities55388 -Node: Basic58127 -Node: Screen Size62180 -Node: Cursor Motion63920 -Node: Wrapping74062 -Node: Scrolling77091 -Node: Windows82980 -Node: Clearing83714 -Node: Insdel Line85478 -Node: Insdel Char90390 -Node: Standout100375 -Node: Underlining109433 -Node: Cursor Visibility111852 -Node: Bell112600 -Node: Keypad113149 -Node: Meta Key117864 -Node: Initialization118818 -Node: Pad Specs121369 -Node: Status Line123422 -Node: Half-Line125306 -Node: Printer126108 -Node: Summary127787 -Node: Var Index138114 -Node: Cap Index138827 -Node: Index145991 - -End Tag Table diff --git a/src/libs/termcap/termcap.info-1 b/src/libs/termcap/termcap.info-1 deleted file mode 100644 index a5b5da0bb7..0000000000 --- a/src/libs/termcap/termcap.info-1 +++ /dev/null @@ -1,1114 +0,0 @@ -This is Info file ./termcap.info, produced by Makeinfo-1.55 from the -input file ./termcap.texi. - - This file documents the termcap library of the GNU system. - - Copyright (C) 1988 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: termcap.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) - -* Menu: - -* Introduction:: What is termcap? Why this manual? -* Library:: The termcap library functions. -* Data Base:: What terminal descriptions in `/etc/termcap' look like. -* Capabilities:: Definitions of the individual terminal capabilities: - how to write them in descriptions, and how to use - their values to do display updating. -* Summary:: Brief table of capability names and their meanings. -* Var Index:: Index of C functions and variables. -* Cap Index:: Index of termcap capabilities. -* Index:: Concept index. - - -- The Detailed Node Listing -- - -The Termcap Library - -* Preparation:: Preparing to use the termcap library. -* Find:: Finding the description of the terminal being used. -* Interrogate:: Interrogating the description for particular capabilities. -* Initialize:: Initialization for output using termcap. -* Padding:: Outputting padding. -* Parameters:: Encoding parameters such as cursor positions. - -Padding - -* Why Pad:: Explanation of padding. -* Not Enough:: When there is not enough padding. -* Describe Padding:: The data base says how much padding a terminal needs. -* Output Padding:: Using `tputs' to output the needed padding. - -Filling In Parameters - -* Encode Parameters:: The language for encoding parameters. -* Using Parameters:: Outputting a string command with parameters. - -Sending Display Commands with Parameters - -* tparam:: The general case, for GNU termcap only. -* tgoto:: The special case of cursor motion. - -The Format of the Data Base - -* Format:: Overall format of a terminal description. -* Capability Format:: Format of capabilities within a description. -* Naming:: Naming conventions for terminal types. -* Inheriting:: Inheriting part of a description from -a related terminal type. -* Changing:: When changes in the data base take effect. - -Definitions of the Terminal Capabilities - -* Basic:: Basic characteristics. -* Screen Size:: Screen size, and what happens when it changes. -* Cursor Motion:: Various ways to move the cursor. -* Wrapping:: What happens if you write a character in the last column. -* Scrolling:: Pushing text up and down on the screen. -* Windows:: Limiting the part of the window that output affects. -* Clearing:: Erasing one or many lines. -* Insdel Line:: Making new blank lines in mid-screen; deleting lines. -* Insdel Char:: Inserting and deleting characters within a line. -* Standout:: Highlighting some of the text. -* Underlining:: Underlining some of the text. -* Cursor Visibility:: Making the cursor more or less easy to spot. -* Bell:: Attracts user's attention; not localized on the screen. -* Keypad:: Recognizing when function keys or arrows are typed. -* Meta Key:: META acts like an extra shift key. -* Initialization:: Commands used to initialize or reset the terminal. -* Pad Specs:: Info for the kernel on how much padding is needed. -* Status Line:: A status line displays "background" information. -* Half-Line:: Moving by half-lines, for superscripts and subscripts. -* Printer:: Controlling auxiliary printers of display terminals. - - -File: termcap.info, Node: Introduction, Next: Library, Prev: Top, Up: Top - -Introduction -************ - - "Termcap" is a library and data base that enables programs to use -display terminals in a terminal-independent manner. It originated in -Berkeley Unix. - - The termcap data base describes the capabilities of hundreds of -different display terminals in great detail. Some examples of the -information recorded for a terminal could include how many columns wide -it is, what string to send to move the cursor to an arbitrary position -(including how to encode the row and column numbers), how to scroll the -screen up one or several lines, and how much padding is needed for such -a scrolling operation. - - The termcap library is provided for easy access this data base in -programs that want to do terminal-independent character-based display -output. - - This manual describes the GNU version of the termcap library, which -has some extensions over the Unix version. All the extensions are -identified as such, so this manual also tells you how to use the Unix -termcap. - - The GNU version of the termcap library is available free as source -code, for use in free programs, and runs on Unix and VMS systems (at -least). You can find it in the GNU Emacs distribution in the files -`termcap.c' and `tparam.c'. - - This manual was written for the GNU project, whose goal is to -develop a complete free operating system upward-compatible with Unix -for user programs. The project is approximately two thirds complete. -For more information on the GNU project, including the GNU Emacs editor -and the mostly-portable optimizing C compiler, send one dollar to - - Free Software Foundation - 675 Mass Ave - Cambridge, MA 02139 - - -File: termcap.info, Node: Library, Next: Data Base, Prev: Introduction, Up: Top - -The Termcap Library -******************* - - The termcap library is the application programmer's interface to the -termcap data base. It contains functions for the following purposes: - - * Finding the description of the user's terminal type (`tgetent'). - - * Interrogating the description for information on various topics - (`tgetnum', `tgetflag', `tgetstr'). - - * Computing and performing padding (`tputs'). - - * Encoding numeric parameters such as cursor positions into the - terminal-specific form required for display commands (`tparam', - `tgoto'). - -* Menu: - -* Preparation:: Preparing to use the termcap library. -* Find:: Finding the description of the terminal being used. -* Interrogate:: Interrogating the description for particular capabilities. -* Initialize:: Initialization for output using termcap. -* Padding:: Outputting padding. -* Parameters:: Encoding parameters such as cursor positions. - - -File: termcap.info, Node: Preparation, Next: Find, Up: Library - -Preparing to Use the Termcap Library -==================================== - - To use the termcap library in a program, you need two kinds of -preparation: - - * The compiler needs declarations of the functions and variables in - the library. - - On GNU systems, it suffices to include the header file `termcap.h' - in each source file that uses these functions and variables. - - On Unix systems, there is often no such header file. Then you must - explictly declare the variables as external. You can do likewise - for the functions, or let them be implicitly declared and cast - their values from type `int' to the appropriate type. - - We illustrate the declarations of the individual termcap library - functions with ANSI C prototypes because they show how to pass the - arguments. If you are not using the GNU C compiler, you probably - cannot use function prototypes, so omit the argument types and - names from your declarations. - - * The linker needs to search the library. Usually either - `-ltermcap' or `-ltermlib' as an argument when linking will do - this. - - -File: termcap.info, Node: Find, Next: Interrogate, Prev: Preparation, Up: Library - -Finding a Terminal Description: `tgetent' -========================================= - - An application program that is going to use termcap must first look -up the description of the terminal type in use. This is done by calling -`tgetent', whose declaration in ANSI Standard C looks like: - - int tgetent (char *BUFFER, char *TERMTYPE); - -This function finds the description and remembers it internally so that -you can interrogate it about specific terminal capabilities (*note -Interrogate::.). - - The argument TERMTYPE is a string which is the name for the type of -terminal to look up. Usually you would obtain this from the environment -variable `TERM' using `getenv ("TERM")'. - - If you are using the GNU version of termcap, you can alternatively -ask `tgetent' to allocate enough space. Pass a null pointer for -BUFFER, and `tgetent' itself allocates the storage using `malloc'. -There is no way to get the address that was allocated, and you -shouldn't try to free the storage. - - With the Unix version of termcap, you must allocate space for the -description yourself and pass the address of the space as the argument -BUFFER. There is no way you can tell how much space is needed, so the -convention is to allocate a buffer 2048 characters long and assume that -is enough. (Formerly the convention was to allocate 1024 characters and -assume that was enough. But one day, for one kind of terminal, that was -not enough.) - - No matter how the space to store the description has been obtained, -termcap records its address internally for use when you later -interrogate the description with `tgetnum', `tgetstr' or `tgetflag'. If -the buffer was allocated by termcap, it will be freed by termcap too if -you call `tgetent' again. If the buffer was provided by you, you must -make sure that its contents remain unchanged for as long as you still -plan to interrogate the description. - - The return value of `tgetent' is -1 if there is some difficulty -accessing the data base of terminal types, 0 if the data base is -accessible but the specified type is not defined in it, and some other -value otherwise. - - Here is how you might use the function `tgetent': - - #ifdef unix - static char term_buffer[2048]; - #else - #define term_buffer 0 - #endif - - init_terminal_data () - { - char *termtype = getenv ("TERM"); - int success; - - if (termtype == 0) - fatal ("Specify a terminal type with `setenv TERM '.\n"); - - success = tgetent (term_buffer, termtype); - if (success < 0) - fatal ("Could not access the termcap data base.\n"); - if (success == 0) - fatal ("Terminal type `%s' is not defined.\n", termtype); - } - -Here we assume the function `fatal' prints an error message and exits. - - If the environment variable `TERMCAP' is defined, its value is used -to override the terminal type data base. The function `tgetent' checks -the value of `TERMCAP' automatically. If the value starts with `/' -then it is taken as a file name to use as the data base file, instead -of `/etc/termcap' which is the standard data base. If the value does -not start with `/' then it is itself used as the terminal description, -provided that the terminal type TERMTYPE is among the types it claims -to apply to. *Note Data Base::, for information on the format of a -terminal description. - - -File: termcap.info, Node: Interrogate, Next: Initialize, Prev: Find, Up: Library - -Interrogating the Terminal Description -====================================== - - Each piece of information recorded in a terminal description is -called a "capability". Each defined terminal capability has a -two-letter code name and a specific meaning. For example, the number -of columns is named `co'. *Note Capabilities::, for definitions of all -the standard capability names. - - Once you have found the proper terminal description with `tgetent' -(*note Find::.), your application program must "interrogate" it for -various terminal capabilities. You must specify the two-letter code of -the capability whose value you seek. - - Capability values can be numeric, boolean (capability is either -present or absent) or strings. Any particular capability always has -the same value type; for example, `co' always has a numeric value, -while `am' (automatic wrap at margin) is always a flag, and `cm' -(cursor motion command) always has a string value. The documentation -of each capability says which type of value it has. - - There are three functions to use to get the value of a capability, -depending on the type of value the capability has. Here are their -declarations in ANSI C: - - int tgetnum (char *NAME); - int tgetflag (char *NAME); - char *tgetstr (char *NAME, char **AREA); - -`tgetnum' - Use `tgetnum' to get a capability value that is numeric. The - argument NAME is the two-letter code name of the capability. If - the capability is present, `tgetnum' returns the numeric value - (which is nonnegative). If the capability is not mentioned in the - terminal description, `tgetnum' returns -1. - -`tgetflag' - Use `tgetflag' to get a boolean value. If the capability NAME is - present in the terminal description, `tgetflag' returns 1; - otherwise, it returns 0. - -`tgetstr' - Use `tgetstr' to get a string value. It returns a pointer to a - string which is the capability value, or a null pointer if the - capability is not present in the terminal description. - - There are two ways `tgetstr' can find space to store the string - value: - - * You can ask `tgetstr' to allocate the space. Pass a null - pointer for the argument AREA, and `tgetstr' will use - `malloc' to allocate storage big enough for the value. - Termcap will never free this storage or refer to it again; you - should free it when you are finished with it. - - This method is more robust, since there is no need to guess - how much space is needed. But it is supported only by the GNU - termcap library. - - * You can provide the space. Provide for the argument AREA the - address of a pointer variable of type `char *'. Before - calling `tgetstr', initialize the variable to point at - available space. Then `tgetstr' will store the string value - in that space and will increment the pointer variable to - point after the space that has been used. You can use the - same pointer variable for many calls to `tgetstr'. - - There is no way to determine how much space is needed for a - single string, and no way for you to prevent or handle - overflow of the area you have provided. However, you can be - sure that the total size of all the string values you will - obtain from the terminal description is no greater than the - size of the description (unless you get the same capability - twice). You can determine that size with `strlen' on the - buffer you provided to `tgetent'. See below for an example. - - Providing the space yourself is the only method supported by - the Unix version of termcap. - - Note that you do not have to specify a terminal type or terminal -description for the interrogation functions. They automatically use the -description found by the most recent call to `tgetent'. - - Here is an example of interrogating a terminal description for -various capabilities, with conditionals to select between the Unix and -GNU methods of providing buffer space. - - char *tgetstr (); - - char *cl_string, *cm_string; - int height; - int width; - int auto_wrap; - - char PC; /* For tputs. */ - char *BC; /* For tgoto. */ - char *UP; - - interrogate_terminal () - { - #ifdef UNIX - /* Here we assume that an explicit term_buffer - was provided to tgetent. */ - char *buffer - = (char *) malloc (strlen (term_buffer)); - #define BUFFADDR &buffer - #else - #define BUFFADDR 0 - #endif - - char *temp; - - /* Extract information we will use. */ - cl_string = tgetstr ("cl", BUFFADDR); - cm_string = tgetstr ("cm", BUFFADDR); - auto_wrap = tgetflag ("am"); - height = tgetnum ("li"); - width = tgetnum ("co"); - - /* Extract information that termcap functions use. */ - temp = tgetstr ("pc", BUFFADDR); - PC = temp ? *temp : 0; - BC = tgetstr ("le", BUFFADDR); - UP = tgetstr ("up", BUFFADDR); - } - -*Note Padding::, for information on the variable `PC'. *Note Using -Parameters::, for information on `UP' and `BC'. - - -File: termcap.info, Node: Initialize, Next: Padding, Prev: Interrogate, Up: Library - -Initialization for Use of Termcap -================================= - - Before starting to output commands to a terminal using termcap, an -application program should do two things: - - * Initialize various global variables which termcap library output - functions refer to. These include `PC' and `ospeed' for padding - (*note Output Padding::.) and `UP' and `BC' for cursor motion - (*note tgoto::.). - - * Tell the kernel to turn off alteration and padding of - horizontal-tab characters sent to the terminal. - - To turn off output processing in Berkeley Unix you would use `ioctl' -with code `TIOCLSET' to set the bit named `LLITOUT', and clear the bits -`ANYDELAY' using `TIOCSETN'. In POSIX or System V, you must clear the -bit named `OPOST'. Refer to the system documentation for details. - - If you do not set the terminal flags properly, some older terminals -will not work. This is because their commands may contain the -characters that normally signify newline, carriage return and -horizontal tab--characters which the kernel thinks it ought to modify -before output. - - When you change the kernel's terminal flags, you must arrange to -restore them to their normal state when your program exits. This -implies that the program must catch fatal signals such as `SIGQUIT' and -`SIGINT' and restore the old terminal flags before actually terminating. - - Modern terminals' commands do not use these special characters, so -if you do not care about problems with old terminals, you can leave the -kernel's terminal flags unaltered. - - -File: termcap.info, Node: Padding, Next: Parameters, Prev: Initialize, Up: Library - -Padding -======= - - "Padding" means outputting null characters following a terminal -display command that takes a long time to execute. The terminal -description says which commands require padding and how much; the -function `tputs', described below, outputs a terminal command while -extracting from it the padding information, and then outputs the -padding that is necessary. - -* Menu: - -* Why Pad:: Explanation of padding. -* Not Enough:: When there is not enough padding. -* Describe Padding:: The data base says how much padding a terminal needs. -* Output Padding:: Using `tputs' to output the needed padding. - - -File: termcap.info, Node: Why Pad, Next: Not Enough, Up: Padding - -Why Pad, and How ----------------- - - Most types of terminal have commands that take longer to execute -than they do to send over a high-speed line. For example, clearing the -screen may take 20msec once the entire command is received. During -that time, on a 9600 bps line, the terminal could receive about 20 -additional output characters while still busy clearing the screen. -Every terminal has a certain amount of buffering capacity to remember -output characters that cannot be processed yet, but too many slow -commands in a row can cause the buffer to fill up. Then any additional -output that cannot be processed immediately will be lost. - - To avoid this problem, we normally follow each display command with -enough useless charaters (usually null characters) to fill up the time -that the display command needs to execute. This does the job if the -terminal throws away null characters without using up space in the -buffer (which most terminals do). If enough padding is used, no output -can ever be lost. The right amount of padding avoids loss of output -without slowing down operation, since the time used to transmit padding -is time that nothing else could be done. - - The number of padding characters needed for an operation depends on -the line speed. In fact, it is proportional to the line speed. A 9600 -baud line transmits about one character per msec, so the clear screen -command in the example above would need about 20 characters of padding. -At 1200 baud, however, only about 3 characters of padding are needed -to fill up 20msec. - - -File: termcap.info, Node: Not Enough, Next: Describe Padding, Prev: Why Pad, Up: Padding - -When There Is Not Enough Padding --------------------------------- - - There are several common manifestations of insufficient padding. - - * Emacs displays `I-search: ^Q-' at the bottom of the screen. - - This means that the terminal thought its buffer was getting full of - display commands, so it tried to tell the computer to stop sending - any. - - * The screen is garbled intermittently, or the details of garbling - vary when you repeat the action. (A garbled screen could be due - to a command which is simply incorrect, or to user option in the - terminal which doesn't match the assumptions of the terminal - description, but this usually leads to reproducible failure.) - - This means that the buffer did get full, and some commands were - lost. Many changeable factors can change which ones are lost. - - * Screen is garbled at high output speeds but not at low speeds. - Padding problems nearly always go away at low speeds, usually even - at 1200 baud. - - This means that a high enough speed permits commands to arrive - faster than they can be executed. - - Although any obscure command on an obscure terminal might lack -padding, in practice problems arise most often from the clearing -commands `cl' and `cd' (*note Clearing::.), the scrolling commands `sf' -and `sr' (*note Scrolling::.), and the line insert/delete commands `al' -and `dl' (*note Insdel Line::.). - - Occasionally the terminal description fails to define `sf' and some -programs will use `do' instead, so you may get a problem with `do'. If -so, first define `sf' just like `do', then add some padding to `sf'. - - The best strategy is to add a lot of padding at first, perhaps 200 -msec. This is much more than enough; in fact, it should cause a -visible slowdown. (If you don't see a slowdown, the change has not -taken effect; *note Changing::..) If this makes the problem go away, -you have found the right place to add padding; now reduce the amount -until the problem comes back, then increase it again. If the problem -remains, either it is in some other capability or it is not a matter of -padding at all. - - Keep in mind that on many terminals the correct padding for -insert/delete line or for scrolling is cursor-position dependent. If -you get problems from scrolling a large region of the screen but not -from scrolling a small part (just a few lines moving), it may mean that -fixed padding should be replaced with position-dependent padding. - - -File: termcap.info, Node: Describe Padding, Next: Output Padding, Prev: Not Enough, Up: Padding - -Specifying Padding in a Terminal Description --------------------------------------------- - - In the terminal description, the amount of padding required by each -display command is recorded as a sequence of digits at the front of the -command. These digits specify the padding time in milliseconds (msec). -They can be followed optionally by a decimal point and one more digit, -which is a number of tenths of msec. - - Sometimes the padding needed by a command depends on the cursor -position. For example, the time taken by an "insert line" command is -usually proportional to the number of lines that need to be moved down -or cleared. An asterisk (`*') following the padding time says that the -time should be multiplied by the number of screen lines affected by the -command. - - :al=1.3*\E[L: - -is used to describe the "insert line" command for a certain terminal. -The padding required is 1.3 msec per line affected. The command itself -is `ESC [ L'. - - The padding time specified in this way tells `tputs' how many pad -characters to output. *Note Output Padding::. - - Two special capability values affect padding for all commands. -These are the `pc' and `pb'. The variable `pc' specifies the character -to pad with, and `pb' the speed below which no padding is needed. The -defaults for these variables, a null character and 0, are correct for -most terminals. *Note Pad Specs::. - - -File: termcap.info, Node: Output Padding, Prev: Describe Padding, Up: Padding - -Performing Padding with `tputs' -------------------------------- - - Use the termcap function `tputs' to output a string containing an -optional padding spec of the form described above (*note Describe -Padding::.). The function `tputs' strips off and decodes the padding -spec, outputs the rest of the string, and then outputs the appropriate -padding. Here is its declaration in ANSI C: - - char PC; - short ospeed; - - int tputs (char *STRING, int NLINES, int (*OUTFUN) ()); - - Here STRING is the string (including padding spec) to be output; -NLINES is the number of lines affected by the operation, which is used -to multiply the amount of padding if the padding spec ends with a `*'. -Finally, OUTFUN is a function (such as `fputchar') that is called to -output each character. When actually called, OUTFUN should expect one -argument, a character. - - The operation of `tputs' is controlled by two global variables, -`ospeed' and `PC'. The value of `ospeed' is supposed to be the -terminal output speed, encoded as in the `ioctl' system call which gets -the speed information. This is needed to compute the number of padding -characters. The value of `PC' is the character used for padding. - - You are responsible for storing suitable values into these variables -before using `tputs'. The value stored into the `PC' variable should be -taken from the `pc' capability in the terminal description (*note Pad -Specs::.). Store zero in `PC' if there is no `pc' capability. - - The argument NLINES requires some thought. Normally, it should be -the number of lines whose contents will be cleared or moved by the -command. For cursor motion commands, or commands that do editing -within one line, use the value 1. For most commands that affect -multiple lines, such as `al' (insert a line) and `cd' (clear from the -cursor to the end of the screen), NLINES should be the screen height -minus the current vertical position (origin 0). For multiple insert -and scroll commands such as `AL' (insert multiple lines), that same -value for NLINES is correct; the number of lines being inserted is not -correct. - - If a "scroll window" feature is used to reduce the number of lines -affected by a command, the value of NLINES should take this into -account. This is because the delay time required depends on how much -work the terminal has to do, and the scroll window feature reduces the -work. *Note Scrolling::. - - Commands such as `ic' and `dc' (insert or delete characters) are -problematical because the padding needed by these commands is -proportional to the number of characters affected, which is the number -of columns from the cursor to the end of the line. It would be nice to -have a way to specify such a dependence, and there is no need for -dependence on vertical position in these commands, so it is an obvious -idea to say that for these commands NLINES should really be the number -of columns affected. However, the definition of termcap clearly says -that NLINES is always the number of lines affected, even in this case, -where it is always 1. It is not easy to change this rule now, because -too many programs and terminal descriptions have been written to follow -it. - - Because NLINES is always 1 for the `ic' and `dc' strings, there is -no reason for them to use `*', but some of them do. These should be -corrected by deleting the `*'. If, some day, such entries have -disappeared, it may be possible to change to a more useful convention -for the NLINES argument for these operations without breaking any -programs. - - -File: termcap.info, Node: Parameters, Prev: Padding, Up: Library - -Filling In Parameters -===================== - - Some terminal control strings require numeric "parameters". For -example, when you move the cursor, you need to say what horizontal and -vertical positions to move it to. The value of the terminal's `cm' -capability, which says how to move the cursor, cannot simply be a -string of characters; it must say how to express the cursor position -numbers and where to put them within the command. - - The specifications of termcap include conventions as to which -string-valued capabilities require parameters, how many parameters, and -what the parameters mean; for example, it defines the `cm' string to -take two parameters, the vertical and horizontal positions, with 0,0 -being the upper left corner. These conventions are described where the -individual commands are documented. - - Termcap also defines a language used within the capability -definition for specifying how and where to encode the parameters for -output. This language uses character sequences starting with `%'. -(This is the same idea as `printf', but the details are different.) -The language for parameter encoding is described in this section. - - A program that is doing display output calls the functions `tparam' -or `tgoto' to encode parameters according to the specifications. These -functions produce a string containing the actual commands to be output -(as well a padding spec which must be processed with `tputs'; *note -Padding::.). - -* Menu: - -* Encode Parameters:: The language for encoding parameters. -* Using Parameters:: Outputting a string command with parameters. - - -File: termcap.info, Node: Encode Parameters, Next: Using Parameters, Up: Parameters - -Describing the Encoding ------------------------ - - A terminal command string that requires parameters contains special -character sequences starting with `%' to say how to encode the -parameters. These sequences control the actions of `tparam' and -`tgoto'. - - The parameters values passed to `tparam' or `tgoto' are considered -to form a vector. A pointer into this vector determines the next -parameter to be processed. Some of the `%'-sequences encode one -parameter and advance the pointer to the next parameter. Other -`%'-sequences alter the pointer or alter the parameter values without -generating output. - - For example, the `cm' string for a standard ANSI terminal is written -as `\E[%i%d;%dH'. (`\E' stands for ESC.) `cm' by convention always -requires two parameters, the vertical and horizontal goal positions, so -this string specifies the encoding of two parameters. Here `%i' -increments the two values supplied, and each `%d' encodes one of the -values in decimal. If the cursor position values 20,58 are encoded -with this string, the result is `\E[21;59H'. - - First, here are the `%'-sequences that generate output. Except for -`%%', each of them encodes one parameter and advances the pointer to -the following parameter. - -`%%' - Output a single `%'. This is the only way to represent a literal - `%' in a terminal command with parameters. `%%' does not use up a - parameter. - -`%d' - As in `printf', output the next parameter in decimal. - -`%2' - Like `%02d' in `printf': output the next parameter in decimal, and - always use at least two digits. - -`%3' - Like `%03d' in `printf': output the next parameter in decimal, and - always use at least three digits. Note that `%4' and so on are - *not* defined. - -`%.' - Output the next parameter as a single character whose ASCII code is - the parameter value. Like `%c' in `printf'. - -`%+CHAR' - Add the next parameter to the character CHAR, and output the - resulting character. For example, `%+ ' represents 0 as a space, - 1 as `!', etc. - - The following `%'-sequences specify alteration of the parameters -(their values, or their order) rather than encoding a parameter for -output. They generate no output; they are used only for their side -effects on the parameters. Also, they do not advance the "next -parameter" pointer except as explicitly stated. Only `%i', `%r' and -`%>' are defined in standard Unix termcap. The others are GNU -extensions. - -`%i' - Increment the next two parameters. This is used for terminals that - expect cursor positions in origin 1. For example, `%i%d,%d' would - output two parameters with `1' for 0, `2' for 1, etc. - -`%r' - Interchange the next two parameters. This is used for terminals - whose cursor positioning command expects the horizontal position - first. - -`%s' - Skip the next parameter. Do not output anything. - -`%b' - Back up one parameter. The last parameter used will become once - again the next parameter to be output, and the next output command - will use it. Using `%b' more than once, you can back up any - number of parameters, and you can refer to each parameter any - number of times. - -`%>C1C2' - Conditionally increment the next parameter. Here C1 and C2 are - characters which stand for their ASCII codes as numbers. If the - next parameter is greater than the ASCII code of C1, the ASCII - code of C2 is added to it. - -`%a OP TYPE POS' - Perform arithmetic on the next parameter, do not use it up, and do - not output anything. Here OP specifies the arithmetic operation, - while TYPE and POS together specify the other operand. - - Spaces are used above to separate the operands for clarity; the - spaces don't appear in the data base, where this sequence is - exactly five characters long. - - The character OP says what kind of arithmetic operation to - perform. It can be any of these characters: - - `=' - assign a value to the next parameter, ignoring its old value. - The new value comes from the other operand. - - `+' - add the other operand to the next parameter. - - `-' - subtract the other operand from the next parameter. - - `*' - multiply the next parameter by the other operand. - - `/' - divide the next parameter by the other operand. - - The "other operand" may be another parameter's value or a constant; - the character TYPE says which. It can be: - - `p' - Use another parameter. The character POS says which - parameter to use. Subtract 64 from its ASCII code to get the - position of the desired parameter relative to this one. Thus, - the character `A' as POS means the parameter after the next - one; the character `?' means the parameter before the next - one. - - `c' - Use a constant value. The character POS specifies the value - of the constant. The 0200 bit is cleared out, so that 0200 - can be used to represent zero. - - The following `%'-sequences are special purpose hacks to compensate -for the weird designs of obscure terminals. They modify the next -parameter or the next two parameters but do not generate output and do -not use up any parameters. `%m' is a GNU extension; the others are -defined in standard Unix termcap. - -`%n' - Exclusive-or the next parameter with 0140, and likewise the - parameter after next. - -`%m' - Complement all the bits of the next parameter and the parameter - after next. - -`%B' - Encode the next parameter in BCD. It alters the value of the - parameter by adding six times the quotient of the parameter by ten. - Here is a C statement that shows how the new value is computed: - - PARM = (PARM / 10) * 16 + PARM % 10; - -`%D' - Transform the next parameter as needed by Delta Data terminals. - This involves subtracting twice the remainder of the parameter by - 16. - - PARM -= 2 * (PARM % 16); - - -File: termcap.info, Node: Using Parameters, Prev: Encode Parameters, Up: Parameters - -Sending Display Commands with Parameters ----------------------------------------- - - The termcap library functions `tparam' and `tgoto' serve as the -analog of `printf' for terminal string parameters. The newer function -`tparam' is a GNU extension, more general but missing from Unix -termcap. The original parameter-encoding function is `tgoto', which is -preferable for cursor motion. - -* Menu: - -* tparam:: The general case, for GNU termcap only. -* tgoto:: The special case of cursor motion. - - -File: termcap.info, Node: tparam, Next: tgoto, Up: Using Parameters - -`tparam' -........ - - The function `tparam' can encode display commands with any number of -parameters and allows you to specify the buffer space. It is the -preferred function for encoding parameters for all but the `cm' -capability. Its ANSI C declaration is as follows: - - char *tparam (char *CTLSTRING, char *BUFFER, int SIZE, int PARM1,...) - - The arguments are a control string CTLSTRING (the value of a terminal -capability, presumably), an output buffer BUFFER and SIZE, and any -number of integer parameters to be encoded. The effect of `tparam' is -to copy the control string into the buffer, encoding parameters -according to the `%' sequences in the control string. - - You describe the output buffer by its address, BUFFER, and its size -in bytes, SIZE. If the buffer is not big enough for the data to be -stored in it, `tparam' calls `malloc' to get a larger buffer. In -either case, `tparam' returns the address of the buffer it ultimately -uses. If the value equals BUFFER, your original buffer was used. -Otherwise, a new buffer was allocated, and you must free it after you -are done with printing the results. If you pass zero for SIZE and -BUFFER, `tparam' always allocates the space with `malloc'. - - All capabilities that require parameters also have the ability to -specify padding, so you should use `tputs' to output the string -produced by `tparam'. *Note Padding::. Here is an example. - - { - char *buf; - char buffer[40]; - - buf = tparam (command, buffer, 40, parm); - tputs (buf, 1, fputchar); - if (buf != buffer) - free (buf); - } - - If a parameter whose value is zero is encoded with `%.'-style -encoding, the result is a null character, which will confuse `tputs'. -This would be a serious problem, but luckily `%.' encoding is used only -by a few old models of terminal, and only for the `cm' capability. To -solve the problem, use `tgoto' rather than `tparam' to encode the `cm' -capability. - - -File: termcap.info, Node: tgoto, Prev: tparam, Up: Using Parameters - -`tgoto' -....... - - The special case of cursor motion is handled by `tgoto'. There are -two reasons why you might choose to use `tgoto': - - * For Unix compatibility, because Unix termcap does not have - `tparam'. - - * For the `cm' capability, since `tgoto' has a special feature to - avoid problems with null characters, tabs and newlines on certain - old terminal types that use `%.' encoding for that capability. - - Here is how `tgoto' might be declared in ANSI C: - - char *tgoto (char *CSTRING, int HPOS, int VPOS) - - There are three arguments, the terminal description's `cm' string and -the two cursor position numbers; `tgoto' computes the parametrized -string in an internal static buffer and returns the address of that -buffer. The next time you use `tgoto' the same buffer will be reused. - - Parameters encoded with `%.' encoding can generate null characters, -tabs or newlines. These might cause trouble: the null character because -`tputs' would think that was the end of the string, the tab because the -kernel or other software might expand it into spaces, and the newline -becaue the kernel might add a carriage-return, or padding characters -normally used for a newline. To prevent such problems, `tgoto' is -careful to avoid these characters. Here is how this works: if the -target cursor position value is such as to cause a problem (that is to -say, zero, nine or ten), `tgoto' increments it by one, then compensates -by appending a string to move the cursor back or up one position. - - The compensation strings to use for moving back or up are found in -global variables named `BC' and `UP'. These are actual external C -variables with upper case names; they are declared `char *'. It is up -to you to store suitable values in them, normally obtained from the -`le' and `up' terminal capabilities in the terminal description with -`tgetstr'. Alternatively, if these two variables are both zero, the -feature of avoiding nulls, tabs and newlines is turned off. - - It is safe to use `tgoto' for commands other than `cm' only if you -have stored zero in `BC' and `UP'. - - Note that `tgoto' reverses the order of its operands: the horizontal -position comes before the vertical position in the arguments to -`tgoto', even though the vertical position comes before the horizontal -in the parameters of the `cm' string. If you use `tgoto' with a -command such as `AL' that takes one parameter, you must pass the -parameter to `tgoto' as the "vertical position". - - -File: termcap.info, Node: Data Base, Next: Capabilities, Prev: Library, Up: Top - -The Format of the Data Base -*************************** - - The termcap data base of terminal descriptions is stored in the file -`/etc/termcap'. It contains terminal descriptions, blank lines, and -comments. - - A terminal description starts with one or more names for the -terminal type. The information in the description is a series of -"capability names" and values. The capability names have standard -meanings (*note Capabilities::.) and their values describe the terminal. - -* Menu: - -* Format:: Overall format of a terminal description. -* Capability Format:: Format of capabilities within a description. -* Naming:: Naming conventions for terminal types. -* Inheriting:: Inheriting part of a description from -a related terminal type. -* Changing:: When changes in the data base take effect. - - -File: termcap.info, Node: Format, Next: Capability Format, Up: Data Base - -Terminal Description Format -=========================== - - Aside from comments (lines starting with `#', which are ignored), -each nonblank line in the termcap data base is a terminal description. -A terminal description is nominally a single line, but it can be split -into multiple lines by inserting the two characters `\ newline'. This -sequence is ignored wherever it appears in a description. - - The preferred way to split the description is between capabilities: -insert the four characters `: \ newline tab' immediately before any -colon. This allows each sub-line to start with some indentation. This -works because, after the `\ newline' are ignored, the result is `: tab -:'; the first colon ends the preceding capability and the second colon -starts the next capability. If you split with `\ newline' alone, you -may not add any indentation after them. - - Here is a real example of a terminal description: - - dw|vt52|DEC vt52:\ - :cr=^M:do=^J:nl=^J:bl=^G:\ - :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:\ - :cm=\EY%+ %+ :co#80:li#24:\ - :nd=\EC:ta=^I:pt:sr=\EI:up=\EA:\ - :ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H: - - Each terminal description begins with several names for the terminal -type. The names are separated by `|' characters, and a colon ends the -last name. The first name should be two characters long; it exists -only for the sake of very old Unix systems and is never used in modern -systems. The last name should be a fully verbose name such as "DEC -vt52" or "Ann Arbor Ambassador with 48 lines". The other names should -include whatever the user ought to be able to specify to get this -terminal type, such as `vt52' or `aaa-48'. *Note Naming::, for -information on how to choose terminal type names. - - After the terminal type names come the terminal capabilities, -separated by colons and with a colon after the last one. Each -capability has a two-letter name, such as `cm' for "cursor motion -string" or `li' for "number of display lines". - - -File: termcap.info, Node: Capability Format, Next: Naming, Prev: Format, Up: Data Base - -Writing the Capabilities -======================== - - There are three kinds of capabilities: flags, numbers, and strings. -Each kind has its own way of being written in the description. Each -defined capability has by convention a particular kind of value; for -example, `li' always has a numeric value and `cm' always a string value. - - A flag capability is thought of as having a boolean value: the value -is true if the capability is present, false if not. When the -capability is present, just write its name between two colons. - - A numeric capability has a value which is a nonnegative number. -Write the capability name, a `#', and the number, between two colons. -For example, `...:li#48:...' is how you specify the `li' capability for -48 lines. - - A string-valued capability has a value which is a sequence of -characters. Usually these are the characters used to perform some -display operation. Write the capability name, a `=', and the -characters of the value, between two colons. For example, -`...:cm=\E[%i%d;%dH:...' is how the cursor motion command for a -standard ANSI terminal would be specified. - - Special characters in the string value can be expressed using -`\'-escape sequences as in C; in addition, `\E' stands for ESC. `^' is -also a kind of escape character; `^' followed by CHAR stands for the -control-equivalent of CHAR. Thus, `^a' stands for the character -control-a, just like `\001'. `\' and `^' themselves can be represented -as `\\' and `\^'. - - To include a colon in the string, you must write `\072'. You might -ask, "Why can't `\:' be used to represent a colon?" The reason is that -the interrogation functions do not count slashes while looking for a -capability. Even if `:ce=ab\:cd:' were interpreted as giving the `ce' -capability the value `ab:cd', it would also appear to define `cd' as a -flag. - - The string value will often contain digits at the front to specify -padding (*note Padding::.) and/or `%'-sequences within to specify how -to encode parameters (*note Parameters::.). Although these things are -not to be output literally to the terminal, they are considered part of -the value of the capability. They are special only when the string -value is processed by `tputs', `tparam' or `tgoto'. By contrast, `\' -and `^' are considered part of the syntax for specifying the characters -in the string. - - Let's look at the VT52 example again: - - dw|vt52|DEC vt52:\ - :cr=^M:do=^J:nl=^J:bl=^G:\ - :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:\ - :cm=\EY%+ %+ :co#80:li#24:\ - :nd=\EC:ta=^I:pt:sr=\EI:up=\EA:\ - :ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H: - - Here we see the numeric-valued capabilities `co' and `li', the flags -`bs' and `pt', and many string-valued capabilities. Most of the -strings start with ESC represented as `\E'. The rest contain control -characters represented using `^'. The meanings of the individual -capabilities are defined elsewhere (*note Capabilities::.). - diff --git a/src/libs/termcap/termcap.info-2 b/src/libs/termcap/termcap.info-2 deleted file mode 100644 index 6098d62dfb..0000000000 --- a/src/libs/termcap/termcap.info-2 +++ /dev/null @@ -1,974 +0,0 @@ -This is Info file ./termcap.info, produced by Makeinfo-1.55 from the -input file ./termcap.texi. - - This file documents the termcap library of the GNU system. - - Copyright (C) 1988 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: termcap.info, Node: Naming, Next: Inheriting, Prev: Capability Format, Up: Data Base - -Terminal Type Name Conventions -============================== - - There are conventions for choosing names of terminal types. For one -thing, all letters should be in lower case. The terminal type for a -terminal in its most usual or most fundamental mode of operation should -not have a hyphen in it. - - If the same terminal has other modes of operation which require -different terminal descriptions, these variant descriptions are given -names made by adding suffixes with hyphens. Such alternate descriptions -are used for two reasons: - - * When the terminal has a switch that changes its behavior. Since - the computer cannot tell how the switch is set, the user must tell - the computer by choosing the appropriate terminal type name. - - For example, the VT-100 has a setup flag that controls whether the - cursor wraps at the right margin. If this flag is set to "wrap", - you must use the terminal type `vt100-am'. Otherwise you must use - `vt100-nam'. Plain `vt100' is defined as a synonym for either - `vt100-am' or `vt100-nam' depending on the preferences of the - local site. - - The standard suffix `-am' stands for "automatic margins". - - * To give the user a choice in how to use the terminal. This is done - when the terminal has a switch that the computer normally controls. - - For example, the Ann Arbor Ambassador can be configured with many - screen sizes ranging from 20 to 60 lines. Fewer lines make bigger - characters but more lines let you see more of what you are editing. - As a result, users have different preferences. Therefore, termcap - provides terminal types for many screen sizes. If you choose type - `aaa-30', the terminal will be configured to use 30 lines; if you - choose `aaa-48', 48 lines will be used, and so on. - - Here is a list of standard suffixes and their conventional meanings: - -`-w' - Short for "wide". This is a mode that gives the terminal more - columns than usual. This is normally a user option. - -`-am' - "Automatic margins". This is an alternate description for use when - the terminal's margin-wrap switch is on; it contains the `am' - flag. The implication is that normally the switch is off and the - usual description for the terminal says that the switch is off. - -`-nam' - "No automatic margins". The opposite of `-am', this names an - alternative description which lacks the `am' flag. This implies - that the terminal is normally operated with the margin-wrap switch - turned on, and the normal description of the terminal says so. - -`-na' - "No arrows". This terminal description initializes the terminal to - keep its arrow keys in local mode. This is a user option. - -`-rv' - "Reverse video". This terminal description causes text output for - normal video to appear as reverse, and text output for reverse - video to come out as normal. Often this description differs from - the usual one by interchanging the two strings which turn reverse - video on and off. - - This is a user option; you can choose either the "reverse video" - variant terminal type or the normal terminal type, and termcap will - obey. - -`-s' - "Status". Says to enable use of a status line which ordinary - output does not touch (*note Status Line::.). - - Some terminals have a special line that is used only as a status - line. For these terminals, there is no need for an `-s' variant; - the status line commands should be defined by default. On other - terminals, enabling a status line means removing one screen line - from ordinary use and reducing the effective screen height. For - these terminals, the user can choose the `-s' variant type to - request use of a status line. - -`-NLINES' - Says to operate with NLINES lines on the screen, for terminals - such as the Ambassador which provide this as an option. Normally - this is a user option; by choosing the terminal type, you control - how many lines termcap will use. - -`-NPAGESp' - Says that the terminal has NPAGES pages worth of screen memory, - for terminals where this is a hardware option. - -`-unk' - Says that description is not for direct use, but only for - reference in `tc' capabilities. Such a description is a kind of - subroutine, because it describes the common characteristics of - several variant descriptions that would use other suffixes in - place of `-unk'. - - -File: termcap.info, Node: Inheriting, Next: Changing, Prev: Naming, Up: Data Base - -Inheriting from Related Descriptions -==================================== - - When two terminal descriptions are similar, their identical parts do -not need to be given twice. Instead, one of the two can be defined in -terms of the other, using the `tc' capability. We say that one -description "refers to" the other, or "inherits from" the other. - - The `tc' capability must be the last one in the terminal description, -and its value is a string which is the name of another terminal type -which is referred to. For example, - - N9|aaa|ambassador|aaa-30|ann arbor ambassador/30 lines:\ - :ti=\E[2J\E[30;0;0;30p:\ - :te=\E[60;0;0;30p\E[30;1H\E[J:\ - :li#30:tc=aaa-unk: - -defines the terminal type `aaa-30' (also known as plain `aaa') in terms -of `aaa-unk', which defines everything about the Ambassador that is -independent of screen height. The types `aaa-36', `aaa-48' and so on -for other screen heights are likewise defined to inherit from `aaa-unk'. - - The capabilities overridden by `aaa-30' include `li', which says how -many lines there are, and `ti' and `te', which configure the terminal -to use that many lines. - - The effective terminal description for type `aaa' consists of the -text shown above followed by the text of the description of `aaa-unk'. -The `tc' capability is handled automatically by `tgetent', which finds -the description thus referenced and combines the two descriptions -(*note Find::.). Therefore, only the implementor of the terminal -descriptions needs to think about using `tc'. Users and application -programmers do not need to be concerned with it. - - Since the reference terminal description is used last, capabilities -specified in the referring description override any specifications of -the same capabilities in the reference description. - - The referring description can cancel out a capability without -specifying any new value for it by means of a special trick. Write the -capability in the referring description, with the character `@' after -the capability name, as follows: - - NZ|aaa-30-nam|ann arbor ambassador/30 lines/no automatic-margins:\ - :am@:tc=aaa-30: - - -File: termcap.info, Node: Changing, Prev: Inheriting, Up: Data Base - -When Changes in the Data Base Take Effect -========================================= - - Each application program must read the terminal description from the -data base, so a change in the data base is effective for all jobs -started after the change is made. - - The change will usually have no effect on a job that have been in -existence since before the change. The program probably read the -terminal description once, when it was started, and is continuing to -use what it read then. If the program does not have a feature for -reexamining the data base, then you will need to run it again (probably -killing the old job). - - If the description in use is coming from the `TERMCAP' environment -variable, then the data base file is effectively overridden, and -changes in it will have no effect until you change the `TERMCAP' -variable as well. For example, some users' `.login' files -automatically copy the terminal description into `TERMCAP' to speed -startup of applications. If you have done this, you will need to -change the `TERMCAP' variable to make the changed data base take effect. - - -File: termcap.info, Node: Capabilities, Next: Summary, Prev: Data Base, Up: Top - -Definitions of the Terminal Capabilities -**************************************** - - This section is divided into many subsections, each for one aspect of -use of display terminals. For writing a display program, you usually -need only check the subsections for the operations you want to use. -For writing a terminal description, you must read each subsection and -fill in the capabilities described there. - - String capabilities that are display commands may require numeric -parameters (*note Parameters::.). Most such capabilities do not use -parameters. When a capability requires parameters, this is explicitly -stated at the beginning of its definition. In simple cases, the first -or second sentence of the definition mentions all the parameters, in -the order they should be given, using a name in upper case for each -one. For example, the `rp' capability is a command that requires two -parameters; its definition begins as follows: - - String of commands to output a graphic character C, repeated N - times. - - In complex cases or when there are many parameters, they are -described explicitly. - - When a capability is described as obsolete, this means that programs -should not be written to look for it, but terminal descriptions should -still be written to provide it. - - When a capability is described as very obsolete, this means that it -should be omitted from terminal descriptions as well. - -* Menu: - -* Basic:: Basic characteristics. -* Screen Size:: Screen size, and what happens when it changes. -* Cursor Motion:: Various ways to move the cursor. -* Wrapping:: What happens if you write a character in the last column. -* Scrolling:: Pushing text up and down on the screen. -* Windows:: Limiting the part of the window that output affects. -* Clearing:: Erasing one or many lines. -* Insdel Line:: Making new blank lines in mid-screen; deleting lines. -* Insdel Char:: Inserting and deleting characters within a line. -* Standout:: Highlighting some of the text. -* Underlining:: Underlining some of the text. -* Cursor Visibility:: Making the cursor more or less easy to spot. -* Bell:: Attracts user's attention; not localized on the screen. -* Keypad:: Recognizing when function keys or arrows are typed. -* Meta Key:: META acts like an extra shift key. -* Initialization:: Commands used to initialize or reset the terminal. -* Pad Specs:: Info for the kernel on how much padding is needed. -* Status Line:: A status line displays "background" information. -* Half-Line:: Moving by half-lines, for superscripts and subscripts. -* Printer:: Controlling auxiliary printers of display terminals. - - -File: termcap.info, Node: Basic, Next: Screen Size, Up: Capabilities - -Basic Characteristics -===================== - - This section documents the capabilities that describe the basic and -nature of the terminal, and also those that are relevant to the output -of graphic characters. - -`os' - Flag whose presence means that the terminal can overstrike. This - means that outputting a graphic character does not erase whatever - was present in the same character position before. The terminals - that can overstrike include printing terminals, storage tubes (all - obsolete nowadays), and many bit-map displays. - -`eo' - Flag whose presence means that outputting a space erases a - character position even if the terminal supports overstriking. If - this flag is not present and overstriking is supported, output of - a space has no effect except to move the cursor. - - (On terminals that do not support overstriking, you can always - assume that outputting a space at a position erases whatever - character was previously displayed there.) - -`gn' - Flag whose presence means that this terminal type is a generic type - which does not really describe any particular terminal. Generic - types are intended for use as the default type assigned when the - user connects to the system, with the intention that the user - should specify what type he really has. One example of a generic - type is the type `network'. - - Since the generic type cannot say how to do anything interesting - with the terminal, termcap-using programs will always find that the - terminal is too weak to be supported if the user has failed to - specify a real terminal type in place of the generic one. The - `gn' flag directs these programs to use a different error message: - "You have not specified your real terminal type", rather than - "Your terminal is not powerful enough to be used". - -`hc' - Flag whose presence means this is a hardcopy terminal. - -`rp' - String of commands to output a graphic character C, repeated N - times. The first parameter value is the ASCII code for the desired - character, and the second parameter is the number of times to - repeat the character. Often this command requires padding - proportional to the number of times the character is repeated. - This effect can be had by using parameter arithmetic with - `%'-sequences to compute the amount of padding, then generating - the result as a number at the front of the string so that `tputs' - will treat it as padding. - -`hz' - Flag whose presence means that the ASCII character `~' cannot be - output on this terminal because it is used for display commands. - - Programs handle this flag by checking all text to be output and - replacing each `~' with some other character(s). If this is not - done, the screen will be thoroughly garbled. - - The old Hazeltine terminals that required such treatment are - probably very rare today, so you might as well not bother to - support this flag. - -`CC' - String whose presence means the terminal has a settable command - character. The value of the string is the default command - character (which is usually ESC). - - All the strings of commands in the terminal description should be - written to use the default command character. If you are writing - an application program that changes the command character, use the - `CC' capability to figure out how to translate all the display - commands to work with the new command character. - - Most programs have no reason to look at the `CC' capability. - -`xb' - Flag whose presence identifies Superbee terminals which are unable - to transmit the characters ESC and `Control-C'. Programs which - support this flag are supposed to check the input for the code - sequences sent by the F1 and F2 keys, and pretend that ESC or - `Control-C' (respectively) had been read. But this flag is - obsolete, and not worth supporting. - - -File: termcap.info, Node: Screen Size, Next: Cursor Motion, Prev: Basic, Up: Capabilities - -Screen Size -=========== - - A terminal description has two capabilities, `co' and `li', that -describe the screen size in columns and lines. But there is more to -the question of screen size than this. - - On some operating systems the "screen" is really a window and the -effective width can vary. On some of these systems, `tgetnum' uses the -actual width of the window to decide what value to return for the `co' -capability, overriding what is actually written in the terminal -description. On other systems, it is up to the application program to -check the actual window width using a system call. For example, on BSD -4.3 systems, the system call `ioctl' with code `TIOCGWINSZ' will tell -you the current screen size. - - On all window systems, termcap is powerless to advise the application -program if the user resizes the window. Application programs must deal -with this possibility in a system-dependent fashion. On some systems -the C shell handles part of the problem by detecting changes in window -size and setting the `TERMCAP' environment variable appropriately. -This takes care of application programs that are started subsequently. -It does not help application programs already running. - - On some systems, including BSD 4.3, all programs using a terminal get -a signal named `SIGWINCH' whenever the screen size changes. Programs -that use termcap should handle this signal by using `ioctl TIOCGWINSZ' -to learn the new screen size. - -`co' - Numeric value, the width of the screen in character positions. - Even hardcopy terminals normally have a `co' capability. - -`li' - Numeric value, the height of the screen in lines. - - -File: termcap.info, Node: Cursor Motion, Next: Wrapping, Prev: Screen Size, Up: Capabilities - -Cursor Motion -============= - - Termcap assumes that the terminal has a "cursor", a spot on the -screen where a visible mark is displayed, and that most display -commands take effect at the position of the cursor. It follows that -moving the cursor to a specified location is very important. - - There are many terminal capabilities for different cursor motion -operations. A terminal description should define as many as possible, -but most programs do not need to use most of them. One capability, -`cm', moves the cursor to an arbitrary place on the screen; this by -itself is sufficient for any application as long as there is no need to -support hardcopy terminals or certain old, weak displays that have only -relative motion commands. Use of other cursor motion capabilities is an -optimization, enabling the program to output fewer characters in some -common cases. - - If you plan to use the relative cursor motion commands in an -application program, you must know what the starting cursor position -is. To do this, you must keep track of the cursor position and update -the records each time anything is output to the terminal, including -graphic characters. In addition, it is necessary to know whether the -terminal wraps after writing in the rightmost column. *Note Wrapping::. - - One other motion capability needs special mention: `nw' moves the -cursor to the beginning of the following line, perhaps clearing all the -starting line after the cursor, or perhaps not clearing at all. This -capability is a least common denominator that is probably supported -even by terminals that cannot do most other things such as `cm' or `do'. -Even hardcopy terminals can support `nw'. - -`cm' - String of commands to position the cursor at line L, column C. - Both parameters are origin-zero, and are defined relative to the - screen, not relative to display memory. - - All display terminals except a few very obsolete ones support `cm', - so it is acceptable for an application program to refuse to - operate on terminals lacking `cm'. - -`ho' - String of commands to move the cursor to the upper left corner of - the screen (this position is called the "home position"). In - terminals where the upper left corner of the screen is not the - same as the beginning of display memory, this command must go to - the upper left corner of the screen, not the beginning of display - memory. - - Every display terminal supports this capability, and many - application programs refuse to operate if the `ho' capability is - missing. - -`ll' - String of commands to move the cursor to the lower left corner of - the screen. On some terminals, moving up from home position does - this, but programs should never assume that will work. Just - output the `ll' string (if it is provided); if moving to home - position and then moving up is the best way to get there, the `ll' - command will do that. - -`cr' - String of commands to move the cursor to the beginning of the line - it is on. If this capability is not specified, many programs - assume they can use the ASCII carriage return character for this. - -`le' - String of commands to move the cursor left one column. Unless the - `bw' flag capability is specified, the effect is undefined if the - cursor is at the left margin; do not use this command there. If - `bw' is present, this command may be used at the left margin, and - it wraps the cursor to the last column of the preceding line. - -`nd' - String of commands to move the cursor right one column. The - effect is undefined if the cursor is at the right margin; do not - use this command there, not even if `am' is present. - -`up' - String of commands to move the cursor vertically up one line. The - effect of sending this string when on the top line is undefined; - programs should never use it that way. - -`do' - String of commands to move the cursor vertically down one line. - The effect of sending this string when on the bottom line is - undefined; programs should never use it that way. - - Some programs do use `do' to scroll up one line if used at the - bottom line, if `sf' is not defined but `sr' is. This is only to - compensate for certain old, incorrect terminal descriptions. (In - principle this might actually lead to incorrect behavior on other - terminals, but that seems to happen rarely if ever.) But the - proper solution is that the terminal description should define - `sf' as well as `do' if the command is suitable for scrolling. - - The original idea was that this string would not contain a newline - character and therefore could be used without disabling the - kernel's usual habit of converting of newline into a - carriage-return newline sequence. But many terminal descriptions - do use newline in the `do' string, so this is not possible; a - program which sends the `do' string must disable output conversion - in the kernel (*note Initialize::.). - -`bw' - Flag whose presence says that `le' may be used in column zero to - move to the last column of the preceding line. If this flag is - not present, `le' should not be used in column zero. - -`nw' - String of commands to move the cursor to start of next line, - possibly clearing rest of line (following the cursor) before - moving. - -`DO', `UP', `LE', `RI' - Strings of commands to move the cursor N lines down vertically, up - vertically, or N columns left or right. Do not attempt to move - past any edge of the screen with these commands; the effect of - trying that is undefined. Only a few terminal descriptions provide - these commands, and most programs do not use them. - -`CM' - String of commands to position the cursor at line L, column C, - relative to display memory. Both parameters are origin-zero. - This capability is present only in terminals where there is a - difference between screen-relative and memory-relative addressing, - and not even in all such terminals. - -`ch' - String of commands to position the cursor at column C in the same - line it is on. This is a special case of `cm' in which the - vertical position is not changed. The `ch' capability is provided - only when it is faster to output than `cm' would be in this - special case. Programs should not assume most display terminals - have `ch'. - -`cv' - String of commands to position the cursor at line L in the same - column. This is a special case of `cm' in which the horizontal - position is not changed. The `cv' capability is provided only - when it is faster to output than `cm' would be in this special - case. Programs should not assume most display terminals have `cv'. - -`sc' - String of commands to make the terminal save the current cursor - position. Only the last saved position can be used. If this - capability is present, `rc' should be provided also. Most - terminals have neither. - -`rc' - String of commands to make the terminal restore the last saved - cursor position. If this capability is present, `sc' should be - provided also. Most terminals have neither. - -`ff' - String of commands to advance to the next page, for a hardcopy - terminal. - -`ta' - String of commands to move the cursor right to the next hardware - tab stop column. Missing if the terminal does not have any kind of - hardware tabs. Do not send this command if the kernel's terminal - modes say that the kernel is expanding tabs into spaces. - -`bt' - String of commands to move the cursor left to the previous hardware - tab stop column. Missing if the terminal has no such ability; many - terminals do not. Do not send this command if the kernel's - terminal modes say that the kernel is expanding tabs into spaces. - - The following obsolete capabilities should be included in terminal -descriptions when appropriate, but should not be looked at by new -programs. - -`nc' - Flag whose presence means the terminal does not support the ASCII - carriage return character as `cr'. This flag is needed because - old programs assume, when the `cr' capability is missing, that - ASCII carriage return can be used for the purpose. We use `nc' to - tell the old programs that carriage return may not be used. - - New programs should not assume any default for `cr', so they need - not look at `nc'. However, descriptions should contain `nc' - whenever they do not contain `cr'. - -`xt' - Flag whose presence means that the ASCII tab character may not be - used for cursor motion. This flag exists because old programs - assume, when the `ta' capability is missing, that ASCII tab can be - used for the purpose. We use `xt' to tell the old programs not to - use tab. - - New programs should not assume any default for `ta', so they need - not look at `xt' in connection with cursor motion. Note that `xt' - also has implications for standout mode (*note Standout::.). It - is obsolete in regard to cursor motion but not in regard to - standout. - - In fact, `xt' means that the terminal is a Teleray 1061. - -`bc' - Very obsolete alternative name for the `le' capability. - -`bs' - Flag whose presence means that the ASCII character backspace may be - used to move the cursor left. Obsolete; look at `le' instead. - -`nl' - Obsolete capability which is a string that can either be used to - move the cursor down or to scroll. The same string must scroll - when used on the bottom line and move the cursor when used on any - other line. New programs should use `do' or `sf', and ignore `nl'. - - If there is no `nl' capability, some old programs assume they can - use the newline character for this purpose. These programs follow - a bad practice, but because they exist, it is still desirable to - define the `nl' capability in a terminal description if the best - way to move down is *not* a newline. - - -File: termcap.info, Node: Wrapping, Next: Scrolling, Prev: Cursor Motion, Up: Capabilities - -Wrapping -======== - - "Wrapping" means moving the cursor from the right margin to the left -margin of the following line. Some terminals wrap automatically when a -graphic character is output in the last column, while others do not. -Most application programs that use termcap need to know whether the -terminal wraps. There are two special flag capabilities to describe -what the terminal does when a graphic character is output in the last -column. - -`am' - Flag whose presence means that writing a character in the last - column causes the cursor to wrap to the beginning of the next line. - - If `am' is not present, writing in the last column leaves the - cursor at the place where the character was written. - - Writing in the last column of the last line should be avoided on - terminals with `am', as it may or may not cause scrolling to occur - (*note Scrolling::.). Scrolling is surely not what you would - intend. - - If your program needs to check the `am' flag, then it also needs - to check the `xn' flag which indicates that wrapping happens in a - strange way. Many common terminals have the `xn' flag. - -`xn' - Flag whose presence means that the cursor wraps in a strange way. - At least two distinct kinds of strange behavior are known; the - termcap data base does not contain anything to distinguish the two. - - On Concept-100 terminals, output in the last column wraps the - cursor almost like an ordinary `am' terminal. But if the next - thing output is a newline, it is ignored. - - DEC VT-100 terminals (when the wrap switch is on) do a different - strange thing: the cursor wraps only if the next thing output is - another graphic character. In fact, the wrap occurs when the - following graphic character is received by the terminal, before the - character is placed on the screen. - - On both of these terminals, after writing in the last column a - following graphic character will be displayed in the first column - of the following line. But the effect of relative cursor motion - characters such as newline or backspace at such a time depends on - the terminal. The effect of erase or scrolling commands also - depends on the terminal. You can't assume anything about what - they will do on a terminal that has `xn'. So, to be safe, you - should never do these things at such a time on such a terminal. - - To be sure of reliable results on a terminal which has the `xn' - flag, output a `cm' absolute positioning command after writing in - the last column. Another safe thing to do is to output - carriage-return newline, which will leave the cursor at the - beginning of the following line. - -`LP' - Flag whose presence means that it is safe to write in the last - column of the last line without worrying about undesired - scrolling. `LP' indicates the DEC flavor of `xn' strangeness. - - -File: termcap.info, Node: Scrolling, Next: Windows, Prev: Wrapping, Up: Capabilities - -Scrolling -========= - - "Scrolling" means moving the contents of the screen up or down one or -more lines. Moving the contents up is "forward scrolling"; moving them -down is "reverse scrolling". - - Scrolling happens after each line of output during ordinary output -on most display terminals. But in an application program that uses -termcap for random-access output, scrolling happens only when -explicitly requested with the commands in this section. - - Some terminals have a "scroll region" feature. This lets you limit -the effect of scrolling to a specified range of lines. Lines outside -the range are unaffected when scrolling happens. The scroll region -feature is available if either `cs' or `cS' is present. - -`sf' - String of commands to scroll the screen one line up, assuming it is - output with the cursor at the beginning of the bottom line. - -`sr' - String of commands to scroll the screen one line down, assuming it - is output with the cursor at the beginning of the top line. - -`do' - A few programs will try to use `do' to do the work of `sf'. This - is not really correct--it is an attempt to compensate for the - absence of a `sf' command in some old terminal descriptions. - - Since these terminal descriptions do define `sr', perhaps at one - time the definition of `do' was different and it could be used for - scrolling as well. But it isn't desirable to combine these two - functions in one capability, since scrolling often requires more - padding than simply moving the cursor down. Defining `sf' and - `do' separately allows you to specify the padding properly. Also, - all sources agree that `do' should not be relied on to do - scrolling. - - So the best approach is to add `sf' capabilities to the - descriptions of these terminals, copying the definition of `do' if - that does scroll. - -`SF' - String of commands to scroll the screen N lines up, assuming it is - output with the cursor at the beginning of the bottom line. - -`SR' - String of commands to scroll the screen N lines down, assuming it - is output with the cursor at the beginning of the top line. - -`cs' - String of commands to set the scroll region. This command takes - two parameters, START and END, which are the line numbers - (origin-zero) of the first line to include in the scroll region - and of the last line to include in it. When a scroll region is - set, scrolling is limited to the specified range of lines; lines - outside the range are not affected by scroll commands. - - Do not try to move the cursor outside the scroll region. The - region remains set until explicitly removed. To remove the scroll - region, use another `cs' command specifying the full height of the - screen. - - The cursor position is undefined after the `cs' command is set, so - position the cursor with `cm' immediately afterward. - -`cS' - String of commands to set the scroll region using parameters in - different form. The effect is the same as if `cs' were used. - Four parameters are required: - - 1. Total number of lines on the screen. - - 2. Number of lines above desired scroll region. - - 3. Number of lines below (outside of) desired scroll region. - - 4. Total number of lines on the screen, the same as the first - parameter. - - This capability is a GNU extension that was invented to allow the - Ann Arbor Ambassador's scroll-region command to be described; it - could also be done by putting non-Unix `%'-sequences into a `cs' - string, but that would have confused Unix programs that used the - `cs' capability with the Unix termcap. Currently only GNU Emacs - uses the `cS' capability. - -`ns' - Flag which means that the terminal does not normally scroll for - ordinary sequential output. For modern terminals, this means that - outputting a newline in ordinary sequential output with the cursor - on the bottom line wraps to the top line. For some obsolete - terminals, other things may happen. - - The terminal may be able to scroll even if it does not normally do - so. If the `sf' capability is provided, it can be used for - scrolling regardless of `ns'. - -`da' - Flag whose presence means that lines scrolled up off the top of the - screen may come back if scrolling down is done subsequently. - - The `da' and `db' flags do not, strictly speaking, affect how to - scroll. But programs that scroll usually need to clear the lines - scrolled onto the screen, if these flags are present. - -`db' - Flag whose presence means that lines scrolled down off the bottom - of the screen may come back if scrolling up is done subsequently. - -`lm' - Numeric value, the number of lines of display memory that the - terminal has. A value of zero means that the terminal has more - display memory than can fit on the screen, but no fixed number of - lines. (The number of lines may depend on the amount of text in - each line.) - - Any terminal description that defines `SF' should also define `sf'; -likewise for `SR' and `sr'. However, many terminals can only scroll by -one line at a time, so it is common to find `sf' and not `SF', or `sr' -without `SR'. - - Therefore, all programs that use the scrolling facilities should be -prepared to work with `sf' in the case that `SF' is absent, and -likewise with `sr'. On the other hand, an application program that -uses only `sf' and not `SF' is acceptable, though slow on some -terminals. - - When outputting a scroll command with `tputs', the NLINES argument -should be the total number of lines in the portion of the screen being -scrolled. Very often these commands require padding proportional to -this number of lines. *Note Padding::. - - -File: termcap.info, Node: Windows, Next: Clearing, Prev: Scrolling, Up: Capabilities - -Windows -======= - - A "window", in termcap, is a rectangular portion of the screen to -which all display operations are restricted. Wrapping, clearing, -scrolling, insertion and deletion all operate as if the specified -window were all the screen there was. - -`wi' - String of commands to set the terminal output screen window. This - string requires four parameters, all origin-zero: - 1. The first line to include in the window. - - 2. The last line to include in the window. - - 3. The first column to include in the window. - - 4. The last column to include in the window. - - Most terminals do not support windows. - - -File: termcap.info, Node: Clearing, Next: Insdel Line, Prev: Windows, Up: Capabilities - -Clearing Parts of the Screen -============================ - - There are several terminal capabilities for clearing parts of the -screen to blank. All display terminals support the `cl' string, and -most display terminals support all of these capabilities. - -`cl' - String of commands to clear the entire screen and position the - cursor at the upper left corner. - -`cd' - String of commands to clear the line the cursor is on, and all the - lines below it, down to the bottom of the screen. This command - string should be used only with the cursor in column zero; their - effect is undefined if the cursor is elsewhere. - -`ce' - String of commands to clear from the cursor to the end of the - current line. - -`ec' - String of commands to clear N characters, starting with the - character that the cursor is on. This command string is expected - to leave the cursor position unchanged. The parameter N should - never be large enough to reach past the right margin; the effect - of such a large parameter would be undefined. - - Clear to end of line (`ce') is extremely important in programs that -maintain an updating display. Nearly all display terminals support this -operation, so it is acceptable for a an application program to refuse to -work if `ce' is not present. However, if you do not want this -limitation, you can accomplish clearing to end of line by outputting -spaces until you reach the right margin. In order to do this, you must -know the current horizontal position. Also, this technique assumes -that writing a space will erase. But this happens to be true on all -the display terminals that fail to support `ce'. - - -File: termcap.info, Node: Insdel Line, Next: Insdel Char, Prev: Clearing, Up: Capabilities - -Insert/Delete Line -================== - - "Inserting a line" means creating a blank line in the middle of the -screen, and pushing the existing lines of text apart. In fact, the -lines above the insertion point do not change, while the lines below -move down, and one is normally lost at the bottom of the screen. - - "Deleting a line" means causing the line to disappear from the -screen, closing up the gap by moving the lines below it upward. A new -line appears at the bottom of the screen. Usually this line is blank, -but on terminals with the `db' flag it may be a line previously moved -off the screen bottom by scrolling or line insertion. - - Insertion and deletion of lines is useful in programs that maintain -an updating display some parts of which may get longer or shorter. -They are also useful in editors for scrolling parts of the screen, and -for redisplaying after lines of text are killed or inserted. - - Many terminals provide commands to insert or delete a single line at -the cursor position. Some provide the ability to insert or delete -several lines with one command, using the number of lines to insert or -delete as a parameter. Always move the cursor to column zero before -using any of these commands. - -`al' - String of commands to insert a blank line before the line the - cursor is on. The existing line, and all lines below it, are - moved down. The last line in the screen (or in the scroll region, - if one is set) disappears and in most circumstances is discarded. - It may not be discarded if the `db' is present (*note - Scrolling::.). - - The cursor must be at the left margin before this command is used. - This command does not move the cursor. - -`dl' - String of commands to delete the line the cursor is on. The - following lines move up, and a blank line appears at the bottom of - the screen (or bottom of the scroll region). If the terminal has - the `db' flag, a nonblank line previously pushed off the screen - bottom may reappear at the bottom. - - The cursor must be at the left margin before this command is used. - This command does not move the cursor. - -`AL' - String of commands to insert N blank lines before the line that - the cursor is on. It is like `al' repeated N times, except that - it is as fast as one `al'. - -`DL' - String of commands to delete N lines starting with the line that - the cursor is on. It is like `dl' repeated N times, except that - it is as fast as one `dl'. - - Any terminal description that defines `AL' should also define `al'; -likewise for `DL' and `dl'. However, many terminals can only insert or -delete one line at a time, so it is common to find `al' and not `AL', -or `dl' without `DL'. - - Therefore, all programs that use the insert and delete facilities -should be prepared to work with `al' in the case that `AL' is absent, -and likewise with `dl'. On the other hand, it is acceptable to write -an application that uses only `al' and `dl' and does not look for `AL' -or `DL' at all. - - If a terminal does not support line insertion and deletion directly, -but does support a scroll region, the effect of insertion and deletion -can be obtained with scrolling. However, it is up to the individual -user program to check for this possibility and use the scrolling -commands to get the desired result. It is fairly important to implement -this alternate strategy, since it is the only way to get the effect of -line insertion and deletion on the popular VT100 terminal. - - Insertion and deletion of lines is affected by the scroll region on -terminals that have a settable scroll region. This is useful when it is -desirable to move any few consecutive lines up or down by a few lines. -*Note Scrolling::. - - The line pushed off the bottom of the screen is not lost if the -terminal has the `db' flag capability; instead, it is pushed into -display memory that does not appear on the screen. This is the same -thing that happens when scrolling pushes a line off the bottom of the -screen. Either reverse scrolling or deletion of a line can bring the -apparently lost line back onto the bottom of the screen. If the -terminal has the scroll region feature as well as `db', the pushed-out -line really is lost if a scroll region is in effect. - - When outputting an insert or delete command with `tputs', the NLINES -argument should be the total number of lines from the cursor to the -bottom of the screen (or scroll region). Very often these commands -require padding proportional to this number of lines. *Note Padding::. - - For `AL' and `DL' the NLINES argument should *not* depend on the -number of lines inserted or deleted; only the total number of lines -affected. This is because it is just as fast to insert two or N lines -with `AL' as to insert one line with `al'. - diff --git a/src/libs/termcap/termcap.info-3 b/src/libs/termcap/termcap.info-3 deleted file mode 100644 index d5b309f21a..0000000000 --- a/src/libs/termcap/termcap.info-3 +++ /dev/null @@ -1,1480 +0,0 @@ -This is Info file ./termcap.info, produced by Makeinfo-1.55 from the -input file ./termcap.texi. - - This file documents the termcap library of the GNU system. - - Copyright (C) 1988 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: termcap.info, Node: Insdel Char, Next: Standout, Prev: Insdel Line, Up: Capabilities - -Insert/Delete Character -======================= - - "Inserting a character" means creating a blank space in the middle -of a line, and pushing the rest of the line rightward. The character -in the rightmost column is lost. - - "Deleting a character" means causing the character to disappear from -the screen, closing up the gap by moving the rest of the line leftward. -A blank space appears in the rightmost column. - - Insertion and deletion of characters is useful in programs that -maintain an updating display some parts of which may get longer or -shorter. It is also useful in editors for redisplaying the results of -editing within a line. - - Many terminals provide commands to insert or delete a single -character at the cursor position. Some provide the ability to insert -or delete several characters with one command, using the number of -characters to insert or delete as a parameter. - - Many terminals provide an insert mode in which outputting a graphic -character has the added effect of inserting a position for that -character. A special command string is used to enter insert mode and -another is used to exit it. The reason for designing a terminal with -an insert mode rather than an insert command is that inserting -character positions is usually followed by writing characters into -them. With insert mode, this is as fast as simply writing the -characters, except for the fixed overhead of entering and leaving -insert mode. However, when the line speed is great enough, padding may -be required for the graphic characters output in insert mode. - - Some terminals require you to enter insert mode and then output a -special command for each position to be inserted. Or they may require -special commands to be output before or after each graphic character to -be inserted. - - Deletion of characters is usually accomplished by a straightforward -command to delete one or several positions; but on some terminals, it -is necessary to enter a special delete mode before using the delete -command, and leave delete mode afterward. Sometimes delete mode and -insert mode are the same mode. - - Some terminals make a distinction between character positions in -which a space character has been output and positions which have been -cleared. On these terminals, the effect of insert or delete character -runs to the first cleared position rather than to the end of the line. -In fact, the effect may run to more than one line if there is no -cleared position to stop the shift on the first line. These terminals -are identified by the `in' flag capability. - - On terminals with the `in' flag, the technique of skipping over -characters that you know were cleared, and then outputting text later -on in the same line, causes later insert and delete character -operations on that line to do nonstandard things. A program that has -any chance of doing this must check for the `in' flag and must be -careful to write explicit space characters into the intermediate -columns when `in' is present. - - A plethora of terminal capabilities are needed to describe all of -this complexity. Here is a list of them all. Following the list, we -present an algorithm for programs to use to take proper account of all -of these capabilities. - -`im' - String of commands to enter insert mode. - - If the terminal has no special insert mode, but it can insert - characters with a special command, `im' should be defined with a - null value, because the `vi' editor assumes that insertion of a - character is impossible if `im' is not provided. - - New programs should not act like `vi'. They should pay attention - to `im' only if it is defined. - -`ei' - String of commands to leave insert mode. This capability must be - present if `im' is. - - On a few old terminals the same string is used to enter and exit - insert mode. This string turns insert mode on if it was off, and - off it it was on. You can tell these terminals because the `ei' - string equals the `im' string. If you want to support these - terminals, you must always remember accurately whether insert mode - is in effect. However, these terminals are obsolete, and it is - reasonable to refuse to support them. On all modern terminals, you - can safely output `ei' at any time to ensure that insert mode is - turned off. - -`ic' - String of commands to insert one character position at the cursor. - The cursor does not move. - - If outputting a graphic character while in insert mode is - sufficient to insert the character, then the `ic' capability - should be defined with a null value. - - If your terminal offers a choice of ways to insert--either use - insert mode or use a special command--then define `im' and do not - define `ic', since this gives the most efficient operation when - several characters are to be inserted. *Do not* define both - strings, for that means that *both* must be used each time - insertion is done. - -`ip' - String of commands to output following an inserted graphic - character in insert mode. Often it is used just for a padding - spec, when padding is needed after an inserted character (*note - Padding::.). - -`IC' - String of commands to insert N character positions at and after - the cursor. It has the same effect as repeating the `ic' string - and a space, N times. - - If `IC' is provided, application programs may use it without first - entering insert mode. - -`mi' - Flag whose presence means it is safe to move the cursor while in - insert mode and assume the terminal remains in insert mode. - -`in' - Flag whose presence means that the terminal distinguishes between - character positions in which space characters have been output and - positions which have been cleared. - - An application program can assume that the terminal can do character -insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is -provided. - - To insert N blank character positions, move the cursor to the place -to insert them and follow this algorithm: - - 1. If an `IC' string is provided, output it with parameter N and you - are finished. Otherwise (or if you don't want to bother to look - for an `IC' string) follow the remaining steps. - - 2. Output the `im' string, if there is one, unless the terminal is - already in insert mode. - - 3. Repeat steps 4 through 6, N times. - - 4. Output the `ic' string if any. - - 5. Output a space. - - 6. Output the `ip' string if any. - - 7. Output the `ei' string, eventually, to exit insert mode. There is - no need to do this right away. If the `mi' flag is present, you - can move the cursor and the cursor will remain in insert mode; - then you can do more insertion elsewhere without reentering insert - mode. - - To insert N graphic characters, position the cursor and follow this -algorithm: - - 1. If an `IC' string is provided, output it with parameter N, then - output the graphic characters, and you are finished. Otherwise - (or if you don't want to bother to look for an `IC' string) follow - the remaining steps. - - 2. Output the `im' string, if there is one, unless the terminal is - already in insert mode. - - 3. For each character to be output, repeat steps 4 through 6. - - 4. Output the `ic' string if any. - - 5. Output the next graphic character. - - 6. Output the `ip' string if any. - - 7. Output the `ei' string, eventually, to exit insert mode. There is - no need to do this right away. If the `mi' flag is present, you - can move the cursor and the cursor will remain in insert mode; - then you can do more insertion elsewhere without reentering insert - mode. - - Note that this is not the same as the original Unix termcap -specifications in one respect: it assumes that the `IC' string can be -used without entering insert mode. This is true as far as I know, and -it allows you be able to avoid entering and leaving insert mode, and -also to be able to avoid the inserted-character padding after the -characters that go into the inserted positions. - - Deletion of characters is less complicated; deleting one column is -done by outputting the `dc' string. However, there may be a delete -mode that must be entered with `dm' in order to make `dc' work. - -`dc' - String of commands to delete one character position at the cursor. - If `dc' is not present, the terminal cannot delete characters. - -`DC' - String of commands to delete N characters starting at the cursor. - It has the same effect as repeating the `dc' string N times. Any - terminal description that has `DC' also has `dc'. - -`dm' - String of commands to enter delete mode. If not present, there is - no delete mode, and `dc' can be used at any time (assuming there is - a `dc'). - -`ed' - String of commands to exit delete mode. This must be present if - `dm' is. - - To delete N character positions, position the cursor and follow these -steps: - - 1. If the `DC' string is present, output it with parameter N and you - are finished. Otherwise, follow the remaining steps. - - 2. Output the `dm' string, unless you know the terminal is already in - delete mode. - - 3. Output the `dc' string N times. - - 4. Output the `ed' string eventually. If the flag capability `mi' is - present, you can move the cursor and do more deletion without - leaving and reentering delete mode. - - As with the `IC' string, we have departed from the original termcap -specifications by assuming that `DC' works without entering delete mode -even though `dc' would not. - - If the `dm' and `im' capabilities are both present and have the same -value, it means that the terminal has one mode for both insertion and -deletion. It is useful for a program to know this, because then it can -do insertions after deletions, or vice versa, without leaving -insert/delete mode and reentering it. - - -File: termcap.info, Node: Standout, Next: Underlining, Prev: Insdel Char, Up: Capabilities - -Standout and Appearance Modes -============================= - - "Appearance modes" are modifications to the ways characters are -displayed. Typical appearance modes include reverse video, dim, bright, -blinking, underlined, invisible, and alternate character set. Each -kind of terminal supports various among these, or perhaps none. - - For each type of terminal, one appearance mode or combination of -them that looks good for highlighted text is chosen as the "standout -mode". The capabilities `so' and `se' say how to enter and leave -standout mode. Programs that use appearance modes only to highlight -some text generally use the standout mode so that they can work on as -many terminals as possible. Use of specific appearance modes other -than "underlined" and "alternate character set" is rare. - - Terminals that implement appearance modes fall into two general -classes as to how they do it. - - In some terminals, the presence or absence of any appearance mode is -recorded separately for each character position. In these terminals, -each graphic character written is given the appearance modes current at -the time it is written, and keeps those modes until it is erased or -overwritten. There are special commands to turn the appearance modes -on or off for characters to be written in the future. - - In other terminals, the change of appearance modes is represented by -a marker that belongs to a certain screen position but affects all -following screen positions until the next marker. These markers are -traditionally called "magic cookies". - - The same capabilities (`so', `se', `mb' and so on) for turning -appearance modes on and off are used for both magic-cookie terminals -and per-character terminals. On magic cookie terminals, these give the -commands to write the magic cookies. On per-character terminals, they -change the current modes that affect future output and erasure. Some -simple applications can use these commands without knowing whether or -not they work by means of cookies. - - However, a program that maintains and updates a display needs to know -whether the terminal uses magic cookies, and exactly what their effect -is. This information comes from the `sg' capability. - - The `sg' capability is a numeric capability whose presence indicates -that the terminal uses magic cookies for appearance modes. Its value is -the number of character positions that a magic cookie occupies. Usually -the cookie occupies one or more character positions on the screen, and -these character positions are displayed as blank, but in some terminals -the cookie has zero width. - - The `sg' capability describes both the magic cookie to turn standout -on and the cookie to turn it off. This makes the assumption that both -kinds of cookie have the same width on the screen. If that is not true, -the narrower cookie must be "widened" with spaces until it has the same -width as the other. - - On some magic cookie terminals, each line always starts with normal -display; in other words, the scope of a magic cookie never extends over -more than one line. But on other terminals, one magic cookie affects -all the lines below it unless explicitly canceled. Termcap does not -define any way to distinguish these two ways magic cookies can work. -To be safe, it is best to put a cookie at the beginning of each line. - - On some per-character terminals, standout mode or other appearance -modes may be canceled by moving the cursor. On others, moving the -cursor has no effect on the state of the appearance modes. The latter -class of terminals are given the flag capability `ms' ("can move in -standout"). All programs that might have occasion to move the cursor -while appearance modes are turned on must check for this flag; if it is -not present, they should reset appearance modes to normal before doing -cursor motion. - - A program that has turned on only standout mode should use `se' to -reset the standout mode to normal. A program that has turned on only -alternate character set mode should use `ae' to return it to normal. -If it is possible that any other appearance modes are turned on, use the -`me' capability to return them to normal. - - Note that the commands to turn on one appearance mode, including `so' -and `mb' ... `mr', if used while some other appearance modes are turned -on, may combine the two modes on some terminals but may turn off the -mode previously enabled on other terminals. This is because some -terminals do not have a command to set or clear one appearance mode -without changing the others. Programs should not attempt to use -appearance modes in combination except with `sa', and when switching -from one single mode to another should always turn off the previously -enabled mode and then turn on the new desired mode. - - On some old terminals, the `so' and `se' commands may be the same -command, which has the effect of turning standout on if it is off, or -off it is on. It is therefore risky for a program to output extra `se' -commands for good measure. Fortunately, all these terminals are -obsolete. - - Programs that update displays in which standout-text may be replaced -with non-standout text must check for the `xs' flag. In a per-character -terminal, this flag says that the only way to remove standout once -written is to clear that portion of the line with the `ce' string or -something even more powerful (*note Clearing::.); just writing new -characters at those screen positions will not change the modes in -effect there. In a magic cookie terminal, `xs' says that the only way -to remove a cookie is to clear a portion of the line that includes the -cookie; writing a different cookie at the same position does not work. - - Such programs must also check for the `xt' flag, which means that the -terminal is a Teleray 1061. On this terminal it is impossible to -position the cursor at the front of a magic cookie, so the only two -ways to remove a cookie are (1) to delete the line it is on or (2) to -position the cursor at least one character before it (possibly on a -previous line) and output the `se' string, which on these terminals -finds and removes the next `so' magic cookie on the screen. (It may -also be possible to remove a cookie which is not at the beginning of a -line by clearing that line.) The `xt' capability also has implications -for the use of tab characters, but in that regard it is obsolete (*Note -Cursor Motion::). - -`so' - String of commands to enter standout mode. - -`se' - String of commands to leave standout mode. - -`sg' - Numeric capability, the width on the screen of the magic cookie. - This capability is absent in terminals that record appearance modes - character by character. - -`ms' - Flag whose presence means that it is safe to move the cursor while - the appearance modes are not in the normal state. If this flag is - absent, programs should always reset the appearance modes to - normal before moving the cursor. - -`xs' - Flag whose presence means that the only way to reset appearance - modes already on the screen is to clear to end of line. On a - per-character terminal, you must clear the area where the modes - are set. On a magic cookie terminal, you must clear an area - containing the cookie. See the discussion above. - -`xt' - Flag whose presence means that the cursor cannot be positioned - right in front of a magic cookie, and that `se' is a command to - delete the next magic cookie following the cursor. See discussion - above. - -`mb' - String of commands to enter blinking mode. - -`md' - String of commands to enter double-bright mode. - -`mh' - String of commands to enter half-bright mode. - -`mk' - String of commands to enter invisible mode. - -`mp' - String of commands to enter protected mode. - -`mr' - String of commands to enter reverse-video mode. - -`me' - String of commands to turn off all appearance modes, including - standout mode and underline mode. On some terminals it also turns - off alternate character set mode; on others, it may not. This - capability must be present if any of `mb' ... `mr' is present. - -`as' - String of commands to turn on alternate character set mode. This - mode assigns some or all graphic characters an alternate picture - on the screen. There is no standard as to what the alternate - pictures look like. - -`ae' - String of commands to turn off alternate character set mode. - -`sa' - String of commands to turn on an arbitrary combination of - appearance modes. It accepts 9 parameters, each of which controls - a particular kind of appearance mode. A parameter should be 1 to - turn its appearance mode on, or zero to turn that mode off. Most - terminals do not support the `sa' capability, even among those - that do have various appearance modes. - - The nine parameters are, in order, STANDOUT, UNDERLINE, REVERSE, - BLINK, HALF-BRIGHT, DOUBLE-BRIGHT, BLANK, PROTECT, ALT CHAR SET. - - -File: termcap.info, Node: Underlining, Next: Cursor Visibility, Prev: Standout, Up: Capabilities - -Underlining -=========== - - Underlining on most terminals is a kind of appearance mode, much like -standout mode. Therefore, it may be implemented using magic cookies or -as a flag in the terminal whose current state affects each character -that is output. *Note Standout::, for a full explanation. - - The `ug' capability is a numeric capability whose presence indicates -that the terminal uses magic cookies for underlining. Its value is the -number of character positions that a magic cookie for underlining -occupies; it is used for underlining just as `sg' is used for standout. -Aside from the simplest applications, it is impossible to use -underlining correctly without paying attention to the value of `ug'. - -`us' - String of commands to turn on underline mode or to output a magic - cookie to start underlining. - -`ue' - String of commands to turn off underline mode or to output a magic - cookie to stop underlining. - -`ug' - Width of magic cookie that represents a change of underline mode; - or missing, if the terminal does not use a magic cookie for this. - -`ms' - Flag whose presence means that it is safe to move the cursor while - the appearance modes are not in the normal state. Underlining is - an appearance mode. If this flag is absent, programs should - always turn off underlining before moving the cursor. - - There are two other, older ways of doing underlining: there can be a -command to underline a single character, or the output of `_', the -ASCII underscore character, as an overstrike could cause a character to -be underlined. New programs need not bother to handle these -capabilities unless the author cares strongly about the obscure -terminals which support them. However, terminal descriptions should -provide these capabilities when appropriate. - -`uc' - String of commands to underline the character under the cursor, and - move the cursor right. - -`ul' - Flag whose presence means that the terminal can underline by - overstriking an underscore character (`_'); some terminals can do - this even though they do not support overstriking in general. An - implication of this flag is that when outputting new text to - overwrite old text, underscore characters must be treated - specially lest they underline the old text instead. - - -File: termcap.info, Node: Cursor Visibility, Next: Bell, Prev: Underlining, Up: Capabilities - -Cursor Visibility -================= - - Some terminals have the ability to make the cursor invisible, or to -enhance it. Enhancing the cursor is often done by programs that plan -to use the cursor to indicate to the user a position of interest that -may be anywhere on the screen--for example, the Emacs editor enhances -the cursor on entry. Such programs should always restore the cursor to -normal on exit. - -`vs' - String of commands to enhance the cursor. - -`vi' - String of commands to make the cursor invisible. - -`ve' - String of commands to return the cursor to normal. - - If you define either `vs' or `vi', you must also define `ve'. - - -File: termcap.info, Node: Bell, Next: Keypad, Prev: Cursor Visibility, Up: Capabilities - -Bell -==== - - Here we describe commands to make the terminal ask for the user to -pay attention to it. - -`bl' - String of commands to cause the terminal to make an audible sound. - If this capability is absent, the terminal has no way to make a - suitable sound. - -`vb' - String of commands to cause the screen to flash to attract - attention ("visible bell"). If this capability is absent, the - terminal has no way to do such a thing. - - -File: termcap.info, Node: Keypad, Next: Meta Key, Prev: Bell, Up: Capabilities - -Keypad and Function Keys -======================== - - Many terminals have arrow and function keys that transmit specific -character sequences to the computer. Since the precise sequences used -depend on the terminal, termcap defines capabilities used to say what -the sequences are. Unlike most termcap string-valued capabilities, -these are not strings of commands to be sent to the terminal, rather -strings that are received from the terminal. - - Programs that expect to use keypad keys should check, initially, for -a `ks' capability and send it, to make the keypad actually transmit. -Such programs should also send the `ke' string when exiting. - -`ks' - String of commands to make the keypad keys transmit. If this - capability is not provided, but the others in this section are, - programs may assume that the keypad keys always transmit. - -`ke' - String of commands to make the keypad keys work locally. This - capability is provided only if `ks' is. - -`kl' - String of input characters sent by typing the left-arrow key. If - this capability is missing, you cannot expect the terminal to have - a left-arrow key that transmits anything to the computer. - -`kr' - String of input characters sent by typing the right-arrow key. - -`ku' - String of input characters sent by typing the up-arrow key. - -`kd' - String of input characters sent by typing the down-arrow key. - -`kh' - String of input characters sent by typing the "home-position" key. - -`K1' ... `K5' - Strings of input characters sent by the five other keys in a 3-by-3 - array that includes the arrow keys, if the keyboard has such a - 3-by-3 array. Note that one of these keys may be the - "home-position" key, in which case one of these capabilities will - have the same value as the `kh' key. - -`k0' - String of input characters sent by function key 10 (or 0, if the - terminal has one labeled 0). - -`k1' ... `k9' - Strings of input characters sent by function keys 1 through 9, - provided for those function keys that exist. - -`kn' - Number: the number of numbered function keys, if there are more - than 10. - -`l0' ... `l9' - Strings which are the labels appearing on the keyboard on the keys - described by the capabilities `k0' ... `l9'. These capabilities - should be left undefined if the labels are `f0' or `f10' and `f1' - ... `f9'. - -`kH' - String of input characters sent by the "home down" key, if there is - one. - -`kb' - String of input characters sent by the "backspace" key, if there is - one. - -`ka' - String of input characters sent by the "clear all tabs" key, if - there is one. - -`kt' - String of input characters sent by the "clear tab stop this column" - key, if there is one. - -`kC' - String of input characters sent by the "clear screen" key, if - there is one. - -`kD' - String of input characters sent by the "delete character" key, if - there is one. - -`kL' - String of input characters sent by the "delete line" key, if there - is one. - -`kM' - String of input characters sent by the "exit insert mode" key, if - there is one. - -`kE' - String of input characters sent by the "clear to end of line" key, - if there is one. - -`kS' - String of input characters sent by the "clear to end of screen" - key, if there is one. - -`kI' - String of input characters sent by the "insert character" or "enter - insert mode" key, if there is one. - -`kA' - String of input characters sent by the "insert line" key, if there - is one. - -`kN' - String of input characters sent by the "next page" key, if there is - one. - -`kP' - String of input characters sent by the "previous page" key, if - there is one. - -`kF' - String of input characters sent by the "scroll forward" key, if - there is one. - -`kR' - String of input characters sent by the "scroll reverse" key, if - there is one. - -`kT' - String of input characters sent by the "set tab stop in this - column" key, if there is one. - -`ko' - String listing the other function keys the terminal has. This is a - very obsolete way of describing the same information found in the - `kH' ... `kT' keys. The string contains a list of two-character - termcap capability names, separated by commas. The meaning is - that for each capability name listed, the terminal has a key which - sends the string which is the value of that capability. For - example, the value `:ko=cl,ll,sf,sr:' says that the terminal has - four function keys which mean "clear screen", "home down", "scroll - forward" and "scroll reverse". - - -File: termcap.info, Node: Meta Key, Next: Initialization, Prev: Keypad, Up: Capabilities - -Meta Key -======== - - A Meta key is a key on the keyboard that modifies each character you -type by controlling the 0200 bit. This bit is on if and only if the -Meta key is held down when the character is typed. Characters typed -using the Meta key are called Meta characters. Emacs uses Meta -characters as editing commands. - -`km' - Flag whose presence means that the terminal has a Meta key. - -`mm' - String of commands to enable the functioning of the Meta key. - -`mo' - String of commands to disable the functioning of the Meta key. - - If the terminal has `km' but does not have `mm' and `mo', it means -that the Meta key always functions. If it has `mm' and `mo', it means -that the Meta key can be turned on or off. Send the `mm' string to -turn it on, and the `mo' string to turn it off. I do not know why one -would ever not want it to be on. - - -File: termcap.info, Node: Initialization, Next: Pad Specs, Prev: Meta Key, Up: Capabilities - -Initialization -============== - -`ti' - String of commands to put the terminal into whatever special modes - are needed or appropriate for programs that move the cursor - nonsequentially around the screen. Programs that use termcap to do - full-screen display should output this string when they start up. - -`te' - String of commands to undo what is done by the `ti' string. - Programs that output the `ti' string on entry should output this - string when they exit. - -`is' - String of commands to initialize the terminal for each login - session. - -`if' - String which is the name of a file containing the string of - commands to initialize the terminal for each session of use. - Normally `is' and `if' are not both used. - -`i1' -`i3' - Two more strings of commands to initialize the terminal for each - login session. The `i1' string (if defined) is output before `is' - or `if', and the `i3' string (if defined) is output after. - - The reason for having three separate initialization strings is to - make it easier to define a group of related terminal types with - slightly different initializations. Define two or three of the - strings in the basic type; then the other types can override one - or two of the strings. - -`rs' - String of commands to reset the terminal from any strange mode it - may be in. Normally this includes the `is' string (or other - commands with the same effects) and more. What would go in the - `rs' string but not in the `is' string are annoying or slow - commands to bring the terminal back from strange modes that nobody - would normally use. - -`it' - Numeric value, the initial spacing between hardware tab stop - columns when the terminal is powered up. Programs to initialize - the terminal can use this to decide whether there is a need to set - the tab stops. If the initial width is 8, well and good; if it is - not 8, then the tab stops should be set; if they cannot be set, - the kernel is told to convert tabs to spaces, and other programs - will observe this and do likewise. - -`ct' - String of commands to clear all tab stops. - -`st' - String of commands to set tab stop at current cursor column on all - lines. - -`NF' - Flag whose presence means that the terminal does not support - XON/XOFF flow control. Programs should not send XON (`C-q') or - XOFF (`C-s') characters to the terminal. - - -File: termcap.info, Node: Pad Specs, Next: Status Line, Prev: Initialization, Up: Capabilities - -Padding Capabilities -==================== - - There are two terminal capabilities that exist just to explain the -proper way to obey the padding specifications in all the command string -capabilities. One, `pc', must be obeyed by all termcap-using programs. - -`pb' - Numeric value, the lowest baud rate at which padding is actually - needed. Programs may check this and refrain from doing any - padding at lower speeds. - -`pc' - String of commands for padding. The first character of this - string is to be used as the pad character, instead of using null - characters for padding. If `pc' is not provided, use null - characters. Every program that uses termcap must look up this - capability and use it to set the variable `PC' that is used by - `tputs'. *Note Padding::. - - Some termcap capabilities exist just to specify the amount of -padding that the kernel should give to cursor motion commands used in -ordinary sequential output. - -`dC' - Numeric value, the number of msec of padding needed for the - carriage-return character. - -`dN' - Numeric value, the number of msec of padding needed for the newline - (linefeed) character. - -`dB' - Numeric value, the number of msec of padding needed for the - backspace character. - -`dF' - Numeric value, the number of msec of padding needed for the - formfeed character. - -`dT' - Numeric value, the number of msec of padding needed for the tab - character. - - In some systems, the kernel uses the above capabilities; in other -systems, the kernel uses the paddings specified in the string -capabilities `cr', `sf', `le', `ff' and `ta'. Descriptions of -terminals which require such padding should contain the `dC' ... `dT' -capabilities and also specify the appropriate padding in the -corresponding string capabilities. Since no modern terminals require -padding for ordinary sequential output, you probably won't need to do -either of these things. - - -File: termcap.info, Node: Status Line, Next: Half-Line, Prev: Pad Specs, Up: Capabilities - -Status Line -=========== - - A "status line" is a line on the terminal that is not used for -ordinary display output but instead used for a special message. The -intended use is for a continuously updated description of what the -user's program is doing, and that is where the name "status line" comes -from, but in fact it could be used for anything. The distinguishing -characteristic of a status line is that ordinary output to the terminal -does not affect it; it changes only if the special status line commands -of this section are used. - -`hs' - Flag whose presence means that the terminal has a status line. If - a terminal description specifies that there is a status line, it - must provide the `ts' and `fs' capabilities. - -`ts' - String of commands to move the terminal cursor into the status - line. Usually these commands must specifically record the old - cursor position for the sake of the `fs' string. - -`fs' - String of commands to move the cursor back from the status line to - its previous position (outside the status line). - -`es' - Flag whose presence means that other display commands work while - writing the status line. In other words, one can clear parts of - it, insert or delete characters, move the cursor within it using - `ch' if there is a `ch' capability, enter and leave standout mode, - and so on. - -`ds' - String of commands to disable the display of the status line. This - may be absent, if there is no way to disable the status line - display. - -`ws' - Numeric value, the width of the status line. If this capability is - absent in a terminal that has a status line, it means the status - line is the same width as the other lines. - - Note that the value of `ws' is sometimes as small as 8. - - -File: termcap.info, Node: Half-Line, Next: Printer, Prev: Status Line, Up: Capabilities - -Half-Line Motion -================ - - Some terminals have commands for moving the cursor vertically by -half-lines, useful for outputting subscripts and superscripts. Mostly -it is hardcopy terminals that have such features. - -`hu' - String of commands to move the cursor up half a line. If the - terminal is a display, it is your responsibility to avoid moving - up past the top line; however, most likely the terminal that - supports this is a hardcopy terminal and there is nothing to be - concerned about. - -`hd' - String of commands to move the cursor down half a line. If the - terminal is a display, it is your responsibility to avoid moving - down past the bottom line, etc. - - -File: termcap.info, Node: Printer, Prev: Half-Line, Up: Capabilities - -Controlling Printers Attached to Terminals -========================================== - - Some terminals have attached hardcopy printer ports. They may be -able to copy the screen contents to the printer; they may also be able -to redirect output to the printer. Termcap does not have anything to -tell the program whether the redirected output appears also on the -screen; it does on some terminals but not all. - -`ps' - String of commands to cause the contents of the screen to be - printed. If it is absent, the screen contents cannot be printed. - -`po' - String of commands to redirect further output to the printer. - -`pf' - String of commands to terminate redirection of output to the - printer. This capability must be present in the description if - `po' is. - -`pO' - String of commands to redirect output to the printer for next N - characters of output, regardless of what they are. Redirection - will end automatically after N characters of further output. Until - then, nothing that is output can end redirection, not even the - `pf' string if there is one. The number N should not be more than - 255. - - One use of this capability is to send non-text byte sequences - (such as bit-maps) to the printer. - - Most terminals with printers do not support all of `ps', `po' and -`pO'; any one or two of them may be supported. To make a program that -can send output to all kinds of printers, it is necessary to check for -all three of these capabilities, choose the most convenient of the ones -that are provided, and use it in its own appropriate fashion. - - -File: termcap.info, Node: Summary, Next: Var Index, Prev: Capabilities, Up: Top - -Summary of Capability Names -*************************** - - Here are all the terminal capability names in alphabetical order -with a brief description of each. For cross references to their -definitions, see the index of capability names (*note Cap Index::.). - -`ae' - String to turn off alternate character set mode. - -`al' - String to insert a blank line before the cursor. - -`AL' - String to insert N blank lines before the cursor. - -`am' - Flag: output to last column wraps cursor to next line. - -`as' - String to turn on alternate character set mode.like. - -`bc' - Very obsolete alternative name for the `le' capability. - -`bl' - String to sound the bell. - -`bs' - Obsolete flag: ASCII backspace may be used for leftward motion. - -`bt' - String to move the cursor left to the previous hardware tab stop - column. - -`bw' - Flag: `le' at left margin wraps to end of previous line. - -`CC' - String to change terminal's command character. - -`cd' - String to clear the line the cursor is on, and following lines. - -`ce' - String to clear from the cursor to the end of the line. - -`ch' - String to position the cursor at column C in the same line. - -`cl' - String to clear the entire screen and put cursor at upper left - corner. - -`cm' - String to position the cursor at line L, column C. - -`CM' - String to position the cursor at line L, column C, relative to - display memory. - -`co' - Number: width of the screen. - -`cr' - String to move cursor sideways to left margin. - -`cs' - String to set the scroll region. - -`cS' - Alternate form of string to set the scroll region. - -`ct' - String to clear all tab stops. - -`cv' - String to position the cursor at line L in the same column. - -`da' - Flag: data scrolled off top of screen may be scrolled back. - -`db' - Flag: data scrolled off bottom of screen may be scrolled back. - -`dB' - Obsolete number: msec of padding needed for the backspace - character. - -`dc' - String to delete one character position at the cursor. - -`dC' - Obsolete number: msec of padding needed for the carriage-return - character. - -`DC' - String to delete N characters starting at the cursor. - -`dF' - Obsolete number: msec of padding needed for the formfeed character. - -`dl' - String to delete the line the cursor is on. - -`DL' - String to delete N lines starting with the cursor's line. - -`dm' - String to enter delete mode. - -`dN' - Obsolete number: msec of padding needed for the newline character. - -`do' - String to move the cursor vertically down one line. - -`DO' - String to move cursor vertically down N lines. - -`ds' - String to disable the display of the status line. - -`dT' - Obsolete number: msec of padding needed for the tab character. - -`ec' - String of commands to clear N characters at cursor. - -`ed' - String to exit delete mode. - -`ei' - String to leave insert mode. - -`eo' - Flag: output of a space can erase an overstrike. - -`es' - Flag: other display commands work while writing the status line. - -`ff' - String to advance to the next page, for a hardcopy terminal. - -`fs' - String to move the cursor back from the status line to its - previous position (outside the status line). - -`gn' - Flag: this terminal type is generic, not real. - -`hc' - Flag: hardcopy terminal. - -`hd' - String to move the cursor down half a line. - -`ho' - String to position cursor at upper left corner. - -`hs' - Flag: the terminal has a status line. - -`hu' - String to move the cursor up half a line. - -`hz' - Flag: terminal cannot accept `~' as output. - -`i1' - String to initialize the terminal for each login session. - -`i3' - String to initialize the terminal for each login session. - -`ic' - String to insert one character position at the cursor. - -`IC' - String to insert N character positions at the cursor. - -`if' - String naming a file of commands to initialize the terminal. - -`im' - String to enter insert mode. - -`in' - Flag: outputting a space is different from moving over empty - positions. - -`ip' - String to output following an inserted character in insert mode. - -`is' - String to initialize the terminal for each login session. - -`it' - Number: initial spacing between hardware tab stop columns. - -`k0' - String of input sent by function key 0 or 10. - -`k1 ... k9' - Strings of input sent by function keys 1 through 9. - -`K1 ... K5' - Strings sent by the five other keys in 3-by-3 array with arrows. - -`ka' - String of input sent by the "clear all tabs" key. - -`kA' - String of input sent by the "insert line" key. - -`kb' - String of input sent by the "backspace" key. - -`kC' - String of input sent by the "clear screen" key. - -`kd' - String of input sent by typing the down-arrow key. - -`kD' - String of input sent by the "delete character" key. - -`ke' - String to make the function keys work locally. - -`kE' - String of input sent by the "clear to end of line" key. - -`kF' - String of input sent by the "scroll forward" key. - -`kh' - String of input sent by typing the "home-position" key. - -`kH' - String of input sent by the "home down" key. - -`kI' - String of input sent by the "insert character" or "enter insert - mode" key. - -`kl' - String of input sent by typing the left-arrow key. - -`kL' - String of input sent by the "delete line" key. - -`km' - Flag: the terminal has a Meta key. - -`kM' - String of input sent by the "exit insert mode" key. - -`kn' - Numeric value, the number of numbered function keys. - -`kN' - String of input sent by the "next page" key. - -`ko' - Very obsolete string listing the terminal's named function keys. - -`kP' - String of input sent by the "previous page" key. - -`kr' - String of input sent by typing the right-arrow key. - -`kR' - String of input sent by the "scroll reverse" key. - -`ks' - String to make the function keys transmit. - -`kS' - String of input sent by the "clear to end of screen" key. - -`kt' - String of input sent by the "clear tab stop this column" key. - -`kT' - String of input sent by the "set tab stop in this column" key. - -`ku' - String of input sent by typing the up-arrow key. - -`l0' - String on keyboard labelling function key 0 or 10. - -`l1 ... l9' - Strings on keyboard labelling function keys 1 through 9. - -`le' - String to move the cursor left one column. - -`LE' - String to move cursor left N columns. - -`li' - Number: height of the screen. - -`ll' - String to position cursor at lower left corner. - -`lm' - Number: lines of display memory. - -`LP' - Flag: writing to last column of last line will not scroll. - -`mb' - String to enter blinking mode. - -`md' - String to enter double-bright mode. - -`me' - String to turn off all appearance modes - -`mh' - String to enter half-bright mode. - -`mi' - Flag: cursor motion in insert mode is safe. - -`mk' - String to enter invisible mode. - -`mm' - String to enable the functioning of the Meta key. - -`mo' - String to disable the functioning of the Meta key. - -`mp' - String to enter protected mode. - -`mr' - String to enter reverse-video mode. - -`ms' - Flag: cursor motion in standout mode is safe. - -`nc' - Obsolete flag: do not use ASCII carriage-return on this terminal. - -`nd' - String to move the cursor right one column. - -`NF' - Flag: do not use XON/XOFF flow control. - -`nl' - Obsolete alternative name for the `do' and `sf' capabilities. - -`ns' - Flag: the terminal does not normally scroll for sequential output. - -`nw' - String to move to start of next line, possibly clearing rest of - old line. - -`os' - Flag: terminal can overstrike. - -`pb' - Number: the lowest baud rate at which padding is actually needed. - -`pc' - String containing character for padding. - -`pf' - String to terminate redirection of output to the printer. - -`po' - String to redirect further output to the printer. - -`pO' - String to redirect N characters ofoutput to the printer. - -`ps' - String to print the screen on the attached printer. - -`rc' - String to move to last saved cursor position. - -`RI' - String to move cursor right N columns. - -`rp' - String to output character C repeated N times. - -`rs' - String to reset the terminal from any strange modes. - -`sa' - String to turn on an arbitrary combination of appearance modes. - -`sc' - String to save the current cursor position. - -`se' - String to leave standout mode. - -`sf' - String to scroll the screen one line up. - -`SF' - String to scroll the screen N lines up. - -`sg' - Number: width of magic standout cookie. Absent if magic cookies - are not used. - -`so' - String to enter standout mode. - -`sr' - String to scroll the screen one line down. - -`SR' - String to scroll the screen N line down. - -`st' - String to set tab stop at current cursor column on all lines. - programs. - -`ta' - String to move the cursor right to the next hardware tab stop - column. - -`te' - String to return terminal to settings for sequential output. - -`ti' - String to initialize terminal for random cursor motion. - -`ts' - String to move the terminal cursor into the status line. - -`uc' - String to underline one character and move cursor right. - -`ue' - String to turn off underline mode - -`ug' - Number: width of underlining magic cookie. Absent if underlining - doesn't use magic cookies. - -`ul' - Flag: underline by overstriking with an underscore. - -`up' - String to move the cursor vertically up one line. - -`UP' - String to move cursor vertically up N lines. - -`us' - String to turn on underline mode - -`vb' - String to make the screen flash. - -`ve' - String to return the cursor to normal. - -`vi' - String to make the cursor invisible. - -`vs' - String to enhance the cursor. - -`wi' - String to set the terminal output screen window. - -`ws' - Number: the width of the status line. - -`xb' - Flag: superbee terminal. - -`xn' - Flag: cursor wraps in a strange way. - -`xs' - Flag: clearing a line is the only way to clear the appearance - modes of positions in that line (or, only way to remove magic - cookies on that line). - -`xt' - Flag: Teleray 1061; several strange characteristics. - - -File: termcap.info, Node: Var Index, Next: Cap Index, Prev: Summary, Up: Top - -Variable and Function Index -*************************** - -* Menu: - -* BC: tgoto. -* ospeed: Output Padding. -* PC: Output Padding. -* tgetent: Find. -* tgetflag: Interrogate. -* tgetnum: Interrogate. -* tgetstr: Interrogate. -* tgoto: tgoto. -* tparam: tparam. -* tputs: Output Padding. -* UP: tgoto. - diff --git a/src/libs/termcap/termcap.info-4 b/src/libs/termcap/termcap.info-4 deleted file mode 100644 index 4b8bf791ce..0000000000 --- a/src/libs/termcap/termcap.info-4 +++ /dev/null @@ -1,220 +0,0 @@ -This is Info file ./termcap.info, produced by Makeinfo-1.55 from the -input file ./termcap.texi. - - This file documents the termcap library of the GNU system. - - Copyright (C) 1988 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: termcap.info, Node: Cap Index, Next: Index, Prev: Var Index, Up: Top - -Capability Index -**************** - -* Menu: - -* ae: Standout. -* al: Insdel Line. -* AL: Insdel Line. -* am: Wrapping. -* as: Standout. -* bc: Cursor Motion. -* bl: Bell. -* bs: Cursor Motion. -* bt: Cursor Motion. -* bw: Cursor Motion. -* CC: Basic. -* cd: Clearing. -* ce: Clearing. -* ch: Cursor Motion. -* cl: Clearing. -* cm: Cursor Motion. -* CM: Cursor Motion. -* co: Screen Size. -* cr: Cursor Motion. -* cS: Scrolling. -* cs: Scrolling. -* ct: Initialization. -* cv: Cursor Motion. -* da: Scrolling. -* dB: Pad Specs. -* db: Scrolling. -* dC: Pad Specs. -* DC: Insdel Char. -* dc: Insdel Char. -* dF: Pad Specs. -* dl: Insdel Line. -* DL: Insdel Line. -* dm: Insdel Char. -* dN: Pad Specs. -* do: Cursor Motion. -* DO: Cursor Motion. -* ds: Status Line. -* dT: Pad Specs. -* ec: Clearing. -* ed: Insdel Char. -* ei: Insdel Char. -* eo: Basic. -* es: Status Line. -* ff: Cursor Motion. -* fs: Status Line. -* gn: Basic. -* hc: Basic. -* hd: Half-Line. -* ho: Cursor Motion. -* hs: Status Line. -* hu: Half-Line. -* hz: Basic. -* i1: Initialization. -* i3: Initialization. -* IC: Insdel Char. -* ic: Insdel Char. -* if: Initialization. -* im: Insdel Char. -* in: Insdel Char. -* ip: Insdel Char. -* is: Initialization. -* it: Initialization. -* K1...K5: Keypad. -* k1...k9: Keypad. -* kA...kT: Keypad. -* ka...ku: Keypad. -* km: Meta Key. -* l0...l9: Keypad. -* le: Cursor Motion. -* LE: Cursor Motion. -* li: Screen Size. -* ll: Cursor Motion. -* lm: Scrolling. -* LP: Wrapping. -* mb: Standout. -* md: Standout. -* me: Standout. -* mh: Standout. -* mi: Insdel Char. -* mk: Standout. -* mm: Meta Key. -* mo: Meta Key. -* mp: Standout. -* mr: Standout. -* ms: Standout. -* ms: Underlining. -* nc: Cursor Motion. -* nd: Cursor Motion. -* NF: Initialization. -* nl: Cursor Motion. -* ns: Scrolling. -* nw: Cursor Motion. -* os: Basic. -* pb: Pad Specs. -* pc: Pad Specs. -* pf: Printer. -* pO: Printer. -* po: Printer. -* ps: Printer. -* rc: Cursor Motion. -* RI: Cursor Motion. -* rp: Basic. -* rs: Initialization. -* sa: Standout. -* sc: Cursor Motion. -* se: Standout. -* SF: Scrolling. -* sf: Scrolling. -* sg: Standout. -* so: Standout. -* SR: Scrolling. -* sr: Scrolling. -* st: Initialization. -* ta: Cursor Motion. -* te: Initialization. -* ti: Initialization. -* ts: Status Line. -* uc: Underlining. -* ue: Underlining. -* ug: Underlining. -* ul: Underlining. -* up: Cursor Motion. -* UP: Cursor Motion. -* us: Underlining. -* vb: Bell. -* ve: Cursor Visibility. -* vi: Cursor Visibility. -* vs: Cursor Visibility. -* wi: Windows. -* ws: Status Line. -* xb: Basic. -* xn: Wrapping. -* xs: Standout. -* xt: Cursor Motion. -* xt: Standout. - - -File: termcap.info, Node: Index, Prev: Cap Index, Up: Top - -Concept Index -************* - -* Menu: - -* %: Encode Parameters. -* appearance modes: Standout. -* bell: Bell. -* clearing the screen: Clearing. -* command character: Basic. -* cursor motion: Cursor Motion. -* delete character: Insdel Char. -* delete line: Insdel Line. -* delete mode: Insdel Char. -* description format: Format. -* erasing: Clearing. -* generic terminal type: Basic. -* home position: Cursor Motion. -* inheritance: Inheriting. -* initialization: Initialization. -* insert character: Insdel Char. -* insert line: Insdel Line. -* insert mode: Insdel Char. -* line speed: Output Padding. -* magic cookie: Standout. -* meta key: Meta Key. -* names of terminal types: Naming. -* overstrike: Basic. -* padding: Pad Specs. -* padding: Padding. -* parameters: Parameters. -* printer: Printer. -* repeat output: Basic. -* reset: Initialization. -* screen size: Screen Size. -* screen size: Naming. -* screen size: Screen Size. -* scrolling: Scrolling. -* standout: Standout. -* status line: Status Line. -* Superbee: Basic. -* tab stops: Initialization. -* termcap: Introduction. -* terminal flags (kernel): Initialize. -* underlining: Underlining. -* visibility: Cursor Visibility. -* visible bell: Bell. -* window: Windows. -* wrapping: Wrapping. -* wrapping: Naming. - - diff --git a/src/libs/termcap/termcap.texi b/src/libs/termcap/termcap.texi deleted file mode 100644 index 7a6cd565bb..0000000000 --- a/src/libs/termcap/termcap.texi +++ /dev/null @@ -1,3618 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@setfilename termcap.info -@settitle The Termcap Library -@smallbook - -@ifinfo -This file documents the termcap library of the GNU system. - -Copyright (C) 1988 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@end ifinfo - -@setchapternewpage odd - -@c @shorttitlepage The Termcap Manual - -@titlepage -@ignore -@sp 6 -@center @titlefont{Termcap} -@sp 1 -@center The Termcap Library and Data Base -@sp 4 -@center Second Edition -@sp 1 -@center December 1992 -@sp 5 -@center Richard M. Stallman -@sp 1 -@center Free Software Foundation -@end ignore - -@c Real title page -@title The Termcap Manual -@subtitle The Termcap Library and Data Base -@subtitle Second Edition -@subtitle December 1992 -@author Richard M. Stallman -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1988 Free Software Foundation, Inc. - -Published by the Free Software Foundation -(675 Mass Ave, Cambridge MA 02139). -Printed copies are available for $10 each. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by the Foundation. -@sp 2 -Cover art by Etienne Suvasa. -@end titlepage -@page - -@synindex vr fn - -@node Top, Introduction, (dir), (dir) - -@menu -* Introduction:: What is termcap? Why this manual? -* Library:: The termcap library functions. -* Data Base:: What terminal descriptions in @file{/etc/termcap} look like. -* Capabilities:: Definitions of the individual terminal capabilities: - how to write them in descriptions, and how to use - their values to do display updating. -* Summary:: Brief table of capability names and their meanings. -* Var Index:: Index of C functions and variables. -* Cap Index:: Index of termcap capabilities. -* Index:: Concept index. - - --- The Detailed Node Listing --- - -The Termcap Library - -* Preparation:: Preparing to use the termcap library. -* Find:: Finding the description of the terminal being used. -* Interrogate:: Interrogating the description for particular capabilities. -* Initialize:: Initialization for output using termcap. -* Padding:: Outputting padding. -* Parameters:: Encoding parameters such as cursor positions. - -Padding - -* Why Pad:: Explanation of padding. -* Not Enough:: When there is not enough padding. -* Describe Padding:: The data base says how much padding a terminal needs. -* Output Padding:: Using @code{tputs} to output the needed padding. - -Filling In Parameters - -* Encode Parameters:: The language for encoding parameters. -* Using Parameters:: Outputting a string command with parameters. - -Sending Display Commands with Parameters - -* tparam:: The general case, for GNU termcap only. -* tgoto:: The special case of cursor motion. - -The Format of the Data Base - -* Format:: Overall format of a terminal description. -* Capability Format:: Format of capabilities within a description. -* Naming:: Naming conventions for terminal types. -* Inheriting:: Inheriting part of a description from -a related terminal type. -* Changing:: When changes in the data base take effect. - -Definitions of the Terminal Capabilities - -* Basic:: Basic characteristics. -* Screen Size:: Screen size, and what happens when it changes. -* Cursor Motion:: Various ways to move the cursor. -* Wrapping:: What happens if you write a character in the last column. -* Scrolling:: Pushing text up and down on the screen. -* Windows:: Limiting the part of the window that output affects. -* Clearing:: Erasing one or many lines. -* Insdel Line:: Making new blank lines in mid-screen; deleting lines. -* Insdel Char:: Inserting and deleting characters within a line. -* Standout:: Highlighting some of the text. -* Underlining:: Underlining some of the text. -* Cursor Visibility:: Making the cursor more or less easy to spot. -* Bell:: Attracts user's attention; not localized on the screen. -* Keypad:: Recognizing when function keys or arrows are typed. -* Meta Key:: @key{META} acts like an extra shift key. -* Initialization:: Commands used to initialize or reset the terminal. -* Pad Specs:: Info for the kernel on how much padding is needed. -* Status Line:: A status line displays ``background'' information. -* Half-Line:: Moving by half-lines, for superscripts and subscripts. -* Printer:: Controlling auxiliary printers of display terminals. -@end menu - -@node Introduction, Library, Top, Top -@unnumbered Introduction - -@cindex termcap -@dfn{Termcap} is a library and data base that enables programs to use -display terminals in a terminal-independent manner. It originated in -Berkeley Unix. - -The termcap data base describes the capabilities of hundreds of different -display terminals in great detail. Some examples of the information -recorded for a terminal could include how many columns wide it is, what -string to send to move the cursor to an arbitrary position (including how -to encode the row and column numbers), how to scroll the screen up one or -several lines, and how much padding is needed for such a scrolling -operation. - -The termcap library is provided for easy access this data base in programs -that want to do terminal-independent character-based display output. - -This manual describes the GNU version of the termcap library, which has -some extensions over the Unix version. All the extensions are identified -as such, so this manual also tells you how to use the Unix termcap. - -The GNU version of the termcap library is available free as source code, -for use in free programs, and runs on Unix and VMS systems (at least). You -can find it in the GNU Emacs distribution in the files @file{termcap.c} and -@file{tparam.c}. - -This manual was written for the GNU project, whose goal is to develop a -complete free operating system upward-compatible with Unix for user -programs. The project is approximately two thirds complete. For more -information on the GNU project, including the GNU Emacs editor and the -mostly-portable optimizing C compiler, send one dollar to - -@display -Free Software Foundation -675 Mass Ave -Cambridge, MA 02139 -@end display - -@node Library, Data Base, Introduction, Top -@chapter The Termcap Library - -The termcap library is the application programmer's interface to the -termcap data base. It contains functions for the following purposes: - -@itemize @bullet -@item -Finding the description of the user's terminal type (@code{tgetent}). - -@item -Interrogating the description for information on various topics -(@code{tgetnum}, @code{tgetflag}, @code{tgetstr}). - -@item -Computing and performing padding (@code{tputs}). - -@item -Encoding numeric parameters such as cursor positions into the -terminal-specific form required for display commands (@code{tparam}, -@code{tgoto}). -@end itemize - -@menu -* Preparation:: Preparing to use the termcap library. -* Find:: Finding the description of the terminal being used. -* Interrogate:: Interrogating the description for particular capabilities. -* Initialize:: Initialization for output using termcap. -* Padding:: Outputting padding. -* Parameters:: Encoding parameters such as cursor positions. -@end menu - -@node Preparation, Find, , Library -@section Preparing to Use the Termcap Library - -To use the termcap library in a program, you need two kinds of preparation: - -@itemize @bullet -@item -The compiler needs declarations of the functions and variables in the -library. - -On GNU systems, it suffices to include the header file -@file{termcap.h} in each source file that uses these functions and -variables.@refill - -On Unix systems, there is often no such header file. Then you must -explictly declare the variables as external. You can do likewise for -the functions, or let them be implicitly declared and cast their -values from type @code{int} to the appropriate type. - -We illustrate the declarations of the individual termcap library -functions with ANSI C prototypes because they show how to pass the -arguments. If you are not using the GNU C compiler, you probably -cannot use function prototypes, so omit the argument types and names -from your declarations. - -@item -The linker needs to search the library. Usually either -@samp{-ltermcap} or @samp{-ltermlib} as an argument when linking will -do this.@refill -@end itemize - -@node Find, Interrogate, Preparation, Library -@section Finding a Terminal Description: @code{tgetent} - -@findex tgetent -An application program that is going to use termcap must first look up the -description of the terminal type in use. This is done by calling -@code{tgetent}, whose declaration in ANSI Standard C looks like: - -@example -int tgetent (char *@var{buffer}, char *@var{termtype}); -@end example - -@noindent -This function finds the description and remembers it internally so that -you can interrogate it about specific terminal capabilities -(@pxref{Interrogate}). - -The argument @var{termtype} is a string which is the name for the type of -terminal to look up. Usually you would obtain this from the environment -variable @code{TERM} using @code{getenv ("TERM")}. - -If you are using the GNU version of termcap, you can alternatively ask -@code{tgetent} to allocate enough space. Pass a null pointer for -@var{buffer}, and @code{tgetent} itself allocates the storage using -@code{malloc}. There is no way to get the address that was allocated, -and you shouldn't try to free the storage.@refill - -With the Unix version of termcap, you must allocate space for the -description yourself and pass the address of the space as the argument -@var{buffer}. There is no way you can tell how much space is needed, so -the convention is to allocate a buffer 2048 characters long and assume that -is enough. (Formerly the convention was to allocate 1024 characters and -assume that was enough. But one day, for one kind of terminal, that was -not enough.) - -No matter how the space to store the description has been obtained, -termcap records its address internally for use when you later interrogate -the description with @code{tgetnum}, @code{tgetstr} or @code{tgetflag}. If -the buffer was allocated by termcap, it will be freed by termcap too if you -call @code{tgetent} again. If the buffer was provided by you, you must -make sure that its contents remain unchanged for as long as you still plan -to interrogate the description.@refill - -The return value of @code{tgetent} is @minus{}1 if there is some difficulty -accessing the data base of terminal types, 0 if the data base is accessible -but the specified type is not defined in it, and some other value -otherwise. - -Here is how you might use the function @code{tgetent}: - -@smallexample -#ifdef unix -static char term_buffer[2048]; -#else -#define term_buffer 0 -#endif - -init_terminal_data () -@{ - char *termtype = getenv ("TERM"); - int success; - - if (termtype == 0) - fatal ("Specify a terminal type with `setenv TERM '.\n"); - - success = tgetent (term_buffer, termtype); - if (success < 0) - fatal ("Could not access the termcap data base.\n"); - if (success == 0) - fatal ("Terminal type `%s' is not defined.\n", termtype); -@} -@end smallexample - -@noindent -Here we assume the function @code{fatal} prints an error message and exits. - -If the environment variable @code{TERMCAP} is defined, its value is used to -override the terminal type data base. The function @code{tgetent} checks -the value of @code{TERMCAP} automatically. If the value starts with -@samp{/} then it is taken as a file name to use as the data base file, -instead of @file{/etc/termcap} which is the standard data base. If the -value does not start with @samp{/} then it is itself used as the terminal -description, provided that the terminal type @var{termtype} is among the -types it claims to apply to. @xref{Data Base}, for information on the -format of a terminal description.@refill - -@node Interrogate, Initialize, Find, Library -@section Interrogating the Terminal Description - -Each piece of information recorded in a terminal description is called a -@dfn{capability}. Each defined terminal capability has a two-letter code -name and a specific meaning. For example, the number of columns is named -@samp{co}. @xref{Capabilities}, for definitions of all the standard -capability names. - -Once you have found the proper terminal description with @code{tgetent} -(@pxref{Find}), your application program must @dfn{interrogate} it for -various terminal capabilities. You must specify the two-letter code of -the capability whose value you seek. - -Capability values can be numeric, boolean (capability is either present or -absent) or strings. Any particular capability always has the same value -type; for example, @samp{co} always has a numeric value, while @samp{am} -(automatic wrap at margin) is always a flag, and @samp{cm} (cursor motion -command) always has a string value. The documentation of each capability -says which type of value it has.@refill - -There are three functions to use to get the value of a capability, -depending on the type of value the capability has. Here are their -declarations in ANSI C: - -@findex tgetnum -@findex tgetflag -@findex tgetstr -@example -int tgetnum (char *@var{name}); -int tgetflag (char *@var{name}); -char *tgetstr (char *@var{name}, char **@var{area}); -@end example - -@table @code -@item tgetnum -Use @code{tgetnum} to get a capability value that is numeric. The -argument @var{name} is the two-letter code name of the capability. If -the capability is present, @code{tgetnum} returns the numeric value -(which is nonnegative). If the capability is not mentioned in the -terminal description, @code{tgetnum} returns @minus{}1. - -@item tgetflag -Use @code{tgetflag} to get a boolean value. If the capability -@var{name} is present in the terminal description, @code{tgetflag} -returns 1; otherwise, it returns 0. - -@item tgetstr -Use @code{tgetstr} to get a string value. It returns a pointer to a -string which is the capability value, or a null pointer if the -capability is not present in the terminal description. - -There are two ways @code{tgetstr} can find space to store the string value: - -@itemize @bullet -@item -You can ask @code{tgetstr} to allocate the space. Pass a null -pointer for the argument @var{area}, and @code{tgetstr} will use -@code{malloc} to allocate storage big enough for the value. -Termcap will never free this storage or refer to it again; you -should free it when you are finished with it. - -This method is more robust, since there is no need to guess how -much space is needed. But it is supported only by the GNU -termcap library. - -@item -You can provide the space. Provide for the argument @var{area} the -address of a pointer variable of type @code{char *}. Before calling -@code{tgetstr}, initialize the variable to point at available space. -Then @code{tgetstr} will store the string value in that space and will -increment the pointer variable to point after the space that has been -used. You can use the same pointer variable for many calls to -@code{tgetstr}. - -There is no way to determine how much space is needed for a single -string, and no way for you to prevent or handle overflow of the area -you have provided. However, you can be sure that the total size of -all the string values you will obtain from the terminal description is -no greater than the size of the description (unless you get the same -capability twice). You can determine that size with @code{strlen} on -the buffer you provided to @code{tgetent}. See below for an example. - -Providing the space yourself is the only method supported by the Unix -version of termcap. -@end itemize -@end table - -Note that you do not have to specify a terminal type or terminal -description for the interrogation functions. They automatically use the -description found by the most recent call to @code{tgetent}. - -Here is an example of interrogating a terminal description for various -capabilities, with conditionals to select between the Unix and GNU methods -of providing buffer space. - -@example -char *tgetstr (); - -char *cl_string, *cm_string; -int height; -int width; -int auto_wrap; - -char PC; /* For tputs. */ -char *BC; /* For tgoto. */ -char *UP; - -interrogate_terminal () -@{ -#ifdef UNIX - /* Here we assume that an explicit term_buffer - was provided to tgetent. */ - char *buffer - = (char *) malloc (strlen (term_buffer)); -#define BUFFADDR &buffer -#else -#define BUFFADDR 0 -#endif - - char *temp; - - /* Extract information we will use. */ - cl_string = tgetstr ("cl", BUFFADDR); - cm_string = tgetstr ("cm", BUFFADDR); - auto_wrap = tgetflag ("am"); - height = tgetnum ("li"); - width = tgetnum ("co"); - - /* Extract information that termcap functions use. */ - temp = tgetstr ("pc", BUFFADDR); - PC = temp ? *temp : 0; - BC = tgetstr ("le", BUFFADDR); - UP = tgetstr ("up", BUFFADDR); -@} -@end example - -@noindent -@xref{Padding}, for information on the variable @code{PC}. @xref{Using -Parameters}, for information on @code{UP} and @code{BC}. - -@node Initialize, Padding, Interrogate, Library -@section Initialization for Use of Termcap -@cindex terminal flags (kernel) - -Before starting to output commands to a terminal using termcap, -an application program should do two things: - -@itemize @bullet -@item -Initialize various global variables which termcap library output -functions refer to. These include @code{PC} and @code{ospeed} for -padding (@pxref{Output Padding}) and @code{UP} and @code{BC} for -cursor motion (@pxref{tgoto}).@refill - -@item -Tell the kernel to turn off alteration and padding of horizontal-tab -characters sent to the terminal. -@end itemize - -To turn off output processing in Berkeley Unix you would use @code{ioctl} -with code @code{TIOCLSET} to set the bit named @code{LLITOUT}, and clear -the bits @code{ANYDELAY} using @code{TIOCSETN}. In POSIX or System V, you -must clear the bit named @code{OPOST}. Refer to the system documentation -for details.@refill - -If you do not set the terminal flags properly, some older terminals will -not work. This is because their commands may contain the characters that -normally signify newline, carriage return and horizontal tab---characters -which the kernel thinks it ought to modify before output. - -When you change the kernel's terminal flags, you must arrange to restore -them to their normal state when your program exits. This implies that the -program must catch fatal signals such as @code{SIGQUIT} and @code{SIGINT} -and restore the old terminal flags before actually terminating. - -Modern terminals' commands do not use these special characters, so if you -do not care about problems with old terminals, you can leave the kernel's -terminal flags unaltered. - -@node Padding, Parameters, Initialize, Library -@section Padding -@cindex padding - -@dfn{Padding} means outputting null characters following a terminal display -command that takes a long time to execute. The terminal description says -which commands require padding and how much; the function @code{tputs}, -described below, outputs a terminal command while extracting from it the -padding information, and then outputs the padding that is necessary. - -@menu -* Why Pad:: Explanation of padding. -* Not Enough:: When there is not enough padding. -* Describe Padding:: The data base says how much padding a terminal needs. -* Output Padding:: Using @code{tputs} to output the needed padding. -@end menu - -@node Why Pad, Not Enough, , Padding -@subsection Why Pad, and How - -Most types of terminal have commands that take longer to execute than they -do to send over a high-speed line. For example, clearing the screen may -take 20msec once the entire command is received. During that time, on a -9600 bps line, the terminal could receive about 20 additional output -characters while still busy clearing the screen. Every terminal has a -certain amount of buffering capacity to remember output characters that -cannot be processed yet, but too many slow commands in a row can cause the -buffer to fill up. Then any additional output that cannot be processed -immediately will be lost. - -To avoid this problem, we normally follow each display command with enough -useless charaters (usually null characters) to fill up the time that the -display command needs to execute. This does the job if the terminal throws -away null characters without using up space in the buffer (which most -terminals do). If enough padding is used, no output can ever be lost. The -right amount of padding avoids loss of output without slowing down -operation, since the time used to transmit padding is time that nothing -else could be done. - -The number of padding characters needed for an operation depends on the -line speed. In fact, it is proportional to the line speed. A 9600 baud -line transmits about one character per msec, so the clear screen command in -the example above would need about 20 characters of padding. At 1200 baud, -however, only about 3 characters of padding are needed to fill up 20msec. - -@node Not Enough, Describe Padding, Why Pad, Padding -@subsection When There Is Not Enough Padding - -There are several common manifestations of insufficient padding. - -@itemize @bullet -@item -Emacs displays @samp{I-search: ^Q-} at the bottom of the screen. - -This means that the terminal thought its buffer was getting full of -display commands, so it tried to tell the computer to stop sending -any. - -@item -The screen is garbled intermittently, or the details of garbling vary -when you repeat the action. (A garbled screen could be due to a -command which is simply incorrect, or to user option in the terminal -which doesn't match the assumptions of the terminal description, but -this usually leads to reproducible failure.) - -This means that the buffer did get full, and some commands were lost. -Many changeable factors can change which ones are lost. - -@item -Screen is garbled at high output speeds but not at low speeds. -Padding problems nearly always go away at low speeds, usually even at -1200 baud. - -This means that a high enough speed permits commands to arrive faster -than they can be executed. -@end itemize - -Although any obscure command on an obscure terminal might lack padding, -in practice problems arise most often from the clearing commands -@samp{cl} and @samp{cd} (@pxref{Clearing}), the scrolling commands -@samp{sf} and @samp{sr} (@pxref{Scrolling}), and the line insert/delete -commands @samp{al} and @samp{dl} (@pxref{Insdel Line}). - -Occasionally the terminal description fails to define @samp{sf} and some -programs will use @samp{do} instead, so you may get a problem with -@samp{do}. If so, first define @samp{sf} just like @samp{do}, then -add some padding to @samp{sf}. - -The best strategy is to add a lot of padding at first, perhaps 200 msec. -This is much more than enough; in fact, it should cause a visible slowdown. -(If you don't see a slowdown, the change has not taken effect; -@pxref{Changing}.) If this makes the problem go away, you have found the -right place to add padding; now reduce the amount until the problem comes -back, then increase it again. If the problem remains, either it is in some -other capability or it is not a matter of padding at all. - -Keep in mind that on many terminals the correct padding for insert/delete -line or for scrolling is cursor-position dependent. If you get problems -from scrolling a large region of the screen but not from scrolling a small -part (just a few lines moving), it may mean that fixed padding should be -replaced with position-dependent padding. - -@node Describe Padding, Output Padding, Not Enough, Padding -@subsection Specifying Padding in a Terminal Description - -In the terminal description, the amount of padding required by each display -command is recorded as a sequence of digits at the front of the command. -These digits specify the padding time in milliseconds (msec). They can be -followed optionally by a decimal point and one more digit, which is a -number of tenths of msec. - -Sometimes the padding needed by a command depends on the cursor position. -For example, the time taken by an ``insert line'' command is usually -proportional to the number of lines that need to be moved down or cleared. -An asterisk (@samp{*}) following the padding time says that the time -should be multiplied by the number of screen lines affected by the command. - -@example -:al=1.3*\E[L: -@end example - -@noindent -is used to describe the ``insert line'' command for a certain terminal. -The padding required is 1.3 msec per line affected. The command itself is -@samp{@key{ESC} [ L}. - -The padding time specified in this way tells @code{tputs} how many pad -characters to output. @xref{Output Padding}. - -Two special capability values affect padding for all commands. These are -the @samp{pc} and @samp{pb}. The variable @samp{pc} specifies the -character to pad with, and @samp{pb} the speed below which no padding is -needed. The defaults for these variables, a null character and 0, -are correct for most terminals. @xref{Pad Specs}. - -@node Output Padding, , Describe Padding, Padding -@subsection Performing Padding with @code{tputs} -@cindex line speed - -@findex tputs -Use the termcap function @code{tputs} to output a string containing an -optional padding spec of the form described above (@pxref{Describe -Padding}). The function @code{tputs} strips off and decodes the padding -spec, outputs the rest of the string, and then outputs the appropriate -padding. Here is its declaration in ANSI C: - -@example -char PC; -short ospeed; - -int tputs (char *@var{string}, int @var{nlines}, int (*@var{outfun}) ()); -@end example - -Here @var{string} is the string (including padding spec) to be output; -@var{nlines} is the number of lines affected by the operation, which is -used to multiply the amount of padding if the padding spec ends with a -@samp{*}. Finally, @var{outfun} is a function (such as @code{fputchar}) -that is called to output each character. When actually called, -@var{outfun} should expect one argument, a character. - -@vindex ospeed -@vindex PC -The operation of @code{tputs} is controlled by two global variables, -@code{ospeed} and @code{PC}. The value of @code{ospeed} is supposed to be -the terminal output speed, encoded as in the @code{ioctl} system call which -gets the speed information. This is needed to compute the number of -padding characters. The value of @code{PC} is the character used for -padding. - -You are responsible for storing suitable values into these variables before -using @code{tputs}. The value stored into the @code{PC} variable should be -taken from the @samp{pc} capability in the terminal description (@pxref{Pad -Specs}). Store zero in @code{PC} if there is no @samp{pc} -capability.@refill - -The argument @var{nlines} requires some thought. Normally, it should be -the number of lines whose contents will be cleared or moved by the command. -For cursor motion commands, or commands that do editing within one line, -use the value 1. For most commands that affect multiple lines, such as -@samp{al} (insert a line) and @samp{cd} (clear from the cursor to the end -of the screen), @var{nlines} should be the screen height minus the current -vertical position (origin 0). For multiple insert and scroll commands such -as @samp{AL} (insert multiple lines), that same value for @var{nlines} is -correct; the number of lines being inserted is @i{not} correct.@refill - -If a ``scroll window'' feature is used to reduce the number of lines -affected by a command, the value of @var{nlines} should take this into -account. This is because the delay time required depends on how much work -the terminal has to do, and the scroll window feature reduces the work. -@xref{Scrolling}. - -Commands such as @samp{ic} and @samp{dc} (insert or delete characters) are -problematical because the padding needed by these commands is proportional -to the number of characters affected, which is the number of columns from -the cursor to the end of the line. It would be nice to have a way to -specify such a dependence, and there is no need for dependence on vertical -position in these commands, so it is an obvious idea to say that for these -commands @var{nlines} should really be the number of columns affected. -However, the definition of termcap clearly says that @var{nlines} is always -the number of lines affected, even in this case, where it is always 1. It -is not easy to change this rule now, because too many programs and terminal -descriptions have been written to follow it. - -Because @var{nlines} is always 1 for the @samp{ic} and @samp{dc} strings, -there is no reason for them to use @samp{*}, but some of them do. These -should be corrected by deleting the @samp{*}. If, some day, such entries -have disappeared, it may be possible to change to a more useful convention -for the @var{nlines} argument for these operations without breaking any -programs. - -@node Parameters, , Padding, Library -@section Filling In Parameters -@cindex parameters - -Some terminal control strings require numeric @dfn{parameters}. For -example, when you move the cursor, you need to say what horizontal and -vertical positions to move it to. The value of the terminal's @samp{cm} -capability, which says how to move the cursor, cannot simply be a string of -characters; it must say how to express the cursor position numbers and -where to put them within the command. - -The specifications of termcap include conventions as to which string-valued -capabilities require parameters, how many parameters, and what the -parameters mean; for example, it defines the @samp{cm} string to take -two parameters, the vertical and horizontal positions, with 0,0 being the -upper left corner. These conventions are described where the individual -commands are documented. - -Termcap also defines a language used within the capability definition for -specifying how and where to encode the parameters for output. This language -uses character sequences starting with @samp{%}. (This is the same idea as -@code{printf}, but the details are different.) The language for parameter -encoding is described in this section. - -A program that is doing display output calls the functions @code{tparam} or -@code{tgoto} to encode parameters according to the specifications. These -functions produce a string containing the actual commands to be output (as -well a padding spec which must be processed with @code{tputs}; -@pxref{Padding}). - -@menu -* Encode Parameters:: The language for encoding parameters. -* Using Parameters:: Outputting a string command with parameters. -@end menu - -@node Encode Parameters, Using Parameters, , Parameters -@subsection Describing the Encoding -@cindex % - -A terminal command string that requires parameters contains special -character sequences starting with @samp{%} to say how to encode the -parameters. These sequences control the actions of @code{tparam} and -@code{tgoto}. - -The parameters values passed to @code{tparam} or @code{tgoto} are -considered to form a vector. A pointer into this vector determines -the next parameter to be processed. Some of the @samp{%}-sequences -encode one parameter and advance the pointer to the next parameter. -Other @samp{%}-sequences alter the pointer or alter the parameter -values without generating output. - -For example, the @samp{cm} string for a standard ANSI terminal is written -as @samp{\E[%i%d;%dH}. (@samp{\E} stands for @key{ESC}.) @samp{cm} by -convention always requires two parameters, the vertical and horizontal goal -positions, so this string specifies the encoding of two parameters. Here -@samp{%i} increments the two values supplied, and each @samp{%d} encodes -one of the values in decimal. If the cursor position values 20,58 are -encoded with this string, the result is @samp{\E[21;59H}. - -First, here are the @samp{%}-sequences that generate output. Except for -@samp{%%}, each of them encodes one parameter and advances the pointer -to the following parameter. - -@table @samp -@item %% -Output a single @samp{%}. This is the only way to represent a literal -@samp{%} in a terminal command with parameters. @samp{%%} does not -use up a parameter. - -@item %d -As in @code{printf}, output the next parameter in decimal. - -@item %2 -Like @samp{%02d} in @code{printf}: output the next parameter in -decimal, and always use at least two digits. - -@item %3 -Like @samp{%03d} in @code{printf}: output the next parameter in -decimal, and always use at least three digits. Note that @samp{%4} -and so on are @emph{not} defined. - -@item %. -Output the next parameter as a single character whose ASCII code is -the parameter value. Like @samp{%c} in @code{printf}. - -@item %+@var{char} -Add the next parameter to the character @var{char}, and output the -resulting character. For example, @samp{%+ } represents 0 as a space, -1 as @samp{!}, etc. -@end table - -The following @samp{%}-sequences specify alteration of the parameters -(their values, or their order) rather than encoding a parameter for output. -They generate no output; they are used only for their side effects -on the parameters. Also, they do not advance the ``next parameter'' pointer -except as explicitly stated. Only @samp{%i}, @samp{%r} and @samp{%>} are -defined in standard Unix termcap. The others are GNU extensions.@refill - -@table @samp -@item %i -Increment the next two parameters. This is used for terminals that -expect cursor positions in origin 1. For example, @samp{%i%d,%d} would -output two parameters with @samp{1} for 0, @samp{2} for 1, etc. - -@item %r -Interchange the next two parameters. This is used for terminals whose -cursor positioning command expects the horizontal position first. - -@item %s -Skip the next parameter. Do not output anything. - -@item %b -Back up one parameter. The last parameter used will become once again -the next parameter to be output, and the next output command will use -it. Using @samp{%b} more than once, you can back up any number of -parameters, and you can refer to each parameter any number of times. - -@item %>@var{c1}@var{c2} -Conditionally increment the next parameter. Here @var{c1} and -@var{c2} are characters which stand for their ASCII codes as numbers. -If the next parameter is greater than the ASCII code of @var{c1}, the -ASCII code of @var{c2} is added to it.@refill - -@item %a @var{op} @var{type} @var{pos} -Perform arithmetic on the next parameter, do not use it up, and do not -output anything. Here @var{op} specifies the arithmetic operation, -while @var{type} and @var{pos} together specify the other operand. - -Spaces are used above to separate the operands for clarity; the spaces -don't appear in the data base, where this sequence is exactly five -characters long. - -The character @var{op} says what kind of arithmetic operation to -perform. It can be any of these characters: - -@table @samp -@item = -assign a value to the next parameter, ignoring its old value. -The new value comes from the other operand. - -@item + -add the other operand to the next parameter. - -@item - -subtract the other operand from the next parameter. - -@item * -multiply the next parameter by the other operand. - -@item / -divide the next parameter by the other operand. -@end table - -The ``other operand'' may be another parameter's value or a constant; -the character @var{type} says which. It can be: - -@table @samp -@item p -Use another parameter. The character @var{pos} says which -parameter to use. Subtract 64 from its ASCII code to get the -position of the desired parameter relative to this one. Thus, -the character @samp{A} as @var{pos} means the parameter after the -next one; the character @samp{?} means the parameter before the -next one. - -@item c -Use a constant value. The character @var{pos} specifies the -value of the constant. The 0200 bit is cleared out, so that 0200 -can be used to represent zero. -@end table -@end table - -The following @samp{%}-sequences are special purpose hacks to compensate -for the weird designs of obscure terminals. They modify the next parameter -or the next two parameters but do not generate output and do not use up any -parameters. @samp{%m} is a GNU extension; the others are defined in -standard Unix termcap. - -@table @samp -@item %n -Exclusive-or the next parameter with 0140, and likewise the parameter -after next. - -@item %m -Complement all the bits of the next parameter and the parameter after next. - -@item %B -Encode the next parameter in BCD. It alters the value of the -parameter by adding six times the quotient of the parameter by ten. -Here is a C statement that shows how the new value is computed: - -@example -@var{parm} = (@var{parm} / 10) * 16 + @var{parm} % 10; -@end example - -@item %D -Transform the next parameter as needed by Delta Data terminals. -This involves subtracting twice the remainder of the parameter by 16. - -@example -@var{parm} -= 2 * (@var{parm} % 16); -@end example -@end table - -@node Using Parameters, , Encode Parameters, Parameters -@subsection Sending Display Commands with Parameters - -The termcap library functions @code{tparam} and @code{tgoto} serve as the -analog of @code{printf} for terminal string parameters. The newer function -@code{tparam} is a GNU extension, more general but missing from Unix -termcap. The original parameter-encoding function is @code{tgoto}, which -is preferable for cursor motion. - -@menu -* tparam:: The general case, for GNU termcap only. -* tgoto:: The special case of cursor motion. -@end menu - -@node tparam, tgoto, , Using Parameters -@subsubsection @code{tparam} - -@findex tparam -The function @code{tparam} can encode display commands with any number of -parameters and allows you to specify the buffer space. It is the preferred -function for encoding parameters for all but the @samp{cm} capability. Its -ANSI C declaration is as follows: - -@smallexample -char *tparam (char *@var{ctlstring}, char *@var{buffer}, int @var{size}, int @var{parm1},...) -@end smallexample - -The arguments are a control string @var{ctlstring} (the value of a terminal -capability, presumably), an output buffer @var{buffer} and @var{size}, and -any number of integer parameters to be encoded. The effect of -@code{tparam} is to copy the control string into the buffer, encoding -parameters according to the @samp{%} sequences in the control string. - -You describe the output buffer by its address, @var{buffer}, and its size -in bytes, @var{size}. If the buffer is not big enough for the data to be -stored in it, @code{tparam} calls @code{malloc} to get a larger buffer. In -either case, @code{tparam} returns the address of the buffer it ultimately -uses. If the value equals @var{buffer}, your original buffer was used. -Otherwise, a new buffer was allocated, and you must free it after you are -done with printing the results. If you pass zero for @var{size} and -@var{buffer}, @code{tparam} always allocates the space with @code{malloc}. - -All capabilities that require parameters also have the ability to specify -padding, so you should use @code{tputs} to output the string produced by -@code{tparam}. @xref{Padding}. Here is an example. - -@example -@{ -char *buf; -char buffer[40]; - -buf = tparam (command, buffer, 40, parm); -tputs (buf, 1, fputchar); -if (buf != buffer) -free (buf); -@} -@end example - -If a parameter whose value is zero is encoded with @samp{%.}-style -encoding, the result is a null character, which will confuse @code{tputs}. -This would be a serious problem, but luckily @samp{%.} encoding is used -only by a few old models of terminal, and only for the @samp{cm} -capability. To solve the problem, use @code{tgoto} rather than -@code{tparam} to encode the @samp{cm} capability.@refill - -@node tgoto, , tparam, Using Parameters -@subsubsection @code{tgoto} - -@findex tgoto -The special case of cursor motion is handled by @code{tgoto}. There -are two reasons why you might choose to use @code{tgoto}: - -@itemize @bullet -@item -For Unix compatibility, because Unix termcap does not have @code{tparam}. - -@item -For the @samp{cm} capability, since @code{tgoto} has a special feature -to avoid problems with null characters, tabs and newlines on certain old -terminal types that use @samp{%.} encoding for that capability. -@end itemize - -Here is how @code{tgoto} might be declared in ANSI C: - -@example -char *tgoto (char *@var{cstring}, int @var{hpos}, int @var{vpos}) -@end example - -There are three arguments, the terminal description's @samp{cm} string and -the two cursor position numbers; @code{tgoto} computes the parametrized -string in an internal static buffer and returns the address of that buffer. -The next time you use @code{tgoto} the same buffer will be reused. - -@vindex UP -@vindex BC -Parameters encoded with @samp{%.} encoding can generate null characters, -tabs or newlines. These might cause trouble: the null character because -@code{tputs} would think that was the end of the string, the tab because -the kernel or other software might expand it into spaces, and the newline -becaue the kernel might add a carriage-return, or padding characters -normally used for a newline. To prevent such problems, @code{tgoto} is -careful to avoid these characters. Here is how this works: if the target -cursor position value is such as to cause a problem (that is to say, zero, -nine or ten), @code{tgoto} increments it by one, then compensates by -appending a string to move the cursor back or up one position. - -The compensation strings to use for moving back or up are found in global -variables named @code{BC} and @code{UP}. These are actual external C -variables with upper case names; they are declared @code{char *}. It is up -to you to store suitable values in them, normally obtained from the -@samp{le} and @samp{up} terminal capabilities in the terminal description -with @code{tgetstr}. Alternatively, if these two variables are both zero, -the feature of avoiding nulls, tabs and newlines is turned off. - -It is safe to use @code{tgoto} for commands other than @samp{cm} only if -you have stored zero in @code{BC} and @code{UP}. - -Note that @code{tgoto} reverses the order of its operands: the horizontal -position comes before the vertical position in the arguments to -@code{tgoto}, even though the vertical position comes before the horizontal -in the parameters of the @samp{cm} string. If you use @code{tgoto} with a -command such as @samp{AL} that takes one parameter, you must pass the -parameter to @code{tgoto} as the ``vertical position''.@refill - -@node Data Base, Capabilities, Library, Top -@chapter The Format of the Data Base - -The termcap data base of terminal descriptions is stored in the file -@file{/etc/termcap}. It contains terminal descriptions, blank lines, and -comments. - -A terminal description starts with one or more names for the terminal type. -The information in the description is a series of @dfn{capability names} -and values. The capability names have standard meanings -(@pxref{Capabilities}) and their values describe the terminal. - -@menu -* Format:: Overall format of a terminal description. -* Capability Format:: Format of capabilities within a description. -* Naming:: Naming conventions for terminal types. -* Inheriting:: Inheriting part of a description from -a related terminal type. -* Changing:: When changes in the data base take effect. -@end menu - -@node Format, Capability Format, , Data Base -@section Terminal Description Format -@cindex description format - -Aside from comments (lines starting with @samp{#}, which are ignored), each -nonblank line in the termcap data base is a terminal description. -A terminal description is nominally a single line, but it can be split -into multiple lines by inserting the two characters @samp{\ newline}. -This sequence is ignored wherever it appears in a description. - -The preferred way to split the description is between capabilities: insert -the four characters @samp{: \ newline tab} immediately before any colon. -This allows each sub-line to start with some indentation. This works -because, after the @samp{\ newline} are ignored, the result is @samp{: tab -:}; the first colon ends the preceding capability and the second colon -starts the next capability. If you split with @samp{\ newline} alone, you -may not add any indentation after them. - -Here is a real example of a terminal description: - -@example -dw|vt52|DEC vt52:\ - :cr=^M:do=^J:nl=^J:bl=^G:\ - :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:\ - :cm=\EY%+ %+ :co#80:li#24:\ - :nd=\EC:ta=^I:pt:sr=\EI:up=\EA:\ - :ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H: -@end example - -Each terminal description begins with several names for the terminal type. -The names are separated by @samp{|} characters, and a colon ends the last -name. The first name should be two characters long; it exists only for the -sake of very old Unix systems and is never used in modern systems. The -last name should be a fully verbose name such as ``DEC vt52'' or ``Ann -Arbor Ambassador with 48 lines''. The other names should include whatever -the user ought to be able to specify to get this terminal type, such as -@samp{vt52} or @samp{aaa-48}. @xref{Naming}, for information on how to -choose terminal type names. - -After the terminal type names come the terminal capabilities, separated by -colons and with a colon after the last one. Each capability has a -two-letter name, such as @samp{cm} for ``cursor motion string'' or @samp{li} -for ``number of display lines''. - -@node Capability Format, Naming, Format, Data Base -@section Writing the Capabilities - -There are three kinds of capabilities: flags, numbers, and strings. Each -kind has its own way of being written in the description. Each defined -capability has by convention a particular kind of value; for example, -@samp{li} always has a numeric value and @samp{cm} always a string value. - -A flag capability is thought of as having a boolean value: the value is -true if the capability is present, false if not. When the capability is -present, just write its name between two colons. - -A numeric capability has a value which is a nonnegative number. Write the -capability name, a @samp{#}, and the number, between two colons. For -example, @samp{@dots{}:li#48:@dots{}} is how you specify the @samp{li} -capability for 48 lines.@refill - -A string-valued capability has a value which is a sequence of characters. -Usually these are the characters used to perform some display operation. -Write the capability name, a @samp{=}, and the characters of the value, -between two colons. For example, @samp{@dots{}:cm=\E[%i%d;%dH:@dots{}} is -how the cursor motion command for a standard ANSI terminal would be -specified.@refill - -Special characters in the string value can be expressed using -@samp{\}-escape sequences as in C; in addition, @samp{\E} stands for -@key{ESC}. @samp{^} is also a kind of escape character; @samp{^} followed -by @var{char} stands for the control-equivalent of @var{char}. Thus, -@samp{^a} stands for the character control-a, just like @samp{\001}. -@samp{\} and @samp{^} themselves can be represented as @samp{\\} and -@samp{\^}.@refill - -To include a colon in the string, you must write @samp{\072}. You might -ask, ``Why can't @samp{\:} be used to represent a colon?'' The reason is -that the interrogation functions do not count slashes while looking for a -capability. Even if @samp{:ce=ab\:cd:} were interpreted as giving the -@samp{ce} capability the value @samp{ab:cd}, it would also appear to define -@samp{cd} as a flag. - -The string value will often contain digits at the front to specify padding -(@pxref{Padding}) and/or @samp{%}-sequences within to specify how to encode -parameters (@pxref{Parameters}). Although these things are not to be -output literally to the terminal, they are considered part of the value of -the capability. They are special only when the string value is processed -by @code{tputs}, @code{tparam} or @code{tgoto}. By contrast, @samp{\} and -@samp{^} are considered part of the syntax for specifying the characters -in the string. - -Let's look at the VT52 example again: - -@example -dw|vt52|DEC vt52:\ - :cr=^M:do=^J:nl=^J:bl=^G:\ - :le=^H:bs:cd=\EJ:ce=\EK:cl=\EH\EJ:\ - :cm=\EY%+ %+ :co#80:li#24:\ - :nd=\EC:ta=^I:pt:sr=\EI:up=\EA:\ - :ku=\EA:kd=\EB:kr=\EC:kl=\ED:kb=^H: -@end example - -Here we see the numeric-valued capabilities @samp{co} and @samp{li}, the -flags @samp{bs} and @samp{pt}, and many string-valued capabilities. Most -of the strings start with @key{ESC} represented as @samp{\E}. The rest -contain control characters represented using @samp{^}. The meanings of the -individual capabilities are defined elsewhere (@pxref{Capabilities}). - -@node Naming, Inheriting, Capability Format, Data Base -@section Terminal Type Name Conventions -@cindex names of terminal types - -There are conventions for choosing names of terminal types. For one thing, -all letters should be in lower case. The terminal type for a terminal in -its most usual or most fundamental mode of operation should not have a -hyphen in it. - -If the same terminal has other modes of operation which require -different terminal descriptions, these variant descriptions are given -names made by adding suffixes with hyphens. Such alternate descriptions -are used for two reasons: - -@itemize @bullet -@item -When the terminal has a switch that changes its behavior. Since the -computer cannot tell how the switch is set, the user must tell the -computer by choosing the appropriate terminal type name. - -@cindex wrapping -For example, the VT-100 has a setup flag that controls whether the -cursor wraps at the right margin. If this flag is set to ``wrap'', -you must use the terminal type @samp{vt100-am}. Otherwise you must -use @samp{vt100-nam}. Plain @samp{vt100} is defined as a synonym for -either @samp{vt100-am} or @samp{vt100-nam} depending on the -preferences of the local site.@refill - -The standard suffix @samp{-am} stands for ``automatic margins''. - -@item -To give the user a choice in how to use the terminal. This is done -when the terminal has a switch that the computer normally controls. - -@cindex screen size -For example, the Ann Arbor Ambassador can be configured with many -screen sizes ranging from 20 to 60 lines. Fewer lines make bigger -characters but more lines let you see more of what you are editing. -As a result, users have different preferences. Therefore, termcap -provides terminal types for many screen sizes. If you choose type -@samp{aaa-30}, the terminal will be configured to use 30 lines; if you -choose @samp{aaa-48}, 48 lines will be used, and so on. -@end itemize - -Here is a list of standard suffixes and their conventional meanings: - -@table @samp -@item -w -Short for ``wide''. This is a mode that gives the terminal more -columns than usual. This is normally a user option. - -@item -am -``Automatic margins''. This is an alternate description for use when -the terminal's margin-wrap switch is on; it contains the @samp{am} -flag. The implication is that normally the switch is off and the -usual description for the terminal says that the switch is off. - -@item -nam -``No automatic margins''. The opposite of @samp{-am}, this names an -alternative description which lacks the @samp{am} flag. This implies -that the terminal is normally operated with the margin-wrap switch -turned on, and the normal description of the terminal says so. - -@item -na -``No arrows''. This terminal description initializes the terminal to -keep its arrow keys in local mode. This is a user option. - -@item -rv -``Reverse video''. This terminal description causes text output for -normal video to appear as reverse, and text output for reverse video -to come out as normal. Often this description differs from the usual -one by interchanging the two strings which turn reverse video on and -off.@refill - -This is a user option; you can choose either the ``reverse video'' -variant terminal type or the normal terminal type, and termcap will -obey. - -@item -s -``Status''. Says to enable use of a status line which ordinary output -does not touch (@pxref{Status Line}). - -Some terminals have a special line that is used only as a status line. -For these terminals, there is no need for an @samp{-s} variant; the -status line commands should be defined by default. On other -terminals, enabling a status line means removing one screen line from -ordinary use and reducing the effective screen height. For these -terminals, the user can choose the @samp{-s} variant type to request -use of a status line. - -@item -@var{nlines} -Says to operate with @var{nlines} lines on the screen, for terminals -such as the Ambassador which provide this as an option. Normally this -is a user option; by choosing the terminal type, you control how many -lines termcap will use. - -@item -@var{npages}p -Says that the terminal has @var{npages} pages worth of screen memory, -for terminals where this is a hardware option. - -@item -unk -Says that description is not for direct use, but only for reference in -@samp{tc} capabilities. Such a description is a kind of subroutine, -because it describes the common characteristics of several variant -descriptions that would use other suffixes in place of @samp{-unk}. -@end table - -@node Inheriting, Changing, Naming, Data Base -@section Inheriting from Related Descriptions - -@cindex inheritance -When two terminal descriptions are similar, their identical parts do not -need to be given twice. Instead, one of the two can be defined in terms of -the other, using the @samp{tc} capability. We say that one description -@dfn{refers to} the other, or @dfn{inherits from} the other. - -The @samp{tc} capability must be the last one in the terminal description, -and its value is a string which is the name of another terminal type which -is referred to. For example, - -@example -N9|aaa|ambassador|aaa-30|ann arbor ambassador/30 lines:\ - :ti=\E[2J\E[30;0;0;30p:\ - :te=\E[60;0;0;30p\E[30;1H\E[J:\ - :li#30:tc=aaa-unk: -@end example - -@noindent -defines the terminal type @samp{aaa-30} (also known as plain @samp{aaa}) in -terms of @samp{aaa-unk}, which defines everything about the Ambassador that -is independent of screen height. The types @samp{aaa-36}, @samp{aaa-48} -and so on for other screen heights are likewise defined to inherit from -@samp{aaa-unk}. - -The capabilities overridden by @samp{aaa-30} include @samp{li}, which says -how many lines there are, and @samp{ti} and @samp{te}, which configure the -terminal to use that many lines. - -The effective terminal description for type @samp{aaa} consists of the text -shown above followed by the text of the description of @samp{aaa-unk}. The -@samp{tc} capability is handled automatically by @code{tgetent}, which -finds the description thus referenced and combines the two descriptions -(@pxref{Find}). Therefore, only the implementor of the terminal -descriptions needs to think about using @samp{tc}. Users and application -programmers do not need to be concerned with it. - -Since the reference terminal description is used last, capabilities -specified in the referring description override any specifications of the -same capabilities in the reference description. - -The referring description can cancel out a capability without specifying -any new value for it by means of a special trick. Write the capability in -the referring description, with the character @samp{@@} after the capability -name, as follows: - -@smallexample -NZ|aaa-30-nam|ann arbor ambassador/30 lines/no automatic-margins:\ - :am@@:tc=aaa-30: -@end smallexample - -@node Changing, , Inheriting, Data Base -@section When Changes in the Data Base Take Effect - -Each application program must read the terminal description from the -data base, so a change in the data base is effective for all jobs started -after the change is made. - -The change will usually have no effect on a job that have been in existence -since before the change. The program probably read the terminal description -once, when it was started, and is continuing to use what it read then. -If the program does not have a feature for reexamining the data base, then -you will need to run it again (probably killing the old job). - -If the description in use is coming from the @code{TERMCAP} environment -variable, then the data base file is effectively overridden, and changes in -it will have no effect until you change the @code{TERMCAP} variable as -well. For example, some users' @file{.login} files automatically copy the -terminal description into @code{TERMCAP} to speed startup of applications. -If you have done this, you will need to change the @code{TERMCAP} variable -to make the changed data base take effect. - -@node Capabilities, Summary, Data Base, Top -@chapter Definitions of the Terminal Capabilities - -This section is divided into many subsections, each for one aspect of -use of display terminals. For writing a display program, you usually need -only check the subsections for the operations you want to use. For writing -a terminal description, you must read each subsection and fill in the -capabilities described there. - -String capabilities that are display commands may require numeric -parameters (@pxref{Parameters}). Most such capabilities do not use -parameters. When a capability requires parameters, this is explicitly -stated at the beginning of its definition. In simple cases, the first or -second sentence of the definition mentions all the parameters, in the order -they should be given, using a name -@iftex -in italics -@end iftex -@ifinfo -in upper case -@end ifinfo -for each one. For example, the @samp{rp} capability is a command that -requires two parameters; its definition begins as follows: - -@quotation -String of commands to output a graphic character @var{c}, repeated @var{n} -times. -@end quotation - -In complex cases or when there are many parameters, they are described -explicitly. - -When a capability is described as obsolete, this means that programs should -not be written to look for it, but terminal descriptions should still be -written to provide it. - -When a capability is described as very obsolete, this means that it should -be omitted from terminal descriptions as well. - -@menu -* Basic:: Basic characteristics. -* Screen Size:: Screen size, and what happens when it changes. -* Cursor Motion:: Various ways to move the cursor. -* Wrapping:: What happens if you write a character in the last column. -* Scrolling:: Pushing text up and down on the screen. -* Windows:: Limiting the part of the window that output affects. -* Clearing:: Erasing one or many lines. -* Insdel Line:: Making new blank lines in mid-screen; deleting lines. -* Insdel Char:: Inserting and deleting characters within a line. -* Standout:: Highlighting some of the text. -* Underlining:: Underlining some of the text. -* Cursor Visibility:: Making the cursor more or less easy to spot. -* Bell:: Attracts user's attention; not localized on the screen. -* Keypad:: Recognizing when function keys or arrows are typed. -* Meta Key:: @key{META} acts like an extra shift key. -* Initialization:: Commands used to initialize or reset the terminal. -* Pad Specs:: Info for the kernel on how much padding is needed. -* Status Line:: A status line displays ``background'' information. -* Half-Line:: Moving by half-lines, for superscripts and subscripts. -* Printer:: Controlling auxiliary printers of display terminals. -@end menu - -@node Basic, Screen Size, , Capabilities -@section Basic Characteristics - -This section documents the capabilities that describe the basic and -nature of the terminal, and also those that are relevant to the output -of graphic characters. - -@table @samp -@item os -@kindex os -@cindex overstrike -Flag whose presence means that the terminal can overstrike. This -means that outputting a graphic character does not erase whatever was -present in the same character position before. The terminals that can -overstrike include printing terminals, storage tubes (all obsolete -nowadays), and many bit-map displays. - -@item eo -@kindex eo -Flag whose presence means that outputting a space erases a character -position even if the terminal supports overstriking. If this flag is -not present and overstriking is supported, output of a space has no -effect except to move the cursor. - -(On terminals that do not support overstriking, you can always assume -that outputting a space at a position erases whatever character was -previously displayed there.) - -@item gn -@kindex gn -@cindex generic terminal type -Flag whose presence means that this terminal type is a generic type -which does not really describe any particular terminal. Generic types -are intended for use as the default type assigned when the user -connects to the system, with the intention that the user should -specify what type he really has. One example of a generic type -is the type @samp{network}. - -Since the generic type cannot say how to do anything interesting with -the terminal, termcap-using programs will always find that the -terminal is too weak to be supported if the user has failed to specify -a real terminal type in place of the generic one. The @samp{gn} flag -directs these programs to use a different error message: ``You have -not specified your real terminal type'', rather than ``Your terminal -is not powerful enough to be used''. - -@item hc -@kindex hc -Flag whose presence means this is a hardcopy terminal. - -@item rp -@kindex rp -@cindex repeat output -String of commands to output a graphic character @var{c}, repeated @var{n} -times. The first parameter value is the ASCII code for the desired -character, and the second parameter is the number of times to repeat the -character. Often this command requires padding proportional to the -number of times the character is repeated. This effect can be had by -using parameter arithmetic with @samp{%}-sequences to compute the -amount of padding, then generating the result as a number at the front -of the string so that @code{tputs} will treat it as padding. - -@item hz -@kindex hz -Flag whose presence means that the ASCII character @samp{~} cannot be -output on this terminal because it is used for display commands. - -Programs handle this flag by checking all text to be output and -replacing each @samp{~} with some other character(s). If this is not -done, the screen will be thoroughly garbled. - -The old Hazeltine terminals that required such treatment are probably -very rare today, so you might as well not bother to support this flag. - -@item CC -@kindex CC -@cindex command character -String whose presence means the terminal has a settable command -character. The value of the string is the default command character -(which is usually @key{ESC}). - -All the strings of commands in the terminal description should be -written to use the default command character. If you are writing an -application program that changes the command character, use the -@samp{CC} capability to figure out how to translate all the display -commands to work with the new command character. - -Most programs have no reason to look at the @samp{CC} capability. - -@item xb -@kindex xb -@cindex Superbee -Flag whose presence identifies Superbee terminals which are unable to -transmit the characters @key{ESC} and @kbd{Control-C}. Programs which -support this flag are supposed to check the input for the code sequences -sent by the @key{F1} and @key{F2} keys, and pretend that @key{ESC} -or @kbd{Control-C} (respectively) had been read. But this flag is -obsolete, and not worth supporting. -@end table - -@node Screen Size, Cursor Motion, Basic, Capabilities -@section Screen Size -@cindex screen size - -A terminal description has two capabilities, @samp{co} and @samp{li}, -that describe the screen size in columns and lines. But there is more -to the question of screen size than this. - -On some operating systems the ``screen'' is really a window and the -effective width can vary. On some of these systems, @code{tgetnum} -uses the actual width of the window to decide what value to return for -the @samp{co} capability, overriding what is actually written in the -terminal description. On other systems, it is up to the application -program to check the actual window width using a system call. For -example, on BSD 4.3 systems, the system call @code{ioctl} with code -@code{TIOCGWINSZ} will tell you the current screen size. - -On all window systems, termcap is powerless to advise the application -program if the user resizes the window. Application programs must -deal with this possibility in a system-dependent fashion. On some -systems the C shell handles part of the problem by detecting changes -in window size and setting the @code{TERMCAP} environment variable -appropriately. This takes care of application programs that are -started subsequently. It does not help application programs already -running. - -On some systems, including BSD 4.3, all programs using a terminal get -a signal named @code{SIGWINCH} whenever the screen size changes. -Programs that use termcap should handle this signal by using -@code{ioctl TIOCGWINSZ} to learn the new screen size. - -@table @samp -@item co -@kindex co -@cindex screen size -Numeric value, the width of the screen in character positions. Even -hardcopy terminals normally have a @samp{co} capability. - -@item li -@kindex li -Numeric value, the height of the screen in lines. -@end table - -@node Cursor Motion, Wrapping, Screen Size, Capabilities -@section Cursor Motion -@cindex cursor motion - -Termcap assumes that the terminal has a @dfn{cursor}, a spot on the screen -where a visible mark is displayed, and that most display commands take -effect at the position of the cursor. It follows that moving the cursor -to a specified location is very important. - -There are many terminal capabilities for different cursor motion -operations. A terminal description should define as many as possible, but -most programs do not need to use most of them. One capability, @samp{cm}, -moves the cursor to an arbitrary place on the screen; this by itself is -sufficient for any application as long as there is no need to support -hardcopy terminals or certain old, weak displays that have only relative -motion commands. Use of other cursor motion capabilities is an -optimization, enabling the program to output fewer characters in some -common cases. - -If you plan to use the relative cursor motion commands in an application -program, you must know what the starting cursor position is. To do this, -you must keep track of the cursor position and update the records each -time anything is output to the terminal, including graphic characters. -In addition, it is necessary to know whether the terminal wraps after -writing in the rightmost column. @xref{Wrapping}. - -One other motion capability needs special mention: @samp{nw} moves the -cursor to the beginning of the following line, perhaps clearing all the -starting line after the cursor, or perhaps not clearing at all. This -capability is a least common denominator that is probably supported even by -terminals that cannot do most other things such as @samp{cm} or @samp{do}. -Even hardcopy terminals can support @samp{nw}. - -@table @asis -@item @samp{cm} -@kindex cm -String of commands to position the cursor at line @var{l}, column @var{c}. -Both parameters are origin-zero, and are defined relative to the -screen, not relative to display memory. - -All display terminals except a few very obsolete ones support @samp{cm}, -so it is acceptable for an application program to refuse to operate on -terminals lacking @samp{cm}. - -@item @samp{ho} -@kindex ho -@cindex home position -String of commands to move the cursor to the upper left corner of the -screen (this position is called the @dfn{home position}). In -terminals where the upper left corner of the screen is not the same as -the beginning of display memory, this command must go to the upper -left corner of the screen, not the beginning of display memory. - -Every display terminal supports this capability, and many application -programs refuse to operate if the @samp{ho} capability is missing. - -@item @samp{ll} -@kindex ll -String of commands to move the cursor to the lower left corner of the -screen. On some terminals, moving up from home position does this, -but programs should never assume that will work. Just output the -@samp{ll} string (if it is provided); if moving to home position and -then moving up is the best way to get there, the @samp{ll} command -will do that. - -@item @samp{cr} -@kindex cr -String of commands to move the cursor to the beginning of the line it -is on. If this capability is not specified, many programs assume -they can use the ASCII carriage return character for this. - -@item @samp{le} -@kindex le -String of commands to move the cursor left one column. Unless the -@samp{bw} flag capability is specified, the effect is undefined if the -cursor is at the left margin; do not use this command there. If -@samp{bw} is present, this command may be used at the left margin, and -it wraps the cursor to the last column of the preceding line. - -@item @samp{nd} -@kindex nd -String of commands to move the cursor right one column. The effect is -undefined if the cursor is at the right margin; do not use this -command there, not even if @samp{am} is present. - -@item @samp{up} -@kindex up -String of commands to move the cursor vertically up one line. The -effect of sending this string when on the top line is undefined; -programs should never use it that way. - -@item @samp{do} -@kindex do -String of commands to move the cursor vertically down one line. The -effect of sending this string when on the bottom line is undefined; -programs should never use it that way. - -Some programs do use @samp{do} to scroll up one line if used at the -bottom line, if @samp{sf} is not defined but @samp{sr} is. This is -only to compensate for certain old, incorrect terminal descriptions. -(In principle this might actually lead to incorrect behavior on other -terminals, but that seems to happen rarely if ever.) But the proper -solution is that the terminal description should define @samp{sf} as -well as @samp{do} if the command is suitable for scrolling. - -The original idea was that this string would not contain a newline -character and therefore could be used without disabling the kernel's -usual habit of converting of newline into a carriage-return newline -sequence. But many terminal descriptions do use newline in the -@samp{do} string, so this is not possible; a program which sends the -@samp{do} string must disable output conversion in the kernel -(@pxref{Initialize}). - -@item @samp{bw} -@kindex bw -Flag whose presence says that @samp{le} may be used in column zero -to move to the last column of the preceding line. If this flag -is not present, @samp{le} should not be used in column zero. - -@item @samp{nw} -@kindex nw -String of commands to move the cursor to start of next line, possibly -clearing rest of line (following the cursor) before moving. - -@item @samp{DO}, @samp{UP}, @samp{LE}, @samp{RI} -@kindex DO -@kindex LE -@kindex RI -@kindex UP -Strings of commands to move the cursor @var{n} lines down vertically, -up vertically, or @var{n} columns left or right. Do not attempt to -move past any edge of the screen with these commands; the effect of -trying that is undefined. Only a few terminal descriptions provide -these commands, and most programs do not use them. - -@item @samp{CM} -@kindex CM -String of commands to position the cursor at line @var{l}, column -@var{c}, relative to display memory. Both parameters are origin-zero. -This capability is present only in terminals where there is a -difference between screen-relative and memory-relative addressing, and -not even in all such terminals. - -@item @samp{ch} -@kindex ch -String of commands to position the cursor at column @var{c} in the -same line it is on. This is a special case of @samp{cm} in which the -vertical position is not changed. The @samp{ch} capability is -provided only when it is faster to output than @samp{cm} would be in -this special case. Programs should not assume most display terminals -have @samp{ch}. - -@item @samp{cv} -@kindex cv -String of commands to position the cursor at line @var{l} in the same -column. This is a special case of @samp{cm} in which the horizontal -position is not changed. The @samp{cv} capability is provided only -when it is faster to output than @samp{cm} would be in this special -case. Programs should not assume most display terminals have -@samp{cv}. - -@item @samp{sc} -@kindex sc -String of commands to make the terminal save the current cursor -position. Only the last saved position can be used. If this -capability is present, @samp{rc} should be provided also. Most -terminals have neither. - -@item @samp{rc} -@kindex rc -String of commands to make the terminal restore the last saved cursor -position. If this capability is present, @samp{sc} should be provided -also. Most terminals have neither. - -@item @samp{ff} -@kindex ff -String of commands to advance to the next page, for a hardcopy -terminal. - -@item @samp{ta} -@kindex ta -String of commands to move the cursor right to the next hardware tab -stop column. Missing if the terminal does not have any kind of -hardware tabs. Do not send this command if the kernel's terminal -modes say that the kernel is expanding tabs into spaces. - -@item @samp{bt} -@kindex bt -String of commands to move the cursor left to the previous hardware -tab stop column. Missing if the terminal has no such ability; many -terminals do not. Do not send this command if the kernel's terminal -modes say that the kernel is expanding tabs into spaces. -@end table - -The following obsolete capabilities should be included in terminal -descriptions when appropriate, but should not be looked at by new programs. - -@table @samp -@item nc -@kindex nc -Flag whose presence means the terminal does not support the ASCII -carriage return character as @samp{cr}. This flag is needed because -old programs assume, when the @samp{cr} capability is missing, that -ASCII carriage return can be used for the purpose. We use @samp{nc} -to tell the old programs that carriage return may not be used. - -New programs should not assume any default for @samp{cr}, so they need -not look at @samp{nc}. However, descriptions should contain @samp{nc} -whenever they do not contain @samp{cr}. - -@item xt -@kindex xt -Flag whose presence means that the ASCII tab character may not be used -for cursor motion. This flag exists because old programs assume, when -the @samp{ta} capability is missing, that ASCII tab can be used for -the purpose. We use @samp{xt} to tell the old programs not to use tab. - -New programs should not assume any default for @samp{ta}, so they need -not look at @samp{xt} in connection with cursor motion. Note that -@samp{xt} also has implications for standout mode (@pxref{Standout}). -It is obsolete in regard to cursor motion but not in regard to -standout. - -In fact, @samp{xt} means that the terminal is a Teleray 1061. - -@item bc -@kindex bc -Very obsolete alternative name for the @samp{le} capability. - -@item bs -@kindex bs -Flag whose presence means that the ASCII character backspace may be -used to move the cursor left. Obsolete; look at @samp{le} instead. - -@item nl -@kindex nl -Obsolete capability which is a string that can either be used to move -the cursor down or to scroll. The same string must scroll when used -on the bottom line and move the cursor when used on any other line. -New programs should use @samp{do} or @samp{sf}, and ignore @samp{nl}. - -If there is no @samp{nl} capability, some old programs assume they can -use the newline character for this purpose. These programs follow a -bad practice, but because they exist, it is still desirable to define -the @samp{nl} capability in a terminal description if the best way to -move down is @emph{not} a newline. -@end table - -@node Wrapping, Scrolling, Cursor Motion, Capabilities -@section Wrapping -@cindex wrapping - -@dfn{Wrapping} means moving the cursor from the right margin to the left -margin of the following line. Some terminals wrap automatically when a -graphic character is output in the last column, while others do not. Most -application programs that use termcap need to know whether the terminal -wraps. There are two special flag capabilities to describe what the -terminal does when a graphic character is output in the last column. - -@table @samp -@item am -@kindex am -Flag whose presence means that writing a character in the last column -causes the cursor to wrap to the beginning of the next line. - -If @samp{am} is not present, writing in the last column leaves the -cursor at the place where the character was written. - -Writing in the last column of the last line should be avoided on -terminals with @samp{am}, as it may or may not cause scrolling to -occur (@pxref{Scrolling}). Scrolling is surely not what you would -intend. - -If your program needs to check the @samp{am} flag, then it also needs -to check the @samp{xn} flag which indicates that wrapping happens in a -strange way. Many common terminals have the @samp{xn} flag. - -@item xn -@kindex xn -Flag whose presence means that the cursor wraps in a strange way. At -least two distinct kinds of strange behavior are known; the termcap -data base does not contain anything to distinguish the two. - -On Concept-100 terminals, output in the last column wraps the cursor -almost like an ordinary @samp{am} terminal. But if the next thing -output is a newline, it is ignored. - -DEC VT-100 terminals (when the wrap switch is on) do a different -strange thing: the cursor wraps only if the next thing output is -another graphic character. In fact, the wrap occurs when the -following graphic character is received by the terminal, before the -character is placed on the screen. - -On both of these terminals, after writing in the last column a -following graphic character will be displayed in the first column of -the following line. But the effect of relative cursor motion -characters such as newline or backspace at such a time depends on the -terminal. The effect of erase or scrolling commands also depends on -the terminal. You can't assume anything about what they will do on a -terminal that has @samp{xn}. So, to be safe, you should never do -these things at such a time on such a terminal. - -To be sure of reliable results on a terminal which has the @samp{xn} -flag, output a @samp{cm} absolute positioning command after writing in -the last column. Another safe thing to do is to output carriage-return -newline, which will leave the cursor at the beginning of the following -line. - -@item LP -@kindex LP -Flag whose presence means that it is safe to write in the last column of -the last line without worrying about undesired scrolling. @samp{LP} -indicates the DEC flavor of @samp{xn} strangeness. -@end table - -@node Scrolling, Windows, Wrapping, Capabilities -@section Scrolling -@cindex scrolling - -@dfn{Scrolling} means moving the contents of the screen up or down one or -more lines. Moving the contents up is @dfn{forward scrolling}; moving them -down is @dfn{reverse scrolling}. - -Scrolling happens after each line of output during ordinary output on most -display terminals. But in an application program that uses termcap for -random-access output, scrolling happens only when explicitly requested with -the commands in this section. - -Some terminals have a @dfn{scroll region} feature. This lets you limit -the effect of scrolling to a specified range of lines. Lines outside the -range are unaffected when scrolling happens. The scroll region feature -is available if either @samp{cs} or @samp{cS} is present. - -@table @samp -@item sf -@kindex sf -String of commands to scroll the screen one line up, assuming it is -output with the cursor at the beginning of the bottom line. - -@item sr -@kindex sr -String of commands to scroll the screen one line down, assuming it is -output with the cursor at the beginning of the top line. - -@item do -A few programs will try to use @samp{do} to do the work of @samp{sf}. -This is not really correct---it is an attempt to compensate for the -absence of a @samp{sf} command in some old terminal descriptions. - -Since these terminal descriptions do define @samp{sr}, perhaps at one -time the definition of @samp{do} was different and it could be used -for scrolling as well. But it isn't desirable to combine these two -functions in one capability, since scrolling often requires more -padding than simply moving the cursor down. Defining @samp{sf} and -@samp{do} separately allows you to specify the padding properly. -Also, all sources agree that @samp{do} should not be relied on to do -scrolling. - -So the best approach is to add @samp{sf} capabilities to the -descriptions of these terminals, copying the definition of @samp{do} -if that does scroll. - -@item SF -@kindex SF -String of commands to scroll the screen @var{n} lines up, assuming it -is output with the cursor at the beginning of the bottom line. - -@item SR -@kindex SR -String of commands to scroll the screen @var{n} lines down, assuming it -is output with the cursor at the beginning of the top line. - -@item cs -@kindex cs -String of commands to set the scroll region. This command takes two -parameters, @var{start} and @var{end}, which are the line numbers -(origin-zero) of the first line to include in the scroll region and of -the last line to include in it. When a scroll region is set, -scrolling is limited to the specified range of lines; lines outside -the range are not affected by scroll commands. - -Do not try to move the cursor outside the scroll region. The region -remains set until explicitly removed. To remove the scroll region, -use another @samp{cs} command specifying the full height of the -screen. - -The cursor position is undefined after the @samp{cs} command is set, -so position the cursor with @samp{cm} immediately afterward. - -@item cS -@kindex cS -String of commands to set the scroll region using parameters in -different form. The effect is the same as if @samp{cs} were used. -Four parameters are required: - -@enumerate -@item -Total number of lines on the screen. -@item -Number of lines above desired scroll region. -@item -Number of lines below (outside of) desired scroll region. -@item -Total number of lines on the screen, the same as the first parameter. -@end enumerate - -This capability is a GNU extension that was invented to allow the Ann -Arbor Ambassador's scroll-region command to be described; it could -also be done by putting non-Unix @samp{%}-sequences into a @samp{cs} -string, but that would have confused Unix programs that used the -@samp{cs} capability with the Unix termcap. Currently only GNU Emacs -uses the @samp{cS} capability. - -@item ns -@kindex ns -Flag which means that the terminal does not normally scroll for -ordinary sequential output. For modern terminals, this means that -outputting a newline in ordinary sequential output with the cursor on -the bottom line wraps to the top line. For some obsolete terminals, -other things may happen. - -The terminal may be able to scroll even if it does not normally do so. -If the @samp{sf} capability is provided, it can be used for scrolling -regardless of @samp{ns}. - -@item da -@kindex da -Flag whose presence means that lines scrolled up off the top of the -screen may come back if scrolling down is done subsequently. - -The @samp{da} and @samp{db} flags do not, strictly speaking, affect -how to scroll. But programs that scroll usually need to clear the -lines scrolled onto the screen, if these flags are present. - -@item db -@kindex db -Flag whose presence means that lines scrolled down off the bottom of -the screen may come back if scrolling up is done subsequently. - -@item lm -@kindex lm -Numeric value, the number of lines of display memory that the terminal -has. A value of zero means that the terminal has more display memory -than can fit on the screen, but no fixed number of lines. (The number -of lines may depend on the amount of text in each line.) -@end table - -Any terminal description that defines @samp{SF} should also define @samp{sf}; -likewise for @samp{SR} and @samp{sr}. However, many terminals can only -scroll by one line at a time, so it is common to find @samp{sf} and not -@samp{SF}, or @samp{sr} without @samp{SR}.@refill - -Therefore, all programs that use the scrolling facilities should be -prepared to work with @samp{sf} in the case that @samp{SF} is absent, and -likewise with @samp{sr}. On the other hand, an application program that -uses only @samp{sf} and not @samp{SF} is acceptable, though slow on some -terminals.@refill - -When outputting a scroll command with @code{tputs}, the @var{nlines} -argument should be the total number of lines in the portion of the screen -being scrolled. Very often these commands require padding proportional to -this number of lines. @xref{Padding}. - -@node Windows, Clearing, Scrolling, Capabilities -@section Windows -@cindex window - -A @dfn{window}, in termcap, is a rectangular portion of the screen to which -all display operations are restricted. Wrapping, clearing, scrolling, -insertion and deletion all operate as if the specified window were all the -screen there was. - -@table @samp -@item wi -@kindex wi -String of commands to set the terminal output screen window. -This string requires four parameters, all origin-zero: -@enumerate -@item -The first line to include in the window. -@item -The last line to include in the window. -@item -The first column to include in the window. -@item -The last column to include in the window. -@end enumerate -@end table - -Most terminals do not support windows. - -@node Clearing, Insdel Line, Windows, Capabilities -@section Clearing Parts of the Screen -@cindex erasing -@cindex clearing the screen - -There are several terminal capabilities for clearing parts of the screen -to blank. All display terminals support the @samp{cl} string, and most -display terminals support all of these capabilities. - -@table @samp -@item cl -@kindex cl -String of commands to clear the entire screen and position the cursor -at the upper left corner. - -@item cd -@kindex cd -String of commands to clear the line the cursor is on, and all the -lines below it, down to the bottom of the screen. This command string -should be used only with the cursor in column zero; their effect is -undefined if the cursor is elsewhere. - -@item ce -@kindex ce -String of commands to clear from the cursor to the end of the current -line. - -@item ec -@kindex ec -String of commands to clear @var{n} characters, starting with the -character that the cursor is on. This command string is expected to -leave the cursor position unchanged. The parameter @var{n} should never -be large enough to reach past the right margin; the effect of such a -large parameter would be undefined. -@end table - -Clear to end of line (@samp{ce}) is extremely important in programs that -maintain an updating display. Nearly all display terminals support this -operation, so it is acceptable for a an application program to refuse to -work if @samp{ce} is not present. However, if you do not want this -limitation, you can accomplish clearing to end of line by outputting spaces -until you reach the right margin. In order to do this, you must know the -current horizontal position. Also, this technique assumes that writing a -space will erase. But this happens to be true on all the display terminals -that fail to support @samp{ce}. - -@node Insdel Line, Insdel Char, Clearing, Capabilities -@section Insert/Delete Line - -@cindex insert line -@cindex delete line -@dfn{Inserting a line} means creating a blank line in the middle -of the screen, and pushing the existing lines of text apart. In fact, -the lines above the insertion point do not change, while the lines below -move down, and one is normally lost at the bottom of the screen. - -@dfn{Deleting a line} means causing the line to disappear from the screen, -closing up the gap by moving the lines below it upward. A new line -appears at the bottom of the screen. Usually this line is blank, but -on terminals with the @samp{db} flag it may be a line previously moved -off the screen bottom by scrolling or line insertion. - -Insertion and deletion of lines is useful in programs that maintain an -updating display some parts of which may get longer or shorter. They are -also useful in editors for scrolling parts of the screen, and for -redisplaying after lines of text are killed or inserted. - -Many terminals provide commands to insert or delete a single line at the -cursor position. Some provide the ability to insert or delete several -lines with one command, using the number of lines to insert or delete as a -parameter. Always move the cursor to column zero before using any of -these commands. - -@table @samp -@item al -@kindex al -String of commands to insert a blank line before the line the cursor -is on. The existing line, and all lines below it, are moved down. -The last line in the screen (or in the scroll region, if one is set) -disappears and in most circumstances is discarded. It may not be -discarded if the @samp{db} is present (@pxref{Scrolling}). - -The cursor must be at the left margin before this command is used. -This command does not move the cursor. - -@item dl -@kindex dl -String of commands to delete the line the cursor is on. The following -lines move up, and a blank line appears at the bottom of the screen -(or bottom of the scroll region). If the terminal has the @samp{db} -flag, a nonblank line previously pushed off the screen bottom may -reappear at the bottom. - -The cursor must be at the left margin before this command is used. -This command does not move the cursor. - -@item AL -@kindex AL -String of commands to insert @var{n} blank lines before the line that -the cursor is on. It is like @samp{al} repeated @var{n} times, except -that it is as fast as one @samp{al}. - -@item DL -@kindex DL -String of commands to delete @var{n} lines starting with the line that -the cursor is on. It is like @samp{dl} repeated @var{n} times, except -that it is as fast as one @samp{dl}. -@end table - -Any terminal description that defines @samp{AL} should also define -@samp{al}; likewise for @samp{DL} and @samp{dl}. However, many terminals -can only insert or delete one line at a time, so it is common to find -@samp{al} and not @samp{AL}, or @samp{dl} without @samp{DL}.@refill - -Therefore, all programs that use the insert and delete facilities should be -prepared to work with @samp{al} in the case that @samp{AL} is absent, and -likewise with @samp{dl}. On the other hand, it is acceptable to write -an application that uses only @samp{al} and @samp{dl} and does not look -for @samp{AL} or @samp{DL} at all.@refill - -If a terminal does not support line insertion and deletion directly, -but does support a scroll region, the effect of insertion and deletion -can be obtained with scrolling. However, it is up to the individual -user program to check for this possibility and use the scrolling -commands to get the desired result. It is fairly important to implement -this alternate strategy, since it is the only way to get the effect of -line insertion and deletion on the popular VT100 terminal. - -Insertion and deletion of lines is affected by the scroll region on -terminals that have a settable scroll region. This is useful when it is -desirable to move any few consecutive lines up or down by a few lines. -@xref{Scrolling}. - -The line pushed off the bottom of the screen is not lost if the terminal -has the @samp{db} flag capability; instead, it is pushed into display -memory that does not appear on the screen. This is the same thing that -happens when scrolling pushes a line off the bottom of the screen. -Either reverse scrolling or deletion of a line can bring the apparently -lost line back onto the bottom of the screen. If the terminal has the -scroll region feature as well as @samp{db}, the pushed-out line really -is lost if a scroll region is in effect. - -When outputting an insert or delete command with @code{tputs}, the -@var{nlines} argument should be the total number of lines from the cursor -to the bottom of the screen (or scroll region). Very often these commands -require padding proportional to this number of lines. @xref{Padding}. - -For @samp{AL} and @samp{DL} the @var{nlines} argument should @emph{not} -depend on the number of lines inserted or deleted; only the total number of -lines affected. This is because it is just as fast to insert two or -@var{n} lines with @samp{AL} as to insert one line with @samp{al}. - -@node Insdel Char, Standout, Insdel Line, Capabilities -@section Insert/Delete Character -@cindex insert character -@cindex delete character - -@dfn{Inserting a character} means creating a blank space in the middle of a -line, and pushing the rest of the line rightward. The character in the -rightmost column is lost. - -@dfn{Deleting a character} means causing the character to disappear from -the screen, closing up the gap by moving the rest of the line leftward. A -blank space appears in the rightmost column. - -Insertion and deletion of characters is useful in programs that maintain an -updating display some parts of which may get longer or shorter. It is also -useful in editors for redisplaying the results of editing within a line. - -Many terminals provide commands to insert or delete a single character at -the cursor position. Some provide the ability to insert or delete several -characters with one command, using the number of characters to insert or -delete as a parameter. - -@cindex insert mode -Many terminals provide an insert mode in which outputting a graphic -character has the added effect of inserting a position for that character. -A special command string is used to enter insert mode and another is used -to exit it. The reason for designing a terminal with an insert mode rather -than an insert command is that inserting character positions is usually -followed by writing characters into them. With insert mode, this is as -fast as simply writing the characters, except for the fixed overhead of -entering and leaving insert mode. However, when the line speed is great -enough, padding may be required for the graphic characters output in insert -mode. - -Some terminals require you to enter insert mode and then output a special -command for each position to be inserted. Or they may require special -commands to be output before or after each graphic character to be -inserted. - -@cindex delete mode -Deletion of characters is usually accomplished by a straightforward command -to delete one or several positions; but on some terminals, it is necessary -to enter a special delete mode before using the delete command, and leave -delete mode afterward. Sometimes delete mode and insert mode are the same -mode. - -Some terminals make a distinction between character positions in which a -space character has been output and positions which have been cleared. On -these terminals, the effect of insert or delete character runs to the first -cleared position rather than to the end of the line. In fact, the effect -may run to more than one line if there is no cleared position to stop the -shift on the first line. These terminals are identified by the @samp{in} -flag capability. - -On terminals with the @samp{in} flag, the technique of skipping over -characters that you know were cleared, and then outputting text later on in -the same line, causes later insert and delete character operations on that -line to do nonstandard things. A program that has any chance of doing this -must check for the @samp{in} flag and must be careful to write explicit -space characters into the intermediate columns when @samp{in} is present. - -A plethora of terminal capabilities are needed to describe all of this -complexity. Here is a list of them all. Following the list, we present -an algorithm for programs to use to take proper account of all of these -capabilities. - -@table @samp -@item im -@kindex im -String of commands to enter insert mode. - -If the terminal has no special insert mode, but it can insert -characters with a special command, @samp{im} should be defined with a -null value, because the @samp{vi} editor assumes that insertion of a -character is impossible if @samp{im} is not provided. - -New programs should not act like @samp{vi}. They should pay attention -to @samp{im} only if it is defined. - -@item ei -@kindex ei -String of commands to leave insert mode. This capability must be -present if @samp{im} is. - -On a few old terminals the same string is used to enter and exit -insert mode. This string turns insert mode on if it was off, and off -it it was on. You can tell these terminals because the @samp{ei} -string equals the @samp{im} string. If you want to support these -terminals, you must always remember accurately whether insert mode is -in effect. However, these terminals are obsolete, and it is -reasonable to refuse to support them. On all modern terminals, you -can safely output @samp{ei} at any time to ensure that insert mode is -turned off. - -@item ic -@kindex ic -String of commands to insert one character position at the cursor. -The cursor does not move. - -If outputting a graphic character while in insert mode is sufficient -to insert the character, then the @samp{ic} capability should be -defined with a null value. - -If your terminal offers a choice of ways to insert---either use insert -mode or use a special command---then define @samp{im} and do not define -@samp{ic}, since this gives the most efficient operation when several -characters are to be inserted. @emph{Do not} define both strings, for -that means that @emph{both} must be used each time insertion is done. - -@item ip -@kindex ip -String of commands to output following an inserted graphic character -in insert mode. Often it is used just for a padding spec, when padding -is needed after an inserted character (@pxref{Padding}). - -@item IC -@kindex IC -String of commands to insert @var{n} character positions at and after -the cursor. It has the same effect as repeating the @samp{ic} string -and a space, @var{n} times. - -If @samp{IC} is provided, application programs may use it without first -entering insert mode. - -@item mi -@kindex mi -Flag whose presence means it is safe to move the cursor while in insert -mode and assume the terminal remains in insert mode. - -@item in -@kindex in -Flag whose presence means that the terminal distinguishes between -character positions in which space characters have been output and -positions which have been cleared. -@end table - -An application program can assume that the terminal can do character -insertion if @emph{any one of} the capabilities @samp{IC}, @samp{im}, -@samp{ic} or @samp{ip} is provided. - -To insert @var{n} blank character positions, move the cursor to the place -to insert them and follow this algorithm: - -@enumerate -@item -If an @samp{IC} string is provided, output it with parameter @var{n} -and you are finished. Otherwise (or if you don't want to bother to -look for an @samp{IC} string) follow the remaining steps. - -@item -Output the @samp{im} string, if there is one, unless the terminal is -already in insert mode. - -@item -Repeat steps 4 through 6, @var{n} times. - -@item -Output the @samp{ic} string if any. - -@item -Output a space. - -@item -Output the @samp{ip} string if any. - -@item -Output the @samp{ei} string, eventually, to exit insert mode. There -is no need to do this right away. If the @samp{mi} flag is present, -you can move the cursor and the cursor will remain in insert mode; -then you can do more insertion elsewhere without reentering insert -mode. -@end enumerate - -To insert @var{n} graphic characters, position the cursor and follow this -algorithm: - -@enumerate -@item -If an @samp{IC} string is provided, output it with parameter @var{n}, -then output the graphic characters, and you are finished. Otherwise -(or if you don't want to bother to look for an @samp{IC} string) -follow the remaining steps. - -@item -Output the @samp{im} string, if there is one, unless the terminal is -already in insert mode. - -@item -For each character to be output, repeat steps 4 through 6. - -@item -Output the @samp{ic} string if any. - -@item -Output the next graphic character. - -@item -Output the @samp{ip} string if any. - -@item -Output the @samp{ei} string, eventually, to exit insert mode. There -is no need to do this right away. If the @samp{mi} flag is present, -you can move the cursor and the cursor will remain in insert mode; -then you can do more insertion elsewhere without reentering insert -mode. -@end enumerate - -Note that this is not the same as the original Unix termcap specifications -in one respect: it assumes that the @samp{IC} string can be used without -entering insert mode. This is true as far as I know, and it allows you be -able to avoid entering and leaving insert mode, and also to be able to -avoid the inserted-character padding after the characters that go into the -inserted positions. - -Deletion of characters is less complicated; deleting one column is done by -outputting the @samp{dc} string. However, there may be a delete mode that -must be entered with @samp{dm} in order to make @samp{dc} work. - -@table @samp -@item dc -@kindex dc -String of commands to delete one character position at the cursor. If -@samp{dc} is not present, the terminal cannot delete characters. - -@item DC -@kindex DC -String of commands to delete @var{n} characters starting at the cursor. -It has the same effect as repeating the @samp{dc} string @var{n} times. -Any terminal description that has @samp{DC} also has @samp{dc}. - -@item dm -@kindex dm -String of commands to enter delete mode. If not present, there is no -delete mode, and @samp{dc} can be used at any time (assuming there is -a @samp{dc}). - -@item ed -@kindex ed -String of commands to exit delete mode. This must be present if -@samp{dm} is. -@end table - -To delete @var{n} character positions, position the cursor and follow these -steps: - -@enumerate -@item -If the @samp{DC} string is present, output it with parameter @var{n} -and you are finished. Otherwise, follow the remaining steps. - -@item -Output the @samp{dm} string, unless you know the terminal is already -in delete mode. - -@item -Output the @samp{dc} string @var{n} times. - -@item -Output the @samp{ed} string eventually. If the flag capability -@samp{mi} is present, you can move the cursor and do more deletion -without leaving and reentering delete mode. -@end enumerate - -As with the @samp{IC} string, we have departed from the original termcap -specifications by assuming that @samp{DC} works without entering delete -mode even though @samp{dc} would not. - -If the @samp{dm} and @samp{im} capabilities are both present and have the -same value, it means that the terminal has one mode for both insertion and -deletion. It is useful for a program to know this, because then it can do -insertions after deletions, or vice versa, without leaving insert/delete -mode and reentering it. - -@node Standout, Underlining, Insdel Char, Capabilities -@section Standout and Appearance Modes -@cindex appearance modes -@cindex standout -@cindex magic cookie - -@dfn{Appearance modes} are modifications to the ways characters are -displayed. Typical appearance modes include reverse video, dim, bright, -blinking, underlined, invisible, and alternate character set. Each kind of -terminal supports various among these, or perhaps none. - -For each type of terminal, one appearance mode or combination of them that -looks good for highlighted text is chosen as the @dfn{standout mode}. The -capabilities @samp{so} and @samp{se} say how to enter and leave standout -mode. Programs that use appearance modes only to highlight some text -generally use the standout mode so that they can work on as many terminals -as possible. Use of specific appearance modes other than ``underlined'' -and ``alternate character set'' is rare. - -Terminals that implement appearance modes fall into two general classes as -to how they do it. - -In some terminals, the presence or absence of any appearance mode is -recorded separately for each character position. In these terminals, each -graphic character written is given the appearance modes current at the time -it is written, and keeps those modes until it is erased or overwritten. -There are special commands to turn the appearance modes on or off for -characters to be written in the future. - -In other terminals, the change of appearance modes is represented by a -marker that belongs to a certain screen position but affects all following -screen positions until the next marker. These markers are traditionally -called @dfn{magic cookies}. - -The same capabilities (@samp{so}, @samp{se}, @samp{mb} and so on) for -turning appearance modes on and off are used for both magic-cookie -terminals and per-character terminals. On magic cookie terminals, these -give the commands to write the magic cookies. On per-character terminals, -they change the current modes that affect future output and erasure. Some -simple applications can use these commands without knowing whether or not -they work by means of cookies. - -However, a program that maintains and updates a display needs to know -whether the terminal uses magic cookies, and exactly what their effect is. -This information comes from the @samp{sg} capability. - -The @samp{sg} capability is a numeric capability whose presence indicates -that the terminal uses magic cookies for appearance modes. Its value is -the number of character positions that a magic cookie occupies. Usually -the cookie occupies one or more character positions on the screen, and these -character positions are displayed as blank, but in some terminals the -cookie has zero width. - -The @samp{sg} capability describes both the magic cookie to turn standout -on and the cookie to turn it off. This makes the assumption that both -kinds of cookie have the same width on the screen. If that is not true, -the narrower cookie must be ``widened'' with spaces until it has the same -width as the other. - -On some magic cookie terminals, each line always starts with normal -display; in other words, the scope of a magic cookie never extends over -more than one line. But on other terminals, one magic cookie affects all -the lines below it unless explicitly canceled. Termcap does not define any -way to distinguish these two ways magic cookies can work. To be safe, it -is best to put a cookie at the beginning of each line. - -On some per-character terminals, standout mode or other appearance modes -may be canceled by moving the cursor. On others, moving the cursor has no -effect on the state of the appearance modes. The latter class of terminals -are given the flag capability @samp{ms} (``can move in standout''). All -programs that might have occasion to move the cursor while appearance modes -are turned on must check for this flag; if it is not present, they should -reset appearance modes to normal before doing cursor motion. - -A program that has turned on only standout mode should use @samp{se} to -reset the standout mode to normal. A program that has turned on only -alternate character set mode should use @samp{ae} to return it to normal. -If it is possible that any other appearance modes are turned on, use the -@samp{me} capability to return them to normal. - -Note that the commands to turn on one appearance mode, including @samp{so} -and @samp{mb} @dots{} @samp{mr}, if used while some other appearance modes -are turned on, may combine the two modes on some terminals but may turn off -the mode previously enabled on other terminals. This is because some -terminals do not have a command to set or clear one appearance mode without -changing the others. Programs should not attempt to use appearance modes -in combination except with @samp{sa}, and when switching from one single -mode to another should always turn off the previously enabled mode and then -turn on the new desired mode. - -On some old terminals, the @samp{so} and @samp{se} commands may be the same -command, which has the effect of turning standout on if it is off, or off -it is on. It is therefore risky for a program to output extra @samp{se} -commands for good measure. Fortunately, all these terminals are obsolete. - -Programs that update displays in which standout-text may be replaced with -non-standout text must check for the @samp{xs} flag. In a per-character -terminal, this flag says that the only way to remove standout once written is -to clear that portion of the line with the @samp{ce} string or something -even more powerful (@pxref{Clearing}); just writing new characters at those -screen positions will not change the modes in effect there. In a magic -cookie terminal, @samp{xs} says that the only way to remove a cookie is to -clear a portion of the line that includes the cookie; writing a different -cookie at the same position does not work. - -Such programs must also check for the @samp{xt} flag, which means that the -terminal is a Teleray 1061. On this terminal it is impossible to position -the cursor at the front of a magic cookie, so the only two ways to remove a -cookie are (1) to delete the line it is on or (2) to position the cursor at -least one character before it (possibly on a previous line) and output the -@samp{se} string, which on these terminals finds and removes the next -@samp{so} magic cookie on the screen. (It may also be possible to remove a -cookie which is not at the beginning of a line by clearing that line.) The -@samp{xt} capability also has implications for the use of tab characters, -but in that regard it is obsolete (@xref{Cursor Motion}). - -@table @samp -@item so -@kindex so -String of commands to enter standout mode. - -@item se -@kindex se -String of commands to leave standout mode. - -@item sg -@kindex sg -Numeric capability, the width on the screen of the magic cookie. This -capability is absent in terminals that record appearance modes -character by character. - -@item ms -@kindex ms -Flag whose presence means that it is safe to move the cursor while the -appearance modes are not in the normal state. If this flag is absent, -programs should always reset the appearance modes to normal before -moving the cursor. - -@item xs -@kindex xs -Flag whose presence means that the only way to reset appearance modes -already on the screen is to clear to end of line. On a per-character -terminal, you must clear the area where the modes are set. On a magic -cookie terminal, you must clear an area containing the cookie. -See the discussion above. - -@item xt -@kindex xt -Flag whose presence means that the cursor cannot be positioned right -in front of a magic cookie, and that @samp{se} is a command to delete -the next magic cookie following the cursor. See discussion above. - -@item mb -@kindex mb -String of commands to enter blinking mode. - -@item md -@kindex md -String of commands to enter double-bright mode. - -@item mh -@kindex mh -String of commands to enter half-bright mode. - -@item mk -@kindex mk -String of commands to enter invisible mode. - -@item mp -@kindex mp -String of commands to enter protected mode. - -@item mr -@kindex mr -String of commands to enter reverse-video mode. - -@item me -@kindex me -String of commands to turn off all appearance modes, including -standout mode and underline mode. On some terminals it also turns off -alternate character set mode; on others, it may not. This capability -must be present if any of @samp{mb} @dots{} @samp{mr} is present. - -@item as -@kindex as -String of commands to turn on alternate character set mode. This mode -assigns some or all graphic characters an alternate picture on the -screen. There is no standard as to what the alternate pictures look -like. - -@item ae -@kindex ae -String of commands to turn off alternate character set mode. - -@item sa -@kindex sa -String of commands to turn on an arbitrary combination of appearance -modes. It accepts 9 parameters, each of which controls a particular -kind of appearance mode. A parameter should be 1 to turn its appearance -mode on, or zero to turn that mode off. Most terminals do not support -the @samp{sa} capability, even among those that do have various -appearance modes. - -The nine parameters are, in order, @var{standout}, @var{underline}, -@var{reverse}, @var{blink}, @var{half-bright}, @var{double-bright}, -@var{blank}, @var{protect}, @var{alt char set}. -@end table - -@node Underlining, Cursor Visibility, Standout, Capabilities -@section Underlining -@cindex underlining - -Underlining on most terminals is a kind of appearance mode, much like -standout mode. Therefore, it may be implemented using magic cookies or as -a flag in the terminal whose current state affects each character that is -output. @xref{Standout}, for a full explanation. - -The @samp{ug} capability is a numeric capability whose presence indicates -that the terminal uses magic cookies for underlining. Its value is the -number of character positions that a magic cookie for underlining occupies; -it is used for underlining just as @samp{sg} is used for standout. Aside -from the simplest applications, it is impossible to use underlining -correctly without paying attention to the value of @samp{ug}. - -@table @samp -@item us -@kindex us -String of commands to turn on underline mode or to output a magic cookie -to start underlining. - -@item ue -@kindex ue -String of commands to turn off underline mode or to output a magic -cookie to stop underlining. - -@item ug -@kindex ug -Width of magic cookie that represents a change of underline mode; -or missing, if the terminal does not use a magic cookie for this. - -@item ms -@kindex ms -Flag whose presence means that it is safe to move the cursor while the -appearance modes are not in the normal state. Underlining is an -appearance mode. If this flag is absent, programs should always turn -off underlining before moving the cursor. -@end table - -There are two other, older ways of doing underlining: there can be a -command to underline a single character, or the output of @samp{_}, the -ASCII underscore character, as an overstrike could cause a character to be -underlined. New programs need not bother to handle these capabilities -unless the author cares strongly about the obscure terminals which support -them. However, terminal descriptions should provide these capabilities -when appropriate. - -@table @samp -@item uc -@kindex uc -String of commands to underline the character under the cursor, and -move the cursor right. - -@item ul -@kindex ul -Flag whose presence means that the terminal can underline by -overstriking an underscore character (@samp{_}); some terminals can do -this even though they do not support overstriking in general. An -implication of this flag is that when outputting new text to overwrite -old text, underscore characters must be treated specially lest they -underline the old text instead. -@end table - -@node Cursor Visibility, Bell, Underlining, Capabilities -@section Cursor Visibility -@cindex visibility - -Some terminals have the ability to make the cursor invisible, or to enhance -it. Enhancing the cursor is often done by programs that plan to use the -cursor to indicate to the user a position of interest that may be anywhere -on the screen---for example, the Emacs editor enhances the cursor on entry. -Such programs should always restore the cursor to normal on exit. - -@table @samp -@item vs -@kindex vs -String of commands to enhance the cursor. - -@item vi -@kindex vi -String of commands to make the cursor invisible. - -@item ve -@kindex ve -String of commands to return the cursor to normal. -@end table - -If you define either @samp{vs} or @samp{vi}, you must also define @samp{ve}. - -@node Bell, Keypad, Cursor Visibility, Capabilities -@section Bell -@cindex bell -@cindex visible bell - -Here we describe commands to make the terminal ask for the user to pay -attention to it. - -@table @samp -@item bl -@kindex bl -String of commands to cause the terminal to make an audible sound. If -this capability is absent, the terminal has no way to make a suitable -sound. - -@item vb -@kindex vb -String of commands to cause the screen to flash to attract attention -(``visible bell''). If this capability is absent, the terminal has no -way to do such a thing. -@end table - -@node Keypad, Meta Key, Bell, Capabilities -@section Keypad and Function Keys - -Many terminals have arrow and function keys that transmit specific -character sequences to the computer. Since the precise sequences used -depend on the terminal, termcap defines capabilities used to say what the -sequences are. Unlike most termcap string-valued capabilities, these are -not strings of commands to be sent to the terminal, rather strings that -are received from the terminal. - -Programs that expect to use keypad keys should check, initially, for a -@samp{ks} capability and send it, to make the keypad actually transmit. -Such programs should also send the @samp{ke} string when exiting. - -@table @asis -@item @samp{ks} -@kindex ka@dots{}ku -String of commands to make the keypad keys transmit. If this -capability is not provided, but the others in this section are, -programs may assume that the keypad keys always transmit. - -@item @samp{ke} -String of commands to make the keypad keys work locally. This -capability is provided only if @samp{ks} is. - -@item @samp{kl} -String of input characters sent by typing the left-arrow key. If this -capability is missing, you cannot expect the terminal to have a -left-arrow key that transmits anything to the computer. - -@item @samp{kr} -String of input characters sent by typing the right-arrow key. - -@item @samp{ku} -String of input characters sent by typing the up-arrow key. - -@item @samp{kd} -String of input characters sent by typing the down-arrow key. - -@item @samp{kh} -String of input characters sent by typing the ``home-position'' key. - -@item @samp{K1} @dots{} @samp{K5} -@kindex K1@dots{}K5 -Strings of input characters sent by the five other keys in a 3-by-3 -array that includes the arrow keys, if the keyboard has such a 3-by-3 -array. Note that one of these keys may be the ``home-position'' key, -in which case one of these capabilities will have the same value as -the @samp{kh} key. - -@item @samp{k0} -String of input characters sent by function key 10 (or 0, if the terminal -has one labeled 0). - -@item @samp{k1} @dots{} @samp{k9} -@kindex k1@dots{}k9 -Strings of input characters sent by function keys 1 through 9, -provided for those function keys that exist. - -@item @samp{kn} -Number: the number of numbered function keys, if there are more than -10. - -@item @samp{l0} @dots{} @samp{l9} -@kindex l0@dots{}l9 -Strings which are the labels appearing on the keyboard on the keys -described by the capabilities @samp{k0} @dots{} @samp{l9}. These -capabilities should be left undefined if the labels are @samp{f0} or -@samp{f10} and @samp{f1} @dots{} @samp{f9}.@refill - -@item @samp{kH} -@kindex kA@dots{}kT -String of input characters sent by the ``home down'' key, if there is -one. - -@item @samp{kb} -String of input characters sent by the ``backspace'' key, if there is -one. - -@item @samp{ka} -String of input characters sent by the ``clear all tabs'' key, if there -is one. - -@item @samp{kt} -String of input characters sent by the ``clear tab stop this column'' -key, if there is one. - -@item @samp{kC} -String of input characters sent by the ``clear screen'' key, if there is -one. - -@item @samp{kD} -String of input characters sent by the ``delete character'' key, if -there is one. - -@item @samp{kL} -String of input characters sent by the ``delete line'' key, if there is -one. - -@item @samp{kM} -String of input characters sent by the ``exit insert mode'' key, if -there is one. - -@item @samp{kE} -String of input characters sent by the ``clear to end of line'' key, if -there is one. - -@item @samp{kS} -String of input characters sent by the ``clear to end of screen'' key, -if there is one. - -@item @samp{kI} -String of input characters sent by the ``insert character'' or ``enter -insert mode'' key, if there is one. - -@item @samp{kA} -String of input characters sent by the ``insert line'' key, if there is -one. - -@item @samp{kN} -String of input characters sent by the ``next page'' key, if there is -one. - -@item @samp{kP} -String of input characters sent by the ``previous page'' key, if there is -one. - -@item @samp{kF} -String of input characters sent by the ``scroll forward'' key, if there -is one. - -@item @samp{kR} -String of input characters sent by the ``scroll reverse'' key, if there -is one. - -@item @samp{kT} -String of input characters sent by the ``set tab stop in this column'' -key, if there is one. - -@item @samp{ko} -String listing the other function keys the terminal has. This is a -very obsolete way of describing the same information found in the -@samp{kH} @dots{} @samp{kT} keys. The string contains a list of -two-character termcap capability names, separated by commas. The -meaning is that for each capability name listed, the terminal has a -key which sends the string which is the value of that capability. For -example, the value @samp{:ko=cl,ll,sf,sr:} says that the terminal has -four function keys which mean ``clear screen'', ``home down'', -``scroll forward'' and ``scroll reverse''.@refill -@end table - -@node Meta Key, Initialization, Keypad, Capabilities -@section Meta Key - -@cindex meta key -A Meta key is a key on the keyboard that modifies each character you type -by controlling the 0200 bit. This bit is on if and only if the Meta key is -held down when the character is typed. Characters typed using the Meta key -are called Meta characters. Emacs uses Meta characters as editing -commands. - -@table @samp -@item km -@kindex km -Flag whose presence means that the terminal has a Meta key. - -@item mm -@kindex mm -String of commands to enable the functioning of the Meta key. - -@item mo -@kindex mo -String of commands to disable the functioning of the Meta key. -@end table - -If the terminal has @samp{km} but does not have @samp{mm} and @samp{mo}, it -means that the Meta key always functions. If it has @samp{mm} and -@samp{mo}, it means that the Meta key can be turned on or off. Send the -@samp{mm} string to turn it on, and the @samp{mo} string to turn it off. -I do not know why one would ever not want it to be on. - -@node Initialization, Pad Specs, Meta Key, Capabilities -@section Initialization -@cindex reset -@cindex initialization -@cindex tab stops - -@table @samp -@item ti -@kindex ti -String of commands to put the terminal into whatever special modes are -needed or appropriate for programs that move the cursor -nonsequentially around the screen. Programs that use termcap to do -full-screen display should output this string when they start up. - -@item te -@kindex te -String of commands to undo what is done by the @samp{ti} string. -Programs that output the @samp{ti} string on entry should output this -string when they exit. - -@item is -@kindex is -String of commands to initialize the terminal for each login session. - -@item if -@kindex if -String which is the name of a file containing the string of commands -to initialize the terminal for each session of use. Normally @samp{is} -and @samp{if} are not both used. - -@item i1 -@itemx i3 -@kindex i1 -@kindex i3 -Two more strings of commands to initialize the terminal for each login -session. The @samp{i1} string (if defined) is output before @samp{is} -or @samp{if}, and the @samp{i3} string (if defined) is output after. - -The reason for having three separate initialization strings is to make -it easier to define a group of related terminal types with slightly -different initializations. Define two or three of the strings in the -basic type; then the other types can override one or two of the -strings. - -@item rs -@kindex rs -String of commands to reset the terminal from any strange mode it may -be in. Normally this includes the @samp{is} string (or other commands -with the same effects) and more. What would go in the @samp{rs} -string but not in the @samp{is} string are annoying or slow commands -to bring the terminal back from strange modes that nobody would -normally use. - -@item it -@kindex it -Numeric value, the initial spacing between hardware tab stop columns -when the terminal is powered up. Programs to initialize the terminal -can use this to decide whether there is a need to set the tab stops. -If the initial width is 8, well and good; if it is not 8, then the -tab stops should be set; if they cannot be set, the kernel is told -to convert tabs to spaces, and other programs will observe this and do -likewise. - -@item ct -@kindex ct -String of commands to clear all tab stops. - -@item st -@kindex st -String of commands to set tab stop at current cursor column on all -lines. - -@item NF -@kindex NF -Flag whose presence means that the terminal does not support XON/XOFF -flow control. Programs should not send XON (@kbd{C-q}) or XOFF -(@kbd{C-s}) characters to the terminal. -@end table - -@node Pad Specs, Status Line, Initialization, Capabilities -@section Padding Capabilities -@cindex padding - -There are two terminal capabilities that exist just to explain the proper -way to obey the padding specifications in all the command string -capabilities. One, @samp{pc}, must be obeyed by all termcap-using -programs. - -@table @samp -@item pb -@kindex pb -Numeric value, the lowest baud rate at which padding is actually -needed. Programs may check this and refrain from doing any padding at -lower speeds. - -@item pc -@kindex pc -String of commands for padding. The first character of this string is -to be used as the pad character, instead of using null characters for -padding. If @samp{pc} is not provided, use null characters. Every -program that uses termcap must look up this capability and use it to -set the variable @code{PC} that is used by @code{tputs}. -@xref{Padding}. -@end table - -Some termcap capabilities exist just to specify the amount of padding that -the kernel should give to cursor motion commands used in ordinary -sequential output. - -@table @samp -@item dC -@kindex dC -Numeric value, the number of msec of padding needed for the -carriage-return character. - -@item dN -@kindex dN -Numeric value, the number of msec of padding needed for the newline -(linefeed) character. - -@item dB -@kindex dB -Numeric value, the number of msec of padding needed for the backspace -character. - -@item dF -@kindex dF -Numeric value, the number of msec of padding needed for the formfeed -character. - -@item dT -@kindex dT -Numeric value, the number of msec of padding needed for the tab -character. -@end table - -In some systems, the kernel uses the above capabilities; in other systems, -the kernel uses the paddings specified in the string capabilities -@samp{cr}, @samp{sf}, @samp{le}, @samp{ff} and @samp{ta}. Descriptions of -terminals which require such padding should contain the @samp{dC} @dots{} -@samp{dT} capabilities and also specify the appropriate padding in the -corresponding string capabilities. Since no modern terminals require -padding for ordinary sequential output, you probably won't need to do -either of these things. - -@node Status Line, Half-Line, Pad Specs, Capabilities -@section Status Line - -@cindex status line -A @dfn{status line} is a line on the terminal that is not used for ordinary -display output but instead used for a special message. The intended use is -for a continuously updated description of what the user's program is doing, -and that is where the name ``status line'' comes from, but in fact it could -be used for anything. The distinguishing characteristic of a status line -is that ordinary output to the terminal does not affect it; it changes only -if the special status line commands of this section are used. - -@table @samp -@item hs -@kindex hs -Flag whose presence means that the terminal has a status line. If a -terminal description specifies that there is a status line, it must -provide the @samp{ts} and @samp{fs} capabilities. - -@item ts -@kindex ts -String of commands to move the terminal cursor into the status line. -Usually these commands must specifically record the old cursor -position for the sake of the @samp{fs} string. - -@item fs -@kindex fs -String of commands to move the cursor back from the status line to its -previous position (outside the status line). - -@item es -@kindex es -Flag whose presence means that other display commands work while -writing the status line. In other words, one can clear parts of it, -insert or delete characters, move the cursor within it using @samp{ch} -if there is a @samp{ch} capability, enter and leave standout mode, and -so on. - -@item ds -@kindex ds -String of commands to disable the display of the status line. This -may be absent, if there is no way to disable the status line display. - -@item ws -@kindex ws -Numeric value, the width of the status line. If this capability is -absent in a terminal that has a status line, it means the status line -is the same width as the other lines. - -Note that the value of @samp{ws} is sometimes as small as 8. -@end table - -@node Half-Line, Printer, Status Line, Capabilities -@section Half-Line Motion - -Some terminals have commands for moving the cursor vertically by half-lines, -useful for outputting subscripts and superscripts. Mostly it is hardcopy -terminals that have such features. - -@table @samp -@item hu -@kindex hu -String of commands to move the cursor up half a line. If the terminal -is a display, it is your responsibility to avoid moving up past the -top line; however, most likely the terminal that supports this is a -hardcopy terminal and there is nothing to be concerned about. - -@item hd -@kindex hd -String of commands to move the cursor down half a line. If the -terminal is a display, it is your responsibility to avoid moving down -past the bottom line, etc. -@end table - -@node Printer, , Half-Line, Capabilities -@section Controlling Printers Attached to Terminals -@cindex printer - -Some terminals have attached hardcopy printer ports. They may be able to -copy the screen contents to the printer; they may also be able to redirect -output to the printer. Termcap does not have anything to tell the program -whether the redirected output appears also on the screen; it does on some -terminals but not all. - -@table @samp -@item ps -@kindex ps -String of commands to cause the contents of the screen to be printed. -If it is absent, the screen contents cannot be printed. - -@item po -@kindex po -String of commands to redirect further output to the printer. - -@item pf -@kindex pf -String of commands to terminate redirection of output to the printer. -This capability must be present in the description if @samp{po} is. - -@item pO -@kindex pO -String of commands to redirect output to the printer for next @var{n} -characters of output, regardless of what they are. Redirection will -end automatically after @var{n} characters of further output. Until -then, nothing that is output can end redirection, not even the -@samp{pf} string if there is one. The number @var{n} should not be -more than 255. - -One use of this capability is to send non-text byte sequences (such as -bit-maps) to the printer. -@end table - -Most terminals with printers do not support all of @samp{ps}, @samp{po} and -@samp{pO}; any one or two of them may be supported. To make a program that -can send output to all kinds of printers, it is necessary to check for all -three of these capabilities, choose the most convenient of the ones that -are provided, and use it in its own appropriate fashion. - -@node Summary, Var Index, Capabilities, Top -@chapter Summary of Capability Names - -Here are all the terminal capability names in alphabetical order -with a brief description of each. For cross references to their definitions, -see the index of capability names (@pxref{Cap Index}). - -@table @samp -@item ae -String to turn off alternate character set mode. -@item al -String to insert a blank line before the cursor. -@item AL -String to insert @var{n} blank lines before the cursor. -@item am -Flag: output to last column wraps cursor to next line. -@item as -String to turn on alternate character set mode.like. -@item bc -Very obsolete alternative name for the @samp{le} capability. -@item bl -String to sound the bell. -@item bs -Obsolete flag: ASCII backspace may be used for leftward motion. -@item bt -String to move the cursor left to the previous hardware tab stop column. -@item bw -Flag: @samp{le} at left margin wraps to end of previous line. -@item CC -String to change terminal's command character. -@item cd -String to clear the line the cursor is on, and following lines. -@item ce -String to clear from the cursor to the end of the line. -@item ch -String to position the cursor at column @var{c} in the same line. -@item cl -String to clear the entire screen and put cursor at upper left corner. -@item cm -String to position the cursor at line @var{l}, column @var{c}. -@item CM -String to position the cursor at line @var{l}, column -@var{c}, relative to display memory. -@item co -Number: width of the screen. -@item cr -String to move cursor sideways to left margin. -@item cs -String to set the scroll region. -@item cS -Alternate form of string to set the scroll region. -@item ct -String to clear all tab stops. -@item cv -String to position the cursor at line @var{l} in the same column. -@item da -Flag: data scrolled off top of screen may be scrolled back. -@item db -Flag: data scrolled off bottom of screen may be scrolled back. -@item dB -Obsolete number: msec of padding needed for the backspace character. -@item dc -String to delete one character position at the cursor. -@item dC -Obsolete number: msec of padding needed for the carriage-return character. -@item DC -String to delete @var{n} characters starting at the cursor. -@item dF -Obsolete number: msec of padding needed for the formfeed character. -@item dl -String to delete the line the cursor is on. -@item DL -String to delete @var{n} lines starting with the cursor's line. -@item dm -String to enter delete mode. -@item dN -Obsolete number: msec of padding needed for the newline character. -@item do -String to move the cursor vertically down one line. -@item DO -String to move cursor vertically down @var{n} lines. -@item ds -String to disable the display of the status line. -@item dT -Obsolete number: msec of padding needed for the tab character. -@item ec -String of commands to clear @var{n} characters at cursor. -@item ed -String to exit delete mode. -@item ei -String to leave insert mode. -@item eo -Flag: output of a space can erase an overstrike. -@item es -Flag: other display commands work while writing the status line. -@item ff -String to advance to the next page, for a hardcopy terminal. -@item fs -String to move the cursor back from the status line to its -previous position (outside the status line). -@item gn -Flag: this terminal type is generic, not real. -@item hc -Flag: hardcopy terminal. -@item hd -String to move the cursor down half a line. -@item ho -String to position cursor at upper left corner. -@item hs -Flag: the terminal has a status line. -@item hu -String to move the cursor up half a line. -@item hz -Flag: terminal cannot accept @samp{~} as output. -@item i1 -String to initialize the terminal for each login session. -@item i3 -String to initialize the terminal for each login session. -@item ic -String to insert one character position at the cursor. -@item IC -String to insert @var{n} character positions at the cursor. -@item if -String naming a file of commands to initialize the terminal. -@item im -String to enter insert mode. -@item in -Flag: outputting a space is different from moving over empty positions. -@item ip -String to output following an inserted character in insert mode. -@item is -String to initialize the terminal for each login session. -@item it -Number: initial spacing between hardware tab stop columns. -@item k0 -String of input sent by function key 0 or 10. -@item k1 @dots{} k9 -Strings of input sent by function keys 1 through 9. -@item K1 @dots{} K5 -Strings sent by the five other keys in 3-by-3 array with arrows. -@item ka -String of input sent by the ``clear all tabs'' key. -@item kA -String of input sent by the ``insert line'' key. -@item kb -String of input sent by the ``backspace'' key. -@item kC -String of input sent by the ``clear screen'' key. -@item kd -String of input sent by typing the down-arrow key. -@item kD -String of input sent by the ``delete character'' key. -@item ke -String to make the function keys work locally. -@item kE -String of input sent by the ``clear to end of line'' key. -@item kF -String of input sent by the ``scroll forward'' key. -@item kh -String of input sent by typing the ``home-position'' key. -@item kH -String of input sent by the ``home down'' key. -@item kI -String of input sent by the ``insert character'' or ``enter -insert mode'' key. -@item kl -String of input sent by typing the left-arrow key. -@item kL -String of input sent by the ``delete line'' key. -@item km -Flag: the terminal has a Meta key. -@item kM -String of input sent by the ``exit insert mode'' key. -@item kn -Numeric value, the number of numbered function keys. -@item kN -String of input sent by the ``next page'' key. -@item ko -Very obsolete string listing the terminal's named function keys. -@item kP -String of input sent by the ``previous page'' key. -@item kr -String of input sent by typing the right-arrow key. -@item kR -String of input sent by the ``scroll reverse'' key. -@item ks -String to make the function keys transmit. -@item kS -String of input sent by the ``clear to end of screen'' key. -@item kt -String of input sent by the ``clear tab stop this column'' key. -@item kT -String of input sent by the ``set tab stop in this column'' key. -@item ku -String of input sent by typing the up-arrow key. -@item l0 -String on keyboard labelling function key 0 or 10. -@item l1 @dots{} l9 -Strings on keyboard labelling function keys 1 through 9. -@item le -String to move the cursor left one column. -@item LE -String to move cursor left @var{n} columns. -@item li -Number: height of the screen. -@item ll -String to position cursor at lower left corner. -@item lm -Number: lines of display memory. -@item LP -Flag: writing to last column of last line will not scroll. -@item mb -String to enter blinking mode. -@item md -String to enter double-bright mode. -@item me -String to turn off all appearance modes -@item mh -String to enter half-bright mode. -@item mi -Flag: cursor motion in insert mode is safe. -@item mk -String to enter invisible mode. -@item mm -String to enable the functioning of the Meta key. -@item mo -String to disable the functioning of the Meta key. -@item mp -String to enter protected mode. -@item mr -String to enter reverse-video mode. -@item ms -Flag: cursor motion in standout mode is safe. -@item nc -Obsolete flag: do not use ASCII carriage-return on this terminal. -@item nd -String to move the cursor right one column. -@item NF -Flag: do not use XON/XOFF flow control. -@item nl -Obsolete alternative name for the @samp{do} and @samp{sf} capabilities. -@item ns -Flag: the terminal does not normally scroll for sequential output. -@item nw -String to move to start of next line, possibly clearing rest of old line. -@item os -Flag: terminal can overstrike. -@item pb -Number: the lowest baud rate at which padding is actually needed. -@item pc -String containing character for padding. -@item pf -String to terminate redirection of output to the printer. -@item po -String to redirect further output to the printer. -@item pO -String to redirect @var{n} characters ofoutput to the printer. -@item ps -String to print the screen on the attached printer. -@item rc -String to move to last saved cursor position. -@item RI -String to move cursor right @var{n} columns. -@item rp -String to output character @var{c} repeated @var{n} times. -@item rs -String to reset the terminal from any strange modes. -@item sa -String to turn on an arbitrary combination of appearance modes. -@item sc -String to save the current cursor position. -@item se -String to leave standout mode. -@item sf -String to scroll the screen one line up. -@item SF -String to scroll the screen @var{n} lines up. -@item sg -Number: width of magic standout cookie. Absent if magic cookies are -not used. -@item so -String to enter standout mode. -@item sr -String to scroll the screen one line down. -@item SR -String to scroll the screen @var{n} line down. -@item st -String to set tab stop at current cursor column on all lines. -programs. -@item ta -String to move the cursor right to the next hardware tab stop column. -@item te -String to return terminal to settings for sequential output. -@item ti -String to initialize terminal for random cursor motion. -@item ts -String to move the terminal cursor into the status line. -@item uc -String to underline one character and move cursor right. -@item ue -String to turn off underline mode -@item ug -Number: width of underlining magic cookie. Absent if underlining -doesn't use magic cookies. -@item ul -Flag: underline by overstriking with an underscore. -@item up -String to move the cursor vertically up one line. -@item UP -String to move cursor vertically up @var{n} lines. -@item us -String to turn on underline mode -@item vb -String to make the screen flash. -@item ve -String to return the cursor to normal. -@item vi -String to make the cursor invisible. -@item vs -String to enhance the cursor. -@item wi -String to set the terminal output screen window. -@item ws -Number: the width of the status line. -@item xb -Flag: superbee terminal. -@item xn -Flag: cursor wraps in a strange way. -@item xs -Flag: clearing a line is the only way to clear the appearance modes of -positions in that line (or, only way to remove magic cookies on that -line). -@item xt -Flag: Teleray 1061; several strange characteristics. -@end table - -@node Var Index, Cap Index, Summary, Top -@unnumbered Variable and Function Index - -@printindex fn - -@node Cap Index, Index, Var Index, Top -@unnumbered Capability Index - -@printindex ky - -@node Index, , Cap Index, Top -@unnumbered Concept Index - -@printindex cp - -@contents -@bye - diff --git a/src/libs/termcap/texinfo.tex b/src/libs/termcap/texinfo.tex deleted file mode 100644 index c49af9f4ed..0000000000 --- a/src/libs/termcap/texinfo.tex +++ /dev/null @@ -1,5992 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{1999-09-25.10} -% -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 -% Free Software Foundation, Inc. -% -% This texinfo.tex file is free software; you can redistribute it and/or -% modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. -% -% This texinfo.tex file is distributed in the hope that it will be -% useful, but WITHOUT ANY WARRANTY; without even the implied warranty -% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -% General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. -% -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://texinfo.org/tex/texinfo.tex -% ftp://us.ctan.org/macros/texinfo/texinfo.tex -% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). -% /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% The texinfo.tex in any given Texinfo distribution could well be out -% of date, so if that's what you're using, please check. -% Texinfo has a small home page at http://texinfo.org/. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. -% The extra runs of TeX get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -% Save some parts of plain tex whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexi=\i -\let\ptexlbrace=\{ -\let\ptexrbrace=\} -\let\ptexstar=\* -\let\ptext=\t - -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -\message{Basics,} -\chardef\other=12 - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi - -% Ignore a token. -% -\def\gobble#1{} - -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} -\hyphenation{white-space} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\fi - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \turnoffactive - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg#1{% - \let\next = #1% - \begingroup - \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% - }% -} - -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} - -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., -% @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup -} - -% Change the active space to expand to nothing. -% -\begingroup - \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi - \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname - \fi -} - -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% - \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% -} - -% Define the control sequence \E#1 to give an unmatched @end error. -% -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% -} - - -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -\def\group{\begingroup - \ifnum\catcode13=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -\def\need{\parsearg\needx} - -% Old definition--didn't work. -%\def\needx #1{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\def\needx#1{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break - -\let\br = \par - -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - - -% @page forces the start of a new page -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} - -% This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} - -% @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \input\thisfile -\endgroup} - -\def\thisfile{} - -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} - -% @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% We cannot implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. -% -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. -% -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \iflinks - \readauxfile - \fi % \openindices needs to do some work in any case. - \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. - \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -\ifx\pdfoutput\undefined - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\else - \pdftrue - \pdfoutput = 1 - \input pdfcolor - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - \ifnum\pdftexversion < 14 - \pdfimage - \else - \pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - {#1.pdf}% - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{\pdfdest name{#1@} xyz} - \def\pdfmkpgn#1{#1@} - \let\linkcolor = \Cyan - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - \def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\bgroup - \closein 1 - \indexnofonts - \def\tt{} - % thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - \def\chapentry ##1##2##3{} - \def\unnumbchapentry ##1##2{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2{} - \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \input \jobname.toc - \egroup\fi - }} - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks - } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - \def\pdfurl#1{% - \begingroup - \normalturnoffactive\def\@{@}% - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #1 - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}} - \linkcolor #1\endlink} - \def\mkpgn#1{#1@} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput - - -\message{fonts,} -% Font-change commands. - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. -\newfam\sffam -\def\sf{\fam=\sffam \tensf} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this one. -\def\ttsl{\tenttsl} - -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -\ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} -\else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 -\setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf -} - - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \resetmathfonts \setleading{11pt}} - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} -\setfont\shortcontsl\slshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic -\let\cite=\smartslanted - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\let\ttfont=\t -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in \code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder - \codex - } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} -\def\codex #1{\tclose{#1}\endgroup} - -%\let\exp=\tclose %Was temporary - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} - -% @pounds{} is a sterling sign. -\def\pounds{{\it\$}} - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \oldpage - \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi - % - \ifpdf \pdfmakepagedesttrue \fi - % - \HEADINGSon -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make Tex use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% Produces Day Month Year style of output. -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} - -% @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % -} - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\def\itemize{\parsearg\itemizezzz} - -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a . - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call itemizey, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - -% @multitable ... @end multitable definitions: -% -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup - \vskip\parskip - \let\item\crcr - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% - % - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. -% -\def\ignore{\doignore{ignore}} - -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. -% -\def\ifinfo{\doignore{ifinfo}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} -\def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. -% -\def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 - % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 - % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi -} - -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont - \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont - \let\tensf=\nullfont - % Similarly for index fonts (mostly for their use in smallexample). - \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont - \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont - \let\smallsf=\nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% -} - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. -% -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup -} -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} - -% @value{foo} gets the text saved in variable foo. -{ - \catcode`\_ = \active - % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 - \indexbreaks \let_\normalunderscore - \valuexxx} -} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail - \else - \expandafter\ifsetsucceed - \fi -} -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. -% -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} - -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. - -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} -} - -\def\defcodeindex{\parsearg\newcodeindex} - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -\def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros -} - -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} - -\def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\acronym=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% For \ifx comparisons. -\def\emptymacro{\empty} - -% Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. -% -\def\dosubind#1#2#3{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% - \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. - \toks0 = {#2}% - % - % If third (subentry) arg is present, add it to the index - % string. And include a space. - \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % Set up the complete index entry, with both the sort key - % and the original text, including any font commands. We write - % three arguments to \entry to the .?? file, texindex reduces to - % two when writing the .??s sorted result. - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi - \fi - % - \temp % do the write - % - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 - }% -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \indexbreaks - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\rawbackslashxx}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. -% -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - \ #2% The page number ends the paragraph. - \fi - \fi% - \par -\endgroup} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -\def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -\def\balancecolumns{% - % Called at the end of the double column material. - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% \def\appendixletter{\char\the\appendixno} -% We do the following for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} - \else - \numberedsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} - \else - \appendixsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} - \else - \unnumberedsubsubseczzz{#2} - \fi -\fi -} - -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -% @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the to achieve this: TeX expands \the only once, -% simply yielding the contents of . (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -} - -% Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -% @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{ -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% - \pchapsepmacro - {% - \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} - -\CHAPFplain % The default - -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} - - -% Section titles. -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} - -% Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} - -% Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} - - -% Print any size section title. -% -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% - {% - % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm - % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% - % - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% - }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. -% -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. -% -\newif\iftocfileopened -\def\writetocentry#1{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - \iflinks \write\tocfile{#1{\folio}}\fi -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Finish up the main text and prepare to read what we've written -% to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \pdfmakeoutlines - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} -\let\shortcontents = \summarycontents - -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% -} - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -% -\newdimen\shortappendixwidth -% -\def\shortchaplabel#1{% - % Compute width of word "Appendix", may change with language. - \setbox0 = \hbox{\shortcontrm \putwordAppendix}% - \shortappendixwidth = \wd0 - % - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% -} - -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} - -% Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} - -% Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} - -% And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} - -% This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts - - -\message{environments,} -% @foo ... @end foo. - -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% Adapted from the TeXbook's \boxit. -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{ - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} - -% The @error{} command. -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\def\tex{\begingroup - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie - \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\*=\ptexstar - \let\t=\ptext - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -\let\Etex=\endgroup} - -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip -\def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \inENV % This group ends at the end of the body - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax - \fi -} - -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} - -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} - -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. -% Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \smallfonts - \lisp -} - -% @display: same as @lisp except keep current font. -% -\def\display{\begingroup - \nonfillstart - \let\Edisplay = \nonfillfinish - \gobble -} - -% @smalldisplay (when @smallbook): @display plus smaller fonts. -% -\def\smalldisplayx{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallfonts \rm - \display -} - -% @format: same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eformat = \nonfillfinish - \gobble -} - -% @smallformat (when @smallbook): @format plus smaller fonts. -% -\def\smallformatx{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \smallfonts \rm - \format -} - -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} - -% @flushright. -% -\def\flushright{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushright = \nonfillfinish - \advance\leftskip by 0pt plus 1fill - \gobble -} - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. -% -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace - \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi -} - - -\message{defuns,} -% @defun etc. - -% Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 -} -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = 13 - \global\let& = \ampnr -} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% Used for @deftypemethod and @deftypeivar. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by a space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} - -% Used for @deftypeop. The change from \deftypemethparsebody is an -% extra argument at the beginning which is the `category', instead of it -% being the hardwired string `Method' or `Instance Variable'. We have -% to account for this both in the \...x definition and in parsing the -% input at hand. Thus also need a control sequence (passed as #5) for -% the \E... definition to assign the category name to. -% -\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 ##3 {% - \def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% -} - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % -} - -% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... -% -\def\deftypeop #1 {\def\deftypeopcategory{#1}% - \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader - \deftypeopcategory} -% -% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. -\def\deftypeopheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3} - {\deftypeopcategory\ \putwordon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypemethod CLASS TYPE METHOD ARG... -% -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} -% -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypeivar CLASS TYPE VARNAME -% -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} -% -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{#3}{\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup -} - -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} -% -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME -% -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} -% -\def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup -} - -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. -% -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} -\fi - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... - -% Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. -\def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{The name \the\macname\space is reserved}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist - \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{\ignoreactivespaces -\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% - \expandafter\noexpand\csname#2\endcsname}% -\expandafter\endgroup\next} - - -\message{cross references,} -% @xref etc. - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} -\let\nwnode=\node -\let\lastnode=\relax - -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax - \fi -} -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax - \fi -} - - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. -% -\def\setref#1#2{{% - \indexdummies - \pdfmkdest{#1}% - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifpdf - \leavevmode - \getfilename{#4}% - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1@}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{#1@}% - \fi - \linkcolor - \fi - % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\normalturnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi - \endlink -\endgroup} - -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) -\def\dosetq#1#2{% - {\let\folio=0% - \normalturnoffactive - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi - }% -} - -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. - -\def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \csname X#1\endcsname - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. -% -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} - -% Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % Make the characters 128-255 be printing characters - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux -\endgroup} - - -% Footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -\let\ptexfootnote=\footnote - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \footnotezzz -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\long\gdef\footnotezzz{\insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Hang the footnote text off the number. - \hang - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - -}%end \catcode `\@=11 - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% - \ifpdf - \centerline{\dopdfimage{#1}{#2}{#3}}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \begingroup - \catcode`\^^M = 5 % in case we're inside an example - % If the image is by itself, center it. - \ifvmode - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak - \else - % In the middle of a paragraph, no extra space. - \epsfbox{#1.eps}% - \fi - \endgroup - \fi -} - - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax - \else - \def\temp{\input txi-#1.tex }% - \fi - \temp - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. -% -\def\internalpagesizes#1#2#3#4#5#6{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% -}} - -% Use @smallbook to reset parameters for 7x9.5 (or so) format. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \setleading{12pt}% - % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \deftypemargin = 0pt - \defbodyindent = .5cm - % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% - \parskip = 3pt plus 2pt minus 1pt - % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% - % - \tolerance = 700 - \hfuzz = 1pt -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% - % - \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% - % - \globaldefs = 0 -}} - -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% - \afourpaper - \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % - \globaldefs = 0 -} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$} - -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% \catcode 17=0 % Define control-q -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - -@c Set initial fonts. -@textfonts -@rm - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: diff --git a/src/libs/termcap/tparam.c b/src/libs/termcap/tparam.c deleted file mode 100644 index 6eb6180116..0000000000 --- a/src/libs/termcap/tparam.c +++ /dev/null @@ -1,332 +0,0 @@ -/* Merge parameters into a termcap entry string. - Copyright (C) 1985, 87, 93, 95, 2000 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Emacs config.h may rename various library functions such as malloc. */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef emacs -#include "lisp.h" /* for xmalloc */ -#else - -#ifdef STDC_HEADERS -#include -#include -#else -char *malloc (); -char *realloc (); -#endif - -/* Do this after the include, in case string.h prototypes bcopy. */ -#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif - -#endif /* not emacs */ - -#ifndef NULL -#define NULL (char *) 0 -#endif - -#ifndef emacs -static void -memory_out () -{ - write (2, "virtual memory exhausted\n", 25); - exit (1); -} - -static char * -xmalloc (size) - unsigned size; -{ - register char *tem = malloc (size); - - if (!tem) - memory_out (); - return tem; -} - -static char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *tem = realloc (ptr, size); - - if (!tem) - memory_out (); - return tem; -} -#endif /* not emacs */ - -/* Assuming STRING is the value of a termcap string entry - containing `%' constructs to expand parameters, - merge in parameter values and store result in block OUTSTRING points to. - LEN is the length of OUTSTRING. If more space is needed, - a block is allocated with `malloc'. - - The value returned is the address of the resulting string. - This may be OUTSTRING or may be the address of a block got with `malloc'. - In the latter case, the caller must free the block. - - The fourth and following args to tparam serve as the parameter values. */ - -static char *tparam1 (); - -/* VARARGS 2 */ -char * -tparam (string, outstring, len, arg0, arg1, arg2, arg3) - char *string; - char *outstring; - int len; - int arg0, arg1, arg2, arg3; -{ - int arg[4]; - - arg[0] = arg0; - arg[1] = arg1; - arg[2] = arg2; - arg[3] = arg3; - return tparam1 (string, outstring, len, NULL, NULL, arg); -} - -char *BC; -char *UP; - -static char tgoto_buf[50]; - -char * -tgoto (cm, hpos, vpos) - char *cm; - int hpos, vpos; -{ - int args[2]; - if (!cm) - return NULL; - args[0] = vpos; - args[1] = hpos; - return tparam1 (cm, tgoto_buf, 50, UP, BC, args); -} - -static char * -tparam1 (string, outstring, len, up, left, argp) - char *string; - char *outstring; - int len; - char *up, *left; - register int *argp; -{ - register int c; - register char *p = string; - register char *op = outstring; - char *outend; - int outlen = 0; - - register int tem; - int *old_argp = argp; - int doleft = 0; - int doup = 0; - - outend = outstring + len; - - while (1) - { - /* If the buffer might be too short, make it bigger. */ - if (op + 5 >= outend) - { - register char *new; - int offset = op - outstring; - - if (outlen == 0) - { - outlen = len + 40; - new = (char *) xmalloc (outlen); - bcopy (outstring, new, offset); - } - else - { - outlen *= 2; - new = (char *) xrealloc (outstring, outlen); - } - - op = new + offset; - outend = new + outlen; - outstring = new; - } - c = *p++; - if (!c) - break; - if (c == '%') - { - c = *p++; - tem = *argp; - switch (c) - { - case 'd': /* %d means output in decimal. */ - if (tem < 10) - goto onedigit; - if (tem < 100) - goto twodigit; - case '3': /* %3 means output in decimal, 3 digits. */ - if (tem > 999) - { - *op++ = tem / 1000 + '0'; - tem %= 1000; - } - *op++ = tem / 100 + '0'; - case '2': /* %2 means output in decimal, 2 digits. */ - twodigit: - tem %= 100; - *op++ = tem / 10 + '0'; - onedigit: - *op++ = tem % 10 + '0'; - argp++; - break; - - case 'C': - /* For c-100: print quotient of value by 96, if nonzero, - then do like %+. */ - if (tem >= 96) - { - *op++ = tem / 96; - tem %= 96; - } - case '+': /* %+x means add character code of char x. */ - tem += *p++; - case '.': /* %. means output as character. */ - if (left) - { - /* If want to forbid output of 0 and \n and \t, - and this is one of them, increment it. */ - while (tem == 0 || tem == '\n' || tem == '\t') - { - tem++; - if (argp == old_argp) - doup++, outend -= strlen (up); - else - doleft++, outend -= strlen (left); - } - } - *op++ = tem ? tem : 0200; - case 'f': /* %f means discard next arg. */ - argp++; - break; - - case 'b': /* %b means back up one arg (and re-use it). */ - argp--; - break; - - case 'r': /* %r means interchange following two args. */ - argp[0] = argp[1]; - argp[1] = tem; - old_argp++; - break; - - case '>': /* %>xy means if arg is > char code of x, */ - if (argp[0] > *p++) /* then add char code of y to the arg, */ - argp[0] += *p; /* and in any case don't output. */ - p++; /* Leave the arg to be output later. */ - break; - - case 'a': /* %a means arithmetic. */ - /* Next character says what operation. - Add or subtract either a constant or some other arg. */ - /* First following character is + to add or - to subtract - or = to assign. */ - /* Next following char is 'p' and an arg spec - (0100 plus position of that arg relative to this one) - or 'c' and a constant stored in a character. */ - tem = p[2] & 0177; - if (p[1] == 'p') - tem = argp[tem - 0100]; - if (p[0] == '-') - argp[0] -= tem; - else if (p[0] == '+') - argp[0] += tem; - else if (p[0] == '*') - argp[0] *= tem; - else if (p[0] == '/') - argp[0] /= tem; - else - argp[0] = tem; - - p += 3; - break; - - case 'i': /* %i means add one to arg, */ - argp[0] ++; /* and leave it to be output later. */ - argp[1] ++; /* Increment the following arg, too! */ - break; - - case '%': /* %% means output %; no arg. */ - goto ordinary; - - case 'n': /* %n means xor each of next two args with 140. */ - argp[0] ^= 0140; - argp[1] ^= 0140; - break; - - case 'm': /* %m means xor each of next two args with 177. */ - argp[0] ^= 0177; - argp[1] ^= 0177; - break; - - case 'B': /* %B means express arg as BCD char code. */ - argp[0] += 6 * (tem / 10); - break; - - case 'D': /* %D means weird Delta Data transformation. */ - argp[0] -= 2 * (tem % 16); - break; - - default: - abort (); - } - } - else - /* Ordinary character in the argument string. */ - ordinary: - *op++ = c; - } - *op = 0; - while (doup-- > 0) - strcat (op, up); - while (doleft-- > 0) - strcat (op, left); - return outstring; -} - -#if 0 - -main (argc, argv) - int argc; - char **argv; -{ - char buf[50]; - int args[3]; - args[0] = atoi (argv[2]); - args[1] = atoi (argv[3]); - args[2] = atoi (argv[4]); - tparam1 (argv[1], buf, "LEFT", "UP", args); - printf ("%s\n", buf); - return 0; -} - -#endif diff --git a/src/libs/termcap/version.c b/src/libs/termcap/version.c deleted file mode 100644 index e86bdc476f..0000000000 --- a/src/libs/termcap/version.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Make the library identifiable with the RCS ident command. */ -static char *version_string = "\n$Version: GNU termcap 1.3.1 $\n"; diff --git a/src/preferences/cpufrequency/CPUFrequencyView.cpp b/src/preferences/cpufrequency/CPUFrequencyView.cpp index 8ec880ec72..b0e1adf6c2 100644 --- a/src/preferences/cpufrequency/CPUFrequencyView.cpp +++ b/src/preferences/cpufrequency/CPUFrequencyView.cpp @@ -64,18 +64,21 @@ CPUFrequencyView::CPUFrequencyView(BRect frame, BBox *dynamicBox = new BBox(rect, "dynamicBox"); dynamicBox->SetLabel(B_TRANSLATE("Dynamic stepping")); BGroupLayout* dynamicLayout = new BGroupLayout(B_VERTICAL); - dynamicLayout->SetInsets(10, dynamicBox->TopBorderOffset() * 2 + 10, 10, - 10); - dynamicLayout->SetSpacing(10); + dynamicLayout->SetInsets(B_USE_DEFAULT_SPACING, + dynamicBox->TopBorderOffset() * 2 + 10, + B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING); + dynamicLayout->SetSpacing(B_USE_DEFAULT_SPACING); dynamicBox->SetLayout(dynamicLayout); mainLayout->AddView(dynamicBox); fColorStepView = new ColorStepView(frame); fColorStepView->SetFrequencys(fDriverInterface.GetCpuFrequencyStates()); - fIntegrationTime = new BTextControl(BRect(0,0,Bounds().Width(),10), + fIntegrationTime = new BTextControl(BRect(0, 0, Bounds().Width(), 10), "intergal", B_TRANSLATE("Integration time [ms]: "), "", new BMessage(kIntegrationTimeChanged)); + fIntegrationTime->SetDivider(Bounds().Width() * 3 / 4); + fIntegrationTime->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); dynamicLayout->AddView(fColorStepView); dynamicLayout->AddView(fIntegrationTime); @@ -97,8 +100,8 @@ CPUFrequencyView::CPUFrequencyView(BRect frame, new BMessage(kInstallIntoDeskbar)); statusLayout->AddView(fStatusView); - statusLayout->AddView(fInstallButton); statusLayout->AddItem(BSpaceLayoutItem::CreateGlue()); + statusLayout->AddView(fInstallButton); } diff --git a/src/preferences/cpufrequency/PreferencesWindow.h b/src/preferences/cpufrequency/PreferencesWindow.h index 914beec62b..03e99002a8 100644 --- a/src/preferences/cpufrequency/PreferencesWindow.h +++ b/src/preferences/cpufrequency/PreferencesWindow.h @@ -356,13 +356,10 @@ PreferencesWindow::PreferencesWindow(const char* title, BGroupView* buttonView = new BGroupView(B_HORIZONTAL); fDefaultButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(kDefaultMsg)); - buttonView->AddChild(fDefaultButton); - buttonView->GetLayout()->AddItem( - BSpaceLayoutItem::CreateHorizontalStrut(7)); + fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(kRevertMsg)); - buttonView->AddChild(fRevertButton); buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); @@ -370,8 +367,8 @@ PreferencesWindow::PreferencesWindow(const char* title, SetLayout(new BGroupLayout(B_VERTICAL)); fRootLayout = new BGroupLayout(B_VERTICAL); - fRootLayout->SetInsets(10, 10, 10, 10); - fRootLayout->SetSpacing(10); + fRootLayout->SetInsets(B_USE_DEFAULT_SPACING); + fRootLayout->SetSpacing(B_USE_DEFAULT_SPACING); BView* rootView = new BView("root view", 0, fRootLayout); AddChild(rootView); rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); diff --git a/src/preferences/keymap/KeyboardLayoutView.cpp b/src/preferences/keymap/KeyboardLayoutView.cpp index 82f3a31dfa..5a8fa79bc8 100644 --- a/src/preferences/keymap/KeyboardLayoutView.cpp +++ b/src/preferences/keymap/KeyboardLayoutView.cpp @@ -56,6 +56,7 @@ void KeyboardLayoutView::SetKeyboardLayout(KeyboardLayout* layout) { fLayout = layout; + _InitOffscreen(); _LayoutKeyboard(); Invalidate(); } diff --git a/src/preferences/locale/LocalePreflet.cpp b/src/preferences/locale/LocalePreflet.cpp index 65eb3003f1..594e94ddaa 100644 --- a/src/preferences/locale/LocalePreflet.cpp +++ b/src/preferences/locale/LocalePreflet.cpp @@ -36,7 +36,6 @@ private: status_t _RestartApp(const char* signature) const; LocaleWindow* fLocaleWindow; - BAboutWindow* fAboutWindow; }; @@ -46,8 +45,7 @@ private: LocalePreflet::LocalePreflet() : BApplication(kSignature), - fLocaleWindow(new LocaleWindow()), - fAboutWindow(NULL) + fLocaleWindow(new LocaleWindow()) { fLocaleWindow->Show(); } @@ -55,9 +53,6 @@ LocalePreflet::LocalePreflet() LocalePreflet::~LocalePreflet() { - // replicant deleted, destroy the about window - if (fAboutWindow != NULL) - fAboutWindow->Quit(); } @@ -78,24 +73,24 @@ LocalePreflet::MessageReceived(BMessage* message) break; case B_ABOUT_REQUESTED: - if (fAboutWindow == NULL) { - const char* authors[] = { - "Axel Dörfler", - "Adrien Destugues", - "Oliver Tappe", - NULL - }; + { + BAboutWindow* window = new BAboutWindow(kAppName, kSignature); - fAboutWindow = new BAboutWindow(kAppName, kSignature); - fAboutWindow->AddCopyright(2005, "Haiku, Inc."); - fAboutWindow->AddAuthors(authors); - fAboutWindow->Show(); - } else if (fAboutWindow->IsHidden()) - fAboutWindow->Show(); - else - fAboutWindow->Activate(); + const char* authors[] = { + "Axel Dörfler", + "Adrien Destugues", + "Oliver Tappe", + NULL + }; + + window = new BAboutWindow(kAppName, kSignature); + window->AddCopyright(2005, "Haiku, Inc."); + window->AddAuthors(authors); + + window->Show(); break; + } default: BApplication::MessageReceived(message); diff --git a/src/preferences/mail/ConfigWindow.cpp b/src/preferences/mail/ConfigWindow.cpp index 8007d45bff..36d43126a9 100644 --- a/src/preferences/mail/ConfigWindow.cpp +++ b/src/preferences/mail/ConfigWindow.cpp @@ -815,15 +815,15 @@ ConfigWindow::_SetToGeneralSettings(BMailSettings *settings) int timeIndex = 0; if (interval >= 60) { timeIndex = 1; - sprintf(text, "%ld", interval / (60)); + sprintf(text, "%" B_PRIdTIME, interval / (60)); } if (interval >= (60*60)) { timeIndex = 2; - sprintf(text, "%ld", interval / (60*60)); + sprintf(text, "%" B_PRIdTIME, interval / (60*60)); } if (interval >= (60*60*24)) { timeIndex = 3; - sprintf(text, "%ld", interval / (60*60*24)); + sprintf(text, "%" B_PRIdTIME, interval / (60*60*24)); } fIntervalControl->SetText(text); diff --git a/src/preferences/mail/DNSQuery.cpp b/src/preferences/mail/DNSQuery.cpp index ee31cfd13e..4b638ea548 100644 --- a/src/preferences/mail/DNSQuery.cpp +++ b/src/preferences/mail/DNSQuery.cpp @@ -106,7 +106,7 @@ BRawNetBuffer::ReadString(BString& string) status_t BRawNetBuffer::SkipReading(off_t skip) { - if (fReadPosition + skip > fBuffer.BufferLength()) + if (fReadPosition + skip > (off_t)fBuffer.BufferLength()) return B_ERROR; fReadPosition += skip; return B_OK; @@ -125,7 +125,7 @@ BRawNetBuffer::_Init(const void* buf, size_t size) ssize_t BRawNetBuffer::_ReadStringAt(BString& string, off_t pos) { - if (pos >= fBuffer.BufferLength()) + if (pos >= (off_t)fBuffer.BufferLength()) return -1; ssize_t bytesRead = 0; @@ -133,7 +133,7 @@ BRawNetBuffer::_ReadStringAt(BString& string, off_t pos) buffer = &buffer[pos]; // if the string is compressed we have to follow the links to the // sub strings - while (pos < fBuffer.BufferLength() && *buffer != 0) { + while (pos < (off_t)fBuffer.BufferLength() && *buffer != 0) { if (uint8(*buffer) == 192) { // found a pointer mark buffer++; diff --git a/src/preferences/network/Settings.cpp b/src/preferences/network/Settings.cpp index 8601b560f0..3eab5d3d24 100644 --- a/src/preferences/network/Settings.cpp +++ b/src/preferences/network/Settings.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include @@ -38,7 +40,6 @@ Settings::Settings(const char* name) fDisabled(false), fNameServers(5, true) { - fSocket = socket(AF_INET, SOCK_DGRAM, 0); fName = name; ReadConfiguration(); @@ -47,81 +48,41 @@ Settings::Settings(const char* name) Settings::~Settings() { - close(fSocket); } -bool -Settings::_PrepareRequest(struct ifreq& request) +static status_t +GetDefaultGateway(BString& gateway) { - // This function is used for talking direct to the stack. - // It´s used by _ShowConfiguration. + // TODO: This method is here because BNetworkInterface + // doesn't yet have any route getting methods - const char* name = fName.String(); + int socket = ::socket(AF_INET, SOCK_DGRAM, 0); + if (socket < 0) + return errno; - if (strlen(name) > IF_NAMESIZE) - return false; - - strcpy(request.ifr_name, name); - return true; -} - - -void -Settings::ReadConfiguration() -{ - ifreq request; - if (!_PrepareRequest(request)) - return; - - BString text = "dummy"; - char address[32]; - sockaddr_in* inetAddress = NULL; - - // Obtain IP. - if (ioctl(fSocket, SIOCGIFADDR, &request, sizeof(request)) < 0) - return; - - inetAddress = (sockaddr_in*)&request.ifr_addr; - if (inet_ntop(AF_INET, &inetAddress->sin_addr, address, - sizeof(address)) == NULL) { - return; - } - - fIP = address; - - // Obtain netmask. - if (ioctl(fSocket, SIOCGIFNETMASK, &request, sizeof(request)) < 0) - return; - - inetAddress = (sockaddr_in*)&request.ifr_mask; - if (inet_ntop(AF_INET, &inetAddress->sin_addr, address, - sizeof(address)) == NULL) { - return; - } - - fNetmask = address; + FileDescriptorCloser fdCloser(socket); // Obtain gateway ifconf config; config.ifc_len = sizeof(config.ifc_value); - if (ioctl(fSocket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0) - return; + if (ioctl(socket, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0) + return errno; uint32 size = (uint32)config.ifc_value; if (size == 0) - return; + return B_ERROR; void* buffer = malloc(size); if (buffer == NULL) - return; + return B_NO_MEMORY; MemoryDeleter bufferDeleter(buffer); config.ifc_len = size; config.ifc_buf = buffer; - if (ioctl(fSocket, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0) - return; + if (ioctl(socket, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0) + return errno; ifreq* interface = (ifreq*)buffer; ifreq* end = (ifreq*)((uint8*)buffer + size); @@ -130,8 +91,8 @@ Settings::ReadConfiguration() route_entry& route = interface->ifr_route; if ((route.flags & RTF_GATEWAY) != 0) { - inetAddress = (sockaddr_in*)route.gateway; - fGateway = inet_ntoa(inetAddress->sin_addr); + sockaddr_in* inetAddress = (sockaddr_in*)route.gateway; + gateway = inet_ntoa(inetAddress->sin_addr); } int32 addressSize = 0; @@ -146,9 +107,27 @@ Settings::ReadConfiguration() + sizeof(route_entry) + addressSize); } - uint32 flags = 0; - if (ioctl(fSocket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0) - flags = request.ifr_flags; + return B_OK; +} + + +void +Settings::ReadConfiguration() +{ + BNetworkInterface interface(fName); + BNetworkInterfaceAddress address; + + // TODO: We only get the first address + if (interface.GetAddressAt(0, address) != B_OK) + return; + + fIP = address.Address().ToString(); + fNetmask = address.Mask().ToString(); + + if (GetDefaultGateway(fGateway) != B_OK) + return; + + uint32 flags = interface.Flags(); fAuto = (flags & (IFF_AUTO_CONFIGURED | IFF_CONFIGURING)) != 0; fDisabled = (flags & IFF_UP) == 0; @@ -157,51 +136,15 @@ Settings::ReadConfiguration() fWirelessNetwork.SetTo(NULL); - BPath path; - find_directory(B_COMMON_SETTINGS_DIRECTORY, &path); - path.Append("network"); - path.Append("interfaces"); - - void* handle = load_driver_settings(path.Path()); - if (handle != NULL) { - const driver_settings* settings = get_driver_settings(handle); - if (settings != NULL) { - for (int32 i = 0; i < settings->parameter_count; i++) { - driver_parameter& top = settings->parameters[i]; - if (!strcmp(top.name, "interface")) { - // The name of the interface can either be the value of - // the "interface" parameter, or a separate "name" parameter - const char* name = NULL; - if (top.value_count > 0) { - name = top.values[0]; - if (fName != name) - continue; - } - - // search "network" parameter - for (int32 j = 0; j < top.parameter_count; j++) { - driver_parameter& sub = top.parameters[j]; - if (name == NULL && !strcmp(sub.name, "name") - && sub.value_count > 0) { - name = sub.values[0]; - if (fName != sub.values[0]) - break; - } - - if (!strcmp(sub.name, "network") - && sub.value_count > 0) { - fWirelessNetwork.SetTo(sub.values[0]); - break; - } - } - - // We found our interface - if (fName == name) - break; - } - } + BNetworkDevice networkDevice(fName); + if (networkDevice.IsWireless()) { + uint32 networkIndex = 0; + wireless_network wirelessNetwork; + // TODO: We only get the first associated network for now + if (networkDevice.GetNextAssociatedNetwork(networkIndex, + wirelessNetwork) == B_OK) { + fWirelessNetwork.SetTo(wirelessNetwork.name); } - unload_driver_settings(handle); } // read resolv.conf for the dns. diff --git a/src/preferences/network/Settings.h b/src/preferences/network/Settings.h index 2f54ca78ef..cfa270c3b2 100644 --- a/src/preferences/network/Settings.h +++ b/src/preferences/network/Settings.h @@ -48,14 +48,11 @@ public: void ReadConfiguration(); private: - bool _PrepareRequest(struct ifreq& request); - BString fIP; BString fGateway; BString fNetmask; BString fName; BString fDomain; - int fSocket; bool fAuto; bool fDisabled; BObjectList fNameServers; diff --git a/src/preferences/shortcuts/ShortcutsSpec.cpp b/src/preferences/shortcuts/ShortcutsSpec.cpp index 2fbb513b2e..d7f5ca51bc 100644 --- a/src/preferences/shortcuts/ShortcutsSpec.cpp +++ b/src/preferences/shortcuts/ShortcutsSpec.cpp @@ -488,7 +488,7 @@ ShortcutsSpec::GetCellText(int whichColumn) const if (temp == NULL) temp = ""; } else if (fKey > 0xFF) { - sprintf(fScratch, "#%lx", fKey); + sprintf(fScratch, "#%" B_PRIx32, fKey); return fScratch; } break; diff --git a/src/preferences/shortcuts/ShortcutsWindow.cpp b/src/preferences/shortcuts/ShortcutsWindow.cpp index 5a5c6785e6..dd2803937c 100644 --- a/src/preferences/shortcuts/ShortcutsWindow.cpp +++ b/src/preferences/shortcuts/ShortcutsWindow.cpp @@ -569,7 +569,8 @@ ShortcutsWindow::MessageReceived(BMessage* msg) if (fLastOpenWasAppend == false) { // Clear the menu... while (ShortcutsSpec* item - = ((ShortcutsSpec*)fColumnListView->RemoveItem(0L))) { + = ((ShortcutsSpec*) + fColumnListView->RemoveItem((int32)0))) { delete item; } } diff --git a/src/preferences/shortcuts/clv/ColumnListView.cpp b/src/preferences/shortcuts/clv/ColumnListView.cpp index b9c78192fc..bc7f496ab9 100644 --- a/src/preferences/shortcuts/clv/ColumnListView.cpp +++ b/src/preferences/shortcuts/clv/ColumnListView.cpp @@ -1255,7 +1255,7 @@ bool ColumnListView::RemoveItems(int32 fullListIndex, int32 count) CLVListItem* TheItem; if(fHierarchical) { - uint32 LastSuperItemLevel = ULONG_MAX; + uint32 LastSuperItemLevel = UINT32_MAX; int32 Counter; int32 DisplayItemsToRemove = 0; int32 FirstDisplayItemToRemove = -1; diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp index 4663c0b9e3..808ac9272a 100644 --- a/src/servers/app/Desktop.cpp +++ b/src/servers/app/Desktop.cpp @@ -1903,12 +1903,15 @@ Desktop::SetFocusWindow(Window* nextFocus) return; } - uint32 list = fCurrentWorkspace; - if (!fSettings->NormalMouse()) - list = kFocusList; + uint32 listIndex = fCurrentWorkspace; + WindowList* list = &_Windows(fCurrentWorkspace); + if (!fSettings->NormalMouse()) { + listIndex = kFocusList; + list = &fFocusList; + } if (nextFocus == NULL || hasModal || hasWindowScreen) { - nextFocus = _Windows(list).LastWindow(); + nextFocus = list->LastWindow(); if (fSettings->NormalMouse()) { // If the last window having focus is a window that cannot make it @@ -1923,7 +1926,7 @@ Desktop::SetFocusWindow(Window* nextFocus) // make sure no window is chosen that doesn't want focus or cannot have it while (nextFocus != NULL && !_WindowCanHaveFocus(nextFocus)) { - nextFocus = nextFocus->PreviousWindow(list); + nextFocus = nextFocus->PreviousWindow(listIndex); } if (fFocus == nextFocus) { @@ -2701,6 +2704,7 @@ Desktop::WindowForClientLooperPort(port_id port) WindowList& Desktop::_Windows(int32 index) { + ASSERT(index >= 0 && index < kMaxWorkspaces); return fWorkspaces[index].Windows(); } diff --git a/src/servers/app/drawing/Painter/AGGTextRenderer.cpp b/src/servers/app/drawing/Painter/AGGTextRenderer.cpp index 754ea5172f..0bbc0ad0d1 100644 --- a/src/servers/app/drawing/Painter/AGGTextRenderer.cpp +++ b/src/servers/app/drawing/Painter/AGGTextRenderer.cpp @@ -334,8 +334,9 @@ AGGTextRenderer::RenderString(const char* string, uint32 length, // for when we bypass the transformation pipeline BPoint transformOffset(0.0, 0.0); transform.Transform(&transformOffset); + IntRect clippingIntFrame(clippingFrame); - StringRenderer renderer(clippingFrame, dryRun, + StringRenderer renderer(clippingIntFrame, dryRun, gSubpixelAntialiasing && fAntialias, transformedOutline, transformedContourOutline, transform, transformOffset, nextCharPos, *this); @@ -369,8 +370,9 @@ AGGTextRenderer::RenderString(const char* string, uint32 length, // for when we bypass the transformation pipeline BPoint transformOffset(0.0, 0.0); transform.Transform(&transformOffset); + IntRect clippingIntFrame(clippingFrame); - StringRenderer renderer(clippingFrame, dryRun, + StringRenderer renderer(clippingIntFrame, dryRun, gSubpixelAntialiasing && fAntialias, transformedOutline, transformedContourOutline, transform, transformOffset, nextCharPos, *this); diff --git a/src/servers/app/font/FontManager.cpp b/src/servers/app/font/FontManager.cpp index 1e5e2cfdef..c8e9969ac0 100644 --- a/src/servers/app/font/FontManager.cpp +++ b/src/servers/app/font/FontManager.cpp @@ -223,7 +223,7 @@ FontManager::MessageReceived(BMessage* message) if (fromDirectory == NULL) { // there is a new directory to watch for us _AddPath(entry); - FTRACE("new directory moved in"); + FTRACE(("new directory moved in")); } else { // A directory from our watched directories has // been renamed or moved within the watched @@ -237,7 +237,7 @@ FontManager::MessageReceived(BMessage* message) style->UpdatePath(directory->directory); } } - FTRACE("directory renamed"); + FTRACE(("directory renamed")); } } else { if (fromDirectory != NULL) { diff --git a/src/servers/bluetooth/BluetoothServer.cpp b/src/servers/bluetooth/BluetoothServer.cpp index 40da9daf1d..d5ea861934 100644 --- a/src/servers/bluetooth/BluetoothServer.cpp +++ b/src/servers/bluetooth/BluetoothServer.cpp @@ -344,7 +344,8 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage* message, BMessage* reply) for (int index = lastIndex + 1; index < fLocalDevicesList.CountItems(); index++) { lDeviceImpl= fLocalDevicesList.ItemAt(index); - printf("Requesting local device %ld\n", lDeviceImpl->GetID()); + printf("Requesting local device %" B_PRId32 "\n", + lDeviceImpl->GetID()); if (lDeviceImpl != NULL && lDeviceImpl->Available()) { Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", lDeviceImpl->GetID()); @@ -357,7 +358,8 @@ BluetoothServer::HandleAcquireLocalDevice(BMessage* message, BMessage* reply) if (lDeviceImpl == NULL) { for (int index = 0; index <= lastIndex ; index ++) { lDeviceImpl = fLocalDevicesList.ItemAt(index); - printf("Requesting local device %ld\n", lDeviceImpl->GetID()); + printf("Requesting local device %" B_PRId32 "\n", + lDeviceImpl->GetID()); if (lDeviceImpl != NULL && lDeviceImpl->Available()) { Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", lDeviceImpl->GetID()); @@ -600,7 +602,7 @@ BluetoothServer::_InstallDeskbarIcon() status_t res = deskbar.AddItem(&appInfo.ref); if (res != B_OK) { - printf("Failed adding deskbar icon: %ld\n", res); + printf("Failed adding deskbar icon: %" B_PRId32 "\n", res); } } @@ -611,7 +613,7 @@ BluetoothServer::_RemoveDeskbarIcon() BDeskbar deskbar; status_t res = deskbar.RemoveItem(kDeskbarItemName); if (res != B_OK) { - printf("Failed removing Deskbar icon: %ld: \n", res); + printf("Failed removing Deskbar icon: %" B_PRId32 ": \n", res); } } diff --git a/src/servers/bluetooth/HCITransportAccessor.cpp b/src/servers/bluetooth/HCITransportAccessor.cpp index 2c070d6697..8e64949323 100644 --- a/src/servers/bluetooth/HCITransportAccessor.cpp +++ b/src/servers/bluetooth/HCITransportAccessor.cpp @@ -20,11 +20,11 @@ HCITransportAccessor::HCITransportAccessor(BPath* path) : HCIDelegate(path) if (fDescriptor > 0) { // find out which ID was assigned status = ioctl(fDescriptor, GET_HCI_ID, &fIdentifier, 0); - printf("%s: hid retrieved %lx status=%ld\n", __FUNCTION__, - fIdentifier, status); + printf("%s: hid retrieved %" B_PRIx32 " status=%" B_PRId32 "\n", + __FUNCTION__, fIdentifier, status); } else { - printf("%s: Device driver %s could not be opened %ld\n", __FUNCTION__, - path->Path(), fIdentifier); + printf("%s: Device driver %s could not be opened %" B_PRId32 "\n", + __FUNCTION__, path->Path(), fIdentifier); fIdentifier = B_ERROR; } diff --git a/src/servers/bluetooth/LocalDeviceHandler.cpp b/src/servers/bluetooth/LocalDeviceHandler.cpp index 8a0e7ff738..7d3936a6fe 100644 --- a/src/servers/bluetooth/LocalDeviceHandler.cpp +++ b/src/servers/bluetooth/LocalDeviceHandler.cpp @@ -93,11 +93,12 @@ LocalDeviceHandler::ClearWantedEvent(BMessage* msg, uint16 event, uint16 opcode) // for each Event while (msg->FindInt16("eventExpected", eventIndex, &eventFound) == B_OK) { - printf("%s:Event expected %d@%ld...\n", __FUNCTION__, event, eventIndex); + printf("%s:Event expected %d@%" B_PRId32 "...\n", __FUNCTION__, event, + eventIndex); if (eventFound == event) { - printf("%s:Event matches@%ld", __FUNCTION__, eventIndex); + printf("%s:Event matches@%" B_PRId32 "\n", __FUNCTION__, eventIndex); // there is an opcode specified if (opcode != 0) { diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index 9f11b30114..9a8ec744d5 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -799,7 +799,7 @@ TeamDebugHandler::_PrintStackTrace(thread_id thread) if (error == B_OK) { // create a symbol lookup context debug_symbol_lookup_context *lookupContext = NULL; - error = debug_create_symbol_lookup_context(fTeam, &lookupContext); + error = debug_create_symbol_lookup_context(fTeam, -1, &lookupContext); if (error != B_OK) { debug_printf("debug_server: Failed to create symbol lookup " "context: %s\n", strerror(error)); diff --git a/src/servers/mail/ErrorLogWindow.cpp b/src/servers/mail/ErrorLogWindow.cpp index 0cdeddba9e..f4ddea9755 100644 --- a/src/servers/mail/ErrorLogWindow.cpp +++ b/src/servers/mail/ErrorLogWindow.cpp @@ -208,7 +208,7 @@ Error::GetPreferredSize(float *width, float *height) BTextView *view = static_cast(FindView("error_display")); *width = view->Frame().Width() + 20; - *height = view->TextHeight(0, LONG_MAX) + 3; + *height = view->TextHeight(0, INT32_MAX) + 3; } diff --git a/src/servers/media/AddOnManager.cpp b/src/servers/media/AddOnManager.cpp index ad84b71a7b..b8876a99de 100644 --- a/src/servers/media/AddOnManager.cpp +++ b/src/servers/media/AddOnManager.cpp @@ -117,7 +117,7 @@ AddOnManager::GetDecoderForFormat(xfer_entry_ref* _decoderRef, BAutolock locker(fLock); printf("AddOnManager::GetDecoderForFormat: searching decoder for encoding " - "%ld\n", format.Encoding()); + "%" B_PRIu32 "\n", format.Encoding()); // Since the list of decoders is unsorted, we need to search for // a decoder by add-on directory, in order to maintain the shadowing @@ -175,7 +175,7 @@ AddOnManager::GetEncoder(xfer_entry_ref* _encoderRef, int32 id) // check if the encoder matches the supplied format if (info->internalID == (uint32)id) { printf("AddOnManager::GetEncoderForFormat: found encoder %s for " - "id %ld\n", info->ref.name, id); + "id %" B_PRId32 "\n", info->ref.name, id); *_encoderRef = info->ref; return B_OK; @@ -183,7 +183,7 @@ AddOnManager::GetEncoder(xfer_entry_ref* _encoderRef, int32 id) } printf("AddOnManager::GetEncoderForFormat: failed to find encoder for id " - "%ld\n", id); + "%" B_PRId32 "\n", id); return B_ENTRY_NOT_FOUND; } @@ -198,7 +198,7 @@ AddOnManager::GetWriter(xfer_entry_ref* _ref, uint32 internalID) for (fWriterList.Rewind(); fWriterList.GetNext(&info);) { if (info->internalID == internalID) { printf("AddOnManager::GetWriter: found writer %s for " - "internal_id %lu\n", info->ref.name, internalID); + "internal_id %" B_PRId32 "\n", info->ref.name, internalID); *_ref = info->ref; return B_OK; @@ -425,7 +425,7 @@ printf("removing writer '%s'\n", writerInfo->ref.name); encoder_info* encoderInfo; for (fEncoderList.Rewind(); fEncoderList.GetNext(&encoderInfo);) { if (encoderInfo->ref == ref) { -printf("removing encoder '%s', id %lu\n", encoderInfo->ref.name, +printf("removing encoder '%s', id %" B_PRIu32 "\n", encoderInfo->ref.name, encoderInfo->internalID); fEncoderList.RemoveCurrent(); // Keep going, since we add multiple encoder infos per add-on. @@ -600,7 +600,7 @@ AddOnManager::_FindDecoder(const media_format& format, const BPath& path, continue; printf("AddOnManager::GetDecoderForFormat: found decoder %s/%s " - "for encoding %ld\n", path.Path(), info->ref.name, + "for encoding %" B_PRIu32 "\n", path.Path(), info->ref.name, decoderFormat->Encoding()); *_decoderRef = info->ref; diff --git a/src/servers/media/AppManager.cpp b/src/servers/media/AppManager.cpp index 083a871f42..589dabd0ba 100644 --- a/src/servers/media/AppManager.cpp +++ b/src/servers/media/AppManager.cpp @@ -77,9 +77,10 @@ AppManager::RegisterTeam(team_id team, const BMessenger& messenger) { BAutolock lock(this); - TRACE("AppManager::RegisterTeam %ld\n", team); + TRACE("AppManager::RegisterTeam %" B_PRId32 "\n", team); if (HasTeam(team)) { - ERROR("AppManager::RegisterTeam: team %ld already registered\n", team); + ERROR("AppManager::RegisterTeam: team %" B_PRId32 " already" + " registered\n", team); return B_ERROR; } @@ -96,7 +97,7 @@ AppManager::RegisterTeam(team_id team, const BMessenger& messenger) status_t AppManager::UnregisterTeam(team_id team) { - TRACE("AppManager::UnregisterTeam %ld\n", team); + TRACE("AppManager::UnregisterTeam %" B_PRId32 "\n", team); Lock(); bool isRemoved = fMap.erase(team) != 0; @@ -146,8 +147,9 @@ AppManager::Dump() for (; iterator != fMap.end(); iterator++) { app_info info; be_roster->GetRunningAppInfo(iterator->first, &info); - printf(" team %ld \"%s\", messenger %svalid\n", iterator->first, - info.ref.name, iterator->second.IsValid() ? "" : "NOT "); + printf(" team %" B_PRId32 " \"%s\", messenger %svalid\n", + iterator->first, info.ref.name, + iterator->second.IsValid() ? "" : "NOT "); } printf("AppManager: list end\n"); @@ -159,7 +161,7 @@ AppManager::_CleanupTeam(team_id team) { ASSERT(!IsLocked()); - TRACE("AppManager: cleaning up team %ld\n", team); + TRACE("AppManager: cleaning up team %" B_PRId32 "\n", team); gNodeManager->CleanupTeam(team); gBufferManager->CleanupTeam(team); diff --git a/src/servers/media/BufferManager.cpp b/src/servers/media/BufferManager.cpp index 2f821c30bc..2db9a55116 100644 --- a/src/servers/media/BufferManager.cpp +++ b/src/servers/media/BufferManager.cpp @@ -44,12 +44,13 @@ BufferManager::RegisterBuffer(team_id team, media_buffer_id bufferID, { BAutolock lock(fLocker); - TRACE("RegisterBuffer team = %ld, bufferid = %ld\n", team, bufferID); + TRACE("RegisterBuffer team = %" B_PRId32 ", bufferid = %" B_PRId32 "\n", + team, bufferID); buffer_info* info; if (!fBufferInfoMap.Get(bufferID, info)) { - ERROR("failed to register buffer! team = %ld, bufferid = %ld\n", team, - bufferID); + ERROR("failed to register buffer! team = %" B_PRId32 ", bufferid = %" + B_PRId32 "\n", team, bufferID); return B_ERROR; } @@ -74,8 +75,9 @@ BufferManager::RegisterBuffer(team_id team, size_t size, int32 flags, area_id clonedArea = _CloneArea(area); if (clonedArea < 0) { - ERROR("RegisterBuffer: failed to clone buffer! error = %#lx, team = " - "%ld, area = %ld, offset = %ld, size = %ld\n", clonedArea, team, + ERROR("RegisterBuffer: failed to clone buffer! error = %#" B_PRIx32 + ", team = %" B_PRId32 ", area = %" B_PRId32 ", offset = %" + B_PRIuSIZE ", size = %" B_PRIuSIZE "\n", clonedArea, team, area, offset, size); return clonedArea; } @@ -107,31 +109,32 @@ status_t BufferManager::UnregisterBuffer(team_id team, media_buffer_id bufferID) { BAutolock lock(fLocker); - TRACE("UnregisterBuffer: team = %ld, bufferID = %ld\n", team, bufferID); + TRACE("UnregisterBuffer: team = %" B_PRId32 ", bufferID = %" B_PRId32 "\n", + team, bufferID); buffer_info* info; if (!fBufferInfoMap.Get(bufferID, info)) { - ERROR("UnregisterBuffer: failed to unregister buffer! team = %ld, " - "bufferID = %ld\n", team, bufferID); + ERROR("UnregisterBuffer: failed to unregister buffer! team = %" + B_PRId32 ", bufferID = %" B_PRId32 "\n", team, bufferID); return B_ERROR; } if (info->teams.find(team) == info->teams.end()) { - ERROR("UnregisterBuffer: failed to find team = %ld belonging to " - "bufferID = %ld\n", team, bufferID); + ERROR("UnregisterBuffer: failed to find team = %" B_PRId32 " belonging" + " to bufferID = %" B_PRId32 "\n", team, bufferID); return B_ERROR; } info->teams.erase(team); - TRACE("UnregisterBuffer: team = %ld removed from bufferID = %ld\n", team, - bufferID); + TRACE("UnregisterBuffer: team = %" B_PRId32 " removed from bufferID = %" + B_PRId32 "\n", team, bufferID); if (info->teams.empty()) { _ReleaseClonedArea(info->area); fBufferInfoMap.Remove(bufferID); - TRACE("UnregisterBuffer: bufferID = %ld removed\n", bufferID); + TRACE("UnregisterBuffer: bufferID = %" B_PRId32 " removed\n", bufferID); } return B_OK; @@ -143,7 +146,7 @@ BufferManager::CleanupTeam(team_id team) { BAutolock lock(fLocker); - TRACE("BufferManager::CleanupTeam: team %ld\n", team); + TRACE("BufferManager::CleanupTeam: team %" B_PRId32 "\n", team); BufferInfoMap::Iterator iterator = fBufferInfoMap.GetIterator(); while (iterator.HasNext()) { @@ -152,8 +155,8 @@ BufferManager::CleanupTeam(team_id team) entry.value.teams.erase(team); if (entry.value.teams.empty()) { - PRINT(1, "BufferManager::CleanupTeam: removing buffer id %ld that " - "has no teams\n", entry.key.GetHashCode()); + PRINT(1, "BufferManager::CleanupTeam: removing buffer id %" + B_PRId32 " that has no teams\n", entry.key.GetHashCode()); _ReleaseClonedArea(entry.value.area); iterator.Remove(); } @@ -172,13 +175,14 @@ BufferManager::Dump() BufferInfoMap::Iterator iterator = fBufferInfoMap.GetIterator(); while (iterator.HasNext()) { buffer_info& info = *iterator.NextValue(); - printf(" buffer-id %ld, area-id %ld, offset %ld, size %ld, flags " - "%#08lx\n", info.id, info.area, info.offset, info.size, info.flags); + printf(" buffer-id %" B_PRId32 ", area-id %" B_PRId32 ", offset %ld, " + "size %ld, flags %#08" B_PRIx32 "\n", info.id, info.area, + info.offset, info.size, info.flags); printf(" assigned teams: "); std::set::iterator teamIterator = info.teams.begin(); for (; teamIterator != info.teams.end(); teamIterator++) { - printf("%ld, ", *teamIterator); + printf("%" B_PRId32 ", ", *teamIterator); } printf("\n"); } @@ -193,8 +197,8 @@ BufferManager::_CloneArea(area_id area) clone_info* info; if (fCloneInfoMap.Get(area, info)) { // we have already cloned this particular area - TRACE("BufferManager::_CloneArea() area %ld has already been " - "cloned (id %ld)\n", area, info->clone); + TRACE("BufferManager::_CloneArea() area %" B_PRId32 " has already" + " been cloned (id %" B_PRId32 ")\n", area, info->clone); info->ref_count++; return info->clone; @@ -205,8 +209,8 @@ BufferManager::_CloneArea(area_id area) area_id clonedArea = clone_area("media_server cloned buffer", &address, B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area); - TRACE("BufferManager::_CloneArea() cloned area %ld, clone id %ld\n", - area, clonedArea); + TRACE("BufferManager::_CloneArea() cloned area %" B_PRId32 ", clone id %" + B_PRId32 "\n", area, clonedArea); if (clonedArea < 0) return clonedArea; @@ -235,19 +239,19 @@ BufferManager::_ReleaseClonedArea(area_id clone) clone_info* info; if (!fCloneInfoMap.Get(source, info)) { ERROR("BufferManager::_ReleaseClonedArea(): could not find clone info " - "for id %ld (clone %ld)\n", source, clone); + "for id %" B_PRId32 " (clone %" B_PRId32 ")\n", source, clone); return; } if (--info->ref_count == 0) { - TRACE("BufferManager::_ReleaseClonedArea(): delete cloned area %ld " - "(source %ld)\n", clone, source); + TRACE("BufferManager::_ReleaseClonedArea(): delete cloned area %" + B_PRId32 " (source %" B_PRId32 ")\n", clone, source); fSourceInfoMap.Remove(clone); fCloneInfoMap.Remove(source); delete_area(clone); } else { - TRACE("BufferManager::_ReleaseClonedArea(): released cloned area %ld " - "(source %ld)\n", clone, source); + TRACE("BufferManager::_ReleaseClonedArea(): released cloned area %" + B_PRId32 " (source %" B_PRId32 ")\n", clone, source); } } diff --git a/src/servers/media/FormatManager.cpp b/src/servers/media/FormatManager.cpp index fd3e48e5c8..6d0e3b3641 100644 --- a/src/servers/media/FormatManager.cpp +++ b/src/servers/media/FormatManager.cpp @@ -173,8 +173,8 @@ FormatManager::GetFormats(BMessage& message) reply.AddInt64("timestamp", system_time()); int32 count = fList.CountItems(); - printf("FormatManager::GetFormats(): put %ld formats into message\n", - count); + printf("FormatManager::GetFormats(): put %" B_PRId32 " formats into " + "message\n", count); for (int32 i = 0; i < count; i++) { meta_format* format = fList.ItemAt(i); reply.AddData("formats", MEDIA_META_FORMAT_TYPE, format, @@ -289,7 +289,7 @@ FormatManager::RemoveFormat(const media_format& format) if (metaFormat->format == format) { if (foundIndex != -1) { printf("FormatManager::RemoveFormat() - format already " - "present at previous index: %ld\n", foundIndex); + "present at previous index: %" B_PRId32 "\n", foundIndex); } foundIndex = i; } diff --git a/src/servers/media/NodeManager.cpp b/src/servers/media/NodeManager.cpp index b0f585bb2a..69e72c693d 100644 --- a/src/servers/media/NodeManager.cpp +++ b/src/servers/media/NodeManager.cpp @@ -168,9 +168,10 @@ NodeManager::RegisterNode(media_addon_id addOnID, int32 flavorID, *_nodeID = fNextNodeID++; - TRACE("NodeManager::RegisterNode: node %ld, addon_id %ld, flavor_id %ld, " - "name \"%s\", kinds %#Lx, port %ld, team %ld\n", *_nodeID, addOnID, - flavorID, name, kinds, port, team); + TRACE("NodeManager::RegisterNode: node %" B_PRId32 ", addon_id %" B_PRId32 + ", flavor_id %" B_PRId32 ", name \"%s\", kinds %#Lx, port %" B_PRId32 + ", team %" B_PRId32 "\n", *_nodeID, addOnID, flavorID, name, kinds, + port, team); return B_OK; } @@ -179,28 +180,30 @@ status_t NodeManager::UnregisterNode(media_node_id id, team_id team, media_addon_id* _addOnID, int32* _flavorID) { - TRACE("NodeManager::UnregisterNode enter: node %ld, team %ld\n", id, team); + TRACE("NodeManager::UnregisterNode enter: node %" B_PRId32 ", team %" + B_PRId32 "\n", id, team); BAutolock _(this); NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::UnregisterNode: couldn't find node %ld (team " - "%ld)\n", id, team); + ERROR("NodeManager::UnregisterNode: couldn't find node %" B_PRId32 + " (team %" B_PRId32 ")\n", id, team); return B_ERROR; } registered_node& node = found->second; if (node.containing_team != team) { - ERROR("NodeManager::UnregisterNode: team %ld tried to unregister " - "node %ld, but it was instantiated by team %ld\n", team, id, - node.containing_team); + ERROR("NodeManager::UnregisterNode: team %" B_PRId32 " tried to " + "unregister node %" B_PRId32 ", but it was instantiated by team %" + B_PRId32 "\n", team, id, node.containing_team); return B_ERROR; } if (node.ref_count != 1) { - ERROR("NodeManager::UnregisterNode: node %ld, team %ld has ref count " - "%ld (should be 1)\n", id, team, node.ref_count); + ERROR("NodeManager::UnregisterNode: node %" B_PRId32 ", team %" + B_PRId32 " has ref count %" B_PRId32 " (should be 1)\n", id, team, + node.ref_count); //return B_ERROR; } @@ -209,8 +212,9 @@ NodeManager::UnregisterNode(media_node_id id, team_id team, fNodeMap.erase(found); - TRACE("NodeManager::UnregisterNode leave: node %ld, addon_id %ld, " - "flavor_id %ld team %ld\n", id, *_addOnID, *_flavorID, team); + TRACE("NodeManager::UnregisterNode leave: node %" B_PRId32 ", addon_id %" + B_PRId32 ", flavor_id %" B_PRId32 " team %" B_PRId32 "\n", id, + *_addOnID, *_flavorID, team); return B_OK; } @@ -218,14 +222,15 @@ NodeManager::UnregisterNode(media_node_id id, team_id team, status_t NodeManager::ReleaseNodeReference(media_node_id id, team_id team) { - TRACE("NodeManager::ReleaseNodeReference enter: node %ld, team %ld\n", id, - team); + TRACE("NodeManager::ReleaseNodeReference enter: node %" B_PRId32 ", team %" + B_PRId32 "\n", id, team); BAutolock _(this); NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::ReleaseNodeReference: node %ld not found\n", id); + ERROR("NodeManager::ReleaseNodeReference: node %" B_PRId32 " not " + "found\n", id); return B_ERROR; } @@ -246,8 +251,8 @@ NodeManager::ReleaseNodeReference(media_node_id id, team_id team) node.creator = -1; // invalidate! team = addOnServer; } else { - ERROR("NodeManager::ReleaseNodeReference: node %ld has no team " - "%ld references\n", id, team); + ERROR("NodeManager::ReleaseNodeReference: node %" B_PRId32 " has " + "no team %" B_PRId32 " references\n", id, team); return B_ERROR; } } @@ -261,8 +266,8 @@ NodeManager::ReleaseNodeReference(media_node_id id, team_id team) node.team_ref_count.erase(teamRef); if (--node.ref_count == 0) { - PRINT(1, "NodeManager::ReleaseNodeReference: detected released node is " - "now unused, node %ld\n", id); + PRINT(1, "NodeManager::ReleaseNodeReference: detected released node is" + " now unused, node %" B_PRId32 "\n", id); // TODO: remove! node_final_release_command command; @@ -270,13 +275,14 @@ NodeManager::ReleaseNodeReference(media_node_id id, team_id team) sizeof(command)); if (status != B_OK) { ERROR("NodeManager::ReleaseNodeReference: can't send command to " - "node %ld\n", id); + "node %" B_PRId32 "\n", id); // ignore error } } - TRACE("NodeManager::ReleaseNodeReference leave: node %ld, team %ld, " - "ref %ld, team ref %ld\n", id, team, node.ref_count, teamCount); + TRACE("NodeManager::ReleaseNodeReference leave: node %" B_PRId32 ", team %" + B_PRId32 ", ref %" B_PRId32 ", team ref %" B_PRId32 "\n", id, team, + node.ref_count, teamCount); return B_OK; } @@ -284,13 +290,14 @@ NodeManager::ReleaseNodeReference(media_node_id id, team_id team) status_t NodeManager::ReleaseNodeAll(media_node_id id) { - TRACE("NodeManager::ReleaseNodeAll enter: node %ld\n", id); + TRACE("NodeManager::ReleaseNodeAll enter: node %" B_PRId32 "\n", id); BAutolock _(this); NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::ReleaseNodeAll: node %ld not found\n", id); + ERROR("NodeManager::ReleaseNodeAll: node %" B_PRId32 " not found\n", + id); return B_ERROR; } @@ -303,11 +310,11 @@ NodeManager::ReleaseNodeAll(media_node_id id) sizeof(command)); if (status != B_OK) { ERROR("NodeManager::ReleaseNodeAll: can't send command to " - "node %ld\n", id); + "node %" B_PRId32 "\n", id); // ignore error } - TRACE("NodeManager::ReleaseNodeAll leave: node %ld\n", id); + TRACE("NodeManager::ReleaseNodeAll leave: node %" B_PRId32 "\n", id); return B_OK; } @@ -315,21 +322,23 @@ NodeManager::ReleaseNodeAll(media_node_id id) status_t NodeManager::SetNodeCreator(media_node_id id, team_id creator) { - TRACE("NodeManager::SetNodeCreator node %ld, creator %ld\n", id, creator); + TRACE("NodeManager::SetNodeCreator node %" B_PRId32 ", creator %" B_PRId32 + "\n", id, creator); BAutolock _(this); NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::SetNodeCreator: node %ld not found\n", id); + ERROR("NodeManager::SetNodeCreator: node %" B_PRId32 " not found\n", + id); return B_ERROR; } registered_node& node = found->second; if (node.creator != -1) { - ERROR("NodeManager::SetNodeCreator: node %ld is already assigned " - "creator %ld\n", id, node.creator); + ERROR("NodeManager::SetNodeCreator: node %" B_PRId32 " is already" + " assigned creator %" B_PRId32 "\n", id, node.creator); return B_ERROR; } @@ -341,20 +350,22 @@ NodeManager::SetNodeCreator(media_node_id id, team_id creator) status_t NodeManager::GetCloneForID(media_node_id id, team_id team, media_node* node) { - TRACE("NodeManager::GetCloneForID enter: node %ld team %ld\n", id, team); + TRACE("NodeManager::GetCloneForID enter: node %" B_PRId32 " team %" + B_PRId32 "\n", id, team); BAutolock _(this); status_t status = _AcquireNodeReference(id, team); if (status != B_OK) { ERROR("NodeManager::GetCloneForID: couldn't increment ref count, " - "node %ld team %ld\n", id, team); + "node %" B_PRId32 " team %" B_PRId32 "\n", id, team); return status; } NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::GetCloneForID: node %ld not found\n", id); + ERROR("NodeManager::GetCloneForID: node %" B_PRId32 " not found\n", + id); return B_ERROR; } @@ -364,7 +375,8 @@ NodeManager::GetCloneForID(media_node_id id, team_id team, media_node* node) node->port = registeredNode.port; node->kind = registeredNode.kinds; - TRACE("NodeManager::GetCloneForID leave: node %ld team %ld\n", id, team); + TRACE("NodeManager::GetCloneForID leave: node %" B_PRId32 " team %" + B_PRId32 "\n", id, team); return B_OK; } @@ -382,13 +394,14 @@ NodeManager::GetClone(node_type type, team_id team, media_node* node, { BAutolock _(this); - TRACE("NodeManager::GetClone enter: team %ld, type %d (%s)\n", team, type, get_node_type(type)); + TRACE("NodeManager::GetClone enter: team %" B_PRId32 ", type %d (%s)\n", + team, type, get_node_type(type)); media_node_id id; status_t status = GetDefaultNode(type, &id, inputName, _inputID); if (status != B_OK) { - ERROR("NodeManager::GetClone: couldn't GetDefaultNode, team %ld, " - "type %d (%s)\n", team, type, get_node_type(type)); + ERROR("NodeManager::GetClone: couldn't GetDefaultNode, team %" B_PRId32 + ", type %d (%s)\n", team, type, get_node_type(type)); *node = media_node::null; return status; } @@ -396,15 +409,16 @@ NodeManager::GetClone(node_type type, team_id team, media_node* node, status = GetCloneForID(id, team, node); if (status != B_OK) { - ERROR("NodeManager::GetClone: couldn't GetCloneForID, id %ld, team " - "%ld, type %d (%s)\n", id, team, type, get_node_type(type)); + ERROR("NodeManager::GetClone: couldn't GetCloneForID, id %" B_PRId32 + ", team %" B_PRId32 ", type %d (%s)\n", id, team, type, + get_node_type(type)); *node = media_node::null; return status; } ASSERT(id == node->node); - TRACE("NodeManager::GetClone leave: node id %ld, node port %ld, node " - "kind %#lx\n", node->node, node->port, node->kind); + TRACE("NodeManager::GetClone leave: node id %" B_PRId32 ", node port %" + B_PRId32 ", node kind %#lx\n", node->node, node->port, node->kind); return B_OK; } @@ -412,12 +426,12 @@ NodeManager::GetClone(node_type type, team_id team, media_node* node, status_t NodeManager::ReleaseNode(const media_node& node, team_id team) { - TRACE("NodeManager::ReleaseNode enter: node %ld team %ld\n", node.node, - team); + TRACE("NodeManager::ReleaseNode enter: node %" B_PRId32 " team %" B_PRId32 + "\n", node.node, team); if (ReleaseNodeReference(node.node, team) != B_OK) { - ERROR("NodeManager::ReleaseNode: couldn't decrement node %ld team %ld " - "ref count\n", node.node, team); + ERROR("NodeManager::ReleaseNode: couldn't decrement node %" B_PRId32 + " team %" B_PRId32 " ref count\n", node.node, team); } return B_OK; @@ -432,7 +446,8 @@ NodeManager::PublishInputs(const media_node& node, const media_input* inputs, NodeMap::iterator found = fNodeMap.find(node.node); if (found == fNodeMap.end()) { - ERROR("NodeManager::PublishInputs: node %ld not found\n", node.node); + ERROR("NodeManager::PublishInputs: node %" B_PRId32 " not found\n", + node.node); return B_ERROR; } @@ -459,7 +474,8 @@ NodeManager::PublishOutputs(const media_node &node, const media_output* outputs, NodeMap::iterator found = fNodeMap.find(node.node); if (found == fNodeMap.end()) { - ERROR("NodeManager::PublishOutputs: node %ld not found\n", node.node); + ERROR("NodeManager::PublishOutputs: node %" B_PRId32 " not found\n", + node.node); return B_ERROR; } @@ -489,8 +505,8 @@ NodeManager::FindNodeID(port_id port, media_node_id* _id) if (node.port == port) { *_id = node.node_id; - TRACE("NodeManager::FindNodeID found port %ld, node %ld\n", port, - node.node_id); + TRACE("NodeManager::FindNodeID found port %" B_PRId32 ", node %" + B_PRId32 "\n", port, node.node_id); return B_OK; } @@ -498,8 +514,8 @@ NodeManager::FindNodeID(port_id port, media_node_id* _id) for (; outIterator != node.output_list.end(); outIterator++) { if (outIterator->source.port == port) { *_id = node.node_id; - TRACE("NodeManager::FindNodeID found output port %ld, node " - "%ld\n", port, node.node_id); + TRACE("NodeManager::FindNodeID found output port %" B_PRId32 + ", node %" B_PRId32 "\n", port, node.node_id); return B_OK; } } @@ -508,14 +524,14 @@ NodeManager::FindNodeID(port_id port, media_node_id* _id) for (; inIterator != node.input_list.end(); inIterator++) { if (inIterator->destination.port == port) { *_id = node.node_id; - TRACE("NodeManager::FindNodeID found input port %ld, node " - "%ld\n", port, node.node_id); + TRACE("NodeManager::FindNodeID found input port %" B_PRId32 + ", node %" B_PRId32 "\n", port, node.node_id); return B_OK; } } } - ERROR("NodeManager::FindNodeID failed, port %ld\n", port); + ERROR("NodeManager::FindNodeID failed, port %" B_PRId32 "\n", port); return B_ERROR; } @@ -529,8 +545,8 @@ NodeManager::GetDormantNodeInfo(const media_node& node, NodeMap::iterator found = fNodeMap.find(node.node); if (found == fNodeMap.end()) { - ERROR("NodeManager::GetDormantNodeInfo: node %ld not found\n", - node.node); + ERROR("NodeManager::GetDormantNodeInfo: node %" B_PRId32 " not found" + "\n", node.node); return B_ERROR; } @@ -540,9 +556,9 @@ NodeManager::GetDormantNodeInfo(const media_node& node, && node.node != NODE_SYSTEM_TIMESOURCE_ID) { // This function must return an error if the node is application owned TRACE("NodeManager::GetDormantNodeInfo NODE IS APPLICATION OWNED! " - "node %ld, add_on_id %ld, flavor_id %ld, name \"%s\"\n", node.node, - registeredNode.add_on_id, registeredNode.flavor_id, - registeredNode.name); + "node %" B_PRId32 ", add_on_id %" B_PRId32 ", flavor_id %" B_PRId32 + ", name \"%s\"\n", node.node, registeredNode.add_on_id, + registeredNode.flavor_id, registeredNode.name); return B_ERROR; } @@ -554,9 +570,10 @@ NodeManager::GetDormantNodeInfo(const media_node& node, nodeInfo->flavor_id = registeredNode.flavor_id; strlcpy(nodeInfo->name, registeredNode.name, sizeof(nodeInfo->name)); - TRACE("NodeManager::GetDormantNodeInfo node %ld, add_on_id %ld, " - "flavor_id %ld, name \"%s\"\n", node.node, registeredNode.add_on_id, - registeredNode.flavor_id, registeredNode.name); + TRACE("NodeManager::GetDormantNodeInfo node %" B_PRId32 ", add_on_id %" + B_PRId32 ", flavor_id %" B_PRId32 ", name \"%s\"\n", node.node, + registeredNode.add_on_id, registeredNode.flavor_id, + registeredNode.name); return B_OK; } @@ -568,7 +585,7 @@ NodeManager::GetLiveNodeInfo(const media_node& node, live_node_info* liveInfo) NodeMap::iterator found = fNodeMap.find(node.node); if (found == fNodeMap.end()) { - ERROR("NodeManager::GetLiveNodeInfo: node %ld not found\n", + ERROR("NodeManager::GetLiveNodeInfo: node %" B_PRId32 " not found\n", node.node); return B_ERROR; } @@ -583,8 +600,8 @@ NodeManager::GetLiveNodeInfo(const media_node& node, live_node_info* liveInfo) liveInfo->hint_point = BPoint(0, 0); strlcpy(liveInfo->name, registeredNode.name, sizeof(liveInfo->name)); - TRACE("NodeManager::GetLiveNodeInfo node %ld, name = \"%s\"\n", node.node, - registeredNode.name); + TRACE("NodeManager::GetLiveNodeInfo node %" B_PRId32 ", name = \"%s\"\n", + node.node, registeredNode.name); return B_OK; } @@ -604,8 +621,9 @@ NodeManager::GetInstances(media_addon_id addOnID, int32 flavorID, ids[count++] = node.node_id; } - TRACE("NodeManager::GetInstances found %ld instances for addon_id %ld, " - "flavor_id %ld\n", count, addOnID, flavorID); + TRACE("NodeManager::GetInstances found %" B_PRId32 " instances for " + "addon_id %" B_PRId32 ", flavor_id %" B_PRId32 "\n", count, addOnID, + flavorID); *_count = count; return B_OK; } @@ -616,9 +634,9 @@ NodeManager::GetLiveNodes(LiveNodeList& liveNodes, int32 maxCount, const media_format* inputFormat, const media_format* outputFormat, const char* name, uint64 requireKinds) { - TRACE("NodeManager::GetLiveNodes: maxCount %ld, in-format %p, out-format " - "%p, name %s, require kinds 0x%Lx\n", maxCount, inputFormat, - outputFormat, name != NULL ? name : "NULL", requireKinds); + TRACE("NodeManager::GetLiveNodes: maxCount %" B_PRId32 ", in-format %p, " + "out-format %p, name %s, require kinds 0x%" B_PRIx64 "\n", maxCount, + inputFormat, outputFormat, name != NULL ? name : "NULL", requireKinds); BAutolock _(this); @@ -694,7 +712,7 @@ NodeManager::GetLiveNodes(LiveNodeList& liveNodes, int32 maxCount, count++; } - TRACE("NodeManager::GetLiveNodes found %ld\n", count); + TRACE("NodeManager::GetLiveNodes found %" B_PRId32 "\n", count); return B_OK; } @@ -729,8 +747,8 @@ NodeManager::RegisterAddOn(const entry_ref& ref, media_addon_id* _newID) media_addon_id id = fNextAddOnID++; -// printf("NodeManager::RegisterAddOn: ref-name \"%s\", assigning id %ld\n", -// ref.name, id); +// printf("NodeManager::RegisterAddOn: ref-name \"%s\", assigning id %" +// B_PRId32 "\n", ref.name, id); try { fPathMap.insert(std::make_pair(id, ref)); @@ -744,7 +762,7 @@ NodeManager::RegisterAddOn(const entry_ref& ref, media_addon_id* _newID) void NodeManager::UnregisterAddOn(media_addon_id addOnID) { - PRINT(1, "NodeManager::UnregisterAddOn: id %ld\n", addOnID); + PRINT(1, "NodeManager::UnregisterAddOn: id %" B_PRId32 "\n", addOnID); BAutolock _(this); @@ -774,10 +792,11 @@ NodeManager::GetAddOnRef(media_addon_id addOnID, entry_ref* ref) status_t NodeManager::AddDormantFlavorInfo(const dormant_flavor_info& flavorInfo) { - PRINT(1, "NodeManager::AddDormantFlavorInfo, addon-id %ld, flavor-id %ld, " - "name \"%s\", flavor-name \"%s\", flavor-info \"%s\"\n", - flavorInfo.node_info.addon, flavorInfo.node_info.flavor_id, - flavorInfo.node_info.name, flavorInfo.name, flavorInfo.info); + PRINT(1, "NodeManager::AddDormantFlavorInfo, addon-id %" B_PRId32 ", " + "flavor-id %" B_PRId32 ", name \"%s\", flavor-name \"%s\", flavor-info" + " \"%s\"\n", flavorInfo.node_info.addon, + flavorInfo.node_info.flavor_id, flavorInfo.node_info.name, + flavorInfo.name, flavorInfo.info); BAutolock _(this); @@ -794,13 +813,13 @@ NodeManager::AddDormantFlavorInfo(const dormant_flavor_info& flavorInfo) continue; if (info.info_valid) { - ERROR("NodeManager::AddDormantFlavorInfo, addon-id %ld, " - "flavor-id %ld does already exist\n", info.info.node_info.addon, - info.info.node_info.flavor_id); + ERROR("NodeManager::AddDormantFlavorInfo, addon-id %" B_PRId32 ", " + "flavor-id %" B_PRId32 " does already exist\n", + info.info.node_info.addon, info.info.node_info.flavor_id); } - TRACE("NodeManager::AddDormantFlavorInfo, updating addon-id %ld, " - "flavor-id %ld\n", info.info.node_info.addon, + TRACE("NodeManager::AddDormantFlavorInfo, updating addon-id %" B_PRId32 + ", flavor-id %" B_PRId32 "\n", info.info.node_info.addon, info.info.node_info.flavor_id); info.max_instances_count = flavorInfo.possible_count > 0 @@ -842,9 +861,9 @@ NodeManager::InvalidateDormantFlavorInfo(media_addon_id addOnID) dormant_add_on_flavor_info& info = *iterator; if (info.add_on_id == addOnID && info.info_valid) { - PRINT(1, "NodeManager::InvalidateDormantFlavorInfo, addon-id %ld, " - "flavor-id %ld, name \"%s\", flavor-name \"%s\", flavor-info " - "\"%s\"\n", info.info.node_info.addon, + PRINT(1, "NodeManager::InvalidateDormantFlavorInfo, addon-id %" + B_PRId32 ", flavor-id %" B_PRId32 ", name \"%s\", flavor-name " + "\"%s\", flavor-info \"%s\"\n", info.info.node_info.addon, info.info.node_info.flavor_id, info.info.node_info.name, info.info.name, info.info.info); @@ -864,9 +883,9 @@ NodeManager::RemoveDormantFlavorInfo(media_addon_id addOnID) dormant_add_on_flavor_info& info = fDormantFlavors[index]; if (info.add_on_id == addOnID) { - PRINT(1, "NodeManager::RemoveDormantFlavorInfo, addon-id %ld, " - "flavor-id %ld, name \"%s\", flavor-name \"%s\", flavor-info " - "\"%s\"\n", info.info.node_info.addon, + PRINT(1, "NodeManager::RemoveDormantFlavorInfo, addon-id %" + B_PRId32 ", flavor-id %" B_PRId32 ", name \"%s\", flavor-name " + "\"%s\", flavor-info \"%s\"\n", info.info.node_info.addon, info.info.node_info.flavor_id, info.info.node_info.name, info.info.name, info.info.info); fDormantFlavors.erase(fDormantFlavors.begin() + index--); @@ -890,9 +909,9 @@ NodeManager::IncrementFlavorInstancesCount(media_addon_id addOnID, if (info.instances_count >= info.max_instances_count) { // maximum (or more) instances already exist - ERROR("NodeManager::IncrementFlavorInstancesCount addon-id %ld, " - "flavor-id %ld maximum (or more) instances already exist\n", - addOnID, flavorID); + ERROR("NodeManager::IncrementFlavorInstancesCount addon-id %" + B_PRId32 ", flavor-id %" B_PRId32 " maximum (or more) " + "instances already exist\n", addOnID, flavorID); return B_ERROR; } @@ -914,8 +933,8 @@ NodeManager::IncrementFlavorInstancesCount(media_addon_id addOnID, return B_OK; } - ERROR("NodeManager::IncrementFlavorInstancesCount addon-id %ld, " - "flavor-id %ld not found\n", addOnID, flavorID); + ERROR("NodeManager::IncrementFlavorInstancesCount addon-id %" B_PRId32 ", " + "flavor-id %" B_PRId32 " not found\n", addOnID, flavorID); return B_ERROR; } @@ -936,9 +955,9 @@ NodeManager::DecrementFlavorInstancesCount(media_addon_id addOnID, TeamCountMap::iterator teamInstance = info.team_instances_count.find(team); if (teamInstance == info.team_instances_count.end()) { - ERROR("NodeManager::DecrementFlavorInstancesCount addon-id %ld, " - "flavor-id %ld team %ld has no references\n", addOnID, flavorID, - team); + ERROR("NodeManager::DecrementFlavorInstancesCount addon-id %" + B_PRId32 ", flavor-id %" B_PRId32 " team %" B_PRId32 " has no " + "references\n", addOnID, flavorID, team); return B_ERROR; } if (--teamInstance->second == 0) @@ -948,8 +967,8 @@ NodeManager::DecrementFlavorInstancesCount(media_addon_id addOnID, return B_OK; } - ERROR("NodeManager::DecrementFlavorInstancesCount addon-id %ld, " - "flavor-id %ld not found\n", addOnID, flavorID); + ERROR("NodeManager::DecrementFlavorInstancesCount addon-id %" B_PRId32 ", " + "flavor-id %" B_PRId32 " not found\n", addOnID, flavorID); return B_ERROR; } @@ -1070,7 +1089,7 @@ NodeManager::CleanupTeam(team_id team) fDefaultManager->CleanupTeam(team); - PRINT(1, "NodeManager::CleanupTeam: team %ld\n", team); + PRINT(1, "NodeManager::CleanupTeam: team %" B_PRId32 "\n", team); // TODO: send notifications after removing nodes @@ -1091,8 +1110,8 @@ NodeManager::CleanupTeam(team_id team) // If the team hosting this node is gone, remove node from database if (node.containing_team == team) { - PRINT(1, "NodeManager::CleanupTeam: removing node id %ld, team " - "%ld\n", node.node_id, team); + PRINT(1, "NodeManager::CleanupTeam: removing node id %" B_PRId32 + ", team %" B_PRId32 "\n", node.node_id, team); fNodeMap.erase(remove); continue; } @@ -1101,12 +1120,13 @@ NodeManager::CleanupTeam(team_id team) // remove the team TeamCountMap::iterator teamRef = node.team_ref_count.find(team); if (teamRef != node.team_ref_count.end()) { - PRINT(1, "NodeManager::CleanupTeam: removing %ld refs from node " - "id %ld, team %ld\n", teamRef->second, node.node_id, team); + PRINT(1, "NodeManager::CleanupTeam: removing %" B_PRId32 " refs " + "from node id %" B_PRId32 ", team %" B_PRId32 "\n", + teamRef->second, node.node_id, team); node.ref_count -= teamRef->second; if (node.ref_count == 0) { - PRINT(1, "NodeManager::CleanupTeam: removing node id %ld that " - "has no teams\n", node.node_id); + PRINT(1, "NodeManager::CleanupTeam: removing node id %" + B_PRId32 " that has no teams\n", node.node_id); fNodeMap.erase(remove); } else @@ -1122,9 +1142,10 @@ NodeManager::CleanupTeam(team_id team) TeamCountMap::iterator instanceCount = flavorInfo.team_instances_count.find(team); if (instanceCount != flavorInfo.team_instances_count.end()) { - PRINT(1, "NodeManager::CleanupTeam: removing %ld instances from " - "addon %ld, flavor %ld\n", instanceCount->second, - flavorInfo.add_on_id, flavorInfo.flavor_id); + PRINT(1, "NodeManager::CleanupTeam: removing %" B_PRId32 " " + "instances from addon %" B_PRId32 ", flavor %" B_PRId32 "\n", + instanceCount->second, flavorInfo.add_on_id, + flavorInfo.flavor_id); flavorInfo.instances_count -= instanceCount->second; if (flavorInfo.instances_count <= 0) @@ -1163,7 +1184,7 @@ NodeManager::Dump() for (PathMap::iterator iterator = fPathMap.begin(); iterator != fPathMap.end(); iterator++) { BPath path(&iterator->second); - printf(" addon-id %ld, path \"%s\"\n", iterator->first, + printf(" addon-id %" B_PRId32 ", path \"%s\"\n", iterator->first, path.InitCheck() == B_OK ? path.Path() : "INVALID"); } @@ -1177,24 +1198,27 @@ NodeManager::Dump() iterator != fNodeMap.end(); iterator++) { registered_node& node = iterator->second; - printf(" node-id %ld, addon-id %ld, addon-flavor-id %ld, port %ld, " - "creator %ld, team %ld, kinds %#08Lx, name \"%s\", ref_count %ld\n", - node.node_id, node.add_on_id, node.flavor_id, node.port, - node.creator, node.containing_team, node.kinds, node.name, - node.ref_count); + printf(" node-id %" B_PRId32 ", addon-id %" B_PRId32 ", addon-flavor-" + "id %" B_PRId32 ", port %" B_PRId32 ", creator %" B_PRId32 ", " + "team %" B_PRId32 ", kinds %#08" B_PRIx64 ", name \"%s\", " + "ref_count %" B_PRId32 "\n", node.node_id, node.add_on_id, + node.flavor_id, node.port, node.creator, node.containing_team, + node.kinds, node.name, node.ref_count); printf(" teams (refcount): "); for (TeamCountMap::iterator refsIterator = node.team_ref_count.begin(); refsIterator != node.team_ref_count.end(); refsIterator++) { - printf("%ld (%ld), ", refsIterator->first, refsIterator->second); + printf("%" B_PRId32 " (%" B_PRId32 "), ", refsIterator->first, + refsIterator->second); } printf("\n"); for (InputList::iterator inIterator = node.input_list.begin(); inIterator != node.input_list.end(); inIterator++) { media_input& input = *inIterator; - printf(" media_input: node-id %ld, node-port %ld, source-port " - "%ld, source-id %ld, dest-port %ld, dest-id %ld, name " + printf(" media_input: node-id %" B_PRId32 ", node-port %" + B_PRId32 ", source-port %" B_PRId32 ", source-id %" B_PRId32 + ", dest-port %" B_PRId32 ", dest-id %" B_PRId32 ", name " "\"%s\"\n", input.node.node, input.node.port, input.source.port, input.source.id, input.destination.port, input.destination.id, input.name); @@ -1205,8 +1229,9 @@ NodeManager::Dump() for (OutputList::iterator outIterator = node.output_list.begin(); outIterator != node.output_list.end(); outIterator++) { media_output& output = *outIterator; - printf(" media_output: node-id %ld, node-port %ld, source-port " - "%ld, source-id %ld, dest-port %ld, dest-id %ld, name " + printf(" media_output: node-id %" B_PRId32 ", node-port %" + B_PRId32 ", source-port %" B_PRId32 ", source-id %" B_PRId32 + ", dest-port %" B_PRId32 ", dest-id %" B_PRId32 ", name " "\"%s\"\n", output.node.node, output.node.port, output.source.port, output.source.id, output.destination.port, output.destination.id, output.name); @@ -1226,9 +1251,9 @@ NodeManager::Dump() iterator != fDormantFlavors.end(); iterator++) { dormant_add_on_flavor_info& flavorInfo = *iterator; - printf(" addon-id %ld, flavor-id %ld, max instances count %ld, " - "instances count %ld, info valid %s\n", - flavorInfo.add_on_id, flavorInfo.flavor_id, + printf(" addon-id %" B_PRId32 ", flavor-id %" B_PRId32 ", max " + "instances count %" B_PRId32 ", instances count %" B_PRId32 ", " + "info valid %s\n", flavorInfo.add_on_id, flavorInfo.flavor_id, flavorInfo.max_instances_count, flavorInfo.instances_count, flavorInfo.info_valid ? "yes" : "no"); printf(" teams (instances): "); @@ -1236,18 +1261,20 @@ NodeManager::Dump() = flavorInfo.team_instances_count.begin(); countIterator != flavorInfo.team_instances_count.end(); countIterator++) { - printf("%ld (%ld), ", countIterator->first, countIterator->second); + printf("%" B_PRId32 " (%" B_PRId32 "), ", countIterator->first, + countIterator->second); } printf("\n"); if (!flavorInfo.info_valid) continue; - printf(" addon-id %ld, addon-flavor-id %ld, addon-name \"%s\"\n", - flavorInfo.info.node_info.addon, + printf(" addon-id %" B_PRId32 ", addon-flavor-id %" B_PRId32 ", " + "addon-name \"%s\"\n", flavorInfo.info.node_info.addon, flavorInfo.info.node_info.flavor_id, flavorInfo.info.node_info.name); - printf(" flavor-kinds %#08Lx, flavor_flags %#08lx, internal_id %ld, " - "possible_count %ld, in_format_count %ld, out_format_count %ld\n", + printf(" flavor-kinds %#08" B_PRIx64 ", flavor_flags %#08" B_PRIx32 + ", internal_id %" B_PRId32 ", possible_count %" B_PRId32 ", " + "in_format_count %" B_PRId32 ", out_format_count %" B_PRId32 "\n", flavorInfo.info.kinds, flavorInfo.info.flavor_flags, flavorInfo.info.internal_id, flavorInfo.info.possible_count, flavorInfo.info.in_format_count, flavorInfo.info.out_format_count); @@ -1266,14 +1293,15 @@ NodeManager::Dump() status_t NodeManager::_AcquireNodeReference(media_node_id id, team_id team) { - TRACE("NodeManager::_AcquireNodeReference enter: node %ld, team %ld\n", id, - team); + TRACE("NodeManager::_AcquireNodeReference enter: node %" B_PRId32 ", team " + "%" B_PRId32 "\n", id, team); BAutolock _(this); NodeMap::iterator found = fNodeMap.find(id); if (found == fNodeMap.end()) { - ERROR("NodeManager::_AcquireNodeReference: node %ld not found\n", id); + ERROR("NodeManager::_AcquireNodeReference: node %" B_PRId32 " not " + "found\n", id); return B_ERROR; } @@ -1294,8 +1322,8 @@ NodeManager::_AcquireNodeReference(media_node_id id, team_id team) node.ref_count++; - TRACE("NodeManager::_AcquireNodeReference leave: node %ld, team %ld, " - "ref %ld, team ref %ld\n", id, team, node.ref_count, - node.team_ref_count.find(team)->second); + TRACE("NodeManager::_AcquireNodeReference leave: node %" B_PRId32 ", team " + "%" B_PRId32 ", ref %" B_PRId32 ", team ref %" B_PRId32 "\n", id, team, + node.ref_count, node.team_ref_count.find(team)->second); return B_OK; } diff --git a/src/servers/media/NotificationManager.cpp b/src/servers/media/NotificationManager.cpp index 594de04200..de6accb4f5 100644 --- a/src/servers/media/NotificationManager.cpp +++ b/src/servers/media/NotificationManager.cpp @@ -257,7 +257,7 @@ NotificationManager::CleanupTeam(team_id team) if (debugCount != 0) { ERROR("NotificationManager::CleanupTeam: removed %d notifications for " - "team %ld\n", debugCount, team); + "team %" B_PRId32 "\n", debugCount, team); } } @@ -302,9 +302,9 @@ NotificationManager::Dump() printf("NotificationManager: list of subscribers follows:\n"); Notification *n; for (fNotificationList.Rewind(); fNotificationList.GetNext(&n); ) { - printf(" team %ld, what %#08lx, node-id %ld, node-port %ld, messenger " - "%svalid\n", n->team, n->what, n->node.node, n->node.port, - n->messenger.IsValid() ? "" : "NOT "); + printf(" team %" B_PRId32 ", what %#08" B_PRIx32 ", node-id %" B_PRId32 + ", node-port %" B_PRId32 ", messenger %svalid\n", n->team, n->what, + n->node.node, n->node.port, n->messenger.IsValid() ? "" : "NOT "); } printf("NotificationManager: list end\n"); } diff --git a/src/servers/media/media_server.cpp b/src/servers/media/media_server.cpp index f1cc958a97..31a81126b4 100644 --- a/src/servers/media/media_server.cpp +++ b/src/servers/media/media_server.cpp @@ -275,7 +275,7 @@ ServerApp::_QuitAddOnServer() void ServerApp::_HandleMessage(int32 code, const void* data, size_t size) { - TRACE("ServerApp::HandleMessage %#lx enter\n", code); + TRACE("ServerApp::HandleMessage %#" B_PRIx32 " enter\n", code); switch (code) { case SERVER_CHANGE_FLAVOR_INSTANCES_COUNT: { @@ -493,7 +493,7 @@ ServerApp::_HandleMessage(int32 code, const void* data, size_t size) B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request.area); if (clone < B_OK) { ERROR("SERVER_PUBLISH_INPUTS: failed to clone area, " - "error %#lx\n", clone); + "error %#" B_PRIx32 "\n", clone); status = clone; } else { status = gNodeManager->PublishInputs(request.node, inputs, @@ -522,7 +522,7 @@ ServerApp::_HandleMessage(int32 code, const void* data, size_t size) B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, request.area); if (clone < B_OK) { ERROR("SERVER_PUBLISH_OUTPUTS: failed to clone area, " - "error %#lx\n", clone); + "error %#" B_PRIx32 "\n", clone); status = clone; } else { status = gNodeManager->PublishOutputs(request.node, outputs, @@ -961,10 +961,10 @@ ServerApp::_HandleMessage(int32 code, const void* data, size_t size) } default: - printf("media_server: received unknown message code %#08lx\n", - code); + printf("media_server: received unknown message code %#08" B_PRIx32 + "\n", code); } - TRACE("ServerApp::HandleMessage %#lx leave\n", code); + TRACE("ServerApp::HandleMessage %#" B_PRIx32 " leave\n", code); } diff --git a/src/servers/media_addon/MediaAddonServer.cpp b/src/servers/media_addon/MediaAddonServer.cpp index 19554c8984..a644f584dd 100644 --- a/src/servers/media_addon/MediaAddonServer.cpp +++ b/src/servers/media_addon/MediaAddonServer.cpp @@ -426,8 +426,8 @@ MediaAddonServer::_HandleMessage(int32 code, const void* data, size_t size) break; default: - ERROR("media_addon_server: received unknown message code %#08lx\n", - code); + ERROR("media_addon_server: received unknown message code %#08" + B_PRIx32 "\n", code); break; } } @@ -605,13 +605,14 @@ MediaAddonServer::_AddOnAdded(const char* path, ino_t fileNode) void MediaAddonServer::_DestroyInstantiatedFlavors(AddOnInfo& info) { - printf("MediaAddonServer::_DestroyInstantiatedFlavors addon %ld\n", info.id); + printf("MediaAddonServer::_DestroyInstantiatedFlavors addon %" B_PRId32 + "\n", info.id); NodeVector::iterator iterator = info.active_flavors.begin(); for (; iterator != info.active_flavors.end(); iterator++) { media_node& node = *iterator; - printf("node %ld\n", node.node); + printf("node %" B_PRId32 "\n", node.node); if ((node.kind & B_TIME_SOURCE) != 0 && (fMediaRoster->StopTimeSource(node, 0, true) != B_OK)) { @@ -709,7 +710,7 @@ MediaAddonServer::_InstantiatePhysicalInputsAndOutputs(AddOnInfo& info) const flavor_info* flavorinfo; if (info.addon->GetFlavorAt(i, &flavorinfo) != B_OK) { ERROR("MediaAddonServer::InstantiatePhysialInputsAndOutputs " - "GetFlavorAt failed for index %ld!\n", i); + "GetFlavorAt failed for index %" B_PRId32 "!\n", i); continue; } if ((flavorinfo->kinds & (B_PHYSICAL_INPUT | B_PHYSICAL_OUTPUT)) != 0) { @@ -726,8 +727,8 @@ MediaAddonServer::_InstantiatePhysicalInputsAndOutputs(AddOnInfo& info) dormantNodeInfo, &node); if (status != B_OK) { ERROR("MediaAddonServer::InstantiatePhysialInputsAndOutputs " - "Couldn't instantiate node flavor, internal_id %ld, " - "name %s\n", flavorinfo->internal_id, flavorinfo->name); + "Couldn't instantiate node flavor, internal_id %" B_PRId32 + ", name %s\n", flavorinfo->internal_id, flavorinfo->name); } else { TRACE("Node created!\n"); info.active_flavors.push_back(node); @@ -756,12 +757,12 @@ MediaAddonServer::_InstantiateAutostartFlavors(AddOnInfo& info) else if (status != B_OK) break; - printf("started node %ld\n", index); + printf("started node %" B_PRId32 "\n", index); status = MediaRosterEx(fMediaRoster)->RegisterNode(node, info.id, internalID); if (status != B_OK) { - ERROR("failed to register node %ld\n", index); + ERROR("failed to register node %" B_PRId32 "\n", index); node->Release(); } else { MediaRosterEx(fMediaRoster)->IncrementAddonFlavorInstancesCount( @@ -782,7 +783,7 @@ MediaAddonServer::_AddOnRemoved(ino_t fileNode) FileMap::iterator foundFile = fFileMap.find(fileNode); if (foundFile == fFileMap.end()) { - ERROR("MediaAddonServer::_AddOnRemoved: inode %Ld removed, but no " + ERROR("MediaAddonServer::_AddOnRemoved: inode %" B_PRIdINO " removed, but no " "media add-on found\n", fileNode); return; } @@ -795,7 +796,7 @@ MediaAddonServer::_AddOnRemoved(ino_t fileNode) if (foundInfo == fInfoMap.end()) { ERROR("MediaAddonServer::_AddOnRemoved: couldn't get addon info for " - "add-on %ld\n", id); + "add-on %" B_PRId32 "\n", id); oldFlavorCount = 1000; } else { AddOnInfo& info = foundInfo->second; @@ -806,7 +807,7 @@ MediaAddonServer::_AddOnRemoved(ino_t fileNode) if (info.addon) { ERROR("MediaAddonServer::_AddOnRemoved: couldn't unload addon " - "%ld since flavors are in use\n", id); + "%" B_PRId32 " since flavors are in use\n", id); } fInfoMap.erase(foundInfo); diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index da8472cc72..4935e2cb10 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -895,8 +895,8 @@ NetServer::_ConfigureIPv6LinkLocal(const char* name) const uint8* mac = link.LinkLevelAddress(); // Check for a few failure situations - static const char zeroMac[6] = {0, 0, 0, 0, 0, 0}; - static const char fullMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + static const uint8 zeroMac[6] = {0, 0, 0, 0, 0, 0}; + static const uint8 fullMac[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; if (memcmp(mac, zeroMac, 6) == 0 || memcmp(mac, fullMac, 6) == 0) { // Mac address is all 0 or all FF's diff --git a/src/system/boot/loader/RootFileSystem.cpp b/src/system/boot/loader/RootFileSystem.cpp index 441f5a1765..2c654d8641 100644 --- a/src/system/boot/loader/RootFileSystem.cpp +++ b/src/system/boot/loader/RootFileSystem.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -7,7 +7,6 @@ #include "RootFileSystem.h" #include -#include #include #include @@ -29,7 +28,7 @@ RootFileSystem::~RootFileSystem() } -status_t +status_t RootFileSystem::Open(void **_cookie, int mode) { EntryIterator *iterator = new (std::nothrow) EntryIterator(&fList); @@ -42,7 +41,7 @@ RootFileSystem::Open(void **_cookie, int mode) } -status_t +status_t RootFileSystem::Close(void *cookie) { delete (EntryIterator *)cookie; @@ -84,7 +83,7 @@ RootFileSystem::Lookup(const char *name, bool /*traverseLinks*/) } -status_t +status_t RootFileSystem::GetNextEntry(void *_cookie, char *name, size_t size) { EntryIterator *iterator = (EntryIterator *)_cookie; @@ -98,7 +97,7 @@ RootFileSystem::GetNextEntry(void *_cookie, char *name, size_t size) } -status_t +status_t RootFileSystem::GetNextNode(void *_cookie, Node **_node) { EntryIterator *iterator = (EntryIterator *)_cookie; @@ -113,24 +112,24 @@ RootFileSystem::GetNextNode(void *_cookie, Node **_node) } -status_t +status_t RootFileSystem::Rewind(void *_cookie) { EntryIterator *iterator = (EntryIterator *)_cookie; iterator->Rewind(); - return B_OK; + return B_OK; } -bool +bool RootFileSystem::IsEmpty() { return fList.IsEmpty(); } -status_t +status_t RootFileSystem::AddVolume(Directory *volume, Partition *partition) { struct entry *entry = new (std::nothrow) RootFileSystem::entry(); @@ -165,7 +164,7 @@ RootFileSystem::AddLink(const char *name, Directory *target) } -status_t +status_t RootFileSystem::GetPartitionFor(Directory *volume, Partition **_partition) { EntryIterator iterator = fList.GetIterator(); diff --git a/src/system/boot/loader/elf.cpp b/src/system/boot/loader/elf.cpp index d12e3b11da..7616e897bd 100644 --- a/src/system/boot/loader/elf.cpp +++ b/src/system/boot/loader/elf.cpp @@ -151,15 +151,15 @@ ELFLoader::Create(int fd, preloaded_image** _image) ImageType* image = (ImageType*)kernel_args_malloc(sizeof(ImageType)); if (image == NULL) return B_NO_MEMORY; - - EhdrType& elfHeader = image->elf_header; - - ssize_t length = read_pos(fd, 0, &elfHeader, sizeof(EhdrType)); + + ssize_t length = read_pos(fd, 0, &image->elf_header, sizeof(EhdrType)); if (length < (ssize_t)sizeof(EhdrType)) { kernel_args_free(image); return B_BAD_TYPE; } + const EhdrType& elfHeader = image->elf_header; + if (memcmp(elfHeader.e_ident, ELF_MAGIC, 4) != 0 || elfHeader.e_ident[4] != Class::kIdentClass || elfHeader.e_phoff == 0 @@ -186,7 +186,7 @@ ELFLoader::Load(int fd, preloaded_image* _image) void* mappedRegion = NULL; ImageType* image = static_cast(_image); - EhdrType& elfHeader = image->elf_header; + const EhdrType& elfHeader = image->elf_header; ssize_t size = elfHeader.e_phnum * elfHeader.e_phentsize; PhdrType* programHeaders = (PhdrType*)malloc(size); @@ -445,7 +445,7 @@ template /*static*/ status_t ELFLoader::_LoadSymbolTable(int fd, ImageType* image) { - EhdrType& elfHeader = image->elf_header; + const EhdrType& elfHeader = image->elf_header; SymType* symbolTable = NULL; ShdrType* stringHeader = NULL; uint32 numSymbols = 0; diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp b/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp index c299717118..17e893576e 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/Directory.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include "Directory.h" @@ -9,7 +9,6 @@ #include "File.h" #include -#include #include #include @@ -18,6 +17,7 @@ namespace FFS { + Directory::Directory(Volume &volume, int32 block) : fVolume(volume) @@ -45,14 +45,14 @@ Directory::~Directory() } -status_t +status_t Directory::InitCheck() { return fNode.ValidateCheckSum(); } -status_t +status_t Directory::Open(void **_cookie, int mode) { _inherited::Open(_cookie, mode); @@ -71,7 +71,7 @@ Directory::Open(void **_cookie, int mode) } -status_t +status_t Directory::Close(void *cookie) { _inherited::Close(cookie); @@ -113,7 +113,7 @@ Directory::Lookup(const char *name, bool traverseLinks) } -status_t +status_t Directory::GetNextEntry(void *cookie, char *name, size_t size) { HashIterator *iterator = (HashIterator *)cookie; @@ -127,7 +127,7 @@ Directory::GetNextEntry(void *cookie, char *name, size_t size) } -status_t +status_t Directory::GetNextNode(void *cookie, Node **_node) { return B_ERROR; @@ -165,4 +165,5 @@ Directory::Inode() const return fNode.HeaderKey(); } + } // namespace FFS diff --git a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp index 249d17bf9e..f75be4f8ff 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include "File.h" @@ -10,11 +10,10 @@ #include #include -#include - namespace FFS { + class Stream { public: Stream(int device, FileBlock &node); @@ -255,4 +254,5 @@ File::Inode() const return fNode.HeaderKey(); } + } // namespace FFS diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp b/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp index 4d1cd26e31..295ff39f9d 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/Volume.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include "Volume.h" @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -87,7 +86,7 @@ Volume::~Volume() } -status_t +status_t Volume::InitCheck() { if (fRoot != NULL) diff --git a/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp b/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp index 07fe89981d..28cc48f82e 100644 --- a/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp +++ b/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp @@ -1,14 +1,13 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #include "amiga_ffs.h" #include #include -#include #include #include @@ -31,7 +30,7 @@ class BCPLString { }; -int32 +int32 BCPLString::CopyTo(char *name, size_t size) { int32 length = size - 1 > Length() ? Length() : size - 1; @@ -56,7 +55,7 @@ BaseBlock::GetNameBackOffset(int32 offset, char *name, size_t size) const } -status_t +status_t BaseBlock::ValidateCheckSum() const { if (fData == NULL) @@ -74,7 +73,7 @@ BaseBlock::ValidateCheckSum() const // #pragma mark - -char +char DirectoryBlock::ToUpperChar(int32 type, char c) const { // Taken from Ralph Babel's "The Amiga Guru Book" (1993), section 15.3.4.3 @@ -87,11 +86,11 @@ DirectoryBlock::ToUpperChar(int32 type, char c) const } -int32 +int32 DirectoryBlock::HashIndexFor(int32 type, const char *name) const { int32 hash = strlen(name); - + while (name[0]) { hash = (hash * 13 + ToUpperChar(type, name[0])) & 0x7ff; name++; @@ -101,7 +100,7 @@ DirectoryBlock::HashIndexFor(int32 type, const char *name) const } -int32 +int32 DirectoryBlock::HashValueAt(int32 index) const { return index >= HashSize() ? -1 : (int32)B_BENDIAN_TO_HOST_INT32(HashTable()[index]); @@ -116,11 +115,11 @@ DirectoryBlock::FirstHashValue(int32 &index) const } -int32 +int32 DirectoryBlock::NextHashValue(int32 &index) const { index++; - + int32 value; while ((value = HashValueAt(index)) == 0) { if (++index >= HashSize()) @@ -152,14 +151,14 @@ HashIterator::~HashIterator() } -status_t +status_t HashIterator::InitCheck() { return fData != NULL ? B_OK : B_NO_MEMORY; } -void +void HashIterator::Goto(int32 index) { fCurrent = index; @@ -197,7 +196,7 @@ HashIterator::GetNext(int32 &block) } -void +void HashIterator::Rewind() { fCurrent = 0; diff --git a/src/system/boot/loader/file_systems/bfs/BPlusTree.cpp b/src/system/boot/loader/file_systems/bfs/BPlusTree.cpp deleted file mode 100644 index 8b8ee8fb50..0000000000 --- a/src/system/boot/loader/file_systems/bfs/BPlusTree.cpp +++ /dev/null @@ -1,889 +0,0 @@ -/* - * Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de. - * This file may be used under the terms of the MIT License. - * - * Roughly based on 'btlib' written by Marcus J. Ranum - it shares - * no code but achieves binary compatibility with the on disk format. - */ - - -#include "BPlusTree.h" - -#include -#include -#include - -#include - -#include -#include -#include -#include - -using namespace BFS; - - -// Node Caching for the BPlusTree class -// -// With write support, there is the need for a function that allocates new -// nodes by either returning empty nodes, or by growing the file's data stream -// -// !! The CachedNode class assumes that you have properly locked the stream -// !! before asking for nodes. -// -// Note: This code will fail if the block size is smaller than the node size! -// Since BFS supports block sizes of 1024 bytes or greater, and the node size -// is hard-coded to 1024 bytes, that's not an issue now. - - -void -CachedNode::Unset() -{ - if (fTree == NULL || fTree->fStream == NULL) - return; - - if (fBlock != NULL) - fNode = NULL; -} - - -bplustree_node * -CachedNode::SetTo(off_t offset, bool check) -{ - if (fTree == NULL || fTree->fStream == NULL) - return NULL; - - Unset(); - - // You can only ask for nodes at valid positions - you can't - // even access the b+tree header with this method (use SetToHeader() - // instead) - if (offset > fTree->fHeader->MaximumSize() - fTree->fNodeSize - || offset <= 0 - || (offset % fTree->fNodeSize) != 0) - return NULL; - - if (InternalSetTo(offset) != NULL && check) { - // sanity checks (links, all_key_count) - bplustree_header *header = fTree->fHeader; - if (!header->IsValidLink(fNode->LeftLink()) - || !header->IsValidLink(fNode->RightLink()) - || !header->IsValidLink(fNode->OverflowLink()) - || (int8 *)fNode->Values() + fNode->NumKeys() * sizeof(off_t) - > (int8 *)fNode + fTree->fNodeSize) { - dprintf("invalid node read from offset %Ld, inode at %Ld\n", - offset, fTree->fStream->ID()); - return NULL; - } - } - - return fNode; -} - - -bplustree_header * -CachedNode::SetToHeader() -{ - if (fTree == NULL || fTree->fStream == NULL) - return NULL; - - Unset(); - - InternalSetTo(0LL); - return (bplustree_header *)fNode; -} - - -bplustree_node * -CachedNode::InternalSetTo(off_t offset) -{ - fNode = NULL; - - off_t fileOffset; - block_run run; - if (offset < fTree->fStream->Size() - && fTree->fStream->FindBlockRun(offset, run, fileOffset) == B_OK) { - Volume &volume = fTree->fStream->GetVolume(); - - int32 blockOffset = (offset - fileOffset) / volume.BlockSize(); - fBlockNumber = volume.ToBlock(run) + blockOffset; - - if (fBlock == NULL) { - fBlock = (uint8 *)malloc(volume.BlockSize()); - if (fBlock == NULL) - return NULL; - } - if (read_pos(volume.Device(), fBlockNumber << volume.BlockShift(), - fBlock, volume.BlockSize()) < (ssize_t)volume.BlockSize()) - return NULL; - - // the node is somewhere in that block... (confusing offset calculation) - fNode = (bplustree_node *)(fBlock + offset - - (fileOffset + (blockOffset << volume.BlockShift()))); - } - return fNode; -} - - -// #pragma mark - - - -BPlusTree::BPlusTree(Stream *stream) - : - fStream(NULL), - fHeader(NULL), - fCachedHeader(this) -{ - SetTo(stream); -} - - -BPlusTree::~BPlusTree() -{ -} - - -status_t -BPlusTree::SetTo(Stream *stream) -{ - if (stream == NULL || stream->InitCheck() != B_OK) - return fStatus = B_BAD_VALUE; - - // get on-disk B+Tree header - - fCachedHeader.Unset(); - fStream = stream; - - fHeader = fCachedHeader.SetToHeader(); - if (fHeader == NULL) - return fStatus = B_NO_INIT; - - // is header valid? - - if (fHeader->Magic() != BPLUSTREE_MAGIC - || fHeader->MaximumSize() != stream->Size() - || (fHeader->RootNode() % fHeader->NodeSize()) != 0 - || !fHeader->IsValidLink(fHeader->RootNode())) - return fStatus = B_BAD_DATA; - - fNodeSize = fHeader->NodeSize(); - - { - uint32 toMode[] = {S_STR_INDEX, S_INT_INDEX, S_UINT_INDEX, - S_LONG_LONG_INDEX, S_ULONG_LONG_INDEX, S_FLOAT_INDEX, - S_DOUBLE_INDEX}; - uint32 mode = stream->Mode() & (S_STR_INDEX | S_INT_INDEX - | S_UINT_INDEX | S_LONG_LONG_INDEX | S_ULONG_LONG_INDEX - | S_FLOAT_INDEX | S_DOUBLE_INDEX); - - if (fHeader->DataType() > BPLUSTREE_DOUBLE_TYPE - || ((stream->Mode() & S_INDEX_DIR) != 0 - && toMode[fHeader->DataType()] != mode) - || !stream->IsContainer()) { - return fStatus = B_BAD_TYPE; - } - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - // although it's in stat.h, the S_ALLOW_DUPS flag is obviously unused - // in the original BFS code - we will honour it nevertheless - fAllowDuplicates = ((stream->Mode() & S_INDEX_DIR) == S_INDEX_DIR - && stream->BlockRun() != stream->Parent()) - || (stream->Mode() & S_ALLOW_DUPS) != 0; -#endif - } - - CachedNode cached(this, fHeader->RootNode()); - - return fStatus = cached.Node() ? B_OK : B_BAD_DATA; -} - - -status_t -BPlusTree::InitCheck() -{ - return fStatus; -} - - -int32 -BPlusTree::TypeCodeToKeyType(type_code code) -{ - switch (code) { - case B_STRING_TYPE: - return BPLUSTREE_STRING_TYPE; - case B_INT32_TYPE: - case B_SSIZE_T_TYPE: - return BPLUSTREE_INT32_TYPE; - case B_UINT32_TYPE: - case B_SIZE_T_TYPE: - return BPLUSTREE_UINT32_TYPE; - case B_OFF_T_TYPE: - case B_INT64_TYPE: - return BPLUSTREE_INT64_TYPE; - case B_UINT64_TYPE: - return BPLUSTREE_UINT64_TYPE; - case B_FLOAT_TYPE: - return BPLUSTREE_FLOAT_TYPE; - case B_DOUBLE_TYPE: - return BPLUSTREE_DOUBLE_TYPE; - } - return -1; -} - - -int32 -BPlusTree::ModeToKeyType(mode_t mode) -{ - switch (mode & (S_STR_INDEX | S_INT_INDEX | S_UINT_INDEX | S_LONG_LONG_INDEX - | S_ULONG_LONG_INDEX | S_FLOAT_INDEX | S_DOUBLE_INDEX)) { - case S_INT_INDEX: - return BPLUSTREE_INT32_TYPE; - case S_UINT_INDEX: - return BPLUSTREE_UINT32_TYPE; - case S_LONG_LONG_INDEX: - return BPLUSTREE_INT64_TYPE; - case S_ULONG_LONG_INDEX: - return BPLUSTREE_UINT64_TYPE; - case S_FLOAT_INDEX: - return BPLUSTREE_FLOAT_TYPE; - case S_DOUBLE_INDEX: - return BPLUSTREE_DOUBLE_TYPE; - case S_STR_INDEX: - default: - // default is for standard directories - return BPLUSTREE_STRING_TYPE; - } -} - - -int32 -BPlusTree::CompareKeys(const void *key1, int keyLength1, const void *key2, int keyLength2) -{ - type_code type = 0; - switch (fHeader->DataType()) - { - case BPLUSTREE_STRING_TYPE: - type = B_STRING_TYPE; - break; - case BPLUSTREE_INT32_TYPE: - type = B_INT32_TYPE; - break; - case BPLUSTREE_UINT32_TYPE: - type = B_UINT32_TYPE; - break; - case BPLUSTREE_INT64_TYPE: - type = B_INT64_TYPE; - break; - case BPLUSTREE_UINT64_TYPE: - type = B_UINT64_TYPE; - break; - case BPLUSTREE_FLOAT_TYPE: - type = B_FLOAT_TYPE; - break; - case BPLUSTREE_DOUBLE_TYPE: - type = B_DOUBLE_TYPE; - break; - } - return compareKeys(type, key1, keyLength1, key2, keyLength2); -} - - -status_t -BPlusTree::FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, uint16 *index, - off_t *next) -{ - if (node->all_key_count == 0) { - if (index) - *index = 0; - if (next) - *next = node->OverflowLink(); - return B_ENTRY_NOT_FOUND; - } - - off_t *values = node->Values(); - int16 saveIndex = -1; - - // binary search in the key array - for (int16 first = 0, last = node->NumKeys() - 1; first <= last;) { - uint16 i = (first + last) >> 1; - - uint16 searchLength; - uint8 *searchKey = node->KeyAt(i, &searchLength); - if (searchKey + searchLength + sizeof(off_t) + sizeof(uint16) > (uint8 *)node + fNodeSize - || searchLength > BPLUSTREE_MAX_KEY_LENGTH) { - dprintf("bfs: bad B+tree data\n"); - return B_BAD_DATA; - } - - int32 cmp = CompareKeys(key, keyLength, searchKey, searchLength); - if (cmp < 0) { - last = i - 1; - saveIndex = i; - } else if (cmp > 0) { - saveIndex = first = i + 1; - } else { - if (index) - *index = i; - if (next) - *next = BFS_ENDIAN_TO_HOST_INT64(values[i]); - return B_OK; - } - } - - if (index) - *index = saveIndex; - if (next) { - if (saveIndex == node->NumKeys()) - *next = node->OverflowLink(); - else - *next = BFS_ENDIAN_TO_HOST_INT64(values[saveIndex]); - } - return B_ENTRY_NOT_FOUND; -} - - -/** Prepares the stack to contain all nodes that were passed while - * following the key, from the root node to the leaf node that could - * or should contain that key. - */ - -status_t -BPlusTree::SeekDown(Stack &stack, const uint8 *key, uint16 keyLength) -{ - // set the root node to begin with - node_and_key nodeAndKey; - nodeAndKey.nodeOffset = fHeader->RootNode(); - - CachedNode cached(this); - bplustree_node *node; - while ((node = cached.SetTo(nodeAndKey.nodeOffset)) != NULL) { - // if we are already on leaf level, we're done - if (node->OverflowLink() == BPLUSTREE_NULL) { - // node that the keyIndex is not properly set here (but it's not - // needed in the calling functions anyway)! - nodeAndKey.keyIndex = 0; - stack.Push(nodeAndKey); - return B_OK; - } - - off_t nextOffset; - status_t status = FindKey(node, key, keyLength, &nodeAndKey.keyIndex, &nextOffset); - - if (status == B_ENTRY_NOT_FOUND && nextOffset == nodeAndKey.nodeOffset) - return B_ERROR; - - // put the node offset & the correct keyIndex on the stack - stack.Push(nodeAndKey); - - nodeAndKey.nodeOffset = nextOffset; - } - return B_ERROR; -} - - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES -status_t -BPlusTree::FindFreeDuplicateFragment(bplustree_node *node, CachedNode *cached, off_t *_offset, - bplustree_node **_fragment, uint32 *_index) -{ - off_t *values = node->Values(); - for (int32 i = 0;i < node->all_key_count;i++) { - // does the value link to a duplicate fragment? - if (bplustree_node::LinkType(values[i]) != BPLUSTREE_DUPLICATE_FRAGMENT) - continue; - - bplustree_node *fragment = cached->SetTo(bplustree_node::FragmentOffset( - BFS_ENDIAN_TO_HOST_INT64(values[i])), false); - if (fragment == NULL) { - FATAL(("Could not get duplicate fragment at %Ld\n",values[i])); - continue; - } - - // see if there is some space left for us - int32 num = (fNodeSize >> 3) / (NUM_FRAGMENT_VALUES + 1); - for (int32 j = 0;j < num;j++) { - duplicate_array *array = fragment->FragmentAt(j); - - if (array->count == 0) { - *_offset = bplustree_node::FragmentOffset( - BFS_ENDIAN_TO_HOST_INT64(values[i])); - *_fragment = fragment; - *_index = j; - return B_OK; - } - } - } - return B_ENTRY_NOT_FOUND; -} -#endif - -/** Searches the key in the tree, and stores the offset found in - * _value, if successful. - * It's very similar to BPlusTree::SeekDown(), but doesn't fill - * a stack while it descends the tree. - * Returns B_OK when the key could be found, B_ENTRY_NOT_FOUND - * if not. It can also return other errors to indicate that - * something went wrong. - * Note that this doesn't work with duplicates - it will just - * return B_BAD_TYPE if you call this function on a tree where - * duplicates are allowed. - */ - -status_t -BPlusTree::Find(const uint8 *key, uint16 keyLength, off_t *_value) -{ - if (keyLength < BPLUSTREE_MIN_KEY_LENGTH || keyLength > BPLUSTREE_MAX_KEY_LENGTH - || key == NULL) - return B_BAD_VALUE; - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - if (fAllowDuplicates) - return B_BAD_TYPE; -#endif - - off_t nodeOffset = fHeader->RootNode(); - CachedNode cached(this); - bplustree_node *node; - - while ((node = cached.SetTo(nodeOffset)) != NULL) { - uint16 keyIndex = 0; - off_t nextOffset; - status_t status = FindKey(node, key, keyLength, &keyIndex, &nextOffset); - - if (node->OverflowLink() == BPLUSTREE_NULL) { - if (status == B_OK && _value != NULL) - *_value = BFS_ENDIAN_TO_HOST_INT64(node->Values()[keyIndex]); - - return status; - } else if (nextOffset == nodeOffset) - return B_ERROR; - - nodeOffset = nextOffset; - } - return B_ERROR; -} - - -// #pragma mark - - - -TreeIterator::TreeIterator(BPlusTree *tree) - : - fTree(tree), - fCurrentNodeOffset(BPLUSTREE_NULL) -{ -} - - -TreeIterator::~TreeIterator() -{ -} - - -status_t -TreeIterator::Goto(int8 to) -{ - if (fTree == NULL || fTree->fHeader == NULL) - return B_BAD_VALUE; - - off_t nodeOffset = fTree->fHeader->RootNode(); - CachedNode cached(fTree); - bplustree_node *node; - - while ((node = cached.SetTo(nodeOffset)) != NULL) { - // is the node a leaf node? - if (node->OverflowLink() == BPLUSTREE_NULL) { - fCurrentNodeOffset = nodeOffset; - fCurrentKey = to == BPLUSTREE_BEGIN ? -1 : node->NumKeys(); -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - fDuplicateNode = BPLUSTREE_NULL; -#endif - return B_OK; - } - - // get the next node offset depending on the direction (and if there - // are any keys in that node at all) - off_t nextOffset; - if (to == BPLUSTREE_END || node->all_key_count == 0) - nextOffset = node->OverflowLink(); - else { - if (node->AllKeyLength() > fTree->fNodeSize - || (uint32)node->Values() > (uint32)node + fTree->fNodeSize - 8 * node->NumKeys()) - return B_ERROR; - - nextOffset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[0]); - } - if (nextOffset == nodeOffset) - break; - - nodeOffset = nextOffset; - } - return B_ERROR; -} - - -/** Iterates through the tree in the specified direction. - * When it iterates through duplicates, the "key" is only updated for the - * first entry - if you need to know when this happens, use the "duplicate" - * parameter which is 0 for no duplicate, 1 for the first, and 2 for all - * the other duplicates. - * That's not too nice, but saves the 256 bytes that would be needed to - * store the last key - if this will ever become an issue, it will be - * easy to change. - * The other advantage of this is, that the queries can skip all duplicates - * at once when they are not relevant to them. - */ - -status_t -TreeIterator::Traverse(int8 direction, void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate) -{ - if (fTree == NULL) - return B_INTERRUPTED; - if (fCurrentNodeOffset == BPLUSTREE_NULL - && Goto(direction == BPLUSTREE_FORWARD ? BPLUSTREE_BEGIN : BPLUSTREE_END) < B_OK) - return B_ERROR; - - // if the tree was emptied since the last call - if (fCurrentNodeOffset == BPLUSTREE_FREE) - return B_ENTRY_NOT_FOUND; - - CachedNode cached(fTree); - bplustree_node *node; - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - if (fDuplicateNode != BPLUSTREE_NULL) { - // regardless of traverse direction the duplicates are always presented - // in the same order; since they are all considered as equal, this - // shouldn't cause any problems - - if (!fIsFragment || fDuplicate < fNumDuplicates) { - node = cached.SetTo(bplustree_node::FragmentOffset(fDuplicateNode), - false); - } else - node = NULL; - - if (node != NULL) { - if (!fIsFragment && fDuplicate >= fNumDuplicates) { - // if the node is out of duplicates, we go directly to the next - // one - fDuplicateNode = node->right_link; - if (fDuplicateNode != BPLUSTREE_NULL - && (node = cached.SetTo(fDuplicateNode, false)) != NULL) { - fNumDuplicates - = node->CountDuplicates(fDuplicateNode, false); - fDuplicate = 0; - } - } - if (fDuplicate < fNumDuplicates) { - *value = node->DuplicateAt(fDuplicateNode, fIsFragment, - fDuplicate++); - if (duplicate) - *duplicate = 2; - return B_OK; - } - } - fDuplicateNode = BPLUSTREE_NULL; - } -#endif /* BPLUSTREE_SUPPORTS_DUPLICATES */ - - off_t savedNodeOffset = fCurrentNodeOffset; - if ((node = cached.SetTo(fCurrentNodeOffset)) == NULL) - return B_ERROR; - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - if (duplicate) - *duplicate = 0; -#endif - - fCurrentKey += direction; - - // is the current key in the current node? - while ((direction == BPLUSTREE_FORWARD && fCurrentKey >= node->NumKeys()) - || (direction == BPLUSTREE_BACKWARD && fCurrentKey < 0)) - { - fCurrentNodeOffset = direction == BPLUSTREE_FORWARD ? node->RightLink() : node->LeftLink(); - - // are there any more nodes? - if (fCurrentNodeOffset != BPLUSTREE_NULL) - { - node = cached.SetTo(fCurrentNodeOffset); - if (!node) - return B_ERROR; - - // reset current key - fCurrentKey = direction == BPLUSTREE_FORWARD ? 0 : node->NumKeys(); - } - else - { - // there are no nodes left, so turn back to the last key - fCurrentNodeOffset = savedNodeOffset; - fCurrentKey = direction == BPLUSTREE_FORWARD ? node->NumKeys() : -1; - - return B_ENTRY_NOT_FOUND; - } - } - - if (node->all_key_count == 0) - return B_ERROR; // B_ENTRY_NOT_FOUND ? - - uint16 length; - uint8 *keyStart = node->KeyAt(fCurrentKey, &length); - if (keyStart + length + sizeof(off_t) + sizeof(uint16) > (uint8 *)node + fTree->fNodeSize - || length > BPLUSTREE_MAX_KEY_LENGTH) { - dprintf("bfs: bad b+tree data\n"); - return B_BAD_DATA; - } - - length = min_c(length, maxLength); - memcpy(key, keyStart, length); - - if (fTree->fHeader->DataType() == BPLUSTREE_STRING_TYPE) // terminate string type - { - if (length == maxLength) - length--; - ((char *)key)[length] = '\0'; - } - *keyLength = length; - - off_t offset = BFS_ENDIAN_TO_HOST_INT64(node->Values()[fCurrentKey]); - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - // duplicate fragments? - uint8 type = bplustree_node::LinkType(offset); - if (type == BPLUSTREE_DUPLICATE_FRAGMENT || type == BPLUSTREE_DUPLICATE_NODE) - { - fDuplicateNode = offset; - - node = cached.SetTo(bplustree_node::FragmentOffset(fDuplicateNode), false); - if (node == NULL) - return B_ERROR; - - fIsFragment = type == BPLUSTREE_DUPLICATE_FRAGMENT; - - fNumDuplicates = node->CountDuplicates(offset, fIsFragment); - if (fNumDuplicates) - { - offset = node->DuplicateAt(offset, fIsFragment, 0); - fDuplicate = 1; - if (duplicate) - *duplicate = 1; - } - else - { - // shouldn't happen, but we're dealing here with potentially corrupt disks... - fDuplicateNode = BPLUSTREE_NULL; - offset = 0; - } - } -#endif /* BPLUSTREE_SUPPORTS_DUPLICATES */ - *value = offset; - - return B_OK; -} - - -/** This is more or less a copy of BPlusTree::Find() - but it just - * sets the current position in the iterator, regardless of if the - * key could be found or not. - */ - -status_t -TreeIterator::Find(const uint8 *key, uint16 keyLength) -{ - if (fTree == NULL) - return B_INTERRUPTED; - if (keyLength < BPLUSTREE_MIN_KEY_LENGTH || keyLength > BPLUSTREE_MAX_KEY_LENGTH - || key == NULL) - return B_BAD_VALUE; - - off_t nodeOffset = fTree->fHeader->RootNode(); - - CachedNode cached(fTree); - bplustree_node *node; - while ((node = cached.SetTo(nodeOffset)) != NULL) { - uint16 keyIndex = 0; - off_t nextOffset; - status_t status = fTree->FindKey(node, key, keyLength, &keyIndex, &nextOffset); - - if (node->OverflowLink() == BPLUSTREE_NULL) { - fCurrentNodeOffset = nodeOffset; - fCurrentKey = keyIndex - 1; -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - fDuplicateNode = BPLUSTREE_NULL; -#endif - return status; - } else if (nextOffset == nodeOffset) - return B_ERROR; - - nodeOffset = nextOffset; - } - return B_ERROR; -} - - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES -void -TreeIterator::SkipDuplicates() -{ - fDuplicateNode = BPLUSTREE_NULL; -} -#endif - - -// #pragma mark - - - -void -bplustree_node::Initialize() -{ - left_link = right_link = overflow_link = HOST_ENDIAN_TO_BFS_INT64((uint64)BPLUSTREE_NULL); - all_key_count = 0; - all_key_length = 0; -} - - -uint8 * -bplustree_node::KeyAt(int32 index, uint16 *keyLength) const -{ - if (index < 0 || index > NumKeys()) - return NULL; - - uint8 *keyStart = Keys(); - uint16 *keyLengths = KeyLengths(); - - *keyLength = BFS_ENDIAN_TO_HOST_INT16(keyLengths[index]) - - (index != 0 ? BFS_ENDIAN_TO_HOST_INT16(keyLengths[index - 1]) : 0); - if (index > 0) - keyStart += BFS_ENDIAN_TO_HOST_INT16(keyLengths[index - 1]); - - return keyStart; -} - - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES -uint8 -bplustree_node::CountDuplicates(off_t offset, bool isFragment) const -{ - // the duplicate fragment handling is currently hard-coded to a node size - // of 1024 bytes - with future versions of BFS, this may be a problem - - if (isFragment) { - uint32 fragment = (NUM_FRAGMENT_VALUES + 1) * ((uint64)offset & 0x3ff); - - return ((off_t *)this)[fragment]; - } - return OverflowLink(); -} - - -off_t -bplustree_node::DuplicateAt(off_t offset, bool isFragment, int8 index) const -{ - uint32 start; - if (isFragment) - start = 8 * ((uint64)offset & 0x3ff); - else - start = 2; - - return ((off_t *)this)[start + 1 + index]; -} - - -/** Although the name suggests it, this function doesn't return the real - * used fragment count; at least, it can only count to two: it returns - * 0, if there is no fragment used, 1 if there is only one fragment - * used, and 2 if there are at least 2 fragments used. - */ - -int32 -bplustree_node::FragmentsUsed(uint32 nodeSize) -{ - uint32 used = 0; - for (uint32 i = 0; i < nodeSize / ((NUM_FRAGMENT_VALUES + 1) * sizeof(off_t)); i++) { - duplicate_array *array = FragmentAt(i); - if (array->count > 0 && ++used > 1) - return used; - } - return used; -} -#endif /* BPLUSTREE_SUPPORTS_DUPLICATES */ - - -// #pragma mark - - - -int32 -BFS::compareKeys(type_code type, const void *key1, int keyLength1, const void *key2, int keyLength2) -{ - // if one of the keys is NULL, bail out gracefully - if (key1 == NULL || key2 == NULL) - return -1; - - switch (type) - { - case B_STRING_TYPE: - { - int len = min_c(keyLength1, keyLength2); - int result = strncmp((const char *)key1, (const char *)key2, len); - - if (result == 0 - && !(((const char *)key1)[len] == '\0' && ((const char *)key2)[len] == '\0')) - result = keyLength1 - keyLength2; - - return result; - } - - case B_SSIZE_T_TYPE: - case B_INT32_TYPE: - return *(int32 *)key1 - *(int32 *)key2; - - case B_SIZE_T_TYPE: - case B_UINT32_TYPE: - if (*(uint32 *)key1 == *(uint32 *)key2) - return 0; - else if (*(uint32 *)key1 > *(uint32 *)key2) - return 1; - - return -1; - - case B_OFF_T_TYPE: - case B_INT64_TYPE: - if (*(int64 *)key1 == *(int64 *)key2) - return 0; - else if (*(int64 *)key1 > *(int64 *)key2) - return 1; - - return -1; - - case B_UINT64_TYPE: - if (*(uint64 *)key1 == *(uint64 *)key2) - return 0; - else if (*(uint64 *)key1 > *(uint64 *)key2) - return 1; - - return -1; - - case B_FLOAT_TYPE: - { - float result = *(float *)key1 - *(float *)key2; - if (result == 0.0f) - return 0; - - return (result < 0.0f) ? -1 : 1; - } - - case B_DOUBLE_TYPE: - { - double result = *(double *)key1 - *(double *)key2; - if (result == 0.0) - return 0; - - return (result < 0.0) ? -1 : 1; - } - } - - // if the type is unknown, the entries don't match... - return -1; -} - diff --git a/src/system/boot/loader/file_systems/bfs/BPlusTree.h b/src/system/boot/loader/file_systems/bfs/BPlusTree.h deleted file mode 100644 index 28b58d5c03..0000000000 --- a/src/system/boot/loader/file_systems/bfs/BPlusTree.h +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de. - * This file may be used under the terms of the MIT License. - */ -#ifndef B_PLUS_TREE_H -#define B_PLUS_TREE_H - - -#include - -#include "Stream.h" -#include "Utility.h" - - -template class Stack; - -namespace BFS { - -//****************** on-disk structures ******************** - -#define BPLUSTREE_NULL -1LL -#define BPLUSTREE_FREE -2LL - -struct bplustree_header { - uint32 magic; - uint32 node_size; - uint32 max_number_of_levels; - uint32 data_type; - off_t root_node_pointer; - off_t free_node_pointer; - off_t maximum_size; - - uint32 Magic() const { return BFS_ENDIAN_TO_HOST_INT32(magic); } - uint32 NodeSize() const { return BFS_ENDIAN_TO_HOST_INT32(node_size); } - uint32 DataType() const { return BFS_ENDIAN_TO_HOST_INT32(data_type); } - off_t RootNode() const { return BFS_ENDIAN_TO_HOST_INT64(root_node_pointer); } - off_t MaximumSize() const { return BFS_ENDIAN_TO_HOST_INT64(maximum_size); } - - inline bool IsValidLink(off_t link); -}; - -#define BPLUSTREE_MAGIC 0x69f6c2e8 -#define BPLUSTREE_NODE_SIZE 1024 -#define BPLUSTREE_MAX_KEY_LENGTH 256 -#define BPLUSTREE_MIN_KEY_LENGTH 1 - -enum bplustree_types { - BPLUSTREE_STRING_TYPE = 0, - BPLUSTREE_INT32_TYPE = 1, - BPLUSTREE_UINT32_TYPE = 2, - BPLUSTREE_INT64_TYPE = 3, - BPLUSTREE_UINT64_TYPE = 4, - BPLUSTREE_FLOAT_TYPE = 5, - BPLUSTREE_DOUBLE_TYPE = 6 -}; - -struct sorted_array; -typedef sorted_array duplicate_array; - -struct bplustree_node { - off_t left_link; - off_t right_link; - off_t overflow_link; - uint16 all_key_count; - uint16 all_key_length; - - off_t LeftLink() const { return BFS_ENDIAN_TO_HOST_INT64(left_link); } - off_t RightLink() const { return BFS_ENDIAN_TO_HOST_INT64(right_link); } - off_t OverflowLink() const { return BFS_ENDIAN_TO_HOST_INT64(overflow_link); } - uint16 NumKeys() const { return BFS_ENDIAN_TO_HOST_INT16(all_key_count); } - uint16 AllKeyLength() const { return BFS_ENDIAN_TO_HOST_INT16(all_key_length); } - - inline uint16 *KeyLengths() const; - inline off_t *Values() const; - inline uint8 *Keys() const; - inline int32 Used() const; - uint8 *KeyAt(int32 index,uint16 *keyLength) const; - - inline bool IsLeaf() const; - - void Initialize(); - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - uint8 CountDuplicates(off_t offset, bool isFragment) const; - off_t DuplicateAt(off_t offset, bool isFragment, int8 index) const; - int32 FragmentsUsed(uint32 nodeSize); - inline duplicate_array *FragmentAt(int8 index); - inline duplicate_array *DuplicateArray(); - - static inline uint8 LinkType(off_t link); - static inline off_t MakeLink(uint8 type, off_t link, uint32 fragmentIndex = 0); - static inline bool IsDuplicate(off_t link); - static inline off_t FragmentOffset(off_t link); - static inline uint32 FragmentIndex(off_t link); -#endif -} __attribute__ ((__packed__)); - -//#define BPLUSTREE_NODE 0 -#define BPLUSTREE_DUPLICATE_NODE 2 -#define BPLUSTREE_DUPLICATE_FRAGMENT 3 - -#define NUM_FRAGMENT_VALUES 7 -#define NUM_DUPLICATE_VALUES 125 - -//************************************** - -enum bplustree_traversing { - BPLUSTREE_FORWARD = 1, - BPLUSTREE_BACKWARD = -1, - - BPLUSTREE_BEGIN = 0, - BPLUSTREE_END = 1 -}; - - -//****************** in-memory structures ******************** - -class BPlusTree; -class TreeIterator; -class CachedNode; - -// needed for searching (utilizing a stack) -struct node_and_key { - off_t nodeOffset; - uint16 keyIndex; -}; - - -//***** Cache handling ***** - -class CachedNode { - public: - CachedNode(BPlusTree *tree) - : - fTree(tree), - fNode(NULL), - fBlock(NULL) - { - } - - CachedNode(BPlusTree *tree, off_t offset, bool check = true) - : - fTree(tree), - fNode(NULL), - fBlock(NULL) - { - SetTo(offset, check); - } - - ~CachedNode() - { - Unset(); - free(fBlock); - } - - bplustree_node *SetTo(off_t offset, bool check = true); - bplustree_header *SetToHeader(); - void Unset(); - - bplustree_node *Node() const { return fNode; } - - protected: - bplustree_node *InternalSetTo(off_t offset); - - BPlusTree *fTree; - bplustree_node *fNode; - uint8 *fBlock; - off_t fBlockNumber; -}; - - -//******** B+tree class ********* - -class BPlusTree { - public: - BPlusTree(Stream *stream); - ~BPlusTree(); - - status_t SetTo(Stream *stream); - - status_t InitCheck(); - status_t Validate(); - - status_t Find(const uint8 *key, uint16 keyLength, off_t *value); - - static int32 TypeCodeToKeyType(type_code code); - static int32 ModeToKeyType(mode_t mode); - - private: - BPlusTree(const BPlusTree &); - BPlusTree &operator=(const BPlusTree &); - // no implementation - - int32 CompareKeys(const void *key1, int keylength1, const void *key2, int keylength2); - status_t FindKey(bplustree_node *node, const uint8 *key, uint16 keyLength, - uint16 *index = NULL, off_t *next = NULL); - status_t SeekDown(Stack &stack, const uint8 *key, uint16 keyLength); - - private: - friend class CachedNode; - friend class TreeIterator; - - Stream *fStream; - bplustree_header *fHeader; - CachedNode fCachedHeader; - int32 fNodeSize; -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - bool fAllowDuplicates; -#endif - status_t fStatus; -}; - - -//***** helper classes/functions ***** - -extern int32 compareKeys(type_code type, const void *key1, int keyLength1, - const void *key2, int keyLength2); - -class TreeIterator { - public: - TreeIterator(BPlusTree *tree); - ~TreeIterator(); - - status_t Goto(int8 to); - status_t Traverse(int8 direction, void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate = NULL); - status_t Find(const uint8 *key, uint16 keyLength); - - status_t Rewind(); - status_t GetNextEntry(void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate = NULL); - status_t GetPreviousEntry(void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate = NULL); -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - void SkipDuplicates(); -#endif - - private: - BPlusTree *fTree; - - off_t fCurrentNodeOffset; // traverse position - int32 fCurrentKey; -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES - off_t fDuplicateNode; - uint16 fDuplicate, fNumDuplicates; - bool fIsFragment; -#endif -}; - - -/************************ TreeIterator inline functions ************************/ -// #pragma mark - - -inline status_t -TreeIterator::Rewind() -{ - return Goto(BPLUSTREE_BEGIN); -} - -inline status_t -TreeIterator::GetNextEntry(void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate) -{ - return Traverse(BPLUSTREE_FORWARD, key, keyLength, maxLength, value, duplicate); -} - -inline status_t -TreeIterator::GetPreviousEntry(void *key, uint16 *keyLength, uint16 maxLength, - off_t *value, uint16 *duplicate) -{ - return Traverse(BPLUSTREE_BACKWARD, key, keyLength, maxLength, value, duplicate); -} - -/************************ bplustree_header inline functions ************************/ -// #pragma mark - - - -inline bool -bplustree_header::IsValidLink(off_t link) -{ - return link == BPLUSTREE_NULL || (link > 0 && link <= MaximumSize() - NodeSize()); -} - - -/************************ bplustree_node inline functions ************************/ -// #pragma mark - - - -inline uint16 * -bplustree_node::KeyLengths() const -{ - return (uint16 *)(((char *)this) - + key_align(sizeof(bplustree_node) + AllKeyLength())); -} - -inline off_t * -bplustree_node::Values() const -{ - return (off_t *)((char *)KeyLengths() + NumKeys() * sizeof(uint16)); -} - -inline uint8 * -bplustree_node::Keys() const -{ - return (uint8 *)this + sizeof(bplustree_node); -} - -inline int32 -bplustree_node::Used() const -{ - return key_align(sizeof(bplustree_node) + AllKeyLength()) - + NumKeys() * (sizeof(uint16) + sizeof(off_t)); -} - -inline bool -bplustree_node::IsLeaf() const -{ - return OverflowLink() == BPLUSTREE_NULL; -} - - -#ifdef BPLUSTREE_SUPPORTS_DUPLICATES -inline duplicate_array * -bplustree_node::FragmentAt(int8 index) -{ - return (duplicate_array *)((off_t *)this + index * (NUM_FRAGMENT_VALUES + 1)); -} - - -inline duplicate_array * -bplustree_node::DuplicateArray() -{ - return (duplicate_array *)&this->overflow_link; -} - - -inline uint8 -bplustree_node::LinkType(off_t link) -{ - return *(uint64 *)&link >> 62; -} - - -inline off_t -bplustree_node::MakeLink(uint8 type, off_t link, uint32 fragmentIndex) -{ - return ((off_t)type << 62) | (link & 0x3ffffffffffffc00LL) | (fragmentIndex & 0x3ff); -} - - -inline bool -bplustree_node::IsDuplicate(off_t link) -{ - return (LinkType(link) & (BPLUSTREE_DUPLICATE_NODE | BPLUSTREE_DUPLICATE_FRAGMENT)) > 0; -} - - -inline off_t -bplustree_node::FragmentOffset(off_t link) -{ - return link & 0x3ffffffffffffc00LL; -} - - -inline uint32 -bplustree_node::FragmentIndex(off_t link) -{ - return (uint32)(link & 0x3ff); -} -#endif /* BPLUSTREE_SUPPORTS_DUPLICATES */ - -} // namespace BFS - -#endif /* B_PLUS_TREE_H */ diff --git a/src/system/boot/loader/file_systems/bfs/Directory.cpp b/src/system/boot/loader/file_systems/bfs/Directory.cpp index 91fe02ffab..a4f5642880 100644 --- a/src/system/boot/loader/file_systems/bfs/Directory.cpp +++ b/src/system/boot/loader/file_systems/bfs/Directory.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -52,14 +51,14 @@ Directory::~Directory() } -status_t +status_t Directory::InitCheck() { return fStream.InitCheck(); } -status_t +status_t Directory::Open(void **_cookie, int mode) { _inherited::Open(_cookie, mode); @@ -72,7 +71,7 @@ Directory::Open(void **_cookie, int mode) } -status_t +status_t Directory::Close(void *cookie) { _inherited::Close(cookie); @@ -118,7 +117,7 @@ Directory::Lookup(const char *name, bool traverseLinks) } -status_t +status_t Directory::GetNextEntry(void *cookie, char *name, size_t size) { TreeIterator *iterator = (TreeIterator *)cookie; @@ -129,7 +128,7 @@ Directory::GetNextEntry(void *cookie, char *name, size_t size) } -status_t +status_t Directory::GetNextNode(void *cookie, Node **_node) { TreeIterator *iterator = (TreeIterator *)cookie; @@ -149,7 +148,7 @@ Directory::GetNextNode(void *cookie, Node **_node) } -status_t +status_t Directory::Rewind(void *cookie) { TreeIterator *iterator = (TreeIterator *)cookie; @@ -158,7 +157,7 @@ Directory::Rewind(void *cookie) } -bool +bool Directory::IsEmpty() { TreeIterator iterator(&fTree); diff --git a/src/system/boot/loader/file_systems/bfs/File.cpp b/src/system/boot/loader/file_systems/bfs/File.cpp index 626731d39f..2853ed11b1 100644 --- a/src/system/boot/loader/file_systems/bfs/File.cpp +++ b/src/system/boot/loader/file_systems/bfs/File.cpp @@ -1,16 +1,15 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * This file may be used under the terms of the MIT License. + */ #include "File.h" -#include - namespace BFS { + File::File(Volume &volume, block_run run) : fStream(volume, run) @@ -37,14 +36,14 @@ File::~File() } -status_t +status_t File::InitCheck() { return fStream.InitCheck(); } -ssize_t +ssize_t File::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) { status_t status = fStream.ReadAt(pos, (uint8 *)buffer, &bufferSize); @@ -55,7 +54,7 @@ File::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) } -ssize_t +ssize_t File::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) { return EROFS; @@ -89,4 +88,5 @@ File::Inode() const return fStream.ID(); } + } // namespace BFS diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile b/src/system/boot/loader/file_systems/bfs/Jamfile index e91cf720d1..860fb61786 100644 --- a/src/system/boot/loader/file_systems/bfs/Jamfile +++ b/src/system/boot/loader/file_systems/bfs/Jamfile @@ -19,3 +19,6 @@ BootStaticLibrary boot_bfs : BPlusTree.cpp : -fno-pic ; + +SEARCH on [ FGristFiles BPlusTree.cpp ] + = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ; diff --git a/src/system/boot/loader/file_systems/bfs/Link.cpp b/src/system/boot/loader/file_systems/bfs/Link.cpp index 381abb9515..c5159a2003 100644 --- a/src/system/boot/loader/file_systems/bfs/Link.cpp +++ b/src/system/boot/loader/file_systems/bfs/Link.cpp @@ -1,16 +1,15 @@ /* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2004-2013, Axel Dörfler, axeld@pinc-software.de. + * This file may be used under the terms of the MIT License. + */ #include "Link.h" -#include - namespace BFS { + Link::Link(Volume &volume, block_run run) : File(volume, run) { @@ -63,4 +62,5 @@ Link::Type() const return S_IFLNK; } + } // namespace BFS diff --git a/src/system/boot/loader/file_systems/bfs/Stream.cpp b/src/system/boot/loader/file_systems/bfs/Stream.cpp index 9eb25b7e30..4cdea7dd85 100644 --- a/src/system/boot/loader/file_systems/bfs/Stream.cpp +++ b/src/system/boot/loader/file_systems/bfs/Stream.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * This file may be used under the terms of the MIT License. */ @@ -12,8 +12,6 @@ #include "File.h" #include "Link.h" -#include - #include #include #include diff --git a/src/system/boot/loader/file_systems/bfs/Stream.h b/src/system/boot/loader/file_systems/bfs/Stream.h index 908d0b4d14..19468afbf6 100644 --- a/src/system/boot/loader/file_systems/bfs/Stream.h +++ b/src/system/boot/loader/file_systems/bfs/Stream.h @@ -35,6 +35,7 @@ class Stream : public bfs_inode { bool IsContainer() const { return Mode() & (S_IFDIR | S_INDEX_DIR | S_ATTR_DIR); } bool IsSymlink() const { return S_ISLNK(Mode()); } + bool IsIndex() const { return false; } static Node *NodeFactory(Volume &volume, off_t id); diff --git a/src/system/boot/loader/file_systems/bfs/bfs.cpp b/src/system/boot/loader/file_systems/bfs/bfs.cpp index f6cfd3b36a..3fee5a9dc4 100644 --- a/src/system/boot/loader/file_systems/bfs/bfs.cpp +++ b/src/system/boot/loader/file_systems/bfs/bfs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -12,7 +12,6 @@ #include #include #include -#include #include "Volume.h" #include "Directory.h" diff --git a/src/system/boot/loader/file_systems/fat/CachedBlock.h b/src/system/boot/loader/file_systems/fat/CachedBlock.h index f19ca82036..ab6f6f5342 100644 --- a/src/system/boot/loader/file_systems/fat/CachedBlock.h +++ b/src/system/boot/loader/file_systems/fat/CachedBlock.h @@ -9,16 +9,12 @@ #define CACHED_BLOCK_H -#include -#include -#include -#include - #include "Volume.h" namespace FATFS { + class CachedBlock { public: enum { diff --git a/src/system/boot/loader/file_systems/fat/Directory.cpp b/src/system/boot/loader/file_systems/fat/Directory.cpp index f1e56e6f5a..caa010aa5d 100644 --- a/src/system/boot/loader/file_systems/fat/Directory.cpp +++ b/src/system/boot/loader/file_systems/fat/Directory.cpp @@ -1,7 +1,8 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2008, François Revol + * Distributed under the terms of the MIT License. + */ #include "Directory.h" @@ -14,7 +15,6 @@ #include #include -#include #include "CachedBlock.h" #include "File.h" @@ -24,8 +24,10 @@ //#define TRACE(x) dprintf x #define TRACE(x) do {} while (0) + namespace FATFS { + struct dir_entry { void *Buffer() const { return (void *)fName; }; const char *BaseName() const { return fName; }; @@ -328,7 +330,7 @@ Directory::Open(void **_cookie, int mode) TRACE(("FASFS::Directory::%s(, %d)\n", __FUNCTION__, mode)); _inherited::Open(_cookie, mode); - struct dir_cookie *c = new struct dir_cookie; + dir_cookie *c = new(nothrow) dir_cookie; if (c == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/fat/File.cpp b/src/system/boot/loader/file_systems/fat/File.cpp index 4a06da1934..60ac2e8fb5 100644 --- a/src/system/boot/loader/file_systems/fat/File.cpp +++ b/src/system/boot/loader/file_systems/fat/File.cpp @@ -1,7 +1,8 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2008, François Revol + * Distributed under the terms of the MIT License. + */ #include "File.h" @@ -9,8 +10,6 @@ #include #include -#include - #include "Directory.h" @@ -137,4 +136,5 @@ File::Inode() const return fStream.FirstCluster() << 16; } + } // namespace FATFS diff --git a/src/system/boot/loader/file_systems/fat/Stream.cpp b/src/system/boot/loader/file_systems/fat/Stream.cpp index a8d8754e11..3ed255f656 100644 --- a/src/system/boot/loader/file_systems/fat/Stream.cpp +++ b/src/system/boot/loader/file_systems/fat/Stream.cpp @@ -17,12 +17,12 @@ #include #include -#include #include "CachedBlock.h" #include "Directory.h" #include "File.h" + //#define TRACE(x) dprintf x #define TRACE(x) do {} while (0) diff --git a/src/system/boot/loader/file_systems/fat/Volume.cpp b/src/system/boot/loader/file_systems/fat/Volume.cpp index fae51c9ca9..c2da9568a6 100644 --- a/src/system/boot/loader/file_systems/fat/Volume.cpp +++ b/src/system/boot/loader/file_systems/fat/Volume.cpp @@ -1,7 +1,8 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2008, François Revol + * Distributed under the terms of the MIT License. + */ #include "Volume.h" @@ -10,7 +11,6 @@ #include #include -#include #include #include @@ -18,9 +18,11 @@ #include #include + //#define TRACE(x) dprintf x #define TRACE(x) do {} while (0) + using namespace FATFS; @@ -33,7 +35,7 @@ Volume::Volume(boot::Partition *partition) if ((fDevice = open_node(partition, O_RDONLY)) < B_OK) return; - fCachedBlock = new CachedBlock(*this); + fCachedBlock = new(nothrow) CachedBlock(*this); if (fCachedBlock == NULL) return; @@ -135,13 +137,13 @@ Volume::Volume(boot::Partition *partition) fFatBits = 16; goto err1; } - TRACE(("%s: block size %d, sector size %d, sectors/cluster %d\n", __FUNCTION__, - fBlockSize, fBytesPerSector, fSectorsPerCluster)); - TRACE(("%s: block shift %d, sector shift %d, cluster shift %d\n", __FUNCTION__, - fBlockShift, fSectorShift, fClusterShift)); - TRACE(("%s: reserved %d, max root entries %d, media %02x, sectors/fat %d\n", __FUNCTION__, - fReservedSectors, fMaxRootEntries, fMediaDesc, fSectorsPerFat)); - + TRACE(("%s: block size %d, sector size %d, sectors/cluster %d\n", + __FUNCTION__, fBlockSize, fBytesPerSector, fSectorsPerCluster)); + TRACE(("%s: block shift %d, sector shift %d, cluster shift %d\n", + __FUNCTION__, fBlockShift, fSectorShift, fClusterShift)); + TRACE(("%s: reserved %d, max root entries %d, media %02x, sectors/fat %d\n", + __FUNCTION__, fReservedSectors, fMaxRootEntries, fMediaDesc, + fSectorsPerFat)); //if (fTotalSectors > partition->sectors_per_track * partition->cylinder_count * partition->head_count) if ((off_t)fTotalSectors * fBytesPerSector > partition->size) @@ -150,7 +152,7 @@ Volume::Volume(boot::Partition *partition) TRACE(("%s: found fat%d filesystem, root dir at cluster %d\n", __FUNCTION__, fFatBits, fRootDirCluster)); - fRoot = new Directory(*this, 0, fRootDirCluster, "/"); + fRoot = new(nothrow) Directory(*this, 0, fRootDirCluster, "/"); return; err1: @@ -413,7 +415,7 @@ static status_t dosfs_get_file_system(boot::Partition *partition, ::Directory **_root) { TRACE(("%s()\n", __FUNCTION__)); - Volume *volume = new Volume(partition); + Volume *volume = new(nothrow) Volume(partition); if (volume == NULL) return B_NO_MEMORY; diff --git a/src/system/boot/loader/file_systems/fat/fatfs.cpp b/src/system/boot/loader/file_systems/fat/fatfs.cpp index 074476f3e1..2a989109f8 100644 --- a/src/system/boot/loader/file_systems/fat/fatfs.cpp +++ b/src/system/boot/loader/file_systems/fat/fatfs.cpp @@ -1,14 +1,13 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2008, François Revol + * Distributed under the terms of the MIT License. + */ #include "fatfs.h" #include #include -#include #include #include diff --git a/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp b/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp index c44cc1a227..ea3d0c26d0 100644 --- a/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp +++ b/src/system/boot/loader/file_systems/hfs_plus/hfs_plus.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2005-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/src/system/boot/loader/file_systems/tarfs/tarfs.cpp b/src/system/boot/loader/file_systems/tarfs/tarfs.cpp index 6b75f2733c..60960fc8af 100644 --- a/src/system/boot/loader/file_systems/tarfs/tarfs.cpp +++ b/src/system/boot/loader/file_systems/tarfs/tarfs.cpp @@ -1,6 +1,6 @@ /* * Copyright 2005-2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. - * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2013, Axel Dörfler, axeld@pinc-software.de. * * Distributed under the terms of the MIT License. */ @@ -21,7 +21,6 @@ #include #include -#include #include @@ -39,6 +38,7 @@ static const size_t kTarRegionSize = 8 * 1024 * 1024; // 8 MB namespace TarFS { + struct RegionDelete { inline void operator()(void* memory) { @@ -813,7 +813,6 @@ TarFS::Volume::_Inflate(boot::Partition* partition, void* cookie, off_t offset, } - // #pragma mark - diff --git a/src/system/boot/loader/heap.cpp b/src/system/boot/loader/heap.cpp index 970ce7f272..574548dda5 100644 --- a/src/system/boot/loader/heap.cpp +++ b/src/system/boot/loader/heap.cpp @@ -1,12 +1,11 @@ /* - * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ #include #include -#include #ifdef HEAP_TEST # include diff --git a/src/system/boot/loader/main.cpp b/src/system/boot/loader/main.cpp index 63a78a1e9a..efa659a351 100644 --- a/src/system/boot/loader/main.cpp +++ b/src/system/boot/loader/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -14,8 +14,6 @@ #include #include -#include - //#define TRACE_MAIN #ifdef TRACE_MAIN diff --git a/src/system/boot/loader/menu.cpp b/src/system/boot/loader/menu.cpp index fbb90d5427..4e4da2cd4f 100644 --- a/src/system/boot/loader/menu.cpp +++ b/src/system/boot/loader/menu.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -21,7 +21,6 @@ #include #include #include -#include #include #include "kernel_debug_config.h" diff --git a/src/system/boot/loader/partitions.cpp b/src/system/boot/loader/partitions.cpp index 29d4f20f76..f70bc8a407 100644 --- a/src/system/boot/loader/partitions.cpp +++ b/src/system/boot/loader/partitions.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -16,7 +16,6 @@ #include #include #include -#include #include "RootFileSystem.h" @@ -212,7 +211,7 @@ Partition::Type() const Partition * Partition::AddChild() { - Partition *child = new Partition(fFD); + Partition *child = new(nothrow) Partition(fFD); TRACE(("%p Partition::AddChild %p\n", this, child)); if (child == NULL) return NULL; @@ -426,7 +425,7 @@ add_partitions_for(int fd, bool mountFileSystems, bool isBootDevice) TRACE(("add_partitions_for(fd = %d, mountFS = %s)\n", fd, mountFileSystems ? "yes" : "no")); - Partition *partition = new Partition(fd); + Partition *partition = new(nothrow) Partition(fd); // set some magic/default values partition->block_size = 512; diff --git a/src/system/boot/loader/stdio.cpp b/src/system/boot/loader/stdio.cpp index ca430ea730..267ddbd46f 100644 --- a/src/system/boot/loader/stdio.cpp +++ b/src/system/boot/loader/stdio.cpp @@ -1,12 +1,11 @@ /* - * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ #include #include -#include #include #include diff --git a/src/system/boot/loader/vfs.cpp b/src/system/boot/loader/vfs.cpp index 9c1d5e1e1f..8e6b6c0867 100644 --- a/src/system/boot/loader/vfs.cpp +++ b/src/system/boot/loader/vfs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "RootFileSystem.h" diff --git a/src/system/boot/platform/bios_ia32/apm.cpp b/src/system/boot/platform/bios_ia32/apm.cpp index 3e4aec15fe..9e71b0888d 100644 --- a/src/system/boot/platform/bios_ia32/apm.cpp +++ b/src/system/boot/platform/bios_ia32/apm.cpp @@ -36,9 +36,9 @@ apm_init(void) return B_ERROR; } - apm_info &info = gKernelArgs.platform_args.apm; - info.version = regs.eax & 0xffff; - info.flags = regs.ecx & 0xffff; + const apm_info &info = gKernelArgs.platform_args.apm; + gKernelArgs.platform_args.apm.version = regs.eax & 0xffff; + gKernelArgs.platform_args.apm.flags = regs.ecx & 0xffff; dprintf("APM version %d.%d available, flags %x.\n", (info.version >> 8) & 0xf, info.version & 0xf, info.flags); @@ -64,19 +64,19 @@ apm_init(void) call_bios(0x15, ®s); if ((regs.flags & CARRY_FLAG) != 0) { // reset the version, so that the kernel won't try to use APM - info.version = 0; + gKernelArgs.platform_args.apm.version = 0; return B_ERROR; } - info.code32_segment_base = regs.eax & 0xffff; - info.code32_segment_offset = regs.ebx; - info.code32_segment_length = regs.esi & 0xffff; + gKernelArgs.platform_args.apm.code32_segment_base = regs.eax & 0xffff; + gKernelArgs.platform_args.apm.code32_segment_offset = regs.ebx; + gKernelArgs.platform_args.apm.code32_segment_length = regs.esi & 0xffff; - info.code16_segment_base = regs.ecx & 0xffff; - info.code16_segment_length = regs.esi >> 16; + gKernelArgs.platform_args.apm.code16_segment_base = regs.ecx & 0xffff; + gKernelArgs.platform_args.apm.code16_segment_length = regs.esi >> 16; - info.data_segment_base = regs.edx & 0xffff; - info.data_segment_length = regs.edi & 0xffff; + gKernelArgs.platform_args.apm.data_segment_base = regs.edx & 0xffff; + gKernelArgs.platform_args.apm.data_segment_length = regs.edi & 0xffff; TRACE((" code32: 0x%x, 0x%lx, length 0x%x\n", info.code32_segment_base, info.code32_segment_offset, info.code32_segment_length)); diff --git a/src/system/kernel/Notifications.cpp b/src/system/kernel/Notifications.cpp index 70ca761c61..0673cbaf84 100644 --- a/src/system/kernel/Notifications.cpp +++ b/src/system/kernel/Notifications.cpp @@ -156,13 +156,11 @@ DefaultNotificationService::DefaultNotificationService(const char* name) fName(name) { recursive_lock_init(&fLock, name); - NotificationManager::Manager().RegisterService(*this); } DefaultNotificationService::~DefaultNotificationService() { - NotificationManager::Manager().UnregisterService(*this); recursive_lock_destroy(&fLock); } @@ -253,6 +251,20 @@ DefaultNotificationService::RemoveListener(const KMessage* eventSpecifier, } +status_t +DefaultNotificationService::Register() +{ + return NotificationManager::Manager().RegisterService(*this); +} + + +void +DefaultNotificationService::Unregister() +{ + NotificationManager::Manager().UnregisterService(*this); +} + + status_t DefaultNotificationService::ToEventMask(const KMessage& eventSpecifier, uint32& eventMask) diff --git a/src/system/kernel/arch/x86/32/apm.cpp b/src/system/kernel/arch/x86/32/apm.cpp index f34b0b1b30..1c6b72b178 100644 --- a/src/system/kernel/arch/x86/32/apm.cpp +++ b/src/system/kernel/arch/x86/32/apm.cpp @@ -274,7 +274,7 @@ apm_shutdown(void) status_t apm_init(kernel_args *args) { - apm_info &info = args->platform_args.apm; + const apm_info &info = args->platform_args.apm; TRACE(("apm_init()\n")); @@ -338,11 +338,14 @@ apm_init(kernel_args *args) if ((info.data_segment_base << 4) < 0xe0000) { // use the BIOS data segment as data segment for APM - if (info.data_segment_length == 0) - info.data_segment_length = B_PAGE_SIZE - info.data_segment_base; + if (info.data_segment_length == 0) { + args->platform_args.apm.data_segment_length = B_PAGE_SIZE + - info.data_segment_base; + } set_segment_descriptor(&gGDT[APM_DATA_SEGMENT >> 3], - (addr_t)gDmaAddress + (info.data_segment_base << 4), info.data_segment_length, + (addr_t)gDmaAddress + (info.data_segment_base << 4), + info.data_segment_length, DT_DATA_WRITEABLE, DPL_KERNEL); } else { // use the BIOS area as data segment diff --git a/src/system/kernel/arch/x86/32/arch.S b/src/system/kernel/arch/x86/32/arch.S index 90ef56b363..68d7038be8 100644 --- a/src/system/kernel/arch/x86/32/arch.S +++ b/src/system/kernel/arch/x86/32/arch.S @@ -264,9 +264,12 @@ FUNCTION(arch_cpu_user_strlcpy): /* count remaining bytes in src */ .L_user_strlcpy_source_count: not %ecx + # %ecx was 0 and is now max xor %al,%al + movl %esi,%edi repnz scasb + movl %edi,%esi .L_user_strlcpy_source_done: movl %esi,%eax diff --git a/src/system/kernel/arch/x86/64/arch.S b/src/system/kernel/arch/x86/64/arch.S index 3f07b957d2..3f9b6d1e48 100644 --- a/src/system/kernel/arch/x86/64/arch.S +++ b/src/system/kernel/arch/x86/64/arch.S @@ -251,9 +251,12 @@ FUNCTION(arch_cpu_user_strlcpy): .L_user_strlcpy_source_count: // Count remaining bytes in src not %rcx + # %rcx was 0 and is now max xor %al, %al + movq %rsi, %rdi repnz scasb + movq %rdi, %rsi .L_user_strlcpy_source_done: // Restore the old fault handler diff --git a/src/system/kernel/arch/x86/arch_cpu.cpp b/src/system/kernel/arch/x86/arch_cpu.cpp index 7e60ae4e2e..710307b3a2 100644 --- a/src/system/kernel/arch/x86/arch_cpu.cpp +++ b/src/system/kernel/arch/x86/arch_cpu.cpp @@ -523,6 +523,7 @@ detect_cpu(int currentCPU) // print some fun data get_current_cpuid(&cpuid, 0); + uint32 maxBasicLeaf = cpuid.eax_0.max_eax; // build the vendor string memset(vendorString, 0, sizeof(vendorString)); @@ -561,7 +562,8 @@ detect_cpu(int currentCPU) // see if we can get the model name get_current_cpuid(&cpuid, 0x80000000); - if (cpuid.eax_0.max_eax >= 0x80000004) { + uint32 maxExtendedLeaf = cpuid.eax_0.max_eax; + if (maxExtendedLeaf >= 0x80000004) { // build the model string (need to swap ecx/edx data before copying) unsigned int temp; memset(cpu->arch.model_name, 0, sizeof(cpu->arch.model_name)); @@ -605,15 +607,19 @@ detect_cpu(int currentCPU) get_current_cpuid(&cpuid, 1); cpu->arch.feature[FEATURE_COMMON] = cpuid.eax_1.features; // edx cpu->arch.feature[FEATURE_EXT] = cpuid.eax_1.extended_features; // ecx - if (cpu->arch.vendor == VENDOR_AMD || cpu->arch.vendor == VENDOR_INTEL) { + + if (maxExtendedLeaf >= 0x80000001) { get_current_cpuid(&cpuid, 0x80000001); cpu->arch.feature[FEATURE_EXT_AMD] = cpuid.regs.edx; // edx + if (cpu->arch.vendor != VENDOR_AMD) + cpu->arch.feature[FEATURE_EXT_AMD] &= IA32_FEATURES_INTEL_EXT; + } + + if (maxBasicLeaf >= 6) { + get_current_cpuid(&cpuid, 6); + cpu->arch.feature[FEATURE_6_EAX] = cpuid.regs.eax; + cpu->arch.feature[FEATURE_6_ECX] = cpuid.regs.ecx; } - if (cpu->arch.vendor == VENDOR_INTEL) - cpu->arch.feature[FEATURE_EXT_AMD] &= IA32_FEATURES_INTEL_EXT; - get_current_cpuid(&cpuid, 6); - cpu->arch.feature[FEATURE_6_EAX] = cpuid.regs.eax; - cpu->arch.feature[FEATURE_6_ECX] = cpuid.regs.ecx; #if DUMP_FEATURE_STRING dump_feature_string(currentCPU, cpu); diff --git a/src/system/kernel/arch/x86/arch_debug.cpp b/src/system/kernel/arch/x86/arch_debug.cpp index ce61320f30..ea84e5c807 100644 --- a/src/system/kernel/arch/x86/arch_debug.cpp +++ b/src/system/kernel/arch/x86/arch_debug.cpp @@ -1252,7 +1252,7 @@ arch_get_debug_variable(const char* variableName, uint64* value) struct gdb_register { int32 type; - int64 value; + uint64 value; }; diff --git a/src/system/kernel/arch/x86/paging/64bit/X86PagingMethod64Bit.cpp b/src/system/kernel/arch/x86/paging/64bit/X86PagingMethod64Bit.cpp index 3f04f88775..b560db08c8 100644 --- a/src/system/kernel/arch/x86/paging/64bit/X86PagingMethod64Bit.cpp +++ b/src/system/kernel/arch/x86/paging/64bit/X86PagingMethod64Bit.cpp @@ -373,8 +373,10 @@ X86PagingMethod64Bit::PutPageTableEntryInTable(uint64* entry, page |= X86_64_PTE_USER; if ((attributes & B_WRITE_AREA) != 0) page |= X86_64_PTE_WRITABLE; - if ((attributes & B_EXECUTE_AREA) == 0) + if ((attributes & B_EXECUTE_AREA) == 0 + && x86_check_feature(IA32_FEATURE_AMD_EXT_NX, FEATURE_EXT_AMD)) { page |= X86_64_PTE_NOT_EXECUTABLE; + } } else if ((attributes & B_KERNEL_WRITE_AREA) != 0) page |= X86_64_PTE_WRITABLE; diff --git a/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp b/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp index 3f24ae5434..64eb688172 100644 --- a/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp +++ b/src/system/kernel/arch/x86/paging/64bit/X86VMTranslationMap64Bit.cpp @@ -673,8 +673,10 @@ X86VMTranslationMap64Bit::Protect(addr_t start, addr_t end, uint32 attributes, newProtectionFlags = X86_64_PTE_USER; if ((attributes & B_WRITE_AREA) != 0) newProtectionFlags |= X86_64_PTE_WRITABLE; - if ((attributes & B_EXECUTE_AREA) == 0) + if ((attributes & B_EXECUTE_AREA) == 0 + && x86_check_feature(IA32_FEATURE_AMD_EXT_NX, FEATURE_EXT_AMD)) { newProtectionFlags |= X86_64_PTE_NOT_EXECUTABLE; + } } else if ((attributes & B_KERNEL_WRITE_AREA) != 0) newProtectionFlags = X86_64_PTE_WRITABLE; diff --git a/src/system/kernel/arch/x86/paging/pae/X86PagingMethodPAE.cpp b/src/system/kernel/arch/x86/paging/pae/X86PagingMethodPAE.cpp index 90a2aee58f..f8b471279d 100644 --- a/src/system/kernel/arch/x86/paging/pae/X86PagingMethodPAE.cpp +++ b/src/system/kernel/arch/x86/paging/pae/X86PagingMethodPAE.cpp @@ -784,8 +784,10 @@ X86PagingMethodPAE::PutPageTableEntryInTable(pae_page_table_entry* entry, page |= X86_PAE_PTE_USER; if ((attributes & B_WRITE_AREA) != 0) page |= X86_PAE_PTE_WRITABLE; - if ((attributes & B_EXECUTE_AREA) == 0) + if ((attributes & B_EXECUTE_AREA) == 0 + && x86_check_feature(IA32_FEATURE_AMD_EXT_NX, FEATURE_EXT_AMD)) { page |= X86_PAE_PTE_NOT_EXECUTABLE; + } } else if ((attributes & B_KERNEL_WRITE_AREA) != 0) page |= X86_PAE_PTE_WRITABLE; diff --git a/src/system/kernel/arch/x86/paging/pae/X86VMTranslationMapPAE.cpp b/src/system/kernel/arch/x86/paging/pae/X86VMTranslationMapPAE.cpp index c936af436a..a7e7ef81b3 100644 --- a/src/system/kernel/arch/x86/paging/pae/X86VMTranslationMapPAE.cpp +++ b/src/system/kernel/arch/x86/paging/pae/X86VMTranslationMapPAE.cpp @@ -772,8 +772,10 @@ X86VMTranslationMapPAE::Protect(addr_t start, addr_t end, uint32 attributes, newProtectionFlags = X86_PAE_PTE_USER; if ((attributes & B_WRITE_AREA) != 0) newProtectionFlags |= X86_PAE_PTE_WRITABLE; - if ((attributes & B_EXECUTE_AREA) == 0) + if ((attributes & B_EXECUTE_AREA) == 0 + && x86_check_feature(IA32_FEATURE_AMD_EXT_NX, FEATURE_EXT_AMD)) { newProtectionFlags |= X86_PAE_PTE_NOT_EXECUTABLE; + } } else if ((attributes & B_KERNEL_WRITE_AREA) != 0) newProtectionFlags = X86_PAE_PTE_WRITABLE; diff --git a/src/system/kernel/device_manager/IOSchedulerRoster.cpp b/src/system/kernel/device_manager/IOSchedulerRoster.cpp index bacf3bf6cc..5724aa17b6 100644 --- a/src/system/kernel/device_manager/IOSchedulerRoster.cpp +++ b/src/system/kernel/device_manager/IOSchedulerRoster.cpp @@ -78,10 +78,12 @@ IOSchedulerRoster::IOSchedulerRoster() fNotificationService("I/O") { mutex_init(&fLock, "IOSchedulerRoster"); + fNotificationService.Register(); } IOSchedulerRoster::~IOSchedulerRoster() { mutex_destroy(&fLock); + fNotificationService.Unregister(); } diff --git a/src/system/kernel/device_manager/devfs.cpp b/src/system/kernel/device_manager/devfs.cpp index 159fe39739..ca77751768 100644 --- a/src/system/kernel/device_manager/devfs.cpp +++ b/src/system/kernel/device_manager/devfs.cpp @@ -487,7 +487,7 @@ translate_partition_access(devfs_partition* partition, off_t& offset, ASSERT(offset >= 0); ASSERT(offset < partition->info.size); - size = min_c(size, partition->info.size - offset); + size = (size_t)min_c((off_t)size, partition->info.size - offset); offset += partition->info.offset; } diff --git a/src/system/kernel/device_manager/device_manager.cpp b/src/system/kernel/device_manager/device_manager.cpp index ec71aa1294..27e04080f1 100644 --- a/src/system/kernel/device_manager/device_manager.cpp +++ b/src/system/kernel/device_manager/device_manager.cpp @@ -1552,6 +1552,7 @@ device_node::_GetNextDriverPath(void*& cookie, KPath& _path) switch (subType) { case PCI_scsi: _AddPath(*stack, "busses", "scsi"); + _AddPath(*stack, "busses", "virtio"); break; case PCI_ide: _AddPath(*stack, "busses", "ata"); @@ -1583,6 +1584,7 @@ device_node::_GetNextDriverPath(void*& cookie, KPath& _path) break; case PCI_network: _AddPath(*stack, "drivers", "net"); + _AddPath(*stack, "busses", "virtio"); break; case PCI_display: _AddPath(*stack, "drivers", "graphics"); diff --git a/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp b/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp index 076a24bda4..8a85992ef2 100644 --- a/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp +++ b/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp @@ -254,6 +254,8 @@ KDiskDeviceManager::KDiskDeviceManager() if (InitCheck() != B_OK) return; + fNotifications->Register(); + RescanDiskSystems(); fMediaChecker = spawn_kernel_thread(_CheckMediaStatusDaemon, @@ -310,6 +312,8 @@ KDiskDeviceManager::~KDiskDeviceManager() delete diskSystem; } + fNotifications->Unregister(); + // delete the containers delete fPartitions; delete fDevices; diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index b4ddee33af..114d6ab7c2 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -3531,7 +3531,7 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie, for (; fileVecIndex < fileVecCount; fileVecIndex++) { const file_io_vec &fileVec = fileVecs[fileVecIndex]; off_t fileOffset = fileVec.offset; - off_t fileLeft = min_c(fileVec.length, bytesLeft); + off_t fileLeft = min_c(fileVec.length, (off_t)bytesLeft); TRACE(("FILE VEC [%" B_PRIu32 "] length %" B_PRIdOFF "\n", fileVecIndex, fileLeft)); diff --git a/src/system/kernel/fs/vfs_request_io.cpp b/src/system/kernel/fs/vfs_request_io.cpp index afa5b0659b..4a7984d94a 100644 --- a/src/system/kernel/fs/vfs_request_io.cpp +++ b/src/system/kernel/fs/vfs_request_io.cpp @@ -167,7 +167,7 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request, size_t subRequestCount = 0; for (size_t i = 0; i < vecCount && subRequestCount < kMaxSubRequests; i++) { off_t vecOffset = vecs[i].offset; - off_t vecLength = min_c(vecs[i].length, requestLength); + off_t vecLength = min_c(vecs[i].length, (off_t)requestLength); TRACE_RIO("[%ld] vec %lu offset: %lld, length: %lld\n", find_thread(NULL), i, vecOffset, vecLength); diff --git a/src/system/kernel/image.cpp b/src/system/kernel/image.cpp index 1de30f7c0a..e76cc60118 100644 --- a/src/system/kernel/image.cpp +++ b/src/system/kernel/image.cpp @@ -343,6 +343,8 @@ image_init(void) new(&sNotificationService) ImageNotificationService(); + sNotificationService.Register(); + #ifdef ADD_DEBUGGER_COMMANDS add_debugger_command("team_images", &dump_images_list, "Dump all registered images from the current team"); #endif diff --git a/src/system/kernel/port.cpp b/src/system/kernel/port.cpp index 26fb39d1e3..e4ba96c7ae 100644 --- a/src/system/kernel/port.cpp +++ b/src/system/kernel/port.cpp @@ -792,6 +792,7 @@ port_init(kernel_args *args) " - address of the port's read or write condition.\n", 0); new(&sNotificationService) PortNotificationService(); + sNotificationService.Register(); sPortsActive = true; return B_OK; } diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index d0d68d8c62..1212b62df5 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -2771,6 +2771,8 @@ team_init(kernel_args* args) new(&sNotificationService) TeamNotificationService(); + sNotificationService.Register(); + return B_OK; } diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 93fcfe5dbb..7ac994cd9e 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -2738,6 +2738,8 @@ thread_init(kernel_args *args) // init the notification service new(&sNotificationService) ThreadNotificationService(); + sNotificationService.Register(); + // start the undertaker thread new(&sUndertakerEntries) DoublyLinkedList(); sUndertakerCondition.Init(&sUndertakerEntries, "undertaker entries"); diff --git a/src/system/kernel/util/Random.cpp b/src/system/kernel/util/Random.cpp index 46ad125ff7..12a2eeb074 100644 --- a/src/system/kernel/util/Random.cpp +++ b/src/system/kernel/util/Random.cpp @@ -116,7 +116,7 @@ secure_random_value() data[1] = system_time(); data[2] = find_thread(NULL); data[3] = smp_get_current_cpu(); - data[4] = smp_get_num_cpus(); + data[4] = real_time_clock(); data[5] = sFastLast; data[6] = sLast; data[7] = sSecureLast; diff --git a/src/system/kernel/vm/VMAnonymousCache.cpp b/src/system/kernel/vm/VMAnonymousCache.cpp index 8302f997ee..4105676f91 100644 --- a/src/system/kernel/vm/VMAnonymousCache.cpp +++ b/src/system/kernel/vm/VMAnonymousCache.cpp @@ -490,10 +490,10 @@ VMAnonymousCache::Resize(off_t newSize, int priority) { // If the cache size shrinks, drop all swap pages beyond the new size. if (fAllocatedSwapSize > 0) { - page_num_t oldPageCount = (virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT; + off_t oldPageCount = (virtual_end + B_PAGE_SIZE - 1) >> PAGE_SHIFT; swap_block* swapBlock = NULL; - for (page_num_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT; + for (off_t pageIndex = (newSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT; pageIndex < oldPageCount && fAllocatedSwapSize > 0; pageIndex++) { WriteLocker locker(sSwapHashLock); @@ -579,7 +579,7 @@ VMAnonymousCache::HasPage(off_t offset) bool VMAnonymousCache::DebugHasPage(off_t offset) { - page_num_t pageIndex = offset >> PAGE_SHIFT; + off_t pageIndex = offset >> PAGE_SHIFT; swap_hash_key key = { this, pageIndex }; swap_block* swap = sSwapHashTable.Lookup(key); if (swap == NULL) @@ -1093,7 +1093,7 @@ VMAnonymousCache::_MergeSwapPages(VMAnonymousCache* source) WriteLocker locker(sSwapHashLock); - page_num_t swapBlockPageIndex = offset >> PAGE_SHIFT; + off_t swapBlockPageIndex = offset >> PAGE_SHIFT; swap_hash_key key = { source, swapBlockPageIndex }; swap_block* sourceSwapBlock = sSwapHashTable.Lookup(key); diff --git a/src/system/kernel/vm/VMUserAddressSpace.cpp b/src/system/kernel/vm/VMUserAddressSpace.cpp index 71d48a6f51..dd10892829 100644 --- a/src/system/kernel/vm/VMUserAddressSpace.cpp +++ b/src/system/kernel/vm/VMUserAddressSpace.cpp @@ -397,11 +397,12 @@ VMUserAddressSpace::_RandomizeAddress(addr_t start, addr_t end, size_t alignment, bool initial) { ASSERT((start & addr_t(alignment - 1)) == 0); + ASSERT(start <= end); if (start == end) return start; - addr_t range = end - start; + addr_t range = end - start + 1; if (initial) range = min_c(range, kMaxInitialRandomize); else @@ -538,9 +539,9 @@ VMUserAddressSpace::_InsertAreaSlot(addr_t start, addr_t size, addr_t end, if (addressSpec == B_RANDOMIZED_BASE_ADDRESS) { originalStart = start; - start = _RandomizeAddress(start, end - size, alignment, true); + start = _RandomizeAddress(start, end - size + 1, alignment, true); } - + // walk up to the spot where we should start searching second_chance: VMUserAreaList::Iterator it = fAreas.GetIterator(); @@ -568,10 +569,10 @@ second_chance: if (last == NULL) { // see if we can build it at the beginning of the virtual map addr_t alignedBase = ROUNDUP(start, alignment); - addr_t nextBase = next == NULL ? end : min_c(next->Base(), end); + addr_t nextBase = next == NULL ? end : min_c(next->Base() - 1, end); if (is_valid_spot(start, alignedBase, size, nextBase)) { - addr_t rangeEnd = min_c(nextBase - size, end); + addr_t rangeEnd = min_c(nextBase - size + 1, end); if (is_randomized(addressSpec)) { alignedBase = _RandomizeAddress(alignedBase, rangeEnd, alignment); @@ -587,14 +588,14 @@ second_chance: } // keep walking - while (next != NULL && next->Base() + size - 1 <= end) { + while (next != NULL && next->Base() + next->Size() - 1 <= end) { addr_t alignedBase = ROUNDUP(last->Base() + last->Size(), alignment); - addr_t nextBase = min_c(end, next->Base()); + addr_t nextBase = min_c(end, next->Base() - 1); if (is_valid_spot(last->Base() + (last->Size() - 1), alignedBase, size, nextBase)) { - addr_t rangeEnd = min_c(nextBase - size, end); + addr_t rangeEnd = min_c(nextBase - size + 1, end); if (is_randomized(addressSpec)) { alignedBase = _RandomizeAddress(alignedBase, rangeEnd, alignment); @@ -614,11 +615,11 @@ second_chance: addr_t alignedBase = ROUNDUP(last->Base() + last->Size(), alignment); - if (is_valid_spot(last->Base() + (last->Size() - 1), alignedBase, - size, end)) { + if (next == NULL && is_valid_spot(last->Base() + (last->Size() - 1), + alignedBase, size, end)) { if (is_randomized(addressSpec)) { - alignedBase = _RandomizeAddress(alignedBase, end - size, + alignedBase = _RandomizeAddress(alignedBase, end - size + 1, alignment); } @@ -631,12 +632,13 @@ second_chance: // we didn't find a free spot in the requested range, so we'll // try again without any restrictions - start = USER_BASE_ANY; - if (!is_randomized(addressSpec)) + if (!is_randomized(addressSpec)) { + start = USER_BASE_ANY; addressSpec = B_ANY_ADDRESS; - else if (start == originalStart) + } else if (start == originalStart) { + start = USER_BASE_ANY; addressSpec = B_RANDOMIZED_ANY_ADDRESS; - else { + } else { start = originalStart; addressSpec = B_RANDOMIZED_BASE_ADDRESS; } @@ -672,10 +674,11 @@ second_chance: } if ((next->protection & RESERVED_AVOID_BASE) == 0 - && alignedBase == next->Base() + && alignedBase == next->Base() && next->Size() >= size) { - addr_t rangeEnd = min_c(next->Size() - size, end); + addr_t rangeEnd = min_c( + next->Base() + next->Size() - size, end); if (is_randomized(addressSpec)) { alignedBase = _RandomizeAddress(next->Base(), rangeEnd, alignment); diff --git a/src/system/libroot/libroot_init.c b/src/system/libroot/libroot_init.c index cf6fc668fc..867cbd25a6 100644 --- a/src/system/libroot/libroot_init.c +++ b/src/system/libroot/libroot_init.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -30,6 +31,8 @@ char *__progname = NULL; int __libc_argc; char **__libc_argv; +int __gABIVersion; + char _single_threaded = true; // determines if I/O locking needed; needed for BeOS compatibility @@ -47,6 +50,7 @@ initialize_before(image_id imageID) { char *programPath = __gRuntimeLoader->program_args->args[0]; __gCommPageAddress = __gRuntimeLoader->commpage_address; + __gABIVersion = __gRuntimeLoader->abi_version; if (programPath) { if ((__progname = strrchr(programPath, '/')) == NULL) @@ -71,6 +75,7 @@ initialize_before(image_id imageID) __init_env(__gRuntimeLoader->program_args); __init_heap_post_env(); __init_pwd_backend(); + __set_stack_protection(); } diff --git a/src/system/libroot/os/area.c b/src/system/libroot/os/area.c index 0fedf2fc48..f620d23bd0 100644 --- a/src/system/libroot/os/area.c +++ b/src/system/libroot/os/area.c @@ -5,6 +5,9 @@ #include + +#include + #include "syscalls.h" @@ -12,6 +15,8 @@ area_id create_area(const char *name, void **address, uint32 addressSpec, size_t size, uint32 lock, uint32 protection) { + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) + protection |= B_EXECUTE_AREA; return _kern_create_area(name, address, addressSpec, size, lock, protection); } @@ -20,6 +25,8 @@ area_id clone_area(const char *name, void **address, uint32 addressSpec, uint32 protection, area_id sourceArea) { + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) + protection |= B_EXECUTE_AREA; return _kern_clone_area(name, address, addressSpec, protection, sourceArea); } @@ -55,6 +62,8 @@ resize_area(area_id id, size_t newSize) status_t set_area_protection(area_id id, uint32 protection) { + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) + protection |= B_EXECUTE_AREA; return _kern_set_area_protection(id, protection); } diff --git a/src/system/libroot/os/thread.c b/src/system/libroot/os/thread.c index 7320f2924a..41721453d3 100644 --- a/src/system/libroot/os/thread.c +++ b/src/system/libroot/os/thread.c @@ -74,6 +74,23 @@ _thread_do_exit_work(void) } +void +__set_stack_protection(void) +{ + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) { + area_info info; + ssize_t cookie = 0; + + while (get_next_area_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + if ((info.protection & B_STACK_AREA) != 0) { + _kern_set_area_protection(info.area, + B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA | B_STACK_AREA); + } + } + } +} + + // #pragma mark - @@ -99,8 +116,11 @@ spawn_thread(thread_func entry, const char *name, int32 priority, void *data) id = _kern_spawn_thread(&attributes); if (id < 0) free(thread); - else + else { thread->id = id; + __set_stack_protection(); + } + return id; } diff --git a/src/system/libroot/posix/malloc/arch-specific.cpp b/src/system/libroot/posix/malloc/arch-specific.cpp index 54d2fe00ad..0f16100831 100644 --- a/src/system/libroot/posix/malloc/arch-specific.cpp +++ b/src/system/libroot/posix/malloc/arch-specific.cpp @@ -24,6 +24,8 @@ #include #include +#include + #include #include @@ -103,9 +105,12 @@ __init_heap(void) if (status != B_OK) sHeapBase = NULL; + uint32 protection = B_READ_AREA | B_WRITE_AREA; + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) + protection |= B_EXECUTE_AREA; sHeapArea = create_area("heap", (void **)&sHeapBase, status == B_OK ? B_EXACT_ADDRESS : B_RANDOMIZED_BASE_ADDRESS, - kInitialHeapSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + kInitialHeapSize, B_NO_LOCK, protection); if (sHeapArea < B_OK) return sHeapArea; @@ -164,6 +169,11 @@ hoardSbrk(long size) // align size request size = (size + hoardHeap::ALIGNMENT - 1) & ~(hoardHeap::ALIGNMENT - 1); + // choose correct protection flags + uint32 protection = B_READ_AREA | B_WRITE_AREA; + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) + protection |= B_EXECUTE_AREA; + hoardLock(sHeapLock); // find chunk in free list @@ -259,7 +269,7 @@ hoardSbrk(long size) && (addr_t)base + newHeapSize <= (addr_t)sHeapBase + kHeapReservationSize) { area = create_area("heap", &base, B_EXACT_ADDRESS, newHeapSize, - B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + B_NO_LOCK, protection); if (area == B_NO_MEMORY) { hoardUnlock(sHeapLock); @@ -272,7 +282,7 @@ hoardSbrk(long size) if (area < 0) { base = (void*)(sFreeHeapBase + sHeapAreaSize); area = create_area("heap", &base, B_RANDOMIZED_BASE_ADDRESS, - newHeapSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); + newHeapSize, B_NO_LOCK, protection); } if (area < 0) { diff --git a/src/system/libroot/posix/pthread/pthread.cpp b/src/system/libroot/posix/pthread/pthread.cpp index 15c25165a6..1e7c4e9f96 100644 --- a/src/system/libroot/posix/pthread/pthread.cpp +++ b/src/system/libroot/posix/pthread/pthread.cpp @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -158,6 +159,7 @@ pthread_create(pthread_t* _thread, const pthread_attr_t* attr, return EAGAIN; } + __set_stack_protection(); resume_thread(thread->id); *_thread = thread; diff --git a/src/system/runtime_loader/elf_load_image.cpp b/src/system/runtime_loader/elf_load_image.cpp index 2ccabe46a9..fd90514541 100644 --- a/src/system/runtime_loader/elf_load_image.cpp +++ b/src/system/runtime_loader/elf_load_image.cpp @@ -505,7 +505,7 @@ load_image(char const* name, image_type type, const char* rpath, goto err2; } - status = map_image(fd, path, image, type == B_APP_IMAGE); + status = map_image(fd, path, image); if (status < B_OK) { FATAL("%s: Could not map image: %s\n", image->path, strerror(status)); status = B_ERROR; @@ -536,6 +536,8 @@ load_image(char const* name, image_type type, const char* rpath, #endif } + set_abi_version(image->abi); + // init gcc version dependent image flags // symbol resolution strategy if (image->abi == B_HAIKU_ABI_GCC_2_ANCIENT) diff --git a/src/system/runtime_loader/export.cpp b/src/system/runtime_loader/export.cpp index adfd2a4dd9..f8c0b068c1 100644 --- a/src/system/runtime_loader/export.cpp +++ b/src/system/runtime_loader/export.cpp @@ -57,7 +57,12 @@ struct rld_export gRuntimeLoader = { elf_reinit_after_fork, NULL, // call_atexit_hooks_for_range - terminate_program + terminate_program, + + // the following values will be set later + NULL, // program_args + NULL, // commpage_address + 0 // ABI version }; @@ -67,3 +72,16 @@ rldexport_init(void) gRuntimeLoader.program_args = gProgramArgs; gRuntimeLoader.commpage_address = __gCommPageAddress; } + + +/*! Is called for all images, and sets the minimum ABI version found to the + gRuntimeLoader.abi_version field. +*/ +void +set_abi_version(int abi_version) +{ + if (gRuntimeLoader.abi_version == 0 + || gRuntimeLoader.abi_version > abi_version) { + gRuntimeLoader.abi_version = abi_version; + } +} diff --git a/src/system/runtime_loader/images.cpp b/src/system/runtime_loader/images.cpp index 3bbe34bde2..992dc15975 100644 --- a/src/system/runtime_loader/images.cpp +++ b/src/system/runtime_loader/images.cpp @@ -166,9 +166,9 @@ topological_sort(image_t* image, uint32 slot, image_t** initList, */ static void get_image_region_load_address(image_t* image, uint32 index, long lastDelta, - bool fixed, addr_t& loadAddress, uint32& addressSpecifier) + addr_t& loadAddress, uint32& addressSpecifier) { - if (image->dynamic_ptr != 0 && !fixed) { + if (image->dynamic_ptr != 0) { // relocatable image... we can afford to place wherever if (index == 0) { // but only the first segment gets a free ride @@ -283,7 +283,7 @@ put_image(image_t* image) status_t -map_image(int fd, char const* path, image_t* image, bool fixed) +map_image(int fd, char const* path, image_t* image) { // cut the file name from the path as base name for the created areas const char* baseName = strrchr(path, '/'); @@ -301,16 +301,10 @@ map_image(int fd, char const* path, image_t* image, bool fixed) uint32 addressSpecifier = B_RANDOMIZED_ANY_ADDRESS; for (uint32 i = 0; i < image->num_regions; i++) { - // for BeOS compatibility: if we load an old BeOS executable, we - // have to relocate it, if possible - we recognize it because the - // vmstart is set to 0 (hopefully always) - if (fixed && image->regions[i].vmstart == 0) - fixed = false; - uint32 regionAddressSpecifier; get_image_region_load_address(image, i, i > 0 ? loadAddress - image->regions[i - 1].vmstart : 0, - fixed, loadAddress, regionAddressSpecifier); + loadAddress, regionAddressSpecifier); if (i == 0) { reservedAddress = loadAddress; addressSpecifier = regionAddressSpecifier; @@ -342,7 +336,7 @@ map_image(int fd, char const* path, image_t* image, bool fixed) baseName, i, (image->regions[i].flags & RFLAG_RW) ? "rw" : "ro"); get_image_region_load_address(image, i, - i > 0 ? image->regions[i - 1].delta : 0, fixed, loadAddress, + i > 0 ? image->regions[i - 1].delta : 0, loadAddress, addressSpecifier); // If the image position is arbitrary, we must let it point to the start @@ -423,8 +417,10 @@ unmap_image(image_t* image) /*! This function will change the protection of all read-only segments to really - be read-only. + be read-only (and executable). The areas have to be read/write first, so that they can be relocated. + If at least one image is in compatibility mode then we allow execution of + all areas. */ void remap_images() @@ -432,14 +428,22 @@ remap_images() for (image_t* image = sLoadedImages.head; image != NULL; image = image->next) { for (uint32 i = 0; i < image->num_regions; i++) { - if ((image->regions[i].flags & RFLAG_RW) == 0 - && (image->regions[i].flags & RFLAG_REMAPPED) == 0) { - // we only need to do this once, so we remember those we've already mapped - if (_kern_set_area_protection(image->regions[i].id, - B_READ_AREA | B_EXECUTE_AREA) == B_OK) { - image->regions[i].flags |= RFLAG_REMAPPED; - } + // we only need to do this once, so we remember those we've already + // mapped + if ((image->regions[i].flags & RFLAG_REMAPPED) != 0) + continue; + + status_t result = B_OK; + if ((image->regions[i].flags & RFLAG_RW) == 0) { + result = _kern_set_area_protection(image->regions[i].id, + B_READ_AREA | B_EXECUTE_AREA); + } else if (image->abi < B_HAIKU_ABI_GCC_2_HAIKU) { + result = _kern_set_area_protection(image->regions[i].id, + B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA); } + + if (result == B_OK) + image->regions[i].flags |= RFLAG_REMAPPED; } } } diff --git a/src/system/runtime_loader/images.h b/src/system/runtime_loader/images.h index a929040b42..7a309bb6c8 100644 --- a/src/system/runtime_loader/images.h +++ b/src/system/runtime_loader/images.h @@ -50,7 +50,7 @@ void delete_image_struct(image_t* image); void delete_image(image_t* image); void put_image(image_t* image); -status_t map_image(int fd, char const* path, image_t* image, bool fixed); +status_t map_image(int fd, char const* path, image_t* image); void unmap_image(image_t* image); void remap_images(); diff --git a/src/system/runtime_loader/runtime_loader_private.h b/src/system/runtime_loader/runtime_loader_private.h index 2720a659a8..0aee8750c5 100644 --- a/src/system/runtime_loader/runtime_loader_private.h +++ b/src/system/runtime_loader/runtime_loader_private.h @@ -81,6 +81,7 @@ int resolve_symbol(image_t* rootImage, image_t* image, elf_sym* sym, status_t elf_verify_header(void* header, size_t length); void rldelf_init(void); void rldexport_init(void); +void set_abi_version(int abi_version); status_t elf_reinit_after_fork(void); status_t heap_init(void); diff --git a/src/tests/kits/game/chart/ChartWindow.cpp b/src/tests/kits/game/chart/ChartWindow.cpp index 3a273b1775..a3190711c8 100644 --- a/src/tests/kits/game/chart/ChartWindow.cpp +++ b/src/tests/kits/game/chart/ChartWindow.cpp @@ -1125,7 +1125,8 @@ ChartWindow::GetAppWindow(const char *name) if (window == NULL) break; if (window->LockWithTimeout(200000) == B_OK) { - if (strcmp(window->Name(), name) == 0) { + // skip the w> prefix in window's name. + if (strcmp(window->Name() + 2, name) == 0) { window->Unlock(); break; } @@ -1170,7 +1171,7 @@ ChartWindow::ButtonPicture(bool active, int32 button_type) than what a standard BButton would allow) with the current value of the star density pourcentage. */ value = (fCurrentSettings.star_density*100 + STAR_DENSITY_MAX/2) / STAR_DENSITY_MAX; - sprintf(word, "%3ld", value); + sprintf(word, "%3" B_PRId32, value); draw_string: fOffwindowButton->SetFont(be_bold_font); fOffwindowButton->SetFontSize(14.0); @@ -2134,7 +2135,7 @@ ChartWindow::SetPatternBits(buffer *buf) That's the main thread controling the animation and synchronising the engine state with the changes coming from the UI. */ -long +int32 ChartWindow::Animation(void *data) { int32 i, cur_4_frames_index, cur_last_fps, count_fps; @@ -2252,7 +2253,7 @@ ChartWindow::Animation(void *data) slave of the Animation thread. It's directly synchronised with its master, and will only do some star animation processing whenever its master allows him to do so. */ -long +int32 ChartWindow::Animation2(void *data) { ChartWindow *w = (ChartWindow*)data; diff --git a/src/tests/kits/game/chart/ChartWindow.h b/src/tests/kits/game/chart/ChartWindow.h index 51a430a477..659c51735b 100644 --- a/src/tests/kits/game/chart/ChartWindow.h +++ b/src/tests/kits/game/chart/ChartWindow.h @@ -292,8 +292,8 @@ static BWindow *GetAppWindow(const char *name); /* Engine processing related functions. */ /* those functions are the two processing threads launcher */ -static long Animation(void *data); -static long Animation2(void *data); +static int32 Animation(void *data); +static int32 Animation2(void *data); /* After every camera move or rotation, reprocess the torus cycle of the starfield to maintain the pyramid of vision of the camera completly inside a 1x1x1 iteration of the diff --git a/src/tests/kits/net/Jamfile b/src/tests/kits/net/Jamfile index ce66439eab..f133901cc1 100644 --- a/src/tests/kits/net/Jamfile +++ b/src/tests/kits/net/Jamfile @@ -19,6 +19,8 @@ SimpleTest link_echo : link_echo.cpp : $(TARGET_NETWORK_LIBS) bnetapi be ; SimpleTest getpeername : getpeername.cpp : $(TARGET_NETWORK_LIBS) ; +SimpleTest if_nameindex : if_nameindex.c : $(TARGET_NETWORK_LIBS) ; + SimpleTest tcp_connection_test : tcp_connection_test.cpp : $(TARGET_NETWORK_LIBS) ; diff --git a/src/tests/kits/net/if_nameindex.c b/src/tests/kits/net/if_nameindex.c new file mode 100644 index 0000000000..60f3fbd6bc --- /dev/null +++ b/src/tests/kits/net/if_nameindex.c @@ -0,0 +1,22 @@ +#include +#include +#include + + +int main(int argc, char* argv[]) +{ + struct if_nameindex* ifs; + int i; + + ifs = if_nameindex(); + if (ifs == NULL) { + perror("if_nameindex"); + exit(EXIT_FAILURE); + } + + for (i = 0; ifs[i].if_index != 0 || ifs[i].if_name != NULL; i++) { + printf("%d %s\n", ifs[i].if_index, ifs[i].if_name); + } + + return EXIT_SUCCESS; +} diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp b/src/tests/servers/app/playground/ObjectWindow.cpp index 0b6b9cc590..e78462287a 100644 --- a/src/tests/servers/app/playground/ObjectWindow.cpp +++ b/src/tests/servers/app/playground/ObjectWindow.cpp @@ -92,8 +92,9 @@ class ObjectListView : public BListView { virtual bool InitiateDrag(BPoint point, int32 itemIndex, bool wasSelected) { - printf("InitiateDrag(BPoint(%.1f, %.1f), itemIndex: %ld, wasSelected: %d)\n", - point.x, point.y, itemIndex, wasSelected); + printf("InitiateDrag(BPoint(%.1f, %.1f), itemIndex: %" B_PRId32 + ", wasSelected: %d)\n", point.x, point.y, itemIndex, + wasSelected); SwapItems(itemIndex, itemIndex + 1); return true; } diff --git a/src/tools/locale/Jamfile b/src/tools/locale/Jamfile index 1e47eaacc4..f1564b27a4 100644 --- a/src/tools/locale/Jamfile +++ b/src/tools/locale/Jamfile @@ -15,6 +15,9 @@ local localetools = # Due to the use of STL fstream open() mapping the function names via macro # name doesn't work. DEFINES += _HAIKU_BUILD_DONT_REMAP_FD_FUNCTIONS ; +# We link against the host libbe.so which could also contain this class, so +# rename it for locale tools +DEFINES += DefaultCatalog=ToolsDefaultCatalog ; USES_BE_API on $(localetools) = true ;