Annotation of GNUtools/cctools/include/stuff/arch.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * This file contains the current known set of flags and constants for the
                      3:  * known architectures.
                      4:  */
                      5: #import <mach/machine.h>
                      6: #import <stuff/bytesex.h>
                      7: 
                      8: /*
                      9:  * The structure describing an architecture flag with the string of the flag
                     10:  * name, and the cputype and cpusubtype.
                     11:  */
                     12: struct arch_flag {
                     13:     char *name;
                     14:     cpu_type_t cputype;
                     15:     cpu_subtype_t cpusubtype;
                     16: };
                     17: 
                     18: /*
                     19:  * get_arch_from_flag() is passed a name of an architecture flag and returns
                     20:  * zero if that flag is not known and non-zero if the flag is known.
                     21:  * If the pointer to the arch_flag is not NULL it is filled in with the
                     22:  * arch_flag struct that matches the name.
                     23:  */
                     24: extern int get_arch_from_flag(
                     25:     char *name,
                     26:     struct arch_flag *arch_flag);
                     27: 
                     28: /*
                     29:  * get_arch_from_host() gets the architecture from the host this is running on
                     30:  * and returns zero if the architecture is not known and zero if the
                     31:  * architecture is known.  If the parameters family_arch_flag and
                     32:  * specific_arch_flag are not NULL they get fill in with the family
                     33:  * architecture and specific architecure for the host.  If the architecture
                     34:  * is unknown and the parameters are not NULL then all fields are set to zero.
                     35:  */
                     36: extern int get_arch_from_host(
                     37:     struct arch_flag *family_arch_flag,
                     38:     struct arch_flag *specific_arch_flag);
                     39: 
                     40: /*
                     41:  * get_arch_flags() returns a pointer to an array of all currently know
                     42:  * architecture flags (terminated with an entry with all zeros).
                     43:  */
                     44: extern const struct arch_flag *get_arch_flags(
                     45:     void);
                     46: 
                     47: /*
                     48:  * arch_usage() is called when an unknown architecture flag is encountered.
                     49:  * It prints the currently know architecture flags on stderr.
                     50:  */
                     51: extern void arch_usage(
                     52:     void);
                     53: 
                     54: /*
                     55:  * set_arch_flag_name() sets the name field of the specified arch_flag to
                     56:  * match it's cputype and cpusubtype.  The string is allocated via malloc by
                     57:  * the routines in "allocate.h" and errors are handled by the routines in
                     58:  * "error.h".
                     59:  */
                     60: extern void set_arch_flag_name(
                     61:     struct arch_flag *p);
                     62: 
                     63: /*
                     64:  * get_arch_name_from_types() returns the name of the architecture for the
                     65:  * specified cputype and cpusubtype if known.  If unknown it returns a pointer
                     66:  * to the string "unknown".
                     67:  */
                     68: extern const char *get_arch_name_from_types(
                     69:     cpu_type_t cputype,
                     70:     cpu_subtype_t cpusubtype);
                     71: 
                     72: /*
                     73:  * get_arch_family_from_cputype() returns the family architecture for the
                     74:  * specified cputype if known.  If unknown it returns NULL.
                     75:  */
                     76: extern const struct arch_flag *get_arch_family_from_cputype(
                     77:     cpu_type_t cputype);
                     78: 
                     79: /*
                     80:  * get_byte_sex_from_flag() returns the byte sex of the architecture for the
                     81:  * specified cputype and cpusubtype if known.  If unknown it returns
                     82:  * UNKNOWN_BYTE_SEX.  If the bytesex can be determined directly as in the case
                     83:  * of reading a magic number from a file that should be done and this routine
                     84:  * should not be used as it could be out of date.
                     85:  */
                     86: extern enum byte_sex get_byte_sex_from_flag(
                     87:     const struct arch_flag *flag);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.