Comment lit-on des champs flags ?
Bonjour,
Depuis un programme Pascal, j'appelle une fonction C (API Mac OS x) qui me renvoie une structure de ce type :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| struct GetVolParmsInfoBuffer {
short vMVersion;
long vMAttrib;
Handle vMLocalHand;
long vMServerAdr;
long vMVolumeGrade;
short vMForeignPrivID;
long vMExtendedAttributes;
void * vMDeviceID;
UniCharCount vMMaxNameLength;
};
typedef struct GetVolParmsInfoBuffer GetVolParmsInfoBuffer; |
L'info qui m'intéresse c'est le champ vMExtendedAttributes, décrit en C de cette façon:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Extended Volume Attributes
Describe a volumes extended attributes.
enum {
bIsEjectable = 0,
bSupportsHFSPlusAPIs = 1,
bSupportsFSCatalogSearch = 2,
bSupportsFSExchangeObjects = 3,
bSupports2TBFiles = 4,
bSupportsLongNames = 5,
bSupportsMultiScriptNames = 6,
bSupportsNamedForks = 7,
bSupportsSubtreeIterators = 8,
bL2PCanMapFileBlocks = 9,
bParentModDateChanges = 10,
bAncestorModDateChanges = 11,
bSupportsSymbolicLinks = 13,
bIsAutoMounted = 14,
bAllowCDiDataHandler = 17,
bSupportsExclusiveLocks = 18,
bSupportsJournaling = 19,
bNoVolumeSizes = 20,
bIsOnInternalBus = 21,
bIsCaseSensitive = 22,
bIsCasePreserving = 23,
bDoNotDisplay = 24,
bIsRemovable = 25,
bNoRootTimes = 26,
bIsOnExternalBus = 27,
bSupportsExtendedFileSecurity = 28
}; |
Je récupère bien mon champ dans une variable Pascal de type longint.
Maintenant, comment faire pour connaître la valeur effective de chaque flag ? En C, je vois ce genre de code :
Code:
1 2
|
if (vMExtendedAttributes & (1L << bIsEjectable)) != 0 ... |
Comment diable traduire ça en Pascal ??? 8O
André