//inclou

#ifndef MACTYPES_H
#define  MACTYPES_H

#ifndef  __MACTYPES__
#define __MACTYPES__

//#ifndef OSTYPES_H //hys
// #include <libkern/OSTypes.h>
//#endif

#ifndef CONDITIONALMACROS_H
#include <CarbonCore/ConditionalMacros.h>
#endif

//#include <HYS/CarbonCore/MacTypes.h>
#include <APPLE/CarbonCore/MacTypes.h>
#include <stdbool.h>
#include <stdint.h> //hys
#include <bits/types.h>//hys

#include <AvailabilityMacros.h>

#if PRAGMA_ONCE
#pragma once
#endif

#ifdef __cplusplus
extern "C" {
#endif


//linux define
//#include <bits/types.h>
//typedef signed  char int8_t;
//typedef signed short  int __int16_t;
//typedef signed int __int32_t;
//typedef signed long int __int64_t;
//typedef unsigned char uint8_t;
//typedef unsigned short int uint16_t;
//t/ypedef unsigned int uint32_t;

typedef int8_t SInt8; 
typedef __int16_t  SInt16;
typedef __int32_t  SInt32;
typedef __int64_t  SInt64;
typedef uint8_t  UInt8;
typedef uint16_t  UInt16;
typedef unsigned int                    UInt32;

/*Miscellaneous Types

This section introduces some basic data types that are used throughout the Driver Services Library.
typedef unsigned long           ByteCount; 
typedef unsigned long           ItemCount; 
typedef long                    OSStatus; 
typedef unsigned long           OptionBits; 

For a description of OSStatus, see Error Returns.

The constant kNilOptions (= 0) is provided for clarity.

IDs are used whenever you create, manipulate, or destroy a object. All IDs are derived from the type KernelID :
typedef struct OpaqueRef *KernelID; 

You should use the derived ID types whenever possible to make your code more readable.
Note

Derived ID types are all 32-bit opaque identifiers that specify various kernel resources. There is a separate ID type for each kind of resource--for example, separate types for TaskID and AddressSpaceID. All kernel services that create or allocate a resource return an ID; the ID is later used to specify the resource to perform operations on it or delete it. These IDs are opaque because the value of the ID tells you nothing--you can't tell from an ID which resource it identifies without calling the kernel, you can't tell what ID you'll get back the next time you create a resource, and you can't tell the relationship between any two resources by the relationship between their IDs. When a resource is deleted, its ID usually becomes invalid for a long time. This helps your code catch errors, because if you accidentally use an ID for a resource that has been deleted, chances are you'll get an error instead of doing something to a different resource. 

The value kInvalidID (= 0) is reserved to mean no ID.*/
enum {
kNilOptions = 0,
};

/*ConstStr255Param

Abst_ConstStr255Param

typedef const unsigned char * ConstStr255Param;
Availability
Available in Mac OS X v10.0 and later.*/
#ifndef Old
typedef const unsigned char * ConstStr255Param;

#endif

#ifdef Old
typedef const  char * ConstStr255Param;
#endif

//#ifdef BasicDataBrowser
//typedef const char * ConstStr255Param;
//#endif

/*Data Types
typedef long Fixed;                    //fixed-point number//
typedef long Fract;                    //fractional number//
struct Int64Bit {                      //64-bit integer record//
   long hiLong;                        //high-order long integer//
   long loLong;                        //low-order long integer//
};
typedef struct Int64Bit Int64Bit;*/
typedef long Fract;                    //fractional number//

/*Data Types
typedef unsigned long         ExceptionKind;    /kind of exception*
typedef unsigned long         MemoryReferenceKind;
typedef void                  *Ref;
typedef Ref                   AreaID;
typedef Ref                   LogicalAddress;
sdtruct UnsignedWide {
   unsigned long              hi;
   unsigned long              lo;
};
typedef struct UnsignedWide UnsignedWide;
struct RegisterInformation {
   UnsignedWide         R0;
   UnsignedWide         R1;
   UnsignedWide         R2;
   UnsignedWide         R3;
   UnsignedWide         R4;
   UnsignedWide         R5;
   UnsignedWide         R6;
   UnsignedWide         R7;
   UnsignedWide         R8;
   UnsignedWide         R9;
   UnsignedWide         R10;
   UnsignedWide         R11;
   UnsignedWide         R12;
   UnsignedWide         R13;
   UnsignedWide         R14;
   UnsignedWide         R15;
   UnsignedWide         R16;
   UnsignedWide         R17;
   UnsignedWide         R18;
   UnsignedWide         R19;
   UnsignedWide         R20;
   UnsignedWide         R21;
   UnsignedWide         R22;
   UnsignedWide         R23;
   UnsignedWide         R24;
   UnsignedWide         R25;
   UnsignedWide         R26;
   UnsignedWide         R27;
   UnsignedWide         R28;
   UnsignedWide         R29;
   UnsignedWide         R30;
   UnsignedWide         R31;
};
typedef struct RegisterInformation RegisterInformation;
typedef long                  OSStatus;
typedef OSStatus (*ExceptionHandler) (ExceptionInformation *theException);
struct MachineInformation {
   UnsignedWide                     CTR;  /Count Register*
   UnsignedWide                     LR;   /Link Register/
   UnsignedWide                     PC;   /Program Counter Register/
   unsigned long                    CR;   /Condition Register/
   unsigned long                    XER;  /Fixed-Point Exception Register/
   unsigned long                    MSR;  /Machine State Register/
};
typedef struct MachineInformation MachineInformation;
struct FPUInformation {
   UnsignedWide                     Registers[32]; /FPU registers/
   unsigned long                    FPSCR;         /status/control reg/
};
typedef struct FPUInformation FPUInformation;
struct MemoryExceptionInformation {
   AreaID                           theArea;
   LogicalAddress                   theAddress;
   OSStatus                         theError;
   MemoryReferenceKind              theReference;
};
typedef struct MemoryExceptionInformation MemoryExceptionInformation;
struct ExceptionInformation {
   ExceptionKind                    theKind;
   MachineInformation               *machineState;
   RegisterInformation              *registerImage;
   FPUInformation                   *FPUImage;
   union {
      MemoryExceptionInformation    *memoryInfo;
   } info;
};
typedef struct ExceptionInformation ExceptionInformation;*/

#ifndef OSTYPES_H//define OSTypes.h

struct UnsignedWide {
   unsigned long              hi;
   unsigned long              lo;
};
typedef struct UnsignedWide UnsignedWide;

#if TYPE_LONGLONG
typedef uint64_t  UInt64;
#else

#ifndef __WINESRC__
typedef UnsignedWide                    UInt64;
#else
typedef uint64_t  UInt64;
#endif

#endif

#endif

/*RegionCode

Represents a type used by the Movie Manager API.

typedef SInt16 RegionCode;
Availability
Available in Mac OS X v10.0 and later.
Declared In
Movies.h*/
typedef SInt16 RegionCode;



/*Data Types
typedef char SignedByte;               /arbitrary byte of memory/
typedef unsigned char Byte;            /unsigned, arbitrary byte/
typedef char Ptr;                     /pointer to nonrelocatable block/
typedef Ptr Handle;                   /handle to relocatable block/
typedef unsigned char Str255[256];     /Pascal string/
typedef unsigned char StringPtr;
typedef unsigned char StringHandle;
typedef long (ProcPtr)();             /procedure pointer/
typedef long Size;                     /size in bytes of block/
struct Zone {
   Ptr               bkLim;            /first usable byte after zone/
   Ptr               purgePtr;         /used internally/
   Ptr               hFstFree;         /first free master pointer/
   long              zcbFree;          /number of free bytes/
   GrowZoneProcPtr   gzProc;           /grow-zone function/
   short             moreMast;         /number of master ptrs to allocate/
   short             flags;            /used internally/
   short             cntRel;           /reserved/
   short             maxRel;           /reserved/
   short             cntNRel;          /reserved/
   short             maxNRel;          /reserved/
   short             cntEmpty;         /reserved/
   short             cntHandles;       /reserved/
   long              minCBFree;        /reserved/
   ProcPtr           purgeProc;        /purge-warning procedure/
   Ptr               sparePtr;         /used internally/
   Ptr               allocPtr;         /used internally/
   short             heapData;         /first usable byte in zone/
};
typedef struct Zone Zone;
typedef Zone THz;                     /zone pointer/
*/

typedef char SignedByte;               /*arbitrary byte of memory*/
typedef unsigned char Byte;            /*unsigned, arbitrary byte*/
typedef char *Ptr;                     /*pointer to nonrelocatable block*/
typedef Ptr *Handle;                   /*handle to relocatable block*/
typedef unsigned char **StringHandle;
typedef long (*ProcPtr)();             /*procedure pointer*/

/*Memory Management Types

This section defines some types and values that are fundamental to memory management for native drivers.

Values of type LogicalAddress represent a location in an address space:
typedef void *LogicalAddress; 

Values of type PhysicalAddress represent location in physical memory. They are used primarily with DMA I/O operations:
typedef void *PhysicalAddress; 

A LogicalAddressRange structure is a description of a single logically addressed buffer:
struct LogicalAddressRange
{
    LogicalAddress          address;
    ByteCount               count;
}; 
typedef struct LogicalAddressRange LogicalAddressRange;
typedef struct LogicalAddressRange *LogicalAddressRangePtr; 

A PhysicalAddressRange structure is a description of a single physically addressed buffer:
struct PhysicalAddressRange
{
    PhysicalAddress         address;
    ByteCount               count;
}; 
typedef struct PhysicalAddressRange PhysicalAddressRange;
typedef struct PhysicalAddressRange *PhysicalAddressRangePtr; 

An AddressRange structure is a description of a single buffer, in which the buffer address may be either logical or physical:
struct AddressRange
{
    void            *base;
    ByteCount       length;
}; 
typedef struct AddressRange AddressRange; 

Address spaces are referred to by values of type AddressSpaceID. The value kCurrentAddressSpaceID refers to the current address space:
typedef KernelID AddressSpaceID;
enum
{
    kCurrentAddressSpaceID = 0
};*/
typedef void *LogicalAddress; 
/*ByteCount

Abst_ByteCount

typedef UInt32 ByteCount;
Availability
Available in Mac OS X v10.0 and later.*/
typedef UInt32 ByteCount;

/*ProcessSerialNumber

Defines the unique identifier for an open process.

struct ProcessSerialNumber {
   unsigned long highLongOfPSN;
   unsigned long lowLongOfPSN;
};
typedef struct ProcessSerialNumber ProcessSerialNumber;
typedef ProcessSerialNumber * ProcessSerialNumberPtr;
Fields
highLongOfPSN

The high-order long integer of the process serial number.
lowLongOfPSN

The low-order long integer of the process serial number.
Discussion

All applications (defined as things which can appear in the Dock that are not documents and are launched by the Finder or Dock) on Mac OS X have a unique process serial number. This number is created when the application launches, and remains until the application quits. Other system services, like Apple events, use the ProcessSerialNumber structure to specify an application. 

During launch, every application “checks in” with the Process Manager. Before this checkin, the application can not receive events or draw to the screen. Prior to Mac OS 10.2, this check in occurred before the applications's main function was entered. In Mac OS 10.2 and later, this check in does not occur until the first time the application calls a Process Manager function, or until it enters CFRunLoopRun for the main event loop. This allows tools and other executables which do not need to receive events to link against more of the higher level toolbox frameworks, but may cause a problem if the application expects to be able to retrieve events or use CoreGraphics services before this checkin has occurred. An application can force the connection to the Process Manager to be set up by calling any Process Manager routine, but the recommended way to do this is to call GetCurrentProcess to ask for the current application's PSN. Doing so initializes the connection to the Process Manager if it has not already been set up and ”check in“ the application with the system.

You should not make any assumptions about the meaning of the bits in a process serial number. To compare two process serial numbers, you should use the function SameProcess.

You can obtain a process serial number in one of the following ways:
Process serial numbers are returned by the functions LaunchApplication, GetCurrentProcess, and GetFrontProcess.
Some high-level events return process serial numbers.

If you want to specify a process using the “Process Identification Constants”, you must populate a process serial number structure, passing 0 in highLongOfPSN and the appropriate constant (such as kCurrentProcess) in lowLongOfPSN. For example, to bring the current process forward, you can use the following code:  ProcessSerialNumber psn = { 0, kCurrentProcess };
 SetFrontProcess( &psn );

Availability
Available in Mac OS X v10.0 and later.*/
struct ProcessSerialNumber {
   unsigned long highLongOfPSN;
   unsigned long lowLongOfPSN;
};
typedef struct ProcessSerialNumber ProcessSerialNumber;
typedef ProcessSerialNumber * ProcessSerialNumberPtr;


/*Str31

Represents a type used by the Music Architecture API.

typedef unsigned char Str31;
Availability
Available in Mac OS X v10.0 and later.
Declared In
QuickTimeMusic.h*/
typedef unsigned char Str31[100];

/*TimeBaseRecord

Contains a time base.

struct TimeBaseRecord {
   long    data[1];
};
Fields
data
Discussion

Array of data that constitutes a time base.
Programming Info
C interface file: Movies.h*/
struct TimeBaseRecord {
   long    data[1];
};
typedef  struct TimeBaseRecord TimeBaseRecord;
/*TimeBase

Abst_TimeBase

typedef TimeBaseRecord * TimeBase;
Availability
Available in Mac OS X v10.0 and later.*/
typedef TimeBaseRecord * TimeBase;

/*You specify the time value in a time structure in a 64-bit integer value as follows:
typedef Int64 CompTimeValue;


The Movie Toolbox uses this format so that extremely large time values can be represented. The Int64 data type defines the format of these signed 64-bit integers.
struct Int64
{
    long hi;    // high-order 32 bits-value field in time structure 
    long lo;    //low-order 32 bits-value field in time structure 
};
typedef struct Int64 Int64;*/
struct Int64
{
    long hi;    // high-order 32 bits-value field in time structure 
    long lo;    //low-order 32 bits-value field in time structure 
};
typedef struct Int64 Int64;

typedef Int64 CompTimeValue;

/*Style

Represents a type used by the Movie Manager API.

typedef unsigned char Style;
Availability
Available in Mac OS X v10.0 and later.
Declared In
Movies.h*/
typedef unsigned char Style;


/*ByteCount

Abst_ByteCount

typedef UInt32 ByteCount;
Availability
Available in Mac OS X v10.0 and later.*/
typedef UInt32 ByteCount;

/*typedef float 	float32
 	Single precicion floating point value*/
typedef float 	Float32;

/*TimeValue64

Abst_TimeValue64

typedef SInt64 TimeValue64;
Availability
Available in Mac OS X v10.0 and later.*/
typedef SInt64 TimeValue64;

/*Fixed

Defines a data type for fixed-point decimal numbers.

typedef SInt32 Fixed;
Discussion

This data type uses a 16-bit signed integer and a 16-bit fraction to represent fixed-point decimal numbers in the interval:




For example, the number 1.5 would be represented as 0x00018000, and the number -1.3 would be represented as 0xFFFEB334. To convert numbers between Fixed and float, you can use the functions FixedToFloat and FloatToFixed. 
Availability
Available in Mac OS X v10.0 and later.*/
typedef SInt32 Fixed;

/*TimeValue

Abst_TimeValue

typedef long TimeValue;
Availability
Available in Mac OS X v10.0 and later.*/
typedef long TimeValue;

/*meScale

Abst_TimeScale

typedef long TimeScale;
Availability
Available in Mac OS X v10.0 and later.*/
typedef long TimeScale;

/*Result Codes

The most common result codes returned by the Carbon Event Manager are listed below.Result Code	Value	Description
noErr	0	
No error. 
eventAlreadyPostedErr	-9860	
Returned from PostEventToQueue if the event in question is already in the queue you are posting it to (or any other queue).
eventTargetBusyErr	-9861	
The event target you are trying to modify is busy (for example, dispatching an event).
eventClassInvalidErr	-9862	
This is obsolete and will be removed.
eventClassIncorrectErr	-9864	
This is obsolete and will be removed.
eventHandlerAlreadyInstalledErr	-9866	
Returned from InstallEventHandler if the handler callback you pass is already installed for a given event type you are trying to register.
eventInternalErr	-9868	
A generic error.
eventKindIncorrectErr	-9869	
This is obsolete and will be removed.
eventParameterNotFoundErr	-9870	
The piece of data you are requesting from an event is not present.
eventNotHandledErr	-9874	
This is what you should return from an event handler when your handler has received an event it doesn’t currently want to (or isn’t able to) handle. If you handle an event, you should return noErr from your event handler.
eventLoopTimedOutErr	-9875	
The event loop has timed out. This can be returned from calls to ReceiveNextEvent or RunCurrentEventLoop.
eventLoopQuitErr	-9876	
The event loop was quit, probably by a call to QuitEventLoop. This can be returned from ReceiveNextEvent or RunCurrentEventLoop.
eventNotInQueueErr	-9877	
Returned from RemoveEventFromQueue when trying to remove an event that’s not in any queue.
eventHotKeyExistsErr	-9878	
The hot key combination you chose already exists
eventHotKeyInvalidErr	-9879	
This error code is not currently used.*/
enum {
  noErr= 0
};



/*This section introduces some basic data types that are used throughout the Driver Services Library.
typedef unsigned long           ByteCount; 
typedef unsigned long           ItemCount; 
typedef long                    OSStatus; 
typedef unsigned long           OptionBits; 

For a description of OSStatus, see Error Returns.

The constant kNilOptions (= 0) is provided for clarity.

IDs are used whenever you create, manipulate, or destroy a object. All IDs are derived from the type KernelID :
typedef struct OpaqueRef *KernelID; 

You should use the derived ID types whenever possible to make your code more readable.*/

typedef unsigned long           OptionBits; 

/*FourCharCode

Represents a type used by the Movie Toolkit API.

typedef unsigned long FourCharCode;
Availability
Available in Mac OS X v10.0 and later.
Declared In
Movies.h
MacTypes.h*/
typedef unsigned long FourCharCode;

/*
ResType
GetScrap

Reads data from the scrap.

Unsupported

SInt32 GetScrap (
   Handle hDest,
   ResType theType,
   SInt32 *offset
);
Parameters
hDest

A handle to the memory location where the function should place the data from the scrap. The function makes a copy of the data in memory and sets the handle specified by the hDest parameter to refer to this copy, resizing the handle if necessary. If you specify NULL in this parameter, the function does not read in the data but does return the offset of the data in the scrap and the number of bytes of the requested scrap data type if the requested type exists in the scrap.
theType

The scrap format type of the data you wish to read from the scrap.
offset

On return, a pointer to the location of the data in the scrap. This value is expressed as an offset (in bytes) from the beginning of the scrap. The returned value for the offset parameter is valid only if the Translation Manager isn’t available if the Translation Manager is available, then the value of offset is undefined.
Return Value

The length (in bytes) of the data or a negative function result that indicates the error. If the function returns noTypeErr, then the data in the scrap isn’t available in the scrap format type requested by your application. 
Discussion

Your application can use this function multiple times to read different formats of the same data from the scrap. If more than one format of the same scrap format type exists in the scrap, the function returns the first occurrence of that format type that it finds. For example, if data of type 'TEXT', 'PICT', and 'TEXT' exist on the scrap, and your application requests the data in the scrap with scrap format type 'TEXT', the function returns the first data of type 'TEXT' that it finds.

If your application supports more than one scrap format type, your application should attempt to read its preferred scrap format type first. If your application doesn’t prefer one scrap format type over any other type, it should try reading each of the scrap format types that it supports and use the type that returns the lowest offset. The scrap format type with the lowest offset indicates that this format type was written before any of the others and therefore was preferred by the application that wrote it. 

If you request a scrap format type that isn’t in the scrap and the Translation Manager is available, the Scrap Manager uses the Translation Manager to convert the data of a scrap format type that does exist in the scrap into the scrap format type requested by your application. For example, if the SurfWriter application requests data from the scrap in the 'SURF' scrap format type, and the data in the scrap is available in the format types 'TEXT', 'PICT', and 'SDBS' (SurfDB’s private scrap format type), the Scrap Manager uses the Translation Manager to convert any one of the scrap format types 'TEXT', 'PICT', or 'SDBS' into the 'SURF' scrap format type. The Translation Manager looks for a translator that can perform one of these translations. If such a translator is available (for example, a translator that can translate the 'SDBS' scrap format type into the 'SURF' scrap format type), the Translation Manager uses the translator to translate the data in the scrap into the requested scrap format type. If the translation is successful, the Scrap Manager returns to your application the data from the scrap in the requested scrap format type.

The scrap format type is a four-character sequence that defines the type of data.typedef FourCharCode ResType;


The standard scrap format types are
'TEXT': a series of ASCII characters 
'PICT': a QuickDraw picture, which is a saved sequence of QuickDraw commands that can be displayed using the DrawPicture function 

Optional scrap format types include
'styl': a series of bytes that have the same format as a TextEdit 'styl' resource and that describe styled text data 
'snd ': a series of bytes that have the same format as an 'snd ' resource and that define a sound 
'movv': a series of bytes that have the same format as an 'movv' resource and that define a movie 

Your application should support the 'TEXT' and 'PICT' scrap format types and should optionally support any other scrap format types (such as 'snd ') that are appropriate to your application.

In general, when your application writes data to the scrap, the Scrap Manager appends the data to the scrap in the following format: the first 4 bytes are the scrap type format; the next 4 bytes are the length of the following data in bytes; and the remaining n bytes (where n is an even number) are the data.

If your application uses TextEdit to handle text in its documents, use TextEdit functions to implement the paste operation and to copy data from the scrap to the TextEdit scrap. If your application uses the Dialog Manager to handle editable text items in your application’s dialog boxes and a dialog box is the frontmost window, use the Dialog Manager function DialogPaste to copy data from the scrap to the current editable text item. 
Special Considerations

This function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
Availability
Not available in CarbonLib. Not available in Mac OS X.
Carbon Porting Notes

You should instead use the functions GetScrapFlavorSize and GetScrapFlavorData.
Declared In
Scrap.h
MacTypea.h*/

typedef FourCharCode ResType;

/*OSErr

Abst_OSErr

typedef SInt16 OSErr;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef SInt16 OSErr;

/*Str255

Abst_Str255

typedef unsigned char Str255;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef unsigned char Str255[256];

/*OSStatus

A numeric code used in Carbon to indicate the return status of a function.

typedef SInt32 OSStatus;
Discussion

The system software sometimes uses error codes to inform an application that a requested service is not possible. Many functions return a result code of type OSStatus that indicates whether the function completed successfully, and if not, what the reason for failure was.

If you want to use OSStatus to define error codes for your application, Apple recommends that you use values in the range 1000 through 9999 inclusive. Values outside of this range are reserved by Apple for internal use.
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/

typedef SInt32 OSStatus;

/*StrFileName	Recent Changes
Printable View
Page History
Edit Page


Apple's Documentation 

 typedef Str255 StrFileName;


Pages that refer to StrFileName:
MacTypes.h*/
 typedef Str255 StrFileName;


/*GetScrap

Reads data from the scrap.

Unsupported

SInt32 GetScrap (
   Handle hDest,
   ResType theType,
   SInt32 *offset
);
Parameters
hDest

A handle to the memory location where the function should place the data from the scrap. The function makes a copy of the data in memory and sets the handle specified by the hDest parameter to refer to this copy, resizing the handle if necessary. If you specify NULL in this parameter, the function does not read in the data but does return the offset of the data in the scrap and the number of bytes of the requested scrap data type if the requested type exists in the scrap.
theType

The scrap format type of the data you wish to read from the scrap.
offset

On return, a pointer to the location of the data in the scrap. This value is expressed as an offset (in bytes) from the beginning of the scrap. The returned value for the offset parameter is valid only if the Translation Manager isnt available if the Translation Manager is available, then the value of offset is undefined.
Return Value

The length (in bytes) of the data or a negative function result that indicates the error. If the function returns noTypeErr, then the data in the scrap isnt available in the scrap format type requested by your application. 
Discussion

Your application can use this function multiple times to read different formats of the same data from the scrap. If more than one format of the same scrap format type exists in the scrap, the function returns the first occurrence of that format type that it finds. For example, if data of type 'TEXT', 'PICT', and 'TEXT' exist on the scrap, and your application requests the data in the scrap with scrap format type 'TEXT', the function returns the first data of type 'TEXT' that it finds.

If your application supports more than one scrap format type, your application should attempt to read its preferred scrap format type first. If your application doesnt prefer one scrap format type over any other type, it should try reading each of the scrap format types that it supports and use the type that returns the lowest offset. The scrap format type with the lowest offset indicates that this format type was written before any of the others and therefore was preferred by the application that wrote it. 

If you request a scrap format type that isnt in the scrap and the Translation Manager is available, the Scrap Manager uses the Translation Manager to convert the data of a scrap format type that does exist in the scrap into the scrap format type requested by your application. For example, if the SurfWriter application requests data from the scrap in the 'SURF' scrap format type, and the data in the scrap is available in the format types 'TEXT', 'PICT', and 'SDBS' (SurfDBs private scrap format type), the Scrap Manager uses the Translation Manager to convert any one of the scrap format types 'TEXT', 'PICT', or 'SDBS' into the 'SURF' scrap format type. The Translation Manager looks for a translator that can perform one of these translations. If such a translator is available (for example, a translator that can translate the 'SDBS' scrap format type into the 'SURF' scrap format type), the Translation Manager uses the translator to translate the data in the scrap into the requested scrap format type. If the translation is successful, the Scrap Manager returns to your application the data from the scrap in the requested scrap format type.

The scrap format type is a four-character sequence that defines the type of data.typedef FourCharCode ResType;


The standard scrap format types are
'TEXT': a series of ASCII characters 
'PICT': a QuickDraw picture, which is a saved sequence of QuickDraw commands that can be displayed using the DrawPicture function 

Optional scrap format types include
'styl': a series of bytes that have the same format as a TextEdit 'styl' resource and that describe styled text data 
'snd ': a series of bytes that have the same format as an 'snd ' resource and that define a sound 
'movv': a series of bytes that have the same format as an 'movv' resource and that define a movie 

Your application should support the 'TEXT' and 'PICT' scrap format types and should optionally support any other scrap format types (such as 'snd ') that are appropriate to your application.

In general, when your application writes data to the scrap, the Scrap Manager appends the data to the scrap in the following format: the first 4 bytes are the scrap type format; the next 4 bytes are the length of the following data in bytes; and the remaining n bytes (where n is an even number) are the data.

If your application uses TextEdit to handle text in its documents, use TextEdit functions to implement the paste operation and to copy data from the scrap to the TextEdit scrap. If your application uses the Dialog Manager to handle editable text items in your applications dialog boxes and a dialog box is the frontmost window, use the Dialog Manager function DialogPaste to copy data from the scrap to the current editable text item. 
Special Considerations

This function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.
Availability
Not available in CarbonLib. Not available in Mac OS X.
Carbon Porting Notes

You should instead use the functions GetScrapFlavorSize and GetScrapFlavorData.
Declared In
Scrap.h
MacTypes.h*/
typedef FourCharCode ResType;

/*NumVersion ϰ�?ϡMacTypes.h (Universal Interfaces 3.1 �êƪު) �Ϊ誦���ު
struct NumVersion {
               /* 'vers' ꫽?��� */
    //UInt8      majorRev;       /* ���?���� - BCD */
    //UInt8      minorAndBugRev; /* ���?� 2�3 �� - BCD
                                 // ЫȪ���*/
    //UInt8      stage;          /* ӫͭ?�
                                  //dev, alpha, beta, final */
  //  UInt8      nonRelRev;      /* ����?��*/
//};
 //typedef struct NumVersion      NumVersion;
/*MacTypes.h*/

struct NumVersion {
               /* 'vers' ꫽?��� */
    UInt8      majorRev;       /* ���?���� - BCD */
    UInt8      minorAndBugRev; /* ���?� 2�3 �� - BCD
                                  //ЫȪ���*/
    UInt8      stage;          /* ӫͭ?�
                                  //dev, alpha, beta, final */
    UInt8      nonRelRev;      /* ����?��*/
};
typedef struct NumVersion      NumVersion;


 /*        Point

Defines the position of a point.

struct Point {
   short    v;
   short    h;
};
Fields
v
Discussion

The vertical coordinate of the point.
h
Discussion

The horizontal coordinate of the point.
Programming Info
C interface file: MacTypes.h*/
struct Point {
   short    v;
   short    h;
};
typedef struct Point Point;
typedef Point * PointPtr;

/*StringPtr

Abst_StringPtr

typedef unsigned char * StringPtr;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef unsigned char * StringPtr;


/*OSStatus

Abst_OSStatus

typedef SInt32 OSStatus;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef SInt32 OSStatus;



/*Size

Abst_Size

typedef long Size;
Availability
Available in Mac OS X v10.0 and later
.MacTypes.h*/
typedef long Size;

/*ByteCount

Abst_ByteCount

typedef UInt32 ByteCount;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef UInt32 ByteCount;

/*ItemCount

Abst_ItemCount

typedef UInt32 ItemCount;
Availability
Available in Mac OS X v10.0 and later
.MacTypes.h*/
typedef UInt32 ItemCount;

/*ScriptCode

Abst_ScriptCode

typedef SInt16 ScriptCode;
Availability
Available in Mac OS X v10.0 and later.
MacTypes.h*/
typedef SInt16 ScriptCode;



/*Rect

Defines the size and location of a QuickDraw rectangle.

struct Rect {
   short    top;
   short    left;
   short    bottom;
   short    right;
};
Fields
top
Discussion

The vertical coordinate of the upper-left point of the rectangle.
left
Discussion

The horizontal coordinate of the upper-left point of the rectangle.
bottom
Discussion

The vertical coordinate of the lower-right point of the rectangle.
right
Discussion

The horizontal coordinate of the lower-right point of the rectangle.
Programming Info
C interface file: Quickdraw.h
MacTypes.h*/
struct Rect {
   short    top;
   short    left;
   short    bottom;
   short    right;
};
typedef struct Rect Rect;
typedef Rect * RectPtr;

/*TimeRecord

Contains a time value with its scale and time base.

struct TimeRecord {
   CompTimeValue    value;
   TimeScale        scale;
   TimeBase         base;
};
Fields
value
Discussion

Contains the time value. The time value defines either a duration or an absolute time by specifying the corresponding number of units of time. For durations, this is the number of time units in the period. For an absolute time, this is the number of time units since the beginning of the time coordinate system. The unit for this value is defined by the scale field. The time value is expressed as a 64-bit integer quantity. This 64-bit quantity consists of two 32-bit integers and is defined by the Int64 data type.
scale
Discussion

Contains the time scale. This field specifies the number of units of time that pass each second. If you specify a value of 0, the time base uses its natural time scale.
base
Discussion

Contains a reference to the time base. You obtain a time base by calling GetMovieTimeBase or NewTimeBase. If the time structure defines a duration, set this field to NIL. Otherwise, this field must refer to a valid time base.
Related Functions
AddTime
ClockGetTime
GetMovieTime
GetTimeBaseStartTime
GetTimeBaseStatus
GetTimeBaseStopTime
GetTimeBaseTime
SetTimeBaseZero
SGGrabCompressComplete
SubtractTime
VDCompressDone
VDGetTimeCode 
Programming Info
C interface file: Movies.h*/
struct TimeRecord {
   CompTimeValue    value;
   TimeScale        scale;
   TimeBase         base;
};
typedef struct TimeRecord TimeRecord;

/*wide

Stores a signed 64-bit value as a signed 32-bit integer and an unsigned 32-bit integer.

struct wide {        // big-endian version
   SInt32    hi;
   UInt32    lo;
};
struct wide {        // little-endian version
   UInt32    lo;
   SInt32    hi;
};
Fields
hi
Discussion

The signed high-order 32-bit integer.
lo
Discussion

The unsigned low-order 32-bit integer.
Programming Info
C interface file: Endian.h*/
//struct wide {        // big-endian version
//   SInt32    hi;
//   UInt32    lo;
//};
struct wide {        // little-endian version
   UInt32    lo;
   SInt32    hi;
};
typedef  struct wide wide;


/*FixedPoint

Defines the position of a geometric point in fixed-point numbers.

struct FixedPoint {
   Fixed    x;
   Fixed    y;
};
Fields
x
Discussion

The x (horizontal) coordinate of the point.
y
Discussion

The y (vertical) coordinate of the point.
Related Functions
CurveGetNearestPathPoint
CurveLengthToPoint
CurvePathPointToLength
TransformFixedPoints
TransformFixedRect
TransformRect 
Programming Info
C interface file: MacTypes.h*/

typedef struct FixedPoint {
   Fixed    x;
   Fixed    y;
}FixedPoint ;


#include <APPLE/CarbonCore/MacTypes_E.h>

#ifdef __cplusplus
}
#endif

#endif

#endif
