1/* 2 * Copyright 2013, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Documentation by: 6 * Ingo Weinhold, ingo_weinhold@gmx.de 7 * 8 * Corresponds to: 9 * headers/os/storage/PathFinder.h hrev46390 10 * src/kits/storage/PathFinder.cpp hrev46390 11 */ 12 13 14/*! 15 \file Architecture.h 16 \ingroup support 17 \ingroup libbe 18 \brief Provides functions for getting the primary and secondary 19 architectures of the system. 20*/ 21 22 23/*! 24 \fn const char* get_architecture() 25 \brief Returns the name of the caller's architecture. 26 27 This is the packaging architecture the caller's code has been built for, 28 which may not be the system's primary architecture. 29 30 \return The name of the caller's architecture. 31 32 \see get_primary_architecture() 33*/ 34 35 36/*! 37 \fn const char* get_primary_architecture() 38 \brief Returns the name of the system's primary architecture. 39 40 This is the packaging architecture the main system has been built for. 41 42 \return The name of the system's primary architecture. 43*/ 44 45 46/*! 47 \fn size_t get_secondary_architectures(const char** architectures, 48 size_t count) 49 \brief Returns the names of the system's secondary architectures. 50 51 These are the packaging architectures the system does provide additional 52 support for (i.e. not including the primary architecture). Only actually 53 installed support is considered. E.g. on a pure x86 gcc 2 system 54 (primary architecture "x86_gcc2") without any support installed for gcc 4 55 executables, the function will not return any secondary architectures, even 56 if it would be possible to install the support for gcc 4. 57 58 \param architectures A pre-allocated array of size \a count where the names 59 of the secondary architectures will be stored. Can be \c NULL, if 60 \a count is 0. 61 \param count The size of the \a architectures array. 62 \return The actual number of secondary architectures. May be greater than 63 \a count, but at most \a count names will be written to 64 \a architectures. 65*/ 66 67 68/*! 69 \fn status_t get_secondary_architectures(BStringList& _architectures) 70 \brief Returns the names of the system's secondary architectures. 71 72 This is a C++ interface similar to 73 get_secondary_architectures(const char**,size_t). Instead of returning the 74 architecture names in a pre-allocated array, it expects a BStringList. 75 Note that this version can fail when running out of memory. 76 77 \param _architectures Reference to a BStringList that will be set to the 78 list of names of secondary architectures. On error the list will be 79 emptied. 80 \return A status code. 81 \retval B_OK Everything went fine. 82 \retval B_NO_MEMORY A memory allocation failed. 83 84 \see get_secondary_architectures(const char**,size_t) 85*/ 86 87 88/*! 89 \fn size_t get_architectures(const char** architectures, 90 size_t count) 91 \brief Returns the names of the system's primary and secondary 92 architectures. 93 94 This is a convenience function that returns both the primary architecture 95 as returned by get_primary_architecture() and the secondary architectures 96 as returned by get_secondary_architectures() in the provided array. 97 98 \param architectures A pre-allocated array of size \a count where the names 99 of the architectures will be stored. Can be \c NULL, if \a count is 0. 100 \param count The size of the \a architectures array. 101 \return The actual number of architectures. May be greater than \a count, 102 but at most \a count names will be written to \a architectures. 103*/ 104 105 106/*! 107 \fn status_t get_architectures(BStringList& _architectures) 108 \brief Returns the names of the system's primary and secondary 109 architectures. 110 111 This is a C++ interface similar to 112 get_architectures(const char**,size_t). Instead of returning the 113 architecture names in a pre-allocated array, it expects a BStringList. 114 Note that this version can fail when running out of memory. 115 116 \param _architectures Reference to a BStringList that will be set to the 117 list of names of primary and secondary architectures. On error the list 118 will be emptied. 119 \return A status code. 120 \retval B_OK Everything went fine. 121 \retval B_NO_MEMORY A memory allocation failed. 122 123 \see get_architectures(const char**,size_t) 124*/ 125 126 127/*! 128 \fn const char* guess_architecture_for_path(const char* path) 129 \brief Returns the name of the architecture associated with the given path. 130 131 If the given path refers to an executable, library, or add-on, the function 132 determines for which architecture it has been built and returns that. 133 Otherwise it analyzes the path itself, checking whether it points to/into a 134 directory where files for a secondary architectures reside. If that proved 135 inconclusive the name of the primary architecture is returned. 136 137 \param path The path to be analyzed. It doesn't necessarily have to point to 138 an existing file or directory. 139 \return The name of the architecture determined from \a path. 140*/ 141