Merge branch 'master' into sam460ex
This commit is contained in:
@@ -14,9 +14,9 @@ SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr checkfs
|
|||||||
id ifconfig <bin>install isvolume join kernel_debugger kill less lessecho
|
id ifconfig <bin>install isvolume join kernel_debugger kill less lessecho
|
||||||
lesskey link linkcatkeys listdev ln locale locate logger logname ls
|
lesskey link linkcatkeys listdev ln locale locate logger logname ls
|
||||||
makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume
|
makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume
|
||||||
mv nl nohup notify nproc od paste patch pathchk ping pr printenv printf
|
mv nl nohup notify nproc od open paste patch pathchk ping pr printenv printf
|
||||||
ps ptx pwd query rc readlink ReadOnlyBootPrompt rm rmattr rmdir safemode
|
ps ptx pwd query rc readlink ReadOnlyBootPrompt rm rmattr rmdir safemode
|
||||||
sdiff seq sha1sum shred shuf sleep sort split stat strace stty su sum sync
|
sdiff seq sha1sum shred shuf shutdown sleep sort split stat strace stty su sum sync
|
||||||
sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand
|
sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand
|
||||||
uname uniq unlink unmount unzip <bin>updatedb waitfor wc wget whoami xargs
|
uname uniq unlink unmount unzip <bin>updatedb waitfor wc wget whoami xargs
|
||||||
xres yes zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote zipsplit
|
xres yes zdiff zforce zgrep zip zipcloak <bin>zipgrep zipnote zipsplit
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
*
|
||||||
|
* Corresponds to:
|
||||||
|
* src/kits/game/FileGameSound.cpp hrev45076
|
||||||
|
* src/kits/game/FileGameSound.h hrev45076
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\file FileGameSound.h
|
||||||
|
\brief Provides the BFileGameSound class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class BFileGameSound
|
||||||
|
\ingroup game
|
||||||
|
\ingroup libbe
|
||||||
|
\brief Playback audio from a sound file on disk.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BFileGameSound::BFileGameSound(const entry_ref *file, bool looping,
|
||||||
|
BGameSoundDevice *device)
|
||||||
|
\brief Creates and initializes a BFileGameSound object from an
|
||||||
|
\c entry_ref allowing you to play the specified sound file.
|
||||||
|
|
||||||
|
If \a looping is \c true, the sound automatically replays from the
|
||||||
|
beginning once the end is reached. This is useful for playing
|
||||||
|
background music in a loop.
|
||||||
|
|
||||||
|
You can specify the sound devise to use by setting the \a device
|
||||||
|
parameter. Setting \a device to \c NULL uses the default sound device.
|
||||||
|
|
||||||
|
\param file The entry ref pointing to the sound file on disk.
|
||||||
|
\param looping Whether or not to repeat the sound in a loop.
|
||||||
|
\param device The sound device to use to play the sound, use \c NULL for
|
||||||
|
default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BFileGameSound::BFileGameSound(const char *file, bool looping,
|
||||||
|
BGameSoundDevice *device)
|
||||||
|
\brief Creates and initializes a BFileGameSound object from a file path
|
||||||
|
allowing you to play the specified sound file.
|
||||||
|
|
||||||
|
If \a looping is \c true, the sound automatically replays from the
|
||||||
|
beginning once the end is reached. This is useful for playing
|
||||||
|
background music in a loop.
|
||||||
|
|
||||||
|
You can specify the sound devise to use by setting the \a device
|
||||||
|
parameter. Setting \a device to \c NULL uses the default sound device.
|
||||||
|
|
||||||
|
\param file The path of the sound file on disk.
|
||||||
|
\param looping Whether or not to repeat the sound in a loop.
|
||||||
|
\param device The sound device to use to play the sound, use \c NULL for
|
||||||
|
default.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BFileGameSound::~BFileGameSound()
|
||||||
|
\brief Destroys the BFileGameSound object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BGameSound* BFileGameSound::Clone() const
|
||||||
|
\brief Not implemented, always returns \c NULL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileGameSound::StartPlaying()
|
||||||
|
\brief Plays the sound file.
|
||||||
|
|
||||||
|
\returns A status code, \c B_OK on success or an error code on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileGameSound::StopPlaying()
|
||||||
|
\brief Stops playback of the sound file.
|
||||||
|
|
||||||
|
\returns A status code, \c B_OK on success or an error code on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileGameSound::Preload()
|
||||||
|
\brief Preload the sound file into memory so that playback won't be delayed.
|
||||||
|
|
||||||
|
\returns A status code, \c B_OK on success or an error code if we were
|
||||||
|
unable to communicate with the sound port.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void BFileGameSound::FillBuffer(void *inBuffer, size_t inByteCount)
|
||||||
|
\brief Fill a buffer with sound data.
|
||||||
|
|
||||||
|
\param inBuffer The buffer to fill.
|
||||||
|
\param inByteCount The number of bytes to fill buffer with.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime)
|
||||||
|
\brief Pauses playback if \a isPaused is \c true or resumes play if
|
||||||
|
\a isPaused is \c false.
|
||||||
|
|
||||||
|
\param isPaused \c true to pause playback, \c false to resume playback.
|
||||||
|
\param rampTime Determines how long the change in playback state should
|
||||||
|
take to complete in microseconds. Set to 0 for an instantaneous
|
||||||
|
change.
|
||||||
|
|
||||||
|
\returns A status code.
|
||||||
|
\retval B_OK The playback state was updated.
|
||||||
|
\retval EALREADY Already in the requested playback state.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn int32 BFileGameSound::IsPaused()
|
||||||
|
\brief Returns the current playback status.
|
||||||
|
|
||||||
|
\returns An integer indicating the current playback status.
|
||||||
|
\retval B_NOT_PAUSED Sound is playing.
|
||||||
|
\retval B_PAUSE_IN_PROGRESS The sound is transitioning to or from a paused state.
|
||||||
|
\retval B_PAUSED Sound is paused.
|
||||||
|
*/
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2011, Haiku, Inc. All Rights Reserved.
|
* Copyright 2011-2012 Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
* Oliver Tappe, [email protected]
|
* Oliver Tappe, [email protected]
|
||||||
*
|
*
|
||||||
* Corresponds to:
|
* Corresponds to:
|
||||||
* /trunk/headers/os/locale/Catalog.h rev 43095
|
* /trunk/headers/os/locale/Catalog.h hrev45083
|
||||||
* /trunk/src/kits/locale/Catalog.cpp rev 43095
|
* /trunk/src/kits/locale/Catalog.cpp hrev45083
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,8 @@
|
|||||||
/*!
|
/*!
|
||||||
\class BCatalog
|
\class BCatalog
|
||||||
\ingroup locale
|
\ingroup locale
|
||||||
\brief Class handling string localization.
|
\ingroup libbe
|
||||||
|
\brief String localization handling.
|
||||||
|
|
||||||
BCatalog is the class that allows you to perform string localization. This
|
BCatalog is the class that allows you to perform string localization. This
|
||||||
means you give it a string in english, and it automatically returns the
|
means you give it a string in english, and it automatically returns the
|
||||||
@@ -31,9 +32,9 @@
|
|||||||
Most of the time, you don't have to deal with BCatalog directly. You use
|
Most of the time, you don't have to deal with BCatalog directly. You use
|
||||||
the translation macros instead. However, there are some cases where you
|
the translation macros instead. However, there are some cases where you
|
||||||
will have to use catalogs directly. These include :
|
will have to use catalogs directly. These include :
|
||||||
\li Tools for managing catalogs : if you want to add, remove or edit
|
- Tools for managing catalogs : if you want to add, remove or edit
|
||||||
entries in a catalog, you need to do it using the BCatalog class.
|
entries in a catalog, you need to do it using the BCatalog class.
|
||||||
\li Accessing catalogs other than your own : the macros only grant you
|
- Accessing catalogs other than your own : the macros only grant you
|
||||||
access to the catalog linked with your application. To access
|
access to the catalog linked with your application. To access
|
||||||
other catalogs (for example if you create a script interpreter and
|
other catalogs (for example if you create a script interpreter and
|
||||||
want to localize the scripts), you will have to open a catalog
|
want to localize the scripts), you will have to open a catalog
|
||||||
@@ -58,13 +59,13 @@
|
|||||||
|
|
||||||
For example, if the user sets his language preferences as french(France),
|
For example, if the user sets his language preferences as french(France),
|
||||||
spanish, english, when an application loads a catalog, the following rules
|
spanish, english, when an application loads a catalog, the following rules
|
||||||
are used :
|
are used:
|
||||||
\li Try to load a french(France) catalog. If it is found, this catalog
|
- Try to load a french(France) catalog. If it is found, this catalog
|
||||||
will automatically include strings from the generic french catalog.
|
will automatically include strings from the generic french catalog.
|
||||||
\li Try to load a generic french catalog.
|
- Try to load a generic french catalog.
|
||||||
\li Try to load a generic spanish catalog.
|
- Try to load a generic spanish catalog.
|
||||||
\li Try to load a generic english catalog.
|
- Try to load a generic english catalog.
|
||||||
\li If all of them failed, use the strings that are in the source code.
|
- If all of them failed, use the strings that are in the source code.
|
||||||
|
|
||||||
Note that french(France) will failback to french, but then directly to the
|
Note that french(France) will failback to french, but then directly to the
|
||||||
language in the source code. This avoids mixing 3 or more languages in the
|
language in the source code. This avoids mixing 3 or more languages in the
|
||||||
@@ -73,9 +74,17 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn BCatalog::Catalog(const entry_ref& catalogOwner,
|
\fn BCatalog::BCatalog()
|
||||||
const char* language = NULL, uint32 fingerprint = 0);
|
\brief Construct an empty BCatalog object.
|
||||||
\brief Construct a catalog for the given \a catalogOwner.
|
|
||||||
|
Should be followed by SetTo() method to set the catalog.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BCatalog::BCatalog(const entry_ref& catalogOwner, const char* language,
|
||||||
|
uint32 fingerprint)
|
||||||
|
\brief Construct a BCatalog object for the given \a catalogOwner.
|
||||||
|
|
||||||
If you don't specify a language, the system default list will be used.
|
If you don't specify a language, the system default list will be used.
|
||||||
The language is passed here as a 2 letter ISO code.
|
The language is passed here as a 2 letter ISO code.
|
||||||
@@ -97,9 +106,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BCatalog::~BCatalog()
|
||||||
|
\brief Destroys the BCatalog object freeing memory used by it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn const char* BCatalog::GetString(const char* string,
|
\fn const char* BCatalog::GetString(const char* string,
|
||||||
const char* context = NULL, const char* comment = NULL)
|
const char* context, const char* comment)
|
||||||
\brief Get a string from the catalog.
|
\brief Get a string from the catalog.
|
||||||
|
|
||||||
This method access the data of the catalog and reeturns you the translated
|
This method access the data of the catalog and reeturns you the translated
|
||||||
@@ -133,6 +148,7 @@
|
|||||||
all the catalog files under control.
|
all the catalog files under control.
|
||||||
|
|
||||||
\param id The identifier of the string.
|
\param id The identifier of the string.
|
||||||
|
|
||||||
\returns The translated string if found, or an empty string.
|
\returns The translated string if found, or an empty string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -150,7 +166,12 @@
|
|||||||
\param name The name of the data to retrieve.
|
\param name The name of the data to retrieve.
|
||||||
\param msg The BMessage to fill in with the data.
|
\param msg The BMessage to fill in with the data.
|
||||||
|
|
||||||
\returns An error code.
|
\returns A status code.
|
||||||
|
\retval B_OK Everything went fine.
|
||||||
|
\retval B_ERROR Unable to get an exclusive lock on data.
|
||||||
|
\retval B_NO_INIT Catalog is \c NULL.
|
||||||
|
\retval B_NAME_NOT_FOUND catalog with the specified \a name could not be
|
||||||
|
found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -189,6 +210,10 @@
|
|||||||
\param lang The string where to copy the language.
|
\param lang The string where to copy the language.
|
||||||
|
|
||||||
\returns An error code.
|
\returns An error code.
|
||||||
|
\retval B_OK Everything went as expected.
|
||||||
|
\retval B_ERROR Could not get exclusive lock on catalog.
|
||||||
|
\retval B_BAD_VALUE \a lang is \c NULL.
|
||||||
|
\retval B_NO_INIT Catalog data is \c NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -202,43 +227,43 @@
|
|||||||
\param fp The integer to set to the fingerprint value.
|
\param fp The integer to set to the fingerprint value.
|
||||||
|
|
||||||
\returns An error code.
|
\returns An error code.
|
||||||
|
\retval B_OK Everything went as expected.
|
||||||
|
\retval B_ERROR Could not get exclusive lock on catalog.
|
||||||
|
\retval B_BAD_VALUE \a fp is \c NULL.
|
||||||
|
\retval B_NO_INIT Catalog data is \c NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn status_t BCatalog::SetCatalog(const entry_ref& catalogOwner,
|
\fn status_t BCatalog::SetTo(const entry_ref& catalogOwner,
|
||||||
uint32 fingerprint)
|
const char* language, uint32 fingerprint)
|
||||||
\brief Reload the string data.
|
\brief Reload the string data.
|
||||||
|
|
||||||
This method reloads the data for the given signature and fingerprint.
|
This method reloads the data for the given signature and fingerprint.
|
||||||
|
|
||||||
\param catalogOwner The entry_ref of the catalog that you want to load.
|
\param catalogOwner The \c entry_ref of the catalog that you want to load.
|
||||||
|
\param language The language of the catalog to load. If \c NULL, the user
|
||||||
|
settings will be used.
|
||||||
\param fingerprint The fingerprint of the catalog you want to load.
|
\param fingerprint The fingerprint of the catalog you want to load.
|
||||||
|
|
||||||
\returns An error code.
|
\returns A status code, \c B_OK on success, \c B_ERROR on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn status_t BCatalog::InitCheck() const
|
\fn status_t BCatalog::InitCheck() const
|
||||||
\brief Check if the catalog is in an useable state.
|
\brief Check if the catalog is in a valid and usable state.
|
||||||
|
|
||||||
\returns \c B_OK if the catalog is initialized properly.
|
\returns A status code.
|
||||||
|
\retval B_OK The catalog is initialized properly.
|
||||||
|
\retval B_ERROR Could not get exclusive lock on catalog.
|
||||||
|
\retval B_NO_INIT Catalog data is \c NULL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn int32 BCatalog::CountItems()
|
\fn int32 BCatalog::CountItems()
|
||||||
\brief Returns the number of items in the catalog.
|
\brief Gets the number of items in the catalog.
|
||||||
|
|
||||||
\returns the number of strings in the catalog.
|
\returns the number of strings in the catalog or 0 on error.
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn BCatalogaddOn* BCatalog::CatalogAddOn()
|
|
||||||
\brief Returns the internal storage for this catalog.
|
|
||||||
|
|
||||||
\returns the internal storage class used by this catalog. You should
|
|
||||||
not have to use it.
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,20 +4,22 @@
|
|||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Adrien Destugues, [email protected]
|
* Adrien Destugues, [email protected]
|
||||||
|
* John Scipione, [email protected]
|
||||||
*
|
*
|
||||||
* Corresponds to:
|
* Corresponds to:
|
||||||
* /trunk/headers/os/locale/DurationFormat.h rev 42944
|
* /trunk/headers/os/locale/DurationFormat.h hrev45084
|
||||||
* /trunk/src/kits/locale/DurationFormat.cpp rev 42944
|
* /trunk/src/kits/locale/DurationFormat.cpp hrev45084
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class BDurationFormat
|
\class BDurationFormat
|
||||||
\ingroup locale
|
\ingroup locale
|
||||||
\brief Formatter for time interfals
|
\ingroup libbe
|
||||||
|
\brief Formatter for time intervals.
|
||||||
|
|
||||||
BDurationFormat is a formatter for time intervals. A time interval is defined
|
BDurationFormat is a formatter for time intervals. A time interval is
|
||||||
by its start and end values, and the result is a string such as
|
defined by its start and end values, and the result is a string such as
|
||||||
"1 hour, 2 minutes, 28 seconds".
|
"1 hour, 2 minutes, 28 seconds".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -26,33 +28,85 @@
|
|||||||
\fn BDurationFormat::BDurationFormat(const BString& separator)
|
\fn BDurationFormat::BDurationFormat(const BString& separator)
|
||||||
\brief Constructor.
|
\brief Constructor.
|
||||||
|
|
||||||
\warning Creating a BDurationFormat is a costly operation. Most of the time,
|
\warning Creating a BDurationFormat is a costly operation. Most of the
|
||||||
you most likely want to use the default one through the BLocale class.
|
time want to use the default one through the BLocale class.
|
||||||
|
|
||||||
The separator string will be appended between the elements of formated
|
\param separator String appended between the duration elements.
|
||||||
durations.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void BDurationFormat::SetSeparator(cosnt BString& separator)
|
\fn BDurationFormat::BDurationFormat(const BDurationFormat& other)
|
||||||
\brief Replace the spearator for this formatter.
|
\brief Copy Constructor.
|
||||||
|
|
||||||
|
\param other The BDurationFormat object to copy from.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn status_t BDurationForamt::SetLocale(const BLocale* locale)
|
\fn BDurationFormat::~BDurationFormat()
|
||||||
|
\brief Destructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BDurationFormat&
|
||||||
|
BDurationFormat::operator=(const BDurationFormat& other)
|
||||||
|
\brief Assignment overload.
|
||||||
|
|
||||||
|
\param other The BDurationFormat object to copy from.
|
||||||
|
|
||||||
|
\returns The resulting BDurationFormat object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void BDurationFormat::SetSeparator(const BString& separator)
|
||||||
|
\brief Replace the separator for this formatter.
|
||||||
|
|
||||||
|
\param separator The separator string to set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BDurationFormat::SetLocale(const BLocale* locale)
|
||||||
\brief Sets the locale for this formatter.
|
\brief Sets the locale for this formatter.
|
||||||
|
|
||||||
|
\param locale The BLocale object to set.
|
||||||
|
|
||||||
|
\returns A status code, \c B_OK on success or an error code on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
|
||||||
|
\brief Sets the timezone for this formatter.
|
||||||
|
|
||||||
|
\param timeZone The BTimeZone object to set.
|
||||||
|
|
||||||
|
\returns A status code.
|
||||||
|
\retval B_OK Everything went fine.
|
||||||
|
\retval B_NO_INIT Format object is \c NULL.
|
||||||
|
\retval B_ERROR Other errors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn status_t BDurationFormat::Format(bigtime_t startValue,
|
\fn status_t BDurationFormat::Format(bigtime_t startValue,
|
||||||
bigtime_t endValue, BString* buffer, time_unit_style = B_TIME_UNIT_FULL)
|
bigtime_t stopValue, BString* buffer, time_unit_style style) const
|
||||||
const;
|
|
||||||
\brief Formats a duration defined by its start and end values.
|
\brief Formats a duration defined by its start and end values.
|
||||||
|
|
||||||
The start and end values are in milliseconds. The result is appeded to the
|
The start and end values are in milliseconds. The result is appended to
|
||||||
buffer. The full time style uses full words (hours, minuts, seconds), while the
|
the buffer. The full time style uses full words (hours, minutes, seconds),
|
||||||
shot one uses units (h, m, s).
|
while the short one uses units (h, m, s).
|
||||||
|
|
||||||
|
\param startValue The start value in milliseconds.
|
||||||
|
\param stopValue The stop value in milliseconds.
|
||||||
|
\param buffer The buffer to fill out.
|
||||||
|
\param style The time unit style to use.
|
||||||
|
|
||||||
|
\returns A status code.
|
||||||
|
\retval B_OK Everything went fine.
|
||||||
|
\retval B_BAD_VALUE Buffer was \c NULL.
|
||||||
|
\retval B_ERROR Formatting error.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
*
|
||||||
|
* Corresponds to:
|
||||||
|
* /trunk/headers/os/media/FileInterface.h hrev45081
|
||||||
|
* /trunk/src/kits/media/FileInterface.cpp hrev45081
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\file FileInterface.h
|
||||||
|
\brief Provides BFileInterface abstract class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class BFileInterface
|
||||||
|
\ingroup media
|
||||||
|
\ingroup libbe
|
||||||
|
\brief A node that can read and write data to a file on disk.
|
||||||
|
|
||||||
|
You should derive your subclass from BFileInterface so that your
|
||||||
|
application may specify the file that the node will reference.
|
||||||
|
The Media Server will then call upon the node to try to identify
|
||||||
|
and work with files that are hereunto unknown to it.
|
||||||
|
|
||||||
|
Your node must also derive from BBufferConsumer or BBufferProducer,
|
||||||
|
in addition to BFileInterface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BFileInterface::BFileInterface()
|
||||||
|
\brief Constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn BFileInterface::~BFileInterface()
|
||||||
|
\brief Destructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::HandleMessage(int32 message,
|
||||||
|
const void *data, size_t size)
|
||||||
|
\brief Dispatches a message to the appropriate BMediaNode hook method
|
||||||
|
given a message received on the control port. Implement this method
|
||||||
|
to handle messages that arrive on your control port.
|
||||||
|
|
||||||
|
\param message The message identifier.
|
||||||
|
\param data The message data.
|
||||||
|
\param size The size of the message data in bytes.
|
||||||
|
|
||||||
|
\returns A status code.
|
||||||
|
\retval B_OK Message was dispatched.
|
||||||
|
\retval B_ERROR There was an error dispatching the message, possibly
|
||||||
|
because it doesn't correspond to a hook function.
|
||||||
|
|
||||||
|
\see BMediaNode::HandleMessage() for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::GetNextFileFormat(int32* cookie,
|
||||||
|
media_file_format* _format) = 0;
|
||||||
|
\brief Implement this method to fill out information about a file format
|
||||||
|
indexed by \a cookie.
|
||||||
|
|
||||||
|
The first time this method is called \a cookie will be set to 0.
|
||||||
|
In your implementation you should set information about the first
|
||||||
|
file format you support in \a _format and set \a cookie to some
|
||||||
|
meaningful non-zero value to track your positing in the list of
|
||||||
|
supported formats, then return \c B_OK.
|
||||||
|
|
||||||
|
On successive calls return successive file format information and update
|
||||||
|
\a cookie to track your position in the list. Each time you return new
|
||||||
|
information about a file format return \c B_OK.
|
||||||
|
|
||||||
|
Once you run out of formats return \c B_ERROR.
|
||||||
|
|
||||||
|
\param cookie Index of file format to fill out.
|
||||||
|
\param _format Pointer to a preallocated \c media_file_format object to
|
||||||
|
fill out.
|
||||||
|
|
||||||
|
\return \c B_OK if a file format was filled out for \a cookie, \c B_ERROR
|
||||||
|
or an appropriate error code otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void BFileInterface::DisposeFileFormatCookie(int32 cookie) = 0;
|
||||||
|
\brief Implement this method to dispose of a file format supported by your
|
||||||
|
node indexed by \a cookie.
|
||||||
|
|
||||||
|
You are responsible for freeing any data blocks associated with this
|
||||||
|
\a cookie before returning.
|
||||||
|
|
||||||
|
\param cookie Index of the cookie you wish to dispose of.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::GetDuration(bigtime_t* _time) = 0;
|
||||||
|
\brief Implement this method to fill out the duration in microseconds of
|
||||||
|
the media data contained in the currently referenced file in
|
||||||
|
\a _time.
|
||||||
|
|
||||||
|
\param _time The duration parameter to fill out.
|
||||||
|
|
||||||
|
\return A status code, typically \c B_OK on success and \c B_ERROR
|
||||||
|
or another error code on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::SniffRef(const entry_ref& file,
|
||||||
|
char* _mimeType, float* _quality) = 0;
|
||||||
|
\brief Implement this method to allow the Media Roster to identify
|
||||||
|
a file format associated with this node.
|
||||||
|
|
||||||
|
If you can handle the format, set \a _mimeType to the MIME type
|
||||||
|
of the file format and set \a _quality to indicate how well you
|
||||||
|
can process the file.
|
||||||
|
|
||||||
|
A \a _quality of 0.0 means that you can't handle the file format
|
||||||
|
at all and an \a _quality of 1.0 means you have total control over
|
||||||
|
the file format.
|
||||||
|
|
||||||
|
\param file The file being sniffed.
|
||||||
|
\param _mimeType Fill this out with the appropriate MIME type.
|
||||||
|
\param _quality How well you are able to handle the file format
|
||||||
|
from 0.0 to 1.0.
|
||||||
|
|
||||||
|
\return \c B_OK if you can identify the file's contents, otherwise return
|
||||||
|
an appropriate error code. If you can't handle the file format at
|
||||||
|
all, you should return \c B_MEDIA_NO_HANDLER.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::SetRef(const entry_ref& file, bool create,
|
||||||
|
bigtime_t* _time) = 0;
|
||||||
|
\brief Used when an application wants your node to use a specific file.
|
||||||
|
|
||||||
|
The file specified by \a file may or may not exist.
|
||||||
|
|
||||||
|
If create is \c false you should try to open the existing file, and if
|
||||||
|
successful you should write the running time of the file into \a _time.
|
||||||
|
If you the file does not exist you should return \c B_ENTRY_NOT_FOUND.
|
||||||
|
|
||||||
|
If \a create is \c true you should create a new file, initialize the file
|
||||||
|
for writing, and store 0 in \a _time. You should overwrite the file if
|
||||||
|
it already exists.
|
||||||
|
|
||||||
|
\return \c B_OK on success or an appropriate error code such as \c B_ERROR
|
||||||
|
or \c B_ENTRY_NOT_FOUND on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn status_t BFileInterface::GetRef(entry_ref* _ref, char* _mimeType) = 0;
|
||||||
|
\brief Implement to set the \c entry_ref and the MIME type of the file
|
||||||
|
referenced by the current node.
|
||||||
|
|
||||||
|
\param _ref Set to the \c entry_ref of the file.
|
||||||
|
\param _mimeType Set to the MIME type of the current file.
|
||||||
|
|
||||||
|
\return \c B_OK on success or an appropriate error code such as \c B_ERROR
|
||||||
|
on error.
|
||||||
|
*/
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
#define INTEL_TYPE_IGD (INTEL_TYPE_9xx | 0x0800)
|
#define INTEL_TYPE_IGD (INTEL_TYPE_9xx | 0x0800)
|
||||||
#define INTEL_TYPE_ILK (INTEL_TYPE_9xx | 0x1000)
|
#define INTEL_TYPE_ILK (INTEL_TYPE_9xx | 0x1000)
|
||||||
#define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x2000)
|
#define INTEL_TYPE_SNB (INTEL_TYPE_9xx | 0x2000)
|
||||||
|
#define INTEL_TYPE_IVB (INTEL_TYPE_9xx | 0x4000)
|
||||||
// models
|
// models
|
||||||
#define INTEL_TYPE_SERVER 0x0004
|
#define INTEL_TYPE_SERVER 0x0004
|
||||||
#define INTEL_TYPE_MOBILE 0x0008
|
#define INTEL_TYPE_MOBILE 0x0008
|
||||||
@@ -55,6 +56,9 @@
|
|||||||
#define INTEL_TYPE_SNBG (INTEL_TYPE_SNB)
|
#define INTEL_TYPE_SNBG (INTEL_TYPE_SNB)
|
||||||
#define INTEL_TYPE_SNBGM (INTEL_TYPE_SNB | INTEL_TYPE_MOBILE)
|
#define INTEL_TYPE_SNBGM (INTEL_TYPE_SNB | INTEL_TYPE_MOBILE)
|
||||||
#define INTEL_TYPE_SNBGS (INTEL_TYPE_SNB | INTEL_TYPE_SERVER)
|
#define INTEL_TYPE_SNBGS (INTEL_TYPE_SNB | INTEL_TYPE_SERVER)
|
||||||
|
#define INTEL_TYPE_IVBG (INTEL_TYPE_IVB)
|
||||||
|
#define INTEL_TYPE_IVBGM (INTEL_TYPE_IVB | INTEL_TYPE_MOBILE)
|
||||||
|
#define INTEL_TYPE_IVBGS (INTEL_TYPE_IVB | INTEL_TYPE_SERVER)
|
||||||
|
|
||||||
#define DEVICE_NAME "intel_extreme"
|
#define DEVICE_NAME "intel_extreme"
|
||||||
#define INTEL_ACCELERANT_NAME "intel_extreme.accelerant"
|
#define INTEL_ACCELERANT_NAME "intel_extreme.accelerant"
|
||||||
|
|||||||
@@ -84,7 +84,13 @@ const struct supported_device {
|
|||||||
{0x0106, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT1"},
|
{0x0106, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT1"},
|
||||||
{0x0116, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2"},
|
{0x0116, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2"},
|
||||||
{0x0126, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2+"},
|
{0x0126, INTEL_TYPE_SNBGM, "SandyBridge Mobile GT2+"},
|
||||||
{0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"}
|
{0x010a, INTEL_TYPE_SNBGS, "SandyBridge Server"},
|
||||||
|
|
||||||
|
{0x0152, INTEL_TYPE_IVBG, "IvyBridge Desktop GT1"},
|
||||||
|
{0x0162, INTEL_TYPE_IVBG, "IvyBridge Desktop GT2"},
|
||||||
|
{0x0156, INTEL_TYPE_IVBGM, "IvyBridge Mobile GT1"},
|
||||||
|
{0x0166, INTEL_TYPE_IVBGM, "IvyBridge Mobile GT2"},
|
||||||
|
{0x015a, INTEL_TYPE_IVBGS, "IvyBridge Server GT1"}
|
||||||
};
|
};
|
||||||
|
|
||||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ find_reg(const intel_info& info, uint32 target)
|
|||||||
RETURN_REG(INTERRUPT_STATUS)
|
RETURN_REG(INTERRUPT_STATUS)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef RETURN_REG;
|
#undef RETURN_REG
|
||||||
|
|
||||||
panic("find_reg didn't have any matching register\n");
|
panic("find_reg didn't have any matching register\n");
|
||||||
return target;
|
return target;
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ Architecture::InitRegisterRules(CfaContext& context) const
|
|||||||
status_t
|
status_t
|
||||||
Architecture::CreateStackTrace(Team* team,
|
Architecture::CreateStackTrace(Team* team,
|
||||||
ImageDebugInfoProvider* imageInfoProvider, CpuState* cpuState,
|
ImageDebugInfoProvider* imageInfoProvider, CpuState* cpuState,
|
||||||
StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace)
|
StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace,
|
||||||
|
bool getFullFrameInfo)
|
||||||
{
|
{
|
||||||
BReference<CpuState> cpuStateReference(cpuState);
|
BReference<CpuState> cpuStateReference(cpuState);
|
||||||
|
|
||||||
@@ -161,8 +162,8 @@ Architecture::CreateStackTrace(Team* team,
|
|||||||
CpuState* previousCpuState = NULL;
|
CpuState* previousCpuState = NULL;
|
||||||
if (function != NULL) {
|
if (function != NULL) {
|
||||||
status_t error = functionDebugInfo->GetSpecificImageDebugInfo()
|
status_t error = functionDebugInfo->GetSpecificImageDebugInfo()
|
||||||
->CreateFrame(image, function, cpuState, frame,
|
->CreateFrame(image, function, cpuState, getFullFrameInfo,
|
||||||
previousCpuState);
|
frame, previousCpuState);
|
||||||
if (error != B_OK && error != B_UNSUPPORTED)
|
if (error != B_OK && error != B_UNSUPPORTED)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -170,7 +171,8 @@ Architecture::CreateStackTrace(Team* team,
|
|||||||
// If we have no frame yet, let the architecture create it.
|
// If we have no frame yet, let the architecture create it.
|
||||||
if (frame == NULL) {
|
if (frame == NULL) {
|
||||||
status_t error = CreateStackFrame(image, functionDebugInfo,
|
status_t error = CreateStackFrame(image, functionDebugInfo,
|
||||||
cpuState, nextFrame == NULL, frame, previousCpuState);
|
cpuState, nextFrame == NULL, frame,
|
||||||
|
previousCpuState);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -185,7 +187,7 @@ Architecture::CreateStackTrace(Team* team,
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = nextFrame;
|
nextFrame = frame;
|
||||||
cpuState = previousCpuState;
|
cpuState = previousCpuState;
|
||||||
if (--maxStackDepth == 0)
|
if (--maxStackDepth == 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ public:
|
|||||||
CpuState* cpuState,
|
CpuState* cpuState,
|
||||||
StackTrace*& _stackTrace,
|
StackTrace*& _stackTrace,
|
||||||
int32 maxStackDepth = -1,
|
int32 maxStackDepth = -1,
|
||||||
bool useExistingTrace = false);
|
bool useExistingTrace = false,
|
||||||
|
bool getFullFrameInfo = true);
|
||||||
// team is not locked
|
// team is not locked
|
||||||
|
|
||||||
virtual status_t GetWatchpointDebugCapabilities(
|
virtual status_t GetWatchpointDebugCapabilities(
|
||||||
|
|||||||
@@ -303,7 +303,39 @@ ArchitectureX8664::UpdateStackFrameCpuState(const StackFrame* frame,
|
|||||||
Image* previousImage, FunctionDebugInfo* previousFunction,
|
Image* previousImage, FunctionDebugInfo* previousFunction,
|
||||||
CpuState* previousCpuState)
|
CpuState* previousCpuState)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ArchitectureX8664::UpdateStackFrameCpuState: TODO\n");
|
// This is not a top frame, so we want to offset rip to the previous
|
||||||
|
// (calling) instruction.
|
||||||
|
CpuStateX8664* cpuState = dynamic_cast<CpuStateX8664*>(previousCpuState);
|
||||||
|
|
||||||
|
// get rip
|
||||||
|
uint64 rip = cpuState->IntRegisterValue(X86_64_REGISTER_RIP);
|
||||||
|
if (previousFunction == NULL || rip <= previousFunction->Address())
|
||||||
|
return;
|
||||||
|
target_addr_t functionAddress = previousFunction->Address();
|
||||||
|
|
||||||
|
// allocate a buffer for the function code to disassemble
|
||||||
|
size_t bufferSize = rip - functionAddress;
|
||||||
|
void* buffer = malloc(bufferSize);
|
||||||
|
if (buffer == NULL)
|
||||||
|
return;
|
||||||
|
MemoryDeleter bufferDeleter(buffer);
|
||||||
|
|
||||||
|
// read the code
|
||||||
|
ssize_t bytesRead = fTeamMemory->ReadMemory(functionAddress, buffer,
|
||||||
|
bufferSize);
|
||||||
|
if (bytesRead != (ssize_t)bufferSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// disassemble to get the previous instruction
|
||||||
|
DisassemblerX8664 disassembler;
|
||||||
|
target_addr_t instructionAddress;
|
||||||
|
target_size_t instructionSize;
|
||||||
|
if (disassembler.Init(functionAddress, buffer, bufferSize) == B_OK
|
||||||
|
&& disassembler.GetPreviousInstruction(rip, instructionAddress,
|
||||||
|
instructionSize) == B_OK) {
|
||||||
|
rip -= instructionSize;
|
||||||
|
cpuState->SetIntRegister(X86_64_REGISTER_RIP, rip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,8 @@ ThreadHandler::HandleThreadAction(uint32 action)
|
|||||||
|
|
||||||
if (stackTrace == NULL && cpuState != NULL) {
|
if (stackTrace == NULL && cpuState != NULL) {
|
||||||
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
|
||||||
fThread->GetTeam(), this, cpuState, stackTrace, 1) == B_OK) {
|
fThread->GetTeam(), this, cpuState, stackTrace, 1, false,
|
||||||
|
false) == B_OK) {
|
||||||
stackTraceReference.SetTo(stackTrace, true);
|
stackTraceReference.SetTo(stackTrace, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address)
|
|||||||
status_t
|
status_t
|
||||||
DebuggerImageDebugInfo::CreateFrame(Image* image,
|
DebuggerImageDebugInfo::CreateFrame(Image* image,
|
||||||
FunctionInstance* functionInstance, CpuState* cpuState,
|
FunctionInstance* functionInstance, CpuState* cpuState,
|
||||||
StackFrame*& _previousFrame, CpuState*& _previousCpuState)
|
bool getFullFrameInfo, StackFrame*& _previousFrame,
|
||||||
|
CpuState*& _previousCpuState)
|
||||||
{
|
{
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
virtual status_t CreateFrame(Image* image,
|
virtual status_t CreateFrame(Image* image,
|
||||||
FunctionInstance* functionInstance,
|
FunctionInstance* functionInstance,
|
||||||
CpuState* cpuState,
|
CpuState* cpuState,
|
||||||
|
bool getFullFrameInfo,
|
||||||
StackFrame*& _previousFrame,
|
StackFrame*& _previousFrame,
|
||||||
CpuState*& _previousCpuState);
|
CpuState*& _previousCpuState);
|
||||||
virtual status_t GetStatement(FunctionDebugInfo* function,
|
virtual status_t GetStatement(FunctionDebugInfo* function,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "DebuggerInterface.h"
|
#include "DebuggerInterface.h"
|
||||||
#include "DebugInfoEntries.h"
|
#include "DebugInfoEntries.h"
|
||||||
#include "Demangler.h"
|
#include "Demangler.h"
|
||||||
|
#include "DisassembledCode.h"
|
||||||
#include "Dwarf.h"
|
#include "Dwarf.h"
|
||||||
#include "DwarfFile.h"
|
#include "DwarfFile.h"
|
||||||
#include "DwarfFunctionDebugInfo.h"
|
#include "DwarfFunctionDebugInfo.h"
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
#include "FunctionID.h"
|
#include "FunctionID.h"
|
||||||
#include "FunctionInstance.h"
|
#include "FunctionInstance.h"
|
||||||
#include "GlobalTypeLookup.h"
|
#include "GlobalTypeLookup.h"
|
||||||
|
#include "InstructionInfo.h"
|
||||||
#include "LocatableFile.h"
|
#include "LocatableFile.h"
|
||||||
#include "Register.h"
|
#include "Register.h"
|
||||||
#include "RegisterMap.h"
|
#include "RegisterMap.h"
|
||||||
@@ -516,7 +518,7 @@ DwarfImageDebugInfo::GetAddressSectionType(target_addr_t address)
|
|||||||
status_t
|
status_t
|
||||||
DwarfImageDebugInfo::CreateFrame(Image* image,
|
DwarfImageDebugInfo::CreateFrame(Image* image,
|
||||||
FunctionInstance* functionInstance, CpuState* cpuState,
|
FunctionInstance* functionInstance, CpuState* cpuState,
|
||||||
StackFrame*& _frame, CpuState*& _previousCpuState)
|
bool getFullFrameInfo, StackFrame*& _frame, CpuState*& _previousCpuState)
|
||||||
{
|
{
|
||||||
DwarfFunctionDebugInfo* function = dynamic_cast<DwarfFunctionDebugInfo*>(
|
DwarfFunctionDebugInfo* function = dynamic_cast<DwarfFunctionDebugInfo*>(
|
||||||
functionInstance->GetFunctionDebugInfo());
|
functionInstance->GetFunctionDebugInfo());
|
||||||
@@ -635,7 +637,7 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
|
|||||||
// The subprogram entry may not be available since this may be a case
|
// The subprogram entry may not be available since this may be a case
|
||||||
// where .eh_frame was used to unwind the stack without other DWARF
|
// where .eh_frame was used to unwind the stack without other DWARF
|
||||||
// info being available.
|
// info being available.
|
||||||
if (subprogramEntry != NULL) {
|
if (subprogramEntry != NULL && getFullFrameInfo) {
|
||||||
// create function parameter objects
|
// create function parameter objects
|
||||||
for (DebugInfoEntryList::ConstIterator it
|
for (DebugInfoEntryList::ConstIterator it
|
||||||
= subprogramEntry->Parameters().GetIterator();
|
= subprogramEntry->Parameters().GetIterator();
|
||||||
@@ -665,6 +667,14 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
|
|||||||
_CreateLocalVariables(unit, frame, functionID, *stackFrameDebugInfo,
|
_CreateLocalVariables(unit, frame, functionID, *stackFrameDebugInfo,
|
||||||
instructionPointer, functionInstance->Address() - fRelocationDelta,
|
instructionPointer, functionInstance->Address() - fRelocationDelta,
|
||||||
subprogramEntry->Variables(), subprogramEntry->Blocks());
|
subprogramEntry->Variables(), subprogramEntry->Blocks());
|
||||||
|
|
||||||
|
// determine if the previously executed instruction was a function
|
||||||
|
// call to see if we need to potentially retrieve a return value
|
||||||
|
// as well
|
||||||
|
if (instructionPointer > functionInstance->Address() - fRelocationDelta) {
|
||||||
|
_CreateReturnValue(functionInstance, function, frame,
|
||||||
|
*stackFrameDebugInfo, instructionPointer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame = frameReference.Detach();
|
_frame = frameReference.Detach();
|
||||||
@@ -1073,6 +1083,50 @@ DwarfImageDebugInfo::_CreateLocalVariables(CompilationUnit* unit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
DwarfImageDebugInfo::_CreateReturnValue(FunctionInstance* functionInstance,
|
||||||
|
DwarfFunctionDebugInfo* function, StackFrame* frame,
|
||||||
|
DwarfStackFrameDebugInfo& factory, target_addr_t instructionPointer)
|
||||||
|
{
|
||||||
|
DisassembledCode* sourceCode = NULL;
|
||||||
|
target_size_t bufferSize = std::min(functionInstance->Size(),
|
||||||
|
(target_size_t)64 * 1024);
|
||||||
|
void* buffer = malloc(bufferSize);
|
||||||
|
if (buffer == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
MemoryDeleter bufferDeleter(buffer);
|
||||||
|
ssize_t bytesRead = function->GetSpecificImageDebugInfo()
|
||||||
|
->ReadCode(functionInstance->Address(), buffer, bufferSize);
|
||||||
|
if (bytesRead < 0)
|
||||||
|
return bytesRead;
|
||||||
|
|
||||||
|
status_t result = fArchitecture->DisassembleCode(function, buffer,
|
||||||
|
bytesRead, sourceCode);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
BReference<DisassembledCode> sourceCodeReference(sourceCode, true);
|
||||||
|
target_addr_t previousStatementAddress = instructionPointer + fRelocationDelta - 1;
|
||||||
|
Statement* statement = sourceCode->StatementAtAddress(
|
||||||
|
previousStatementAddress);
|
||||||
|
if (statement == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
TargetAddressRange range = statement->CoveringAddressRange();
|
||||||
|
InstructionInfo info;
|
||||||
|
if (fArchitecture->GetInstructionInfo(range.Start(), info) == B_OK
|
||||||
|
&& info.Type() == INSTRUCTION_TYPE_SUBROUTINE_CALL) {
|
||||||
|
// TODO: determine where the previous instruction actually jumps to,
|
||||||
|
// retrieve that function (could potentially be in another image),
|
||||||
|
// and use its return type to retrieve the return value (will need
|
||||||
|
// architecture support since function return value passing convention
|
||||||
|
// is arch-dependent).
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DwarfImageDebugInfo::_EvaluateBaseTypeConstraints(DIEType* type,
|
DwarfImageDebugInfo::_EvaluateBaseTypeConstraints(DIEType* type,
|
||||||
const TypeLookupConstraints& constraints)
|
const TypeLookupConstraints& constraints)
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ class Architecture;
|
|||||||
class CompilationUnit;
|
class CompilationUnit;
|
||||||
class DebuggerInterface;
|
class DebuggerInterface;
|
||||||
class DIEType;
|
class DIEType;
|
||||||
|
class DwarfFunctionDebugInfo;
|
||||||
class DwarfStackFrameDebugInfo;
|
class DwarfStackFrameDebugInfo;
|
||||||
class DwarfFile;
|
class DwarfFile;
|
||||||
class ElfSegment;
|
class ElfSegment;
|
||||||
class FileManager;
|
class FileManager;
|
||||||
class FileSourceCode;
|
class FileSourceCode;
|
||||||
class FunctionID;
|
class FunctionID;
|
||||||
|
class FunctionInstance;
|
||||||
class GlobalTypeCache;
|
class GlobalTypeCache;
|
||||||
class GlobalTypeLookup;
|
class GlobalTypeLookup;
|
||||||
class LocatableFile;
|
class LocatableFile;
|
||||||
@@ -61,6 +63,7 @@ public:
|
|||||||
virtual status_t CreateFrame(Image* image,
|
virtual status_t CreateFrame(Image* image,
|
||||||
FunctionInstance* functionInstance,
|
FunctionInstance* functionInstance,
|
||||||
CpuState* cpuState,
|
CpuState* cpuState,
|
||||||
|
bool getFullFrameInfo,
|
||||||
StackFrame*& _frame,
|
StackFrame*& _frame,
|
||||||
CpuState*& _previousCpuState);
|
CpuState*& _previousCpuState);
|
||||||
virtual status_t GetStatement(FunctionDebugInfo* function,
|
virtual status_t GetStatement(FunctionDebugInfo* function,
|
||||||
@@ -100,6 +103,12 @@ private:
|
|||||||
const EntryListWrapper& variableEntries,
|
const EntryListWrapper& variableEntries,
|
||||||
const EntryListWrapper& blockEntries);
|
const EntryListWrapper& blockEntries);
|
||||||
|
|
||||||
|
status_t _CreateReturnValue(FunctionInstance* instance,
|
||||||
|
DwarfFunctionDebugInfo* info,
|
||||||
|
StackFrame* frame,
|
||||||
|
DwarfStackFrameDebugInfo& factory,
|
||||||
|
target_addr_t instructionPointer);
|
||||||
|
|
||||||
bool _EvaluateBaseTypeConstraints(DIEType* type,
|
bool _EvaluateBaseTypeConstraints(DIEType* type,
|
||||||
const TypeLookupConstraints& constraints);
|
const TypeLookupConstraints& constraints);
|
||||||
|
|
||||||
|
|||||||
@@ -576,8 +576,9 @@ printf(" -> failed to add type to cache\n");
|
|||||||
= dynamic_cast<DIETemplateTypeParameter*>(_typeEntry);
|
= dynamic_cast<DIETemplateTypeParameter*>(_typeEntry);
|
||||||
DwarfType* templateType;
|
DwarfType* templateType;
|
||||||
if (templateTypeEntry != NULL) {
|
if (templateTypeEntry != NULL) {
|
||||||
if (CreateType(templateTypeEntry->GetType(), templateType)
|
if (templateTypeEntry->GetType() == NULL
|
||||||
!= B_OK) {
|
|| CreateType(templateTypeEntry->GetType(),
|
||||||
|
templateType) != B_OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -55,11 +55,15 @@ public:
|
|||||||
virtual status_t CreateFrame(Image* image,
|
virtual status_t CreateFrame(Image* image,
|
||||||
FunctionInstance* functionInstance,
|
FunctionInstance* functionInstance,
|
||||||
CpuState* cpuState,
|
CpuState* cpuState,
|
||||||
|
bool getFullFrameInfo,
|
||||||
StackFrame*& _Frame,
|
StackFrame*& _Frame,
|
||||||
CpuState*& _previousCpuState) = 0;
|
CpuState*& _previousCpuState) = 0;
|
||||||
// returns reference to previous frame
|
// returns reference to previous frame
|
||||||
// and CPU state; returned CPU state
|
// and CPU state; returned CPU state
|
||||||
// can be NULL; can return B_UNSUPPORTED
|
// can be NULL; can return B_UNSUPPORTED
|
||||||
|
// getFullFrameInfo: try to retrieve
|
||||||
|
// variables/parameters if true
|
||||||
|
// (and supported)
|
||||||
virtual status_t GetStatement(FunctionDebugInfo* function,
|
virtual status_t GetStatement(FunctionDebugInfo* function,
|
||||||
target_addr_t address,
|
target_addr_t address,
|
||||||
Statement*& _statement) = 0;
|
Statement*& _statement) = 0;
|
||||||
|
|||||||
@@ -234,8 +234,11 @@ struct DwarfFile::CIEAugmentation {
|
|||||||
:
|
:
|
||||||
fString(NULL),
|
fString(NULL),
|
||||||
fFlags(0),
|
fFlags(0),
|
||||||
fAddressEncoding(0)
|
fAddressEncoding(CFI_ADDRESS_FORMAT_ABSOLUTE)
|
||||||
{
|
{
|
||||||
|
// we default to absolute address format since that corresponds
|
||||||
|
// to the DWARF standard for .debug_frame. In gcc's case, however,
|
||||||
|
// .eh_frame will generally override that via augmentation 'R'
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init(DataReader& dataReader)
|
void Init(DataReader& dataReader)
|
||||||
@@ -270,11 +273,12 @@ struct DwarfFile::CIEAugmentation {
|
|||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
{
|
{
|
||||||
char personalityEncoding = dataReader.Read<char>(0);
|
char tempEncoding = fAddressEncoding;
|
||||||
uint8 addressSize = EncodedAddressSize(
|
fAddressEncoding = dataReader.Read<char>(0);
|
||||||
personalityEncoding, NULL);
|
off_t offset = dataReader.Offset();
|
||||||
dataReader.Skip(addressSize);
|
ReadEncodedAddress(dataReader, NULL, NULL, true);
|
||||||
remaining -= addressSize + 1;
|
fAddressEncoding = tempEncoding;
|
||||||
|
remaining -= dataReader.Offset() - offset + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'R':
|
case 'R':
|
||||||
@@ -283,14 +287,20 @@ struct DwarfFile::CIEAugmentation {
|
|||||||
--remaining;
|
--remaining;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
WARNING("Encountered unsupported augmentation '%c' "
|
||||||
|
" while parsing CIE augmentation string %s\n",
|
||||||
|
*string, fString);
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
string++;
|
string++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataReader.Skip(remaining);
|
// we should have read through all of the augmentation data
|
||||||
|
// at this point, if not, something is wrong.
|
||||||
if (remaining != 0 || dataReader.HasOverflow()) {
|
if (remaining != 0 || dataReader.HasOverflow()) {
|
||||||
WARNING("Error while reading CIE Augmentation\n");
|
WARNING("Error while reading CIE Augmentation, expected "
|
||||||
|
"%" B_PRIu64 " bytes of augmentation data, but read "
|
||||||
|
"%" B_PRIu64 " bytes.\n", length, length - remaining);
|
||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,24 +380,6 @@ struct DwarfFile::CIEAugmentation {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8 EncodedAddressSize(char encoding, CompilationUnit* unit) const
|
|
||||||
{
|
|
||||||
switch (encoding & 0x07) {
|
|
||||||
case CFI_ADDRESS_FORMAT_ABSOLUTE:
|
|
||||||
return unit->AddressSize();
|
|
||||||
case CFI_ADDRESS_FORMAT_UNSIGNED_16:
|
|
||||||
return 2;
|
|
||||||
case CFI_ADDRESS_FORMAT_UNSIGNED_32:
|
|
||||||
return 4;
|
|
||||||
case CFI_ADDRESS_FORMAT_UNSIGNED_64:
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: gcc doesn't (currently) actually generate LEB128-formatted
|
|
||||||
// addresses. If that changes, we'll need to handle them accordingly
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8 FDEAddressType() const
|
uint8 FDEAddressType() const
|
||||||
{
|
{
|
||||||
return fAddressEncoding & 0x70;
|
return fAddressEncoding & 0x70;
|
||||||
|
|||||||
+31
-57
@@ -119,19 +119,14 @@ Unicode2UTF8(int32 c, char **out)
|
|||||||
|
|
||||||
if (c < 0x80)
|
if (c < 0x80)
|
||||||
*(s++) = c;
|
*(s++) = c;
|
||||||
else if (c < 0x800)
|
else if (c < 0x800) {
|
||||||
{
|
|
||||||
*(s++) = 0xc0 | (c >> 6);
|
*(s++) = 0xc0 | (c >> 6);
|
||||||
*(s++) = 0x80 | (c & 0x3f);
|
*(s++) = 0x80 | (c & 0x3f);
|
||||||
}
|
} else if (c < 0x10000) {
|
||||||
else if (c < 0x10000)
|
|
||||||
{
|
|
||||||
*(s++) = 0xe0 | (c >> 12);
|
*(s++) = 0xe0 | (c >> 12);
|
||||||
*(s++) = 0x80 | ((c >> 6) & 0x3f);
|
*(s++) = 0x80 | ((c >> 6) & 0x3f);
|
||||||
*(s++) = 0x80 | (c & 0x3f);
|
*(s++) = 0x80 | (c & 0x3f);
|
||||||
}
|
} else if (c < 0x200000) {
|
||||||
else if (c < 0x200000)
|
|
||||||
{
|
|
||||||
*(s++) = 0xf0 | (c >> 18);
|
*(s++) = 0xf0 | (c >> 18);
|
||||||
*(s++) = 0x80 | ((c >> 12) & 0x3f);
|
*(s++) = 0x80 | ((c >> 12) & 0x3f);
|
||||||
*(s++) = 0x80 | ((c >> 6) & 0x3f);
|
*(s++) = 0x80 | ((c >> 6) & 0x3f);
|
||||||
@@ -974,15 +969,12 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
msg = Window()->CurrentMessage();
|
msg = Window()->CurrentMessage();
|
||||||
mods = msg->FindInt32("modifiers");
|
mods = msg->FindInt32("modifiers");
|
||||||
|
|
||||||
switch (key[0])
|
switch (key[0]) {
|
||||||
{
|
|
||||||
case B_HOME:
|
case B_HOME:
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
|
||||||
if (IsEditable())
|
if (IsEditable())
|
||||||
BTextView::KeyDown(key, count);
|
BTextView::KeyDown(key, count);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// scroll to the beginning
|
// scroll to the beginning
|
||||||
Select(0, 0);
|
Select(0, 0);
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
@@ -991,12 +983,10 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case B_END:
|
case B_END:
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
|
||||||
if (IsEditable())
|
if (IsEditable())
|
||||||
BTextView::KeyDown(key, count);
|
BTextView::KeyDown(key, count);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// scroll to the end
|
// scroll to the end
|
||||||
int32 length = TextLength();
|
int32 length = TextLength();
|
||||||
Select(length, length);
|
Select(length, length);
|
||||||
@@ -1006,19 +996,15 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x02: // ^b - back 1 char
|
case 0x02: // ^b - back 1 char
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
while (!IsInitialUTF8Byte(ByteAt(--start)))
|
while (!IsInitialUTF8Byte(ByteAt(--start))) {
|
||||||
{
|
if (start < 0) {
|
||||||
if (start < 0)
|
|
||||||
{
|
|
||||||
start = 0;
|
start = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start >= 0)
|
if (start >= 0) {
|
||||||
{
|
|
||||||
Select(start, start);
|
Select(start, start);
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
}
|
}
|
||||||
@@ -1026,21 +1012,16 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case B_DELETE:
|
case B_DELETE:
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
if ((key[0] == B_DELETE) || (mods & B_CONTROL_KEY)) {
|
||||||
if ((key[0] == B_DELETE) || (mods & B_CONTROL_KEY)) // ^d
|
// ^d
|
||||||
{
|
if (IsEditable()) {
|
||||||
if (IsEditable())
|
|
||||||
{
|
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
if (start != end)
|
if (start != end)
|
||||||
Delete();
|
Delete();
|
||||||
else
|
else {
|
||||||
{
|
for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++) {
|
||||||
for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++)
|
if (end > textLen) {
|
||||||
{
|
|
||||||
if (end > textLen)
|
|
||||||
{
|
|
||||||
end = textLen;
|
end = textLen;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1057,12 +1038,10 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x05: // ^e - end of line
|
case 0x05: // ^e - end of line
|
||||||
if ((IsSelectable()) && (mods & B_CONTROL_KEY))
|
if (IsSelectable() && (mods & B_CONTROL_KEY)) {
|
||||||
{
|
|
||||||
if (CurrentLine() == CountLines() - 1)
|
if (CurrentLine() == CountLines() - 1)
|
||||||
Select(TextLength(), TextLength());
|
Select(TextLength(), TextLength());
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
GoToLine(CurrentLine() + 1);
|
GoToLine(CurrentLine() + 1);
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
Select(start - 1, start - 1);
|
Select(start - 1, start - 1);
|
||||||
@@ -1071,17 +1050,14 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x06: // ^f - forward 1 char
|
case 0x06: // ^f - forward 1 char
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
if (end > start)
|
if (end > start)
|
||||||
start = end;
|
start = end;
|
||||||
else
|
else {
|
||||||
{
|
for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end));
|
||||||
for (end = start + 1; !IsInitialUTF8Byte(ByteAt(end)); end++)
|
end++) {
|
||||||
{
|
if (end > textLen) {
|
||||||
if (end > textLen)
|
|
||||||
{
|
|
||||||
end = textLen;
|
end = textLen;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1094,16 +1070,14 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0e: // ^n - next line
|
case 0x0e: // ^n - next line
|
||||||
if (IsSelectable())
|
if (IsSelectable()) {
|
||||||
{
|
|
||||||
raw = B_DOWN_ARROW;
|
raw = B_DOWN_ARROW;
|
||||||
BTextView::KeyDown(&raw, 1);
|
BTextView::KeyDown(&raw, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f: // ^o - open line
|
case 0x0f: // ^o - open line
|
||||||
if (IsEditable())
|
if (IsEditable()) {
|
||||||
{
|
|
||||||
GetSelection(&start, &end);
|
GetSelection(&start, &end);
|
||||||
Delete();
|
Delete();
|
||||||
|
|
||||||
@@ -1123,7 +1097,7 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
fYankBuffer = NULL;
|
fYankBuffer = NULL;
|
||||||
}
|
}
|
||||||
fLastPosition = start;
|
fLastPosition = start;
|
||||||
if (CurrentLine() < (CountLines() - 1)) {
|
if (CurrentLine() < CountLines() - 1) {
|
||||||
GoToLine(CurrentLine() + 1);
|
GoToLine(CurrentLine() + 1);
|
||||||
GetSelection(&end, &end);
|
GetSelection(&end, &end);
|
||||||
end--;
|
end--;
|
||||||
@@ -1161,7 +1135,7 @@ TTextView::KeyDown(const char *key, int32 count)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x19: // ^y yank text
|
case 0x19: // ^y yank text
|
||||||
if ((IsEditable()) && (fYankBuffer)) {
|
if (IsEditable() && fYankBuffer) {
|
||||||
Delete();
|
Delete();
|
||||||
Insert(fYankBuffer);
|
Insert(fYankBuffer);
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
@@ -2256,7 +2230,7 @@ TTextView::AddAsContent(BEmailMessage *mail, bool wrap, uint32 charset, mail_enc
|
|||||||
|
|
||||||
// add a newline to every line except for the ones
|
// add a newline to every line except for the ones
|
||||||
// that already end in newlines, and the last line
|
// that already end in newlines, and the last line
|
||||||
if ((text[endOffset - 1] != '\n') && (i < (numLines - 1))) {
|
if ((text[endOffset - 1] != '\n') && (i < numLines - 1)) {
|
||||||
content[contentLength++] = '\n';
|
content[contentLength++] = '\n';
|
||||||
|
|
||||||
// copy quote level of the first line
|
// copy quote level of the first line
|
||||||
|
|||||||
@@ -4,39 +4,38 @@
|
|||||||
#include "KUndoBuffer.h"
|
#include "KUndoBuffer.h"
|
||||||
|
|
||||||
|
|
||||||
KUndoItem::KUndoItem(const char* redo_text,
|
KUndoItem::KUndoItem(const char* redo_text, int32 length, int32 offset,
|
||||||
int32 length,
|
undo_type history, int32 cursor_pos)
|
||||||
int32 offset,
|
|
||||||
undo_type history,
|
|
||||||
int32 cursor_pos)
|
|
||||||
{
|
{
|
||||||
Offset = offset;
|
Offset = offset;
|
||||||
Length = length;
|
Length = length;
|
||||||
History = history;
|
History = history;
|
||||||
CursorPos = cursor_pos;
|
CursorPos = cursor_pos;
|
||||||
|
|
||||||
if (redo_text!=NULL) {
|
if (redo_text != NULL) {
|
||||||
RedoText = (char*)malloc(length);
|
RedoText = (char*)malloc(length);
|
||||||
memcpy(RedoText, redo_text, length);
|
memcpy(RedoText, redo_text, length);
|
||||||
if (RedoText!=NULL) {
|
if (RedoText != NULL)
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
} else {
|
else
|
||||||
fStatus = B_ERROR;
|
fStatus = B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KUndoItem::~KUndoItem()
|
KUndoItem::~KUndoItem()
|
||||||
{
|
{
|
||||||
free(RedoText);
|
free(RedoText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
KUndoItem::InitCheck()
|
KUndoItem::InitCheck()
|
||||||
{
|
{
|
||||||
return fStatus;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KUndoItem::Merge(const char* text, int32 length)
|
KUndoItem::Merge(const char* text, int32 length)
|
||||||
{
|
{
|
||||||
@@ -53,6 +52,7 @@ KUndoBuffer::KUndoBuffer():BList(1024)
|
|||||||
fNewItem = true;
|
fNewItem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KUndoBuffer::~KUndoBuffer()
|
KUndoBuffer::~KUndoBuffer()
|
||||||
{
|
{
|
||||||
MakeEmpty();
|
MakeEmpty();
|
||||||
@@ -62,34 +62,38 @@ KUndoBuffer::~KUndoBuffer()
|
|||||||
bool
|
bool
|
||||||
KUndoBuffer::AddItem(KUndoItem* item, int32 index)
|
KUndoBuffer::AddItem(KUndoItem* item, int32 index)
|
||||||
{
|
{
|
||||||
for (int32 i=CountItems()-1; i>=index; i--) {
|
for (int32 i = CountItems() - 1; i >= index; i--)
|
||||||
RemoveItem(i);
|
RemoveItem(i);
|
||||||
}
|
|
||||||
return AddItem(item);
|
return AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
KUndoBuffer::AddItem(KUndoItem* item)
|
KUndoBuffer::AddItem(KUndoItem* item)
|
||||||
{
|
{
|
||||||
return BList::AddItem(item);
|
return BList::AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KUndoBuffer::MakeEmpty(void)
|
KUndoBuffer::MakeEmpty(void)
|
||||||
{
|
{
|
||||||
for(int32 i=CountItems()-1; i>=0;i--) {
|
for (int32 i = CountItems() - 1; i >= 0; i--)
|
||||||
RemoveItem(i);
|
RemoveItem(i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KUndoItem*
|
KUndoItem*
|
||||||
KUndoBuffer::RemoveItem(int32 index)
|
KUndoBuffer::RemoveItem(int32 index)
|
||||||
{
|
{
|
||||||
if (fIndex>=CountItems()) fIndex--;
|
if (fIndex >= CountItems())
|
||||||
|
fIndex--;
|
||||||
delete this->ItemAt(index);
|
delete this->ItemAt(index);
|
||||||
return (KUndoItem*)BList::RemoveItem(index);
|
return (KUndoItem*)BList::RemoveItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KUndoItem*
|
KUndoItem*
|
||||||
KUndoBuffer::ItemAt(int32 index) const
|
KUndoBuffer::ItemAt(int32 index) const
|
||||||
{
|
{
|
||||||
@@ -103,12 +107,14 @@ KUndoBuffer::On()
|
|||||||
fNoTouch = false;
|
fNoTouch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KUndoBuffer::Off()
|
KUndoBuffer::Off()
|
||||||
{
|
{
|
||||||
fNoTouch = true;
|
fNoTouch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset,
|
KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset,
|
||||||
undo_type history, int32 cursor_pos)
|
undo_type history, int32 cursor_pos)
|
||||||
@@ -117,7 +123,7 @@ KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset,
|
|||||||
cursor_pos);
|
cursor_pos);
|
||||||
|
|
||||||
status_t status = NewUndoItem->InitCheck();
|
status_t status = NewUndoItem->InitCheck();
|
||||||
if ( status != B_OK) {
|
if (status != B_OK) {
|
||||||
delete NewUndoItem;
|
delete NewUndoItem;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -136,13 +142,13 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
|
|||||||
|
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
if (fNewItem || (fIndex < CountItems()) || (CountItems()==0)) {
|
if (fNewItem || fIndex < CountItems() || CountItems() == 0) {
|
||||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||||
fNewItem = false;
|
fNewItem = false;
|
||||||
} else {
|
} else {
|
||||||
KUndoItem* CurrentUndoItem;
|
KUndoItem* CurrentUndoItem;
|
||||||
CurrentUndoItem = ItemAt(fIndex-1);
|
CurrentUndoItem = ItemAt(fIndex - 1);
|
||||||
if (CurrentUndoItem!=NULL) {
|
if (CurrentUndoItem != NULL) {
|
||||||
int32 c_length = CurrentUndoItem->Length;
|
int32 c_length = CurrentUndoItem->Length;
|
||||||
int32 c_offset = CurrentUndoItem->Offset;
|
int32 c_offset = CurrentUndoItem->Offset;
|
||||||
undo_type c_history = CurrentUndoItem->History;
|
undo_type c_history = CurrentUndoItem->History;
|
||||||
@@ -150,9 +156,9 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
|
|||||||
switch(c_history) {
|
switch(c_history) {
|
||||||
case K_INSERTED:
|
case K_INSERTED:
|
||||||
case K_REPLACED:
|
case K_REPLACED:
|
||||||
if ((c_offset + c_length) == offset) {
|
if ((c_offset + c_length) == offset)
|
||||||
CurrentUndoItem->Merge(text, length);
|
CurrentUndoItem->Merge(text, length);
|
||||||
} else {
|
else {
|
||||||
status = NewUndo(text, length, offset, history,
|
status = NewUndo(text, length, offset, history,
|
||||||
cursor_pos);
|
cursor_pos);
|
||||||
}
|
}
|
||||||
@@ -162,11 +168,10 @@ KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
|
|||||||
cursor_pos);
|
cursor_pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -184,65 +189,50 @@ KUndoBuffer::MakeNewUndoItem()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
KUndoBuffer::Undo(char** text,
|
KUndoBuffer::Undo(char** text, int32* length, int32* offset,
|
||||||
int32* length,
|
undo_type* history, int32* cursor_pos)
|
||||||
int32* offset,
|
|
||||||
undo_type* history,
|
|
||||||
int32* cursor_pos)
|
|
||||||
{
|
{
|
||||||
KUndoItem* undoItem;
|
KUndoItem* undoItem;
|
||||||
status_t status;
|
status_t status = B_ERROR;
|
||||||
|
|
||||||
if (fIndex>0) {
|
if (fIndex > 0) {
|
||||||
undoItem = ItemAt(fIndex-1);
|
undoItem = ItemAt(fIndex - 1);
|
||||||
if (undoItem!=NULL) {
|
if (undoItem != NULL) {
|
||||||
*text = undoItem->RedoText;
|
*text = undoItem->RedoText;
|
||||||
*length = undoItem->Length;
|
*length = undoItem->Length;
|
||||||
*offset = undoItem->Offset;
|
*offset = undoItem->Offset;
|
||||||
*history = undoItem->History;
|
*history = undoItem->History;
|
||||||
*cursor_pos = undoItem->CursorPos + undoItem->Length;
|
*cursor_pos = undoItem->CursorPos + undoItem->Length;
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
} else {
|
|
||||||
status = B_ERROR;
|
|
||||||
}
|
}
|
||||||
fIndex--;
|
fIndex--;
|
||||||
} else {
|
|
||||||
status = B_ERROR;
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
KUndoBuffer::Redo(char** text,
|
KUndoBuffer::Redo(char** text, int32* length, int32* offset,
|
||||||
int32* length,
|
undo_type* history, int32* cursor_pos, bool* replaced)
|
||||||
int32* offset,
|
|
||||||
undo_type* history,
|
|
||||||
int32* cursor_pos,
|
|
||||||
bool* replaced)
|
|
||||||
{
|
{
|
||||||
KUndoItem* undoItem;
|
KUndoItem* undoItem;
|
||||||
status_t status;
|
status_t status = B_ERROR;
|
||||||
|
|
||||||
if (fIndex < CountItems()) {
|
if (fIndex < CountItems()) {
|
||||||
undoItem = ItemAt(fIndex);
|
undoItem = ItemAt(fIndex);
|
||||||
if (undoItem!=NULL) {
|
if (undoItem != NULL) {
|
||||||
*text = undoItem->RedoText;
|
*text = undoItem->RedoText;
|
||||||
*length = undoItem->Length;
|
*length = undoItem->Length;
|
||||||
*offset = undoItem->Offset;
|
*offset = undoItem->Offset;
|
||||||
*history = undoItem->History;
|
*history = undoItem->History;
|
||||||
*cursor_pos = undoItem->CursorPos;
|
*cursor_pos = undoItem->CursorPos;
|
||||||
if ((fIndex+1) < CountItems()) {
|
if (fIndex + 1 < CountItems())
|
||||||
*replaced = ItemAt(fIndex+1)->History==K_REPLACED;
|
*replaced = ItemAt(fIndex + 1)->History == K_REPLACED;
|
||||||
} else {
|
else
|
||||||
*replaced = false;
|
*replaced = false;
|
||||||
}
|
|
||||||
status = B_OK;
|
status = B_OK;
|
||||||
} else {
|
|
||||||
status = B_ERROR;
|
|
||||||
}
|
}
|
||||||
fIndex++;
|
fIndex++;
|
||||||
} else {
|
|
||||||
status = B_ERROR;
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -251,10 +241,10 @@ KUndoBuffer::Redo(char** text,
|
|||||||
void
|
void
|
||||||
KUndoBuffer::PrintToStream()
|
KUndoBuffer::PrintToStream()
|
||||||
{
|
{
|
||||||
for(int32 i=0; i<CountItems(); i++) {
|
for (int32 i = 0; i < CountItems(); i++) {
|
||||||
KUndoItem* item = ItemAt(i);
|
KUndoItem* item = ItemAt(i);
|
||||||
printf("%3.3d ", (int)i);
|
printf("%3.3d ", (int)i);
|
||||||
switch(item->History) {
|
switch (item->History) {
|
||||||
case K_INSERTED:
|
case K_INSERTED:
|
||||||
printf("INSERTED ");
|
printf("INSERTED ");
|
||||||
break;
|
break;
|
||||||
@@ -269,14 +259,13 @@ KUndoBuffer::PrintToStream()
|
|||||||
printf("Length = %d ", (int)item->Length);
|
printf("Length = %d ", (int)item->Length);
|
||||||
printf("CursorPos = %d ", (int)item->CursorPos);
|
printf("CursorPos = %d ", (int)item->CursorPos);
|
||||||
printf("RedoText = '");
|
printf("RedoText = '");
|
||||||
for(int32 j=0;j<item->Length;j++) {
|
for (int32 j = 0; j < item->Length; j++) {
|
||||||
uchar c = (uchar)item->RedoText[j];
|
uchar c = (uchar)item->RedoText[j];
|
||||||
if (c >= 0x20) {
|
if (c >= 0x20)
|
||||||
printf("%c", c);
|
printf("%c", c);
|
||||||
} else {
|
else
|
||||||
printf("?");
|
printf("?");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
printf("'\n");
|
printf("'\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1515,7 +1515,7 @@ StyledEditWindow::_ReloadDocument(BMessage* message)
|
|||||||
bs_printf(&alertText,
|
bs_printf(&alertText,
|
||||||
B_TRANSLATE("\"%s\" has unsaved changes.\n"
|
B_TRANSLATE("\"%s\" has unsaved changes.\n"
|
||||||
"Revert it to the last saved version? "), Title());
|
"Revert it to the last saved version? "), Title());
|
||||||
if (_ShowAlert(alertText, B_TRANSLATE("Cancel"), B_TRANSLATE("OK"),
|
if (_ShowAlert(alertText, B_TRANSLATE("Cancel"), B_TRANSLATE("Revert"),
|
||||||
"", B_WARNING_ALERT) != 1)
|
"", B_WARNING_ALERT) != 1)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,7 +331,9 @@ BFileGameSound::Perform(int32 selector,
|
|||||||
status_t
|
status_t
|
||||||
BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime)
|
BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime)
|
||||||
{
|
{
|
||||||
if (fPaused != isPaused) {
|
if (fPaused == isPaused)
|
||||||
|
return EALREADY;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
// Clear any old ramping
|
// Clear any old ramping
|
||||||
@@ -350,7 +352,6 @@ BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime)
|
|||||||
|
|
||||||
fPaused = isPaused;
|
fPaused = isPaused;
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,8 +419,8 @@ DraggableContainerIcon::MouseMoved(BPoint point, uint32 /*transit*/,
|
|||||||
|
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
font.GetHeight(&fontHeight);
|
font.GetHeight(&fontHeight);
|
||||||
float height = fontHeight.ascent + fontHeight.descent + fontHeight.leading
|
float height = ceil(fontHeight.ascent + fontHeight.descent
|
||||||
+ 2 + Bounds().Height() + 8;
|
+ fontHeight.leading + 2 + Bounds().Height() + 8);
|
||||||
|
|
||||||
BRect rect(0, 0, max_c(Bounds().Width(),
|
BRect rect(0, 0, max_c(Bounds().Width(),
|
||||||
font.StringWidth(model->Name()) + 4), height);
|
font.StringWidth(model->Name()) + 4), height);
|
||||||
@@ -2554,10 +2554,13 @@ BContainerWindow::SetupMoveCopyMenus(const entry_ref* item_ref, BMenu* parent)
|
|||||||
// Set the "Identify" item label
|
// Set the "Identify" item label
|
||||||
BMenuItem* identifyItem = parent->FindItem(kIdentifyEntry);
|
BMenuItem* identifyItem = parent->FindItem(kIdentifyEntry);
|
||||||
if (identifyItem != NULL) {
|
if (identifyItem != NULL) {
|
||||||
if (modifierKeys & B_SHIFT_KEY)
|
if (modifierKeys & B_SHIFT_KEY) {
|
||||||
identifyItem->SetLabel(B_TRANSLATE("Force identify"));
|
identifyItem->SetLabel(B_TRANSLATE("Force identify"));
|
||||||
else
|
identifyItem->Message()->ReplaceBool("force", true);
|
||||||
|
} else {
|
||||||
identifyItem->SetLabel(B_TRANSLATE("Identify"));
|
identifyItem->SetLabel(B_TRANSLATE("Identify"));
|
||||||
|
identifyItem->Message()->ReplaceBool("force", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2778,8 +2781,9 @@ BContainerWindow::AddFileContextMenus(BMenu* menu)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"),
|
BMessage* message = new BMessage(kIdentifyEntry);
|
||||||
new BMessage(kIdentifyEntry)));
|
message->AddBool("force", false);
|
||||||
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Identify"), message));
|
||||||
BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons"));
|
BMenu* addOnMenuItem = new BMenu(B_TRANSLATE("Add-ons"));
|
||||||
addOnMenuItem->SetFont(be_plain_font);
|
addOnMenuItem->SetFont(be_plain_font);
|
||||||
menu->AddItem(addOnMenuItem);
|
menu->AddItem(addOnMenuItem);
|
||||||
|
|||||||
@@ -2368,8 +2368,13 @@ BPoseView::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kIdentifyEntry:
|
case kIdentifyEntry:
|
||||||
IdentifySelection();
|
{
|
||||||
|
bool force;
|
||||||
|
if (message->FindBool("force", &force) != B_OK)
|
||||||
|
force = false;
|
||||||
|
IdentifySelection(force);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kEditItem:
|
case kEditItem:
|
||||||
{
|
{
|
||||||
@@ -8360,9 +8365,8 @@ BPoseView::OpenParent()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BPoseView::IdentifySelection()
|
BPoseView::IdentifySelection(bool force)
|
||||||
{
|
{
|
||||||
bool force = (modifiers() & B_SHIFT_KEY) != 0;
|
|
||||||
int32 count = fSelectionList->CountItems();
|
int32 count = fSelectionList->CountItems();
|
||||||
for (int32 index = 0; index < count; index++) {
|
for (int32 index = 0; index < count; index++) {
|
||||||
BPose* pose = fSelectionList->ItemAt(index);
|
BPose* pose = fSelectionList->ItemAt(index);
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ class BPoseView : public BView {
|
|||||||
void OpenInfoWindows();
|
void OpenInfoWindows();
|
||||||
void SetDefaultPrinter();
|
void SetDefaultPrinter();
|
||||||
|
|
||||||
void IdentifySelection();
|
void IdentifySelection(bool force = false);
|
||||||
void UnmountSelectedVolumes();
|
void UnmountSelectedVolumes();
|
||||||
virtual void OpenParent();
|
virtual void OpenParent();
|
||||||
|
|
||||||
|
|||||||
@@ -247,15 +247,15 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData,
|
|||||||
|
|
||||||
// Add relevant attributes. We consider an error here as non-fatal.
|
// Add relevant attributes. We consider an error here as non-fatal.
|
||||||
BNode node(&entry);
|
BNode node(&entry);
|
||||||
node.WriteAttr("Audio:Title", B_STRING_TYPE, 0, (data->title).String(),
|
node.WriteAttr("Media:Title", B_STRING_TYPE, 0, (data->title).String(),
|
||||||
(data->title).Length());
|
(data->title).Length());
|
||||||
node.WriteAttr("Audio:Album", B_STRING_TYPE, 0,
|
node.WriteAttr("Audio:Album", B_STRING_TYPE, 0,
|
||||||
(readResponse->title).String(),
|
(readResponse->title).String(),
|
||||||
(readResponse->title).Length());
|
(readResponse->title).Length());
|
||||||
node.WriteAttr("Audio:Genre", B_STRING_TYPE, 0,
|
node.WriteAttr("Media:Genre", B_STRING_TYPE, 0,
|
||||||
(readResponse->genre).String(),
|
(readResponse->genre).String(),
|
||||||
(readResponse->genre).Length());
|
(readResponse->genre).Length());
|
||||||
node.WriteAttr("Audio:Year", B_INT32_TYPE, 0, &(readResponse->year),
|
node.WriteAttr("Media:Year", B_INT32_TYPE, 0, &(readResponse->year),
|
||||||
sizeof(int32));
|
sizeof(int32));
|
||||||
|
|
||||||
if (data->artist == "") {
|
if (data->artist == "") {
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ TeamDebugHandler::_HandleMessage(DebugMessage *message)
|
|||||||
#ifdef HANDOVER_USE_DEBUGGER
|
#ifdef HANDOVER_USE_DEBUGGER
|
||||||
BAlert *alert = new BAlert(NULL, buffer.String(),
|
BAlert *alert = new BAlert(NULL, buffer.String(),
|
||||||
B_TRANSLATE("Terminate"), B_TRANSLATE("Debug"),
|
B_TRANSLATE("Terminate"), B_TRANSLATE("Debug"),
|
||||||
B_TRANSLATE("Save Report"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
B_TRANSLATE("Save report"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
debugAction = alert->Go();
|
debugAction = alert->Go();
|
||||||
_NotifyRegistrar(fTeam, false, debugAction != kActionKillTeam);
|
_NotifyRegistrar(fTeam, false, debugAction != kActionKillTeam);
|
||||||
|
|||||||
Reference in New Issue
Block a user