Re: Using OMS from Carbon under OS9
Re: Using OMS from Carbon under OS9
- Subject: Re: Using OMS from Carbon under OS9
- From: Herbie Robinson <email@hidden>
- Date: Fri, 25 Oct 2002 01:32:49 -0400
If you carbonize the project, you should have removed all the old
header files; so, you are getting all the OS headers from
pre-compiled header files (or some other magic, like Frameworks).
The latest headers for OS 9 that support Carbon, in fact, support the
old build style, too. You can change some defines and build your
Carbon sources for non-carbon environments. There are a few
omissions, but it's trivial to add the things that are missing (I did
some in my header CarbonSupplement.h).
Here is a prefixfile that I used:
*** Begin Prefix File ***
// source of precompiled header file for Classic PPC.
// add this file to your project, target PPC.
// when compiled it will produce AM_HeadersPPC++.
//
// in Target Settings dialog, Language Settings, C/C++ Language,
// set Prefix file to AM_HeadersPPC++.
#pragma precompile_target "AM_HeadersPPC++"
// Classic PPC settings:
#define TARGET_API_MAC_CARBON 0
#define TARGET_API_MAC_OS8 1
#define USE_OMS_FOR_MIDI 1
#define ACCESSOR_CALLS_ARE_FUNCTIONS 0
#define OPAQUE_TOOLBOX_STRUCTS 0
#define OPAQUE_UPP_TYPES 0
#define CALL_NOT_IN_CARBON 1
#define CARBON_ON_MACH_O 0
#include <MacHeaders.c>
#include <CarbonSupplement.h>
** End Prefix File ***
*** Begin CarbonSupplement.h ***
inline void SetControlDataHandle(ControlHandle theCtl, Handle dataH)
{
(**theCtl).contrlData = dataH;
}
inline UInt16 GetControlHilite(ControlHandle theCtl)
{
return (**theCtl).contrlHilite;
}
inline WindowPtr GetWindowFromPort( GrafPtr p )
{
return p;
}
inline void GetListViewBounds(ListHandle L, Rect *R)
{
*R = (**L).rView;
}
inline void SetListViewBounds(ListHandle L, Rect *R)
{
(**L).rView = *R;
}
inline void GetListVisibleCells(ListHandle L, ListBounds *V)
{
*V = (**L).visible;
}
inline void GetListDataBounds(ListHandle L, ListBounds *V)
{
*V = (**L).dataBounds;
}
inline void GetListCellSize(ListHandle L, Point *S)
{
*S = (**L).cellSize;
}
inline Handle GetListUserHandle(ListHandle L)
{
return (**L).userHandle;
}
inline void SetListUserHandle(ListHandle L, Handle V)
{
(**L).userHandle = V;
}
inline ControlRef GetListVerticalScrollBar(ListHandle L)
{
return (**L).vScroll;
}
inline ControlRef GetListHorizontalScrollBar(ListHandle L)
{
return (**L).hScroll;
}
*** End CarbonSupplement.h ***
Welll, I don't know - Carbonizing the project caused changes throughout; a
whole lot of structural changes to use the Carbon events model and much
more, and in this case there are a lot of new features folded into the
Carbonized version. I think most people are going to find it impractical to
maintain two separate piles of source code for Carbon and non-Carbon; if
that's the least pain we're in trouble.
On the other hand, it's easy to compile specifically separate Mach and
OS9 products using the same Carbon source, so that the Mach build has access
to CoreMIDI. The changes for the non-Mach version are trivial except for
this OMS issue.
I haven't figured out the shared library approach yet & I still wonder
if it really would float. Has anyone actually done that? Doug suggests it;
another correspondent is starting to try it.
Jeff
The least pain approach is to build two different versions of the
program: One non-Carbon for OMS and one Mach-O...
Sorry that I jumped right from the pre-Carbon world to writing
everything Mach-O native on X and don't have any experience with
Carbon development on 9.
I know there's a way others have done this, but I don't know what it
is. It might involve packaging the OMS glue into a shared library.
Doug
On Thursday, Oct 24, 2002, at 11:55 US/Pacific, Jeff Evans wrote:
And a request: Solving the MIDI problem for OS9 is pretty important for
apps that have a large customer base still using 9 but want to become
compatible with X. It would be great if Apple could provide some sample
code for accomplishing this trick - with the author of OMS
present at Apple
>>> perhaps this is not too unreasonable a hope?
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
-*****************************************
**
http://www.curbside-recording.com/ **
******************************************
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.