Getting rid of support for MacOS9 and earlier. This is the first step,

and the biggest in size, but probably the easiest. Hunting through the
source code comes next.
This commit is contained in:
Jack Jansen 2003-11-19 14:34:18 +00:00
parent 6045b9c935
commit 28ecf70db5
181 changed files with 0 additions and 22664 deletions

Binary file not shown.

View File

@ -1,7 +0,0 @@
__terminate
__initialize
__start
__ptmf_null
__vec_longjmp
longjmp
exit

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
init_CG

Binary file not shown.

View File

@ -1 +0,0 @@
init_tkinter

Binary file not shown.

View File

@ -1,17 +0,0 @@
/* The equivalent of the Unix 'sync' system call: FlushVol.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
For now, we only flush the default volume
(since that's the only volume written to by MacB). */
#include "macdefs.h"
void
sync(void)
{
if (FlushVol((StringPtr)0, 0) == noErr)
return;
else {
errno= ENODEV;
return;
}
}

View File

@ -1,362 +0,0 @@
'''
AECaptureParser makes a brave attempt to convert the text output
of the very handy Lasso Capture AE control panel
into close-enough executable python code.
In a roundabout way AECaptureParser offers the way to write lines of AppleScript
and convert them to python code. Once Pythonised, the code can be made prettier,
and it can run without Capture or Script Editor being open.
You need Lasso Capture AE from Blueworld:
ftp://ftp.blueworld.com/Lasso251/LassoCaptureAE.hqx
Lasso Capture AE prints structured ascii representations in a small window.
As these transcripts can be very complex, cut and paste to AECaptureParser, it parses and writes
python code that will, when executed, cause the same events to happen.
It's been tested with some household variety events, I'm sure there will be tons that
don't work.
All objects are converted to standard aetypes.ObjectSpecifier instances.
How to use:
1. Start the Capture window
2. Cause the desired appleevent to happen
- by writing a line of applescript in Script Editor and running it (!)
- by recording some action in Script Editor and running it
3. Find the events in Capture:
- make sure you get the appropriate events, cull if necessary
- sometimes Capture barfs, just quit and start Capture again, run events again
- AECaptureParser can process multiple events - it will just make more code.
4. Copy and paste in this script and execute
5. It will print python code that, when executed recreates the events.
Example:
For instance the following line of AppleScript in Script Editor
tell application "Finder"
return application processes
end tell
will result in the following transcript:
[event: target="Finder", class=core, id=getd]
'----':obj {form:indx, want:type(pcap), seld:abso(«616C6C20»), from:'null'()}
[/event]
Feed a string with this (and perhaps more) events to AECaptureParser
Some mysteries:
* what is '&subj' - it is sent in an activate event: &subj:'null'()
The activate event works when this is left out. A possibility?
* needs to deal with embedded aliasses
'''
__version__ = '0.002'
__author__ = 'evb'
import string
opentag = '{'
closetag = '}'
import aetools
import aetypes
class eventtalker(aetools.TalkTo):
pass
def processes():
'''Helper function to get the list of current processes and their creators
This code was mostly written by AECaptureParser! It ain't pretty, but that's not python's fault!'''
talker = eventtalker('MACS')
_arguments = {}
_attributes = {}
p = []
names = []
creators = []
results = []
# first get the list of process names
_arguments['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('pcap'),
form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
_reply, _arguments, _attributes = talker.send('core', 'getd', _arguments, _attributes)
if _arguments.has_key('errn'):
raise aetools.Error, aetools.decodeerror(_arguments)
if _arguments.has_key('----'):
p = _arguments['----']
for proc in p:
names.append(proc.seld)
# then get the list of process creators
_arguments = {}
_attributes = {}
AEobject_00 = aetypes.ObjectSpecifier(want=aetypes.Type('pcap'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
AEobject_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=AEobject_00)
_arguments['----'] = AEobject_01
_reply, _arguments, _attributes = talker.send('core', 'getd', _arguments, _attributes)
if _arguments.has_key('errn'):
raise aetools.Error, aetools.decodeerror(_arguments)
if _arguments.has_key('----'):
p = _arguments['----']
for proc in p:
creators.append(proc.type)
# then put the lists together
for i in range(len(names)):
results.append((names[i], creators[i]))
return results
class AECaptureParser:
'''convert a captured appleevent-description into executable python code'''
def __init__(self, aetext):
self.aetext = aetext
self.events = []
self.arguments = {}
self.objectindex = 0
self.varindex = 0
self.currentevent = {'variables':{}, 'arguments':{}, 'objects':{}}
self.parse()
def parse(self):
self.lines = string.split(self.aetext, '\n')
for l in self.lines:
if l[:7] == '[event:':
self.eventheader(l)
elif l[:7] == '[/event':
if len(self.currentevent)<>0:
self.events.append(self.currentevent)
self.currentevent = {'variables':{}, 'arguments':{}, 'objects':{}}
self.objectindex = 0
else:
self.line(l)
def line(self, value):
'''interpret literals, variables, lists etc.'''
# stuff in [ ], l ists
varstart = string.find(value, '[')
varstop = string.find(value, ']')
if varstart <> -1 and varstop <> -1 and varstop>varstart:
variable = value[varstart:varstop+1]
name = 'aevar_'+string.zfill(self.varindex, 2)
self.currentevent['variables'][name] = variable
value = value[:varstart]+name+value[varstop+1:]
self.varindex = self.varindex + 1
# stuff in « »
# these are 'ordinal' descriptors of 4 letter codes, so translate
varstart = string.find(value, '«')
varstop = string.find(value, '»')
if varstart <> -1 and varstop <> -1 and varstop>varstart:
variable = value[varstart+1:varstop]
t = ''
for i in range(0, len(variable), 2):
c = eval('0x'+variable[i : i+2])
t = t + chr(c)
name = 'aevar_'+string.zfill(self.varindex, 2)
self.currentevent['variables'][name] = '"' + t + '"'
value = value[:varstart]+name+value[varstop+1:]
self.varindex = self.varindex + 1
pos = string.find(value, ':')
if pos==-1:return
ok = 1
while ok <> None:
value, ok = self.parseobject(value)
self.currentevent['arguments'].update(self.splitparts(value, ':'))
# remove the &subj argument?
if self.currentevent['arguments'].has_key('&subj'):
del self.currentevent['arguments']['&subj']
# check for arguments len(a) < 4, and pad with spaces
for k in self.currentevent['arguments'].keys():
if len(k)<4:
newk = k + (4-len(k))*' '
self.currentevent['arguments'][newk] = self.currentevent['arguments'][k]
del self.currentevent['arguments'][k]
def parseobject(self, obj):
a, b = self.findtag(obj)
stuff = None
if a<>None and b<>None:
stuff = obj[a:b]
name = 'AEobject_'+string.zfill(self.objectindex, 2)
self.currentevent['objects'][name] = self.splitparts(stuff, ':')
obj = obj[:a-5] + name + obj[b+1:]
self.objectindex = self.objectindex +1
return obj, stuff
def nextopen(self, pos, text):
return string.find(text, opentag, pos)
def nextclosed(self, pos, text):
return string.find(text, closetag, pos)
def nexttag(self, pos, text):
start = self.nextopen(pos, text)
stop = self.nextclosed(pos, text)
if start == -1:
if stop == -1:
return -1, -1
return 0, stop
if start < stop and start<>-1:
return 1, start
else:
return 0, stop
def findtag(self, text):
p = -1
last = None,None
while 1:
kind, p = self.nexttag(p+1, text)
if last[0]==1 and kind==0:
return last[1]+len(opentag), p
if (kind, p) == (-1, -1):
break
last=kind, p
return None, None
def splitparts(self, txt, splitter):
res = {}
parts = string.split(txt, ', ')
for p in parts:
pos = string.find(p, splitter)
key = string.strip(p[:pos])
value = string.strip(p[pos+1:])
res[key] = self.map(value)
return res
def eventheader(self, hdr):
self.currentevent['event'] = self.splitparts(hdr[7:-1], '=')
def printobject(self, d):
'''print one object as python code'''
t = []
obj = {}
obj.update(d)
t.append("aetypes.ObjectSpecifier(")
if obj.has_key('want'):
t.append('want=' + self.map(obj['want']))
del obj['want']
t.append(', ')
if obj.has_key('form'):
t.append('form=' + addquotes(self.map(obj['form'])))
del obj['form']
t.append(', ')
if obj.has_key('seld'):
t.append('seld=' + self.map(obj['seld']))
del obj['seld']
t.append(', ')
if obj.has_key('from'):
t.append('fr=' + self.map(obj['from']))
del obj['from']
if len(obj.keys()) > 0:
print '# ', `obj`
t.append(")")
return string.join(t, '')
def map(self, t):
'''map some Capture syntax to python
matchstring : [(old, new), ... ]
'''
m = {
'type(': [('type(', "aetypes.Type('"), (')', "')")],
"'null'()": [("'null'()", "None")],
'abso(': [('abso(', "aetypes.Unknown('abso', ")],
'': [('', '"')],
'': [('', '"')],
'[': [('[', '('), (', ', ',')],
']': [(']', ')')],
'«': [('«', "«")],
'»': [('»', "»")],
}
for k in m.keys():
if string.find(t, k) <> -1:
for old, new in m[k]:
p = string.split(t, old)
t = string.join(p, new)
return t
def printevent(self, i):
'''print the entire captured sequence as python'''
evt = self.events[i]
code = []
code.append('\n# start event ' + `i` + ', talking to ' + evt['event']['target'])
# get the signature for the target application
code.append('talker = eventtalker("'+self.gettarget(evt['event']['target'])+'")')
code.append("_arguments = {}")
code.append("_attributes = {}")
# write the variables
for key, value in evt['variables'].items():
value = evt['variables'][key]
code.append(key + ' = ' + value)
# write the object in the right order
objkeys = evt['objects'].keys()
objkeys.sort()
for key in objkeys:
value = evt['objects'][key]
code.append(key + ' = ' + self.printobject(value))
# then write the arguments
for key, value in evt['arguments'].items():
code.append("_arguments[" + addquotes(key) + "] = " + value )
code.append('_reply, _arguments, _attributes = talker.send("'+
evt['event']['class']+'", "'+evt['event']['id']+'", _arguments, _attributes)')
code.append("if _arguments.has_key('errn'):")
code.append('\traise aetools.Error, aetools.decodeerror(_arguments)')
code.append("if _arguments.has_key('----'):")
code.append("\tprint _arguments['----']")
code.append('# end event ' + `i`)
return string.join(code, '\n')
def gettarget(self, target):
'''get the signature for the target application'''
target = target[1:-1]
if target == 'Finder':
return "MACS"
apps = processes()
for name, creator in apps:
if name == target:
return creator
return '****'
def makecode(self):
code = []
code.append("\n\n")
code.append("# code generated by AECaptureParser v " + __version__)
code.append("# imports, definitions for all events")
code.append("import aetools")
code.append("import aetypes")
code.append("class eventtalker(aetools.TalkTo):")
code.append("\tpass")
code.append("# the events")
# print the events
for i in range(len(self.events)):
code.append(self.printevent(i))
code.append("# end code")
return string.join(code, '\n')
def addquotes(txt):
quotes = ['"', "'"]
if not txt[0] in quotes and not txt[-1] in quotes:
return '"'+txt+'"'
return txt
# ------------------------------------------
# the factory
# ------------------------------------------
# for instance, this event was captured from the Script Editor asking the Finder for a list of active processes.
eventreceptacle = """
[event: target="Finder", class=core, id=setd]
'----':obj {form:prop, want:type(prop), seld:type(posn), from:obj {form:name, want:type(cfol), seld:MoPar:Data:DevDev:Python:Python 1.5.2c1:Extensions, from:'null'()}}, data:[100, 10]
[/event]
"""
aet = AECaptureParser(eventreceptacle)
print aet.makecode()

View File

@ -1,5 +0,0 @@
AECaptureParser is a tool by Erik van Blokland, erik@letterror.com, which
listens for AppleEvents and turns them into the Python code that will generate
those events when executed.
Lots more information is in the docstring in the code.

View File

@ -1,456 +0,0 @@
#include <AEDataModel.h>
#define DEBUG 0
#define kComponentSignatureString "BBPy.LM"
#include <Debugging.h>
#include <BBLMInterface.h>
#include <BBXTInterface.h>
//#include <BBLMTextIterator.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <Sound.h>
#if DEBUG
void debugf_(const char* func,const char* fileName,long line, const char*fmt,...)
{
va_list arg;
char msg[256];
va_start(arg, fmt);
vsnprintf(msg,256 ,fmt, arg);
DebugAssert(COMPONENT_SIGNATURE, DEBUG_NO_OPTIONS, kComponentSignatureString ": " , msg, nil, fileName, line, 0 );
//debug_string(msg);
}
#define debugf(FMT,...) debugf_( __FUNCTION__,__FILE__, __LINE__,FMT,__VA_ARGS__);
#else
#define debugf(FMT,...)
#endif
typedef const char *Str;
enum{
kPyBBLMStringSubst = kBBLMFirstUserRunKind
};
#define iswordchar(x) (isalnum(x)||x=='_')
struct runloc{
bool past_gap;
long pos;
long last_start;
unsigned char*p;
};
char start(struct runloc& r,BBLMParamBlock &pb)
{
r.past_gap = false;
r.last_start = pb.fCalcRunParams.fStartOffset;
r.pos = pb.fCalcRunParams.fStartOffset;
r.p = ((unsigned char*)pb.fText) + pb.fCalcRunParams.fStartOffset;
// Adjust for the gap if weÕre not already past it.
if ((!r.past_gap) && (r.pos >= pb.fTextGapLocation)){
r.p += pb.fTextGapLength;
r.past_gap = true;
}
return *r.p;
}
char nextchar(struct runloc&r,BBLMParamBlock &pb)
{
if ( r.pos< pb.fTextLength){
++r.pos;
++r.p;
if ((!r.past_gap) && (r.pos >= pb.fTextGapLocation)){
r.p += pb.fTextGapLength;
r.past_gap = true;
}
return *r.p;
}
else{
return 0;
}
}
bool addRun(BBLMRunCode kind, int start,int len , const BBLMCallbackBlock& bblm_callbacks)
{
if (len > 0){ // Tie off the code run we were in, unless the length is zero.
debugf("Run %d %d:%d", kind, start, start+len-1 );
return bblmAddRun( &bblm_callbacks, 'Pyth',
kind, start, len, false);
}
else{
return true;
}
}
bool addRunBefore (BBLMRunCode kind,struct runloc& r, const BBLMCallbackBlock& bblm_callbacks)
{
bool more_runs = addRun(kind, r.last_start, r.pos - r.last_start, bblm_callbacks);
r.last_start = r.pos;
return more_runs;
}
bool addRunTo (BBLMRunCode kind, struct runloc& r, const BBLMCallbackBlock& bblm_callbacks)
{
bool more_runs = addRun(kind, r.last_start, r.pos - r.last_start+1, bblm_callbacks);
r.last_start = r.pos+1;
return more_runs;
}
bool colorstr( char delim,
BBLMParamBlock &pb,
struct runloc &r,
const BBLMCallbackBlock &bblm_callbacks)
{
bool tripple = false , pers = false, lookup = false, more_runs = true;
char c = nextchar(r,pb);
if (c == delim){
c = nextchar(r,pb);
if (c == delim){
tripple = true;
c = nextchar(r,pb);
}
else{
//double
return addRunBefore(kBBLMRunIsSingleString,r,bblm_callbacks);
}
}
while (c && more_runs){
if (pers ){
if (isalpha(c)){
more_runs = addRunTo(kPyBBLMStringSubst,r,bblm_callbacks);
}
else if (c == '('){
lookup = true;
}
}
pers = false;
if (c == delim){
if (tripple){
if ((c = nextchar(r,pb))== delim && (c = nextchar(r,pb)) == delim){
break; // end of tripple-quote.
}
}
else{
break; // end of single-quote.
}
}
else if (c== '\\'){
nextchar(r,pb);
}
else if (c=='\r'||c=='\n'){
if (!tripple){
break;
}
}
else if (c=='%'){
more_runs = addRunBefore(kBBLMRunIsSingleString,r,bblm_callbacks);
pers = true;
}
else if (c==')' && lookup){
more_runs = addRunTo(kPyBBLMStringSubst,r,bblm_callbacks);
lookup = false;
}
c = nextchar(r,pb);
}
return more_runs && addRunTo(lookup?kPyBBLMStringSubst:kBBLMRunIsSingleString,r,bblm_callbacks);
}
bool colorcomment(BBLMParamBlock &pb,
struct runloc &r,
const BBLMCallbackBlock &bblm_callbacks)
{
while (char c = nextchar(r,pb)){
if (c=='\r'|| c=='\n'){
break;
}
}
return addRunTo(kBBLMRunIsLineComment,r,bblm_callbacks);
}
void CalculateRuns(BBLMParamBlock &pb,
const BBLMCallbackBlock &bblm_callbacks)
{
const struct rundesc *state = NULL;
bool more_runs=true;
struct runloc r;
char c = start(r,pb);
while (c && more_runs){
loop:
// Process a char
if (state==NULL){
//If we're in the basic 'code' state, check for each interesting char (rundelims[i].start).
switch (c){
case '\'':
case '"':
more_runs = addRunBefore(kBBLMRunIsCode,r,bblm_callbacks);
if (more_runs){
more_runs = colorstr(c,pb,r,bblm_callbacks);
}
break;
case '#' :
more_runs = addRunBefore(kBBLMRunIsCode,r,bblm_callbacks);
if (more_runs){
more_runs = colorcomment(pb,r,bblm_callbacks);
}
break;
default:
break;
}
}
c = nextchar(r,pb);
}
if (more_runs){
addRunBefore(kBBLMRunIsCode,r,bblm_callbacks);
}
}
static void AdjustRange(BBLMParamBlock &params,
const BBLMCallbackBlock &callbacks)
{
DescType language;
BBLMRunCode kind;
SInt32 charPos;
SInt32 length;
UInt32 index = params.fAdjustRangeParams.fStartIndex;
while( index > 0 &&
bblmGetRun(&callbacks, index, language, kind, charPos, length) &&
(kind==kPyBBLMStringSubst||kind==kBBLMRunIsSingleString)){
index--;
};
params.fAdjustRangeParams.fStartIndex = index;
}
// The next couple funcs process the text of a file assumming it's in 1 piece in memory,
// so they may not be called from CalculateRuns.
bool matchword(BBLMParamBlock &pb, const char *pat ,unsigned long *pos)
{
const char *asciText = (const char *) (pb.fTextIsUnicode?NULL:pb.fText);
int i;
for (i=0; pat[i]; i++){
if (*pos+i>=pb.fTextLength){
return false;
}
if (asciText[*pos+i] != pat[i]){
return false;
}
}
if ((*pos+i<pb.fTextLength)&&iswordchar(asciText[*pos+i])){
return false;
}
*pos+=i;
return true;
}
int matchindent(BBLMParamBlock &pb, UInt32 *pos)
{
const char *asciText = (const char *) (pb.fTextIsUnicode?NULL:pb.fText);
int indent=0;
while(*pos<pb.fTextLength){
switch (/*(char)(pb.fTextIsUnicode?uniText[pos]:*/asciText[*pos]/*)*/){
case ' ':
++*pos;
indent++;
break;
case '\t':
++*pos;
indent+=8;
break;
case '#':
return -1;
break;
default:
return indent;
break;
}
}
}
void eat_line(BBLMParamBlock &pb, unsigned long* pos)
{
const char *asciText = (const char *) (pb.fTextIsUnicode?NULL:pb.fText);
while (asciText[*pos]!='\r' && asciText[*pos]!='\n' && *pos<pb.fTextLength) {++*pos;}
while ((asciText[*pos]=='\r' || asciText[*pos]=='\n') && *pos<pb.fTextLength) {++*pos;}
}
void addItem(BBLMParamBlock &pb, UInt32 pos, int nest, BBLMFunctionKinds kind,
const BBLMCallbackBlock *bblm_callbacks)
{
UInt32 funcstartpos = pos;
UInt32 funcnamelen=0;
UInt32 offset=0;
const char *asciText = (const char *) pb.fText;
UInt32 index;
OSErr err;
while (isspace(asciText[pos]) && pos<pb.fTextLength) {++pos;}
UInt32 fnamestart = pos;
while ((isalnum(asciText[pos])||asciText[pos]=='_') && pos<pb.fTextLength) {pos++; funcnamelen++;}
err = bblmAddTokenToBuffer( bblm_callbacks,
pb.fFcnParams.fTokenBuffer,
(void*)&asciText[fnamestart],
funcnamelen,
pb.fTextIsUnicode,
&offset);
BBLMProcInfo procInfo;
procInfo.fFunctionStart = fnamestart; // char offset in file of first character of function
procInfo.fFunctionEnd = pos; // char offset of last character of function
procInfo.fSelStart = fnamestart; // first character to select when choosing function
procInfo.fSelEnd = pos; // last character to select when choosing function
procInfo.fFirstChar = fnamestart; // first character to make visible when choosing function
procInfo.fKind = kind;
procInfo.fIndentLevel = nest; // indentation level of token
procInfo.fFlags = 0; // token flags (see BBLMFunctionFlags)
procInfo.fNameStart = offset; // char offset in token buffer of token name
procInfo.fNameLength = funcnamelen; // length of token name
err = bblmAddFunctionToList(bblm_callbacks,
pb.fFcnParams.fFcnList,
procInfo,
&index);
}
enum{
maxnest=5
};
void ScanForFunctions(BBLMParamBlock &pb,
const BBLMCallbackBlock &bblm_callbacks)
{
const char *asciText = (const char *) (pb.fTextIsUnicode?NULL:pb.fText);
UniCharPtr uniText = (UniCharPtr) (pb.fTextIsUnicode?pb.fText:NULL);
int indents[maxnest]= {0};
int nest = 0;
UInt32 pos=0; // current character offset
while (pos<pb.fTextLength){
int indent = matchindent(pb, &pos);
if (indent >= 0){
for (int i=0; i <= nest; i++){
if (indent<=indents[i]){
nest = i;
indents[nest]=indent;
goto x;
}
}
indents[++nest]=indent;
x:
if (matchword(pb,"def",&pos)){
addItem( pb, pos, nest, kBBLMFunctionMark, &bblm_callbacks);
}
else if (matchword(pb, "class", &pos)){
addItem( pb, pos, nest, kBBLMTypedef, &bblm_callbacks);
}
}
eat_line(pb,&pos);
}
}
OSErr main( BBLMParamBlock &params,
const BBLMCallbackBlock &bblm_callbacks,
const BBXTCallbackBlock &bbxt_callbacks)
{
OSErr result;
if ((params.fSignature != kBBLMParamBlockSignature) ||
(params.fLength < sizeof(BBLMParamBlock)))
{
return paramErr;
}
switch (params.fMessage)
{
case kBBLMInitMessage:
case kBBLMDisposeMessage:
{
result = noErr; // nothing to do
break;
}
case kBBLMCalculateRunsMessage:
CalculateRuns(params, bblm_callbacks);
result = noErr;
break;
case kBBLMScanForFunctionsMessage:
ScanForFunctions(params, bblm_callbacks);
result = noErr;
break;
case kBBLMAdjustRangeMessage:
AdjustRange(params, bblm_callbacks);
result = noErr;
break;
case kBBLMMapRunKindToColorCodeMessage:
switch (params.fMapRunParams.fRunKind){
case kPyBBLMStringSubst:
params.fMapRunParams.fColorCode = kBBLMSGMLAttributeNameColor;
params.fMapRunParams.fMapped = true;
break;
default:
params.fMapRunParams.fMapped = false;
}
result = noErr;
break;
case kBBLMEscapeStringMessage:
case kBBLMAdjustEndMessage:
case kBBLMMapColorCodeToColorMessage:
case kBBLMSetCategoriesMessage:
case kBBLMMatchKeywordMessage:
{
result = userCanceledErr;
break;
}
default:
{
result = paramErr;
break;
}
}
return result;
}

Binary file not shown.

View File

@ -1,35 +0,0 @@
#include "BBLMTypes.r"
#include "MacTypes.r"
#define kKeyWords 1057
resource 'BBLF' (128, "Python Language Mappings", purgeable)
{
kCurrentBBLFVersion,
{
kLanguagePython,
(kBBLMScansFunctions|kBBLMColorsSyntax|kBBLMIsCaseSensitive),
kKeyWords,
"Python",
{
kNeitherSourceNorInclude, ".py",
}
}
};
#define VERSION 0x1, 0x0, final, 0x0
resource 'vers' (1) {
VERSION,
verUS,
"1.1",
"1.1,"
};
resource 'vers' (2) {
VERSION,
verUS,
$$Date,
$$Date
};

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(This file must be converted with BinHex 4.0) :!!"58e*$4'peC`#3#!(GM(8!N!3"!!!!!CX!!!#E!!!!3J#3mjGKEQ3*$@&cFf9 bG!eLFQ9KD`eME'&cF`eMEfjdD@jeC3eNC@B0C'9X$@9XD@B0C@acC3ePH'0PF(3 0CAKPB`eQD@jKE'aj$@C[FJeQFQpY$@GXEf*KE!eTCJeTEA"[FR30D@i0DA-0E'& YBQ4K$@j[G!e[FJe`BA0c$A"bD@jd$A*KDA0P$A*PG(9bEJedFRN0GfKTE'80!!! "!!!!!CX!!!#E!!!!3J1S!h`#qJ!!!"`!-J!!9%9B9!!!!!S%)3#3#Jp3HA4SEfi J5f9jGfpbC(0&9`:

View File

@ -1,12 +0,0 @@
This is the Python Language Module for BBEdit.
This software is a plugin to Bare Bones Software's BBEdit 6.0.2 (or more), designed to make editing & browsing Python Language files easer.
It parses any file ending in .py (or extentions of your choice.) providing BBEdit with the information BBEdit needs to provide services for python files similar to those it provides for 'C'. Namely: syntax coloring and populating BBEdit's '€' popup menu with file's functions and classes.
This Plug-in needs to be placed in your :BBEdit 6.0:BBEdit Support:Language Modules: folder.
If you wish, I have no objections to redistributing it in whole or in part, modify it, or beating small fury animals to death with rolled up printouts of the source code.
Christopher Stern
cistern@earthlink.net

View File

@ -1,129 +0,0 @@
"""PythonSlave.py
An application that responds to three types of apple event:
'pyth'/'EXEC': execute direct parameter as Python
'aevt', 'quit': quit
'aevt', 'odoc': perform python scripts
Copyright © 1996, Just van Rossum, Letterror
"""
__version__ = "0.1.3"
import FrameWork
import sys
import traceback
import aetools
import string
from Carbon import AE
import EasyDialogs
import os
from Carbon import Qd
from types import *
from Carbon.Events import charCodeMask, cmdKey
import MacOS
from Carbon import Evt
def dummyfunc(): pass
modulefilename = dummyfunc.func_code.co_filename
def Interact(timeout = 50000000): # timeout after 10 days...
AE.AEInteractWithUser(timeout)
class PythonSlave(FrameWork.Application):
def __init__(self):
FrameWork.Application.__init__(self)
AE.AEInstallEventHandler('pyth', 'EXEC', ExecHandler)
AE.AEInstallEventHandler('aevt', 'quit', QuitHandler)
AE.AEInstallEventHandler('aevt', 'odoc', OpenDocumentHandler)
def makeusermenus(self):
self.filemenu = m = FrameWork.Menu(self.menubar, "File")
self._quititem = FrameWork.MenuItem(m, "Quit", "Q", self._quit)
def do_kHighLevelEvent(self, event):
(what, message, when, where, modifiers) = event
try:
AE.AEProcessAppleEvent(event)
except AE.Error, detail:
print "Apple Event was not handled, error:", detail
def do_key(self, event):
(what, message, when, where, modifiers) = event
c = chr(message & charCodeMask)
if modifiers & cmdKey and c == '.':
return
FrameWork.Application.do_key(self, event)
def idle(self, event):
Qd.InitCursor()
def quit(self, *args):
raise self
def getabouttext(self):
return "About PythonSlaveƒ"
def do_about(self, id, item, window, event):
EasyDialogs.Message("PythonSlave " + __version__ + "\rCopyright © 1996, Letterror, JvR")
def ExecHandler(theAppleEvent, theReply):
parameters, args = aetools.unpackevent(theAppleEvent)
if parameters.has_key('----'):
if parameters.has_key('NAME'):
print '--- executing "' + parameters['NAME'] + '" ---'
else:
print '--- executing "<unknown>" ---'
stuff = parameters['----']
MyExec(stuff + "\n") # execute input
print '--- done ---'
return 0
def MyExec(stuff):
stuff = string.splitfields(stuff, '\r') # convert return chars
stuff = string.joinfields(stuff, '\n') # to newline chars
Interact()
saveyield = MacOS.EnableAppswitch(1)
try:
exec stuff in {}
except:
MacOS.EnableAppswitch(saveyield)
traceback.print_exc()
MacOS.EnableAppswitch(saveyield)
def OpenDocumentHandler(theAppleEvent, theReply):
parameters, args = aetools.unpackevent(theAppleEvent)
docs = parameters['----']
if type(docs) <> ListType:
docs = [docs]
for doc in docs:
fss, a = doc.Resolve()
path = fss.as_pathname()
if path <> modulefilename:
MyExecFile(path)
return 0
def MyExecFile(path):
saveyield = MacOS.EnableAppswitch(1)
savewd = os.getcwd()
os.chdir(os.path.split(path)[0])
print '--- Executing file "' + os.path.split(path)[1] + '"'
try:
execfile(path, {"__name__": "__main__"})
except:
traceback.print_exc()
MacOS.EnableAppswitch(saveyield)
MacOS.EnableAppswitch(saveyield)
os.chdir(savewd)
print "--- done ---"
def QuitHandler(theAppleEvent, theReply):
slave.quit()
return 0
slave = PythonSlave()
print "PythonSlave", __version__, "ready."
slave.mainloop()

View File

@ -1,45 +0,0 @@
"Run as Python" -- a BBEdit extension to make the Python interpreter execute the
contents of the current window.
version 0.2.3, 18 september 1996
Note by Jack:
Also check out the BBPy.lm contributed software, which is a Python language
module for BBedit, providing syntax coloring and function/class navigation.
contents:
- "Run as Python" -- the extension
- PythonSlave.py -- the "slave" script that handles the AppleEvents
- source -- source code & CW9 project for the extension
quickstart:
- drop "Run as Python" in BBEdit extensions folder
- double-click PythonSlave.py
- start BBEdit
- type some code
- go to Extensions menu: "Run as Python"
- be happy
warning:
since PythonSlave.py runs its own event loop and we have no interface
to SIOUX you *cannot* copy from the console. Duh.
extra feature:
while PythonSlave.py is running you can still double-click Python
documents, they will get executed as if Python was not already running.
bugs:
perhaps
acknowledgements:
- Thanks to Joseph Strout for valuable input and beta testing.
- Thanks to Mark Roseman for providing code that can launch
PythonSlave.py from BBEdit.
Have fun with it!
Please report bugs, or fix 'em. Suggestions are always welcome.
Just van Rossum, Letterror
<just@knoware.nl>

View File

@ -1 +0,0 @@
(This file must be converted with BinHex 4.0) :!!"#3PK88LTMD!#3#!Np!m`!N!3"!!!!#*N!!!HC!!!!T!#3)!e5G@iJBA-J8(P dD'pZE@9bCf9N@8fe69P0ELj`H@&X!J"849K88(PdD!#3','"lI%!N!B*23#3KB! !!`#3"8!""!"8!93%!ePPF`#3"N!!UJ"8!2S%!Nj[!*!&#!!m!$B"9)JqdP"jG'K [EP0XBACP,R"jdb"TFb"ZEh3JFR9ZEQPZCb`J$AG[G@aN)(P[G5"XD@YP)(4[)'a [Bf&dC5"TG$m!N!8)!!S!+!!US!)!!3!!!!i!+!!S!)`"N!!!J&99-!S!!!!%!!! #33!!!!B"!!"5!*!%"U*J#J!!3N*B9!#!!!")jq$)6VS!mN(krqSJ#+"96VS!N!" -ha-(6[S$)%(krpE4r!!!"T8J#+"96R9)j`B!@8mJE`!3)Qm!&#`[!"JHQ"pB!!% I@!!#(eJ!!bSAG!"J4")B%!%#3!#!C`c5!4!"5)")`05!B#JHJ4pB!!%3!3*!!%" R$$!Aj8ML3%M!e)"J$KpB!!)I@!!$*"IPLZ+#hE%S!&1&5S9ZZ&K260m!B%je51F 3)#4!)#`!"#B+PS"R3%U!CKa#,!!)-$bSRkG',`J`2+'BSdDaheE!4!!C3!!),`- [#Nkkrd3[!%kkrdj2l`!-+8S!"%SX!!KR"(!"SCK-h`3)6R9"q[lkdI`!!!D-)!L J9F'-6R91G5!-5IS!"LK86R8!N!4"q[rk))a1GBG6CA49F%%d!!"19[q1,`-YI&" jG'Mre&92,cacD@GZ5'lre%Ki!!4)E[r`-$`)*DJ@-"mf!%T$C`B`!f!!!F496bm m9%9B9#"Z!"4)D!!"F!!3%#m!5'lri$!m##@S&M!I0J"+3fF'-!0J!!'@98m[2&4 &@&3[,J!-,bi!%%KZrqJ`2!JPU"B`(cB!5N0R"M!$B!!"EP92,ca`HA4S,ca&@%9 $5'lrm$mmrrp#TdKZrrJ`2!X8U"B`(cB!5N0R"M!$B!!"2P925'lrq#mm,C!%5'l rk$!m"K#S&M!I0J"+3fF'-!0J!!%D98p)E[ri,ca138e&5'lri$!m"K#S&M!I0J" +3fF'-!0J!!$f98p)E[ri5'lrf%Ki!!-r2!!"5(MrrN+R3UF`2!dAU"B`(cB!$%2 pRfC)98mr2!#!3UHTK6!I0J!-3`!#CJC`!'!!!,*)E[q16VN!!!1q5J"B6fB'F!" J!!#F5'lrMNkj!!!%G$B!5N0B6fF1-!0J!!#%5N0R"$!$B(T96dKZrr!`2!)%U"B `(cB!5N0R"$!$B'*96dKZrq!`2!)%U"B`(cB!5N0R"$!$B%T96dKZrqJ`2!)%U"B `(cB!5N0R"$!$B$*96dKZrrJ`2!)%U"B`(cB!5N0R"$!$B"T96dKZrpJ`2!)%U"B `(cB!5N0R"$!$B!*`!#BI6Pj1GBa6C@jN9'9iG%&c388!!!"19[m!51FB-#CZ!!` Q,J!)6VVp`#J!,`0)E[m!U4PC6bm$)'X!!Nk3!#"I*%JJ5U!T5'lr!&P2,`T1Z3! !"RiJ(bm!,a)[#dkkrDSf!%T$6qm!%'F)2`-JD`"U6T!!)%UJ+L!%`Ba-h``B6Pi JAe"26Y#%E@&TEJ!!!%j@rjJ[#L4Z!!JYI&4&@&6rQ%(j!!!%-LP)!!![,!!!3QG )E[qB5'lrU$mm!!DTkL"X!!#J(dSZrkKQ"(!!B"JdV[qZ*@lrX!!#3HlrY%2U!!C `3+!ZF!%NAdjH6R@54f9d8(PdD'pZ8faKGQ96F'9M!!!!6PB!!#"Z!!JJ+!!J)LJ !*!b!9%9B9'B1$)&3HA4SCJC#,`!-B!BII!!"!!a1ALkI6R@-69P'58a&4NP-9%9 5!!!!6PErINMR%#!NEJ!),Aa03806rhj96bmmFfPRENKZrhj)H!!%5'lrLM!m##@ S&M!I0J"+3fF'-!0J!!'d98m[2%C14&)[2(0[F'9)E[q+2ccrrd+R5'lrq$!m#a5 S&M!I0J"+3fF'-!0J!!'%98mr%LmU!!*#TdKZrj*`!DT5-"p96d+R5'lrNNKZrr4 `!UJM-"p96d+R,`T)E[r`F!+S)c!I98p#Td+R3LG)E[rS-$`("UJ@-"mf!#"Zrr5 J+992,caKE'Pc)'lrp#m3@8m[,[rd6VN!!!Cq)"m[!%KZrq!`2!JPU"B`(b"Zrr5 J+P925'lrq#mm,C!%5'lri$!m"K#S&M!I0J"Q@P925'lri$!m!J5S&M!I)'lrm+! T98m[2'&XDA-JE[r`,a"C6bmZrr"1Z3!!"RiJ(bm!5'lrf$!m##@S&M!I)'lrm+! T98p)E[rS3UG)E[rB-$`'#DJ@-"mf!&925'lrf$!m!J5S&M!I98p)E[ri,caQFf9 X5'lrk$!m"K#S&M!I0J"96dKZrqJ`2!)%U"B`(e925'lrq%KZri*)H!!43QG)H2r r3UG#Tc!m$4HS&M!I0J"+3fF%-!0J+P925'lrq$!m!J5S&M!I0J"+3fF%-!0J%P9 25'lrJM!m!J5S&M!I0J!`!dcI"!K1ANjeN8aKG@jMD&"jG'K[EP0XBACP!!!LAb" IS#8ZJ'S#3TG1d3#3$!C"3iY!FUP!kp!!!!"(!#-J!!!!"RB`,M)Z-cPf-#ib,M- JU5"+GA0d)(CKEL"5Eh0cG@dJ,b"-CA4dCA*bEh)X)$aUGA0d3'aPG(4PFR*[FLj ZE$i!!!%!!!!)Q3!!"jN!!!#N#2`64#G-!!!!(!#@!!9fCA*c!!!!-N4*9%`!!!! q38a59!!!!%T#3PK'!!!!9N*#@%X!!!"L3N*B9!!!!'i!!Irr!!!(6JMm%5J!J2r r!*!*J2rr!!!!K!#3"B$rr`!!!*B!N!@!rrm!!!#H!*!&J!!!)!!!U!#3"!e5G@i JBA-J8(PdD'pZr0%:

View File

@ -1,716 +0,0 @@
#pragma once
#include <MixedMode.h>
#include <Dialogs.h>
#include <Files.h>
#include <Windows.h>
#include <AppleEvents.h>
#include <StandardFile.h>
#if defined(powerc) || defined (__powerc)
#pragma options align=mac68k
#endif
typedef struct
{
FSSpec spec; // designates file on disk
long key; // reserved for future expansion
char tree; // 0 for absolute, 1 for project, 2 for system
Boolean found; // FALSE if file couldn't be located; if so, all other info is moot
OSType type; // file type of found file
OSType crtr; // signature of found file's creator
short spare0; // reserved for future expansion
long spare1;
} ProjectEntry;
enum
{
kNeitherTree,
kProjectTree,
kSystemTree
};
enum
{
kTHINKCProject,
kTHINKPascalProject,
kCodeWarriorProject
};
// masks for the "flags" argument to new-convention interfaces
#define xfWindowOpen 0x00000001
#define xfWindowChangeable 0x00000002
#define xfHasSelection 0x00000004
#define xfUseDefaults 0x00000008
#define xfIsBBEditLite 0x00000040
#define xfIsBBEditDemo 0x00000080
typedef struct
{
FSSpec spec;
OSType key;
short error_kind;
long line_number;
Str255 message;
} ErrorEntry;
typedef enum
{
kNote = 0,
kError,
kWarning
} ErrorKind;
#define kCurrentExternalVersion 5 // current version of callbacks
// Universal callback interfaces
#if USESROUTINEDESCRIPTORS
#define ExtensionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))))
#define NewExtensionUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AppleEvent *))) \
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AppleEvent *))))
#define GetWindowContentsUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define GetSelectionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
#define SetSelectionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))))
#define GetDocInfoUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long *))))
#define GetModDateUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define CopyUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))))
#define PasteUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))))
#define GetLastLineUPPInfo (kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(long))))
#define GetLineNumberUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLineStartUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLineEndUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLinePosUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define InsertUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))))
#define DeleteUPPInfo (kPascalStackBased)
#define SetWindowContentsUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle))))
#define ContentsChangedUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define GetFileTextUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Boolean *))))
#define GetFolderUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
#define OpenSeveralUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(StandardFileReply ***))))
#define CenterDialogUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(DialogPtr))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))))
#define StandardFilterUPPInfo uppModalFilterProcInfo
#define FrameDialogItemUPPInfo uppUserItemProcInfo
#define NewDocumentUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
#define OpenDocumentUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
#define AllocateUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean))))
#define FindPatternUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(Boolean))))
#define ReportOSErrorUPPInfo (kPascalStackBased)
#define GetPreferenceUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
#define SetPreferenceUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
#define StartProgressUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))))
#define DoProgressUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define DoneProgressUPPInfo (kPascalStackBased)
#define GetProjectListUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ProjectEntry***))))
#define ProjectTextListUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle *))))
#define PresetUndoUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))))
#define SetUndoUPPInfo (kPascalStackBased)
#define OpenFileUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr *))))
#define PrepareUndoUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long))))
#define CommitUndoUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define CreateResultsUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WindowPtr *))))
typedef UniversalProcPtr GetWindowContentsProc;
typedef UniversalProcPtr GetSelectionProc;
typedef UniversalProcPtr SetSelectionProc;
typedef UniversalProcPtr GetDocInfoProc;
typedef UniversalProcPtr GetModDateProc;
typedef UniversalProcPtr CopyProc;
typedef UniversalProcPtr PasteProc;
typedef UniversalProcPtr GetLastLineProc;
typedef UniversalProcPtr GetLineNumberProc;
typedef UniversalProcPtr GetLineStartProc;
typedef UniversalProcPtr GetLineEndProc;
typedef UniversalProcPtr GetLinePosProc;
typedef UniversalProcPtr InsertProc;
typedef UniversalProcPtr DeleteProc;
typedef UniversalProcPtr SetWindowContentsProc;
typedef UniversalProcPtr ContentsChangedProc;
typedef UniversalProcPtr GetFileTextProc;
typedef UniversalProcPtr GetFolderProc;
typedef UniversalProcPtr OpenSeveralProc;
typedef UniversalProcPtr CenterDialogProc;
typedef UniversalProcPtr StandardFilterProc;
typedef UniversalProcPtr FrameDialogItemProc;
typedef UniversalProcPtr NewDocumentProc;
typedef UniversalProcPtr OpenDocumentProc;
typedef UniversalProcPtr AllocateProc;
typedef UniversalProcPtr FindPatternProc;
typedef UniversalProcPtr ReportOSErrorProc;
typedef UniversalProcPtr GetPreferenceProc;
typedef UniversalProcPtr SetPreferenceProc;
typedef UniversalProcPtr StartProgressProc;
typedef UniversalProcPtr DoProgressProc;
typedef UniversalProcPtr DoneProgressProc;
typedef UniversalProcPtr GetProjectListProc;
typedef UniversalProcPtr ProjectTextListProc;
typedef UniversalProcPtr PresetUndoProc;
typedef UniversalProcPtr SetUndoProc;
typedef UniversalProcPtr OpenFileProc;
typedef UniversalProcPtr PrepareUndoProc;
typedef UniversalProcPtr CommitUndoProc;
typedef UniversalProcPtr CreateResultsProc;
#define CallGetWindowContents(proc, w) \
(Handle)(CallUniversalProc(proc, GetWindowContentsUPPInfo, (w)))
#define CallGetSelection(proc, selStart, selEnd, firstChar) \
(CallUniversalProc(proc, GetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
#define CallSetSelection(proc, selStart, selEnd, firstChar) \
(CallUniversalProc(proc, SetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
#define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
(CallUniversalProc(proc, GetDocInfoUPPInfo, (w), (name), (vRefNum), (dirID)))
#define CallGetModDate(proc, w) \
(CallUniversalProc(proc, GetModDateUPPInfo, (w)))
#define CallCopy(proc) \
(Handle)(CallUniversalProc(proc, CopyUPPInfo))
#define CallPaste(proc, h) \
(CallUniversalProc(proc, PasteUPPInfo, (h)))
#define CallGetLastLine(proc) \
(CallUniversalProc(proc, GetLastLineUPPInfo))
#define CallGetLineNumber(proc, sel) \
(CallUniversalProc(proc, GetLineNumberUPPInfo, (sel)))
#define CallGetLineStart(proc, sel) \
(CallUniversalProc(proc, GetLineStartUPPInfo, (sel)))
#define CallGetLineEnd(proc, sel) \
(CallUniversalProc(proc, GetLineEndUPPInfo, (sel)))
#define CallGetLinePos(proc, sel) \
(CallUniversalProc(proc, GetLinePosUPPInfo, (sel)))
#define CallInsert(proc, text, len) \
(CallUniversalProc(proc, InsertUPPInfo, (text), (len)))
#define CallDelete(proc) \
(CallUniversalProc(proc, DeleteUPPInfo))
#define CallSetWindowContents(proc, w, h) \
(CallUniversalProc(proc, SetWindowContentsUPPInfo, (w), (h)))
#define CallContentsChanged(proc, w) \
(CallUniversalProc(proc, ContentsChangedUPPInfo, (w)))
#define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
(Handle)(CallUniversalProc(proc, GetFileTextUPPInfo, (vRefNum), (dirID), (name), (canDispose)))
#define CallGetFolder(proc, prompt, vRefNum, dirID) \
(Boolean)(CallUniversalProc(proc, GetFolderUPPInfo, (prompt), (vRefNum), (dirID)))
#define CallOpenSeveral(proc, sort, file_count, files) \
(Boolean)(CallUniversalProc(proc, OpenSeveralUPPInfo, (sort), (file_count), (files)))
#define CallCenterDialog(proc, dialogID) \
(DialogPtr)(CallUniversalProc(proc, CenterDialogUPPInfo, (dialogID)))
#define CallStandardFilter(proc, d, event, item) \
CallModalFilterProc(proc, (d), (event), (item))
#define CallFrameDialogItem(proc, d, item) \
CallUserItemProc(proc, (d), (item))
#define CallNewDocument(proc) \
(WindowPtr)(CallUniversalProc(proc, NewDocumentUPPInfo))
#define CallOpenDocument(proc) \
(WindowPtr)(CallUniversalProc(proc, OpenDocumentUPPInfo))
#define CallAllocate(proc, size, clear) \
(Handle)(CallUniversalProc(proc, AllocateUPPInfo, (size), (clear)))
#define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
(CallUniversalProc(proc, FindPatternUPPInfo, (text), (text_len), (text_offset), \
(pat), (pat_len), (case_sens)))
#define CallReportOSError(proc, code) \
(CallUniversalProc(proc, ReportOSErrorUPPInfo, (code)))
#define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
(CallUniversalProc(proc, GetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
#define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
(CallUniversalProc(proc, SetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
#define CallStartProgress(proc, str, total, cancel_allowed) \
(CallUniversalProc(proc, StartProgressUPPInfo, (str), (total), (cancel_allowed)))
#define CallDoProgress(proc, done) \
(Boolean)(CallUniversalProc(proc, DoProgressUPPInfo, (done)))
#define CallDoneProgress(proc) \
(CallUniversalProc(proc, DoneProgressUPPInfo))
#define CallGetProjectList(proc, spec, kind, count, entries) \
(Boolean)(CallUniversalProc(proc, GetProjectListUPPInfo, (spec), (kind), (count), (entries)))
#define CallProjectTextList(proc, spec, text) \
(Boolean)(CallUniversalProc(proc, ProjectTextListUPPInfo, (spec), (text)))
#define CallPresetUndo(proc) \
(Boolean)(CallUniversalProc(proc, PresetUndoUPPInfo))
#define CallSetUndo(proc) \
(CallUniversalProc(proc, SetUndoUPPInfo))
#define CallOpenFile(proc, spec, w) \
(Boolean)(CallUniversalProc(proc, OpenFileUPPInfo, (spec), (w)))
#define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
(Boolean)(CallUniversalProc(proc, PrepareUndoUPPInfo, (undo_start), (undo_end), \
(sel_start), (sel_end)))
#define CallCommitUndo(proc, new_end) \
(CallUniversalProc(proc, CommitUndoUPPInfo, (new_end)))
#define CallCreateResults(proc, title, count, results, w) \
(Boolean)(CallUniversalProc(proc, CreateResultsUPPInfo, (title), (count), (results), (w)))
#else
typedef pascal Handle (*GetWindowContentsProc)(WindowPtr w);
typedef pascal void (*GetSelectionProc)(long *selStart, long *selEnd, long *firstChar);
typedef pascal void (*SetSelectionProc)(long selStart, long selEnd, long firstChar);
typedef pascal void (*GetDocInfoProc)(WindowPtr w, Str255 fName, short *vRefNum, long *dirID);
typedef pascal long (*GetModDateProc)(WindowPtr w);
typedef pascal Handle (*CopyProc)(void);
typedef pascal void (*PasteProc)(Handle pasteText);
typedef pascal long (*GetLastLineProc)(void);
typedef pascal long (*GetLineNumberProc)(long selection);
typedef pascal long (*GetLineStartProc)(long selection);
typedef pascal long (*GetLineEndProc)(long selection);
typedef pascal long (*GetLinePosProc)(long line);
typedef pascal void (*InsertProc)(char *text, long len);
typedef pascal void (*DeleteProc)(void);
typedef pascal void (*SetWindowContentsProc)(WindowPtr w, Handle h);
typedef pascal void (*ContentsChangedProc)(WindowPtr w);
typedef pascal Handle (*GetFileTextProc)(short vRefNum, long dirID, Str255 fName, Boolean *canDispose);
typedef pascal Boolean (*GetFolderProc)(Str255 prompt, short *vRefNum, long *dirID);
typedef pascal Boolean (*OpenSeveralProc)(Boolean sort, short *file_count, StandardFileReply ***files);
typedef pascal DialogPtr (*CenterDialogProc)(short dialogID);
typedef pascal Boolean (*StandardFilterProc)(DialogPtr d, EventRecord *event, short *item);
typedef pascal void (*FrameDialogItemProc)(DialogPtr d, short item);
typedef pascal WindowPtr (*NewDocumentProc)(void);
typedef pascal WindowPtr (*OpenDocumentProc)(void);
typedef pascal Handle (*AllocateProc)(long size, Boolean clear);
typedef pascal long (*FindPatternProc)(char *text, long text_len, long text_offset,
char *pat, long pat_len,
Boolean case_sensitive);
typedef pascal void (*ReportOSErrorProc)(short code);
typedef pascal void (*GetPreferenceProc)(ResType prefType, short req_len, void *buffer, short *act_len);
typedef pascal void (*SetPreferenceProc)(ResType prefType, short req_len, void *buffer, short *act_len);
typedef pascal void (*StartProgressProc)(Str255 str, long total, Boolean cancel_allowed);
typedef pascal Boolean (*DoProgressProc)(long done);
typedef pascal void (*DoneProgressProc)(void);
typedef pascal Boolean (*GetProjectListProc)(FSSpec *spec, short *kind, short *count, ProjectEntry ***entries);
typedef pascal Boolean (*ProjectTextListProc)(FSSpec *spec, Handle *text);
typedef pascal Boolean (*PresetUndoProc)(void);
typedef pascal void (*SetUndoProc)(void);
typedef pascal Boolean (*OpenFileProc)(FSSpec *spec, WindowPtr *w);
typedef pascal Boolean (*PrepareUndoProc)(long undo_start, long undo_end,
long sel_start, long sel_end);
typedef pascal void (*CommitUndoProc)(long new_end);
typedef pascal Boolean (*CreateResultsProc)(Str255 title, short count, Handle results, WindowPtr *w);
#define CallGetWindowContents(proc, w) \
((proc))((w))
#define CallGetSelection(proc, selStart, selEnd, firstChar) \
((proc))((selStart), (selEnd), (firstChar))
#define CallSetSelection(proc, selStart, selEnd, firstChar) \
((proc))((selStart), (selEnd), (firstChar))
#define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
((proc))((w), (name), (vRefNum), (dirID))
#define CallGetModDate(proc, w) \
((proc))((w))
#define CallCopy(proc) \
((proc))()
#define CallPaste(proc, h) \
((proc))((h))
#define CallGetLastLine(proc) \
((proc))()
#define CallGetLineNumber(proc, sel) \
((proc))((sel))
#define CallGetLineStart(proc, sel) \
((proc))((sel))
#define CallGetLineEnd(proc, sel) \
((proc))((sel))
#define CallGetLinePos(proc, sel) \
((proc))((sel))
#define CallInsert(proc, text, len) \
((proc))((text), (len))
#define CallDelete(proc) \
((proc))()
#define CallSetWindowContents(proc, w, h) \
((proc))((w), (h))
#define CallContentsChanged(proc, w) \
((proc))((w))
#define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
((proc))((vRefNum), (dirID), (name), (canDispose))
#define CallGetFolder(proc, prompt, vRefNum, dirID) \
((proc))((prompt), (vRefNum), (dirID))
#define CallOpenSeveral(proc, sort, file_count, files) \
((proc))((sort), (file_count), (files))
#define CallCenterDialog(proc, dialogID) \
((proc))((dialogID))
#define CallStandardFilter(proc, d, event, item) \
((proc))((d), (event), (item))
#define CallFrameDialogItem(proc, d, item) \
((proc))((d), (item))
#define CallNewDocument(proc) \
((proc))()
#define CallOpenDocument(proc) \
((proc))()
#define CallAllocate(proc, size, clear) \
((proc))((size), (clear))
#define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
((proc))((text), (text_len), (text_offset), (pat), (pat_len), (case_sens))
#define CallReportOSError(proc, code) \
((proc))((code))
#define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
((proc))((prefType), (req_len), (buffer), (act_len))
#define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
((proc))((prefType), (req_len), (buffer), (act_len))
#define CallStartProgress(proc, str, total, cancel_allowed) \
((proc))((str), (total), (cancel_allowed))
#define CallDoProgress(proc, done) \
((proc))((done))
#define CallDoneProgress(proc) \
((proc))()
#define CallGetProjectList(proc, spec, kind, count, entries) \
((proc))((spec), (kind), (count), (entries))
#define CallProjectTextList(proc, spec, text) \
((proc))((spec), (text))
#define CallPresetUndo(proc) \
((proc))()
#define CallSetUndo(proc) \
((proc))()
#define CallOpenFile(proc, spec, w) \
((proc))((spec), (w))
#define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
((proc))((undo_start), (undo_end), (sel_start), (sel_end))
#define CallCommitUndo(proc, new_end) \
((proc))((new_end))
#define CallCreateResults(proc, title, count, results, w) \
((proc))((title), (count), (results), (w))
#endif
typedef struct
{
short version;
// version 1 callbacks
GetWindowContentsProc GetWindowContents;
GetSelectionProc GetSelection;
SetSelectionProc SetSelection;
GetDocInfoProc GetDocInfo;
GetModDateProc GetModDate;
CopyProc Copy;
PasteProc Paste;
// version 2 callbacks
/* Text-Editing stuff */
GetLastLineProc GetLastLine;
GetLineNumberProc GetLineNumber;
GetLineStartProc GetLineStart;
GetLineEndProc GetLineEnd;
GetLinePosProc GetLinePos;
InsertProc Insert;
DeleteProc Delete;
/* Getting and Setting window text */
SetWindowContentsProc SetWindowContents;
ContentsChangedProc ContentsChanged;
/* Reading file text */
GetFileTextProc GetFileText;
/* Direct user-interface calls */
GetFolderProc GetFolder;
OpenSeveralProc OpenSeveral;
CenterDialogProc CenterDialog;
StandardFilterProc StandardFilter;
FrameDialogItemProc FrameDialogItem;
NewDocumentProc NewDocument;
OpenDocumentProc OpenDocument;
/* Utility Routines */
AllocateProc Allocate;
FindPatternProc FindPattern;
ReportOSErrorProc ReportOSError;
/* Preference routines */
GetPreferenceProc GetPreference;
SetPreferenceProc SetPreference;
/* Progress routines */
StartProgressProc StartProgress;
DoProgressProc DoProgress;
DoneProgressProc DoneProgress;
// Version 3 callbacks
GetProjectListProc GetProjectList;
ProjectTextListProc ProjectTextList;
// version 4 callbacks
PresetUndoProc PresetUndo;
SetUndoProc SetUndo;
OpenFileProc OpenFile;
// version 5 callbacks
PrepareUndoProc PrepareUndo;
CommitUndoProc CommitUndo;
CreateResultsProc CreateResults;
} ExternalCallbackBlock;
#if defined(powerc) || defined (__powerc)
#pragma options align=reset
#endif
/*
'main' for a BBXT is declared:
pascal void main(ExternalCallbackBlock *callbacks, WindowPtr w); [C]
The 'new' calling convention, which passes more information
and allows scriptability, is this:
pascal OSErr main(ExternalCallbackBlock *callbacks, WindowPtr w, long flags, AppleEvent *event, AppleEvent *reply);
*/

View File

@ -1,716 +0,0 @@
#pragma once
#include <MixedMode.h>
#include <Dialogs.h>
#include <Files.h>
#include <Windows.h>
#include <AppleEvents.h>
#include <StandardFile.h>
#if defined(powerc) || defined (__powerc)
#pragma options align=mac68k
#endif
typedef struct
{
FSSpec spec; // designates file on disk
long key; // reserved for future expansion
char tree; // 0 for absolute, 1 for project, 2 for system
Boolean found; // FALSE if file couldn't be located; if so, all other info is moot
OSType type; // file type of found file
OSType crtr; // signature of found file's creator
short spare0; // reserved for future expansion
long spare1;
} ProjectEntry;
enum
{
kNeitherTree,
kProjectTree,
kSystemTree
};
enum
{
kTHINKCProject,
kTHINKPascalProject,
kCodeWarriorProject
};
// masks for the "flags" argument to new-convention interfaces
#define xfWindowOpen 0x00000001
#define xfWindowChangeable 0x00000002
#define xfHasSelection 0x00000004
#define xfUseDefaults 0x00000008
#define xfIsBBEditLite 0x00000040
#define xfIsBBEditDemo 0x00000080
typedef struct
{
FSSpec spec;
OSType key;
short error_kind;
long line_number;
Str255 message;
} ErrorEntry;
typedef enum
{
kNote = 0,
kError,
kWarning
} ErrorKind;
#define kCurrentExternalVersion 5 // current version of callbacks
// Universal callback interfaces
#if USESROUTINEDESCRIPTORS
#define ExtensionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))))
#define NewExtensionUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AppleEvent *))) \
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AppleEvent *))))
#define GetWindowContentsUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define GetSelectionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
#define SetSelectionUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))))
#define GetDocInfoUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long *))))
#define GetModDateUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define CopyUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))))
#define PasteUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))))
#define GetLastLineUPPInfo (kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(long))))
#define GetLineNumberUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLineStartUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLineEndUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define GetLinePosUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define InsertUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))))
#define DeleteUPPInfo (kPascalStackBased)
#define SetWindowContentsUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle))))
#define ContentsChangedUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
#define GetFileTextUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Boolean *))))
#define GetFolderUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
#define OpenSeveralUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(StandardFileReply ***))))
#define CenterDialogUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(DialogPtr))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))))
#define StandardFilterUPPInfo uppModalFilterProcInfo
#define FrameDialogItemUPPInfo uppUserItemProcInfo
#define NewDocumentUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
#define OpenDocumentUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
#define AllocateUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean))))
#define FindPatternUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(char *))) \
| STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(Boolean))))
#define ReportOSErrorUPPInfo (kPascalStackBased)
#define GetPreferenceUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
#define SetPreferenceUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
#define StartProgressUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))))
#define DoProgressUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define DoneProgressUPPInfo (kPascalStackBased)
#define GetProjectListUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ProjectEntry***))))
#define ProjectTextListUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle *))))
#define PresetUndoUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))))
#define SetUndoUPPInfo (kPascalStackBased)
#define OpenFileUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr *))))
#define PrepareUndoUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long))))
#define CommitUndoUPPInfo (kPascalStackBased \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
#define CreateResultsUPPInfo (kPascalStackBased \
| RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle))) \
| STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WindowPtr *))))
typedef UniversalProcPtr GetWindowContentsProc;
typedef UniversalProcPtr GetSelectionProc;
typedef UniversalProcPtr SetSelectionProc;
typedef UniversalProcPtr GetDocInfoProc;
typedef UniversalProcPtr GetModDateProc;
typedef UniversalProcPtr CopyProc;
typedef UniversalProcPtr PasteProc;
typedef UniversalProcPtr GetLastLineProc;
typedef UniversalProcPtr GetLineNumberProc;
typedef UniversalProcPtr GetLineStartProc;
typedef UniversalProcPtr GetLineEndProc;
typedef UniversalProcPtr GetLinePosProc;
typedef UniversalProcPtr InsertProc;
typedef UniversalProcPtr DeleteProc;
typedef UniversalProcPtr SetWindowContentsProc;
typedef UniversalProcPtr ContentsChangedProc;
typedef UniversalProcPtr GetFileTextProc;
typedef UniversalProcPtr GetFolderProc;
typedef UniversalProcPtr OpenSeveralProc;
typedef UniversalProcPtr CenterDialogProc;
typedef UniversalProcPtr StandardFilterProc;
typedef UniversalProcPtr FrameDialogItemProc;
typedef UniversalProcPtr NewDocumentProc;
typedef UniversalProcPtr OpenDocumentProc;
typedef UniversalProcPtr AllocateProc;
typedef UniversalProcPtr FindPatternProc;
typedef UniversalProcPtr ReportOSErrorProc;
typedef UniversalProcPtr GetPreferenceProc;
typedef UniversalProcPtr SetPreferenceProc;
typedef UniversalProcPtr StartProgressProc;
typedef UniversalProcPtr DoProgressProc;
typedef UniversalProcPtr DoneProgressProc;
typedef UniversalProcPtr GetProjectListProc;
typedef UniversalProcPtr ProjectTextListProc;
typedef UniversalProcPtr PresetUndoProc;
typedef UniversalProcPtr SetUndoProc;
typedef UniversalProcPtr OpenFileProc;
typedef UniversalProcPtr PrepareUndoProc;
typedef UniversalProcPtr CommitUndoProc;
typedef UniversalProcPtr CreateResultsProc;
#define CallGetWindowContents(proc, w) \
(Handle)(CallUniversalProc(proc, GetWindowContentsUPPInfo, (w)))
#define CallGetSelection(proc, selStart, selEnd, firstChar) \
(CallUniversalProc(proc, GetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
#define CallSetSelection(proc, selStart, selEnd, firstChar) \
(CallUniversalProc(proc, SetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
#define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
(CallUniversalProc(proc, GetDocInfoUPPInfo, (w), (name), (vRefNum), (dirID)))
#define CallGetModDate(proc, w) \
(CallUniversalProc(proc, GetModDateUPPInfo, (w)))
#define CallCopy(proc) \
(Handle)(CallUniversalProc(proc, CopyUPPInfo))
#define CallPaste(proc, h) \
(CallUniversalProc(proc, PasteUPPInfo, (h)))
#define CallGetLastLine(proc) \
(CallUniversalProc(proc, GetLastLineUPPInfo))
#define CallGetLineNumber(proc, sel) \
(CallUniversalProc(proc, GetLineNumberUPPInfo, (sel)))
#define CallGetLineStart(proc, sel) \
(CallUniversalProc(proc, GetLineStartUPPInfo, (sel)))
#define CallGetLineEnd(proc, sel) \
(CallUniversalProc(proc, GetLineEndUPPInfo, (sel)))
#define CallGetLinePos(proc, sel) \
(CallUniversalProc(proc, GetLinePosUPPInfo, (sel)))
#define CallInsert(proc, text, len) \
(CallUniversalProc(proc, InsertUPPInfo, (text), (len)))
#define CallDelete(proc) \
(CallUniversalProc(proc, DeleteUPPInfo))
#define CallSetWindowContents(proc, w, h) \
(CallUniversalProc(proc, SetWindowContentsUPPInfo, (w), (h)))
#define CallContentsChanged(proc, w) \
(CallUniversalProc(proc, ContentsChangedUPPInfo, (w)))
#define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
(Handle)(CallUniversalProc(proc, GetFileTextUPPInfo, (vRefNum), (dirID), (name), (canDispose)))
#define CallGetFolder(proc, prompt, vRefNum, dirID) \
(Boolean)(CallUniversalProc(proc, GetFolderUPPInfo, (prompt), (vRefNum), (dirID)))
#define CallOpenSeveral(proc, sort, file_count, files) \
(Boolean)(CallUniversalProc(proc, OpenSeveralUPPInfo, (sort), (file_count), (files)))
#define CallCenterDialog(proc, dialogID) \
(DialogPtr)(CallUniversalProc(proc, CenterDialogUPPInfo, (dialogID)))
#define CallStandardFilter(proc, d, event, item) \
CallModalFilterProc(proc, (d), (event), (item))
#define CallFrameDialogItem(proc, d, item) \
CallUserItemProc(proc, (d), (item))
#define CallNewDocument(proc) \
(WindowPtr)(CallUniversalProc(proc, NewDocumentUPPInfo))
#define CallOpenDocument(proc) \
(WindowPtr)(CallUniversalProc(proc, OpenDocumentUPPInfo))
#define CallAllocate(proc, size, clear) \
(Handle)(CallUniversalProc(proc, AllocateUPPInfo, (size), (clear)))
#define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
(CallUniversalProc(proc, FindPatternUPPInfo, (text), (text_len), (text_offset), \
(pat), (pat_len), (case_sens)))
#define CallReportOSError(proc, code) \
(CallUniversalProc(proc, ReportOSErrorUPPInfo, (code)))
#define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
(CallUniversalProc(proc, GetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
#define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
(CallUniversalProc(proc, SetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
#define CallStartProgress(proc, str, total, cancel_allowed) \
(CallUniversalProc(proc, StartProgressUPPInfo, (str), (total), (cancel_allowed)))
#define CallDoProgress(proc, done) \
(Boolean)(CallUniversalProc(proc, DoProgressUPPInfo, (done)))
#define CallDoneProgress(proc) \
(CallUniversalProc(proc, DoneProgressUPPInfo))
#define CallGetProjectList(proc, spec, kind, count, entries) \
(Boolean)(CallUniversalProc(proc, GetProjectListUPPInfo, (spec), (kind), (count), (entries)))
#define CallProjectTextList(proc, spec, text) \
(Boolean)(CallUniversalProc(proc, ProjectTextListUPPInfo, (spec), (text)))
#define CallPresetUndo(proc) \
(Boolean)(CallUniversalProc(proc, PresetUndoUPPInfo))
#define CallSetUndo(proc) \
(CallUniversalProc(proc, SetUndoUPPInfo))
#define CallOpenFile(proc, spec, w) \
(Boolean)(CallUniversalProc(proc, OpenFileUPPInfo, (spec), (w)))
#define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
(Boolean)(CallUniversalProc(proc, PrepareUndoUPPInfo, (undo_start), (undo_end), \
(sel_start), (sel_end)))
#define CallCommitUndo(proc, new_end) \
(CallUniversalProc(proc, CommitUndoUPPInfo, (new_end)))
#define CallCreateResults(proc, title, count, results, w) \
(Boolean)(CallUniversalProc(proc, CreateResultsUPPInfo, (title), (count), (results), (w)))
#else
typedef pascal Handle (*GetWindowContentsProc)(WindowPtr w);
typedef pascal void (*GetSelectionProc)(long *selStart, long *selEnd, long *firstChar);
typedef pascal void (*SetSelectionProc)(long selStart, long selEnd, long firstChar);
typedef pascal void (*GetDocInfoProc)(WindowPtr w, Str255 fName, short *vRefNum, long *dirID);
typedef pascal long (*GetModDateProc)(WindowPtr w);
typedef pascal Handle (*CopyProc)(void);
typedef pascal void (*PasteProc)(Handle pasteText);
typedef pascal long (*GetLastLineProc)(void);
typedef pascal long (*GetLineNumberProc)(long selection);
typedef pascal long (*GetLineStartProc)(long selection);
typedef pascal long (*GetLineEndProc)(long selection);
typedef pascal long (*GetLinePosProc)(long line);
typedef pascal void (*InsertProc)(char *text, long len);
typedef pascal void (*DeleteProc)(void);
typedef pascal void (*SetWindowContentsProc)(WindowPtr w, Handle h);
typedef pascal void (*ContentsChangedProc)(WindowPtr w);
typedef pascal Handle (*GetFileTextProc)(short vRefNum, long dirID, Str255 fName, Boolean *canDispose);
typedef pascal Boolean (*GetFolderProc)(Str255 prompt, short *vRefNum, long *dirID);
typedef pascal Boolean (*OpenSeveralProc)(Boolean sort, short *file_count, StandardFileReply ***files);
typedef pascal DialogPtr (*CenterDialogProc)(short dialogID);
typedef pascal Boolean (*StandardFilterProc)(DialogPtr d, EventRecord *event, short *item);
typedef pascal void (*FrameDialogItemProc)(DialogPtr d, short item);
typedef pascal WindowPtr (*NewDocumentProc)(void);
typedef pascal WindowPtr (*OpenDocumentProc)(void);
typedef pascal Handle (*AllocateProc)(long size, Boolean clear);
typedef pascal long (*FindPatternProc)(char *text, long text_len, long text_offset,
char *pat, long pat_len,
Boolean case_sensitive);
typedef pascal void (*ReportOSErrorProc)(short code);
typedef pascal void (*GetPreferenceProc)(ResType prefType, short req_len, void *buffer, short *act_len);
typedef pascal void (*SetPreferenceProc)(ResType prefType, short req_len, void *buffer, short *act_len);
typedef pascal void (*StartProgressProc)(Str255 str, long total, Boolean cancel_allowed);
typedef pascal Boolean (*DoProgressProc)(long done);
typedef pascal void (*DoneProgressProc)(void);
typedef pascal Boolean (*GetProjectListProc)(FSSpec *spec, short *kind, short *count, ProjectEntry ***entries);
typedef pascal Boolean (*ProjectTextListProc)(FSSpec *spec, Handle *text);
typedef pascal Boolean (*PresetUndoProc)(void);
typedef pascal void (*SetUndoProc)(void);
typedef pascal Boolean (*OpenFileProc)(FSSpec *spec, WindowPtr *w);
typedef pascal Boolean (*PrepareUndoProc)(long undo_start, long undo_end,
long sel_start, long sel_end);
typedef pascal void (*CommitUndoProc)(long new_end);
typedef pascal Boolean (*CreateResultsProc)(Str255 title, short count, Handle results, WindowPtr *w);
#define CallGetWindowContents(proc, w) \
((proc))((w))
#define CallGetSelection(proc, selStart, selEnd, firstChar) \
((proc))((selStart), (selEnd), (firstChar))
#define CallSetSelection(proc, selStart, selEnd, firstChar) \
((proc))((selStart), (selEnd), (firstChar))
#define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
((proc))((w), (name), (vRefNum), (dirID))
#define CallGetModDate(proc, w) \
((proc))((w))
#define CallCopy(proc) \
((proc))()
#define CallPaste(proc, h) \
((proc))((h))
#define CallGetLastLine(proc) \
((proc))()
#define CallGetLineNumber(proc, sel) \
((proc))((sel))
#define CallGetLineStart(proc, sel) \
((proc))((sel))
#define CallGetLineEnd(proc, sel) \
((proc))((sel))
#define CallGetLinePos(proc, sel) \
((proc))((sel))
#define CallInsert(proc, text, len) \
((proc))((text), (len))
#define CallDelete(proc) \
((proc))()
#define CallSetWindowContents(proc, w, h) \
((proc))((w), (h))
#define CallContentsChanged(proc, w) \
((proc))((w))
#define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
((proc))((vRefNum), (dirID), (name), (canDispose))
#define CallGetFolder(proc, prompt, vRefNum, dirID) \
((proc))((prompt), (vRefNum), (dirID))
#define CallOpenSeveral(proc, sort, file_count, files) \
((proc))((sort), (file_count), (files))
#define CallCenterDialog(proc, dialogID) \
((proc))((dialogID))
#define CallStandardFilter(proc, d, event, item) \
((proc))((d), (event), (item))
#define CallFrameDialogItem(proc, d, item) \
((proc))((d), (item))
#define CallNewDocument(proc) \
((proc))()
#define CallOpenDocument(proc) \
((proc))()
#define CallAllocate(proc, size, clear) \
((proc))((size), (clear))
#define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
((proc))((text), (text_len), (text_offset), (pat), (pat_len), (case_sens))
#define CallReportOSError(proc, code) \
((proc))((code))
#define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
((proc))((prefType), (req_len), (buffer), (act_len))
#define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
((proc))((prefType), (req_len), (buffer), (act_len))
#define CallStartProgress(proc, str, total, cancel_allowed) \
((proc))((str), (total), (cancel_allowed))
#define CallDoProgress(proc, done) \
((proc))((done))
#define CallDoneProgress(proc) \
((proc))()
#define CallGetProjectList(proc, spec, kind, count, entries) \
((proc))((spec), (kind), (count), (entries))
#define CallProjectTextList(proc, spec, text) \
((proc))((spec), (text))
#define CallPresetUndo(proc) \
((proc))()
#define CallSetUndo(proc) \
((proc))()
#define CallOpenFile(proc, spec, w) \
((proc))((spec), (w))
#define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
((proc))((undo_start), (undo_end), (sel_start), (sel_end))
#define CallCommitUndo(proc, new_end) \
((proc))((new_end))
#define CallCreateResults(proc, title, count, results, w) \
((proc))((title), (count), (results), (w))
#endif
typedef struct
{
short version;
// version 1 callbacks
GetWindowContentsProc GetWindowContents;
GetSelectionProc GetSelection;
SetSelectionProc SetSelection;
GetDocInfoProc GetDocInfo;
GetModDateProc GetModDate;
CopyProc Copy;
PasteProc Paste;
// version 2 callbacks
/* Text-Editing stuff */
GetLastLineProc GetLastLine;
GetLineNumberProc GetLineNumber;
GetLineStartProc GetLineStart;
GetLineEndProc GetLineEnd;
GetLinePosProc GetLinePos;
InsertProc Insert;
DeleteProc Delete;
/* Getting and Setting window text */
SetWindowContentsProc SetWindowContents;
ContentsChangedProc ContentsChanged;
/* Reading file text */
GetFileTextProc GetFileText;
/* Direct user-interface calls */
GetFolderProc GetFolder;
OpenSeveralProc OpenSeveral;
CenterDialogProc CenterDialog;
StandardFilterProc StandardFilter;
FrameDialogItemProc FrameDialogItem;
NewDocumentProc NewDocument;
OpenDocumentProc OpenDocument;
/* Utility Routines */
AllocateProc Allocate;
FindPatternProc FindPattern;
ReportOSErrorProc ReportOSError;
/* Preference routines */
GetPreferenceProc GetPreference;
SetPreferenceProc SetPreference;
/* Progress routines */
StartProgressProc StartProgress;
DoProgressProc DoProgress;
DoneProgressProc DoneProgress;
// Version 3 callbacks
GetProjectListProc GetProjectList;
ProjectTextListProc ProjectTextList;
// version 4 callbacks
PresetUndoProc PresetUndo;
SetUndoProc SetUndo;
OpenFileProc OpenFile;
// version 5 callbacks
PrepareUndoProc PrepareUndo;
CommitUndoProc CommitUndo;
CreateResultsProc CreateResults;
} ExternalCallbackBlock;
#if defined(powerc) || defined (__powerc)
#pragma options align=reset
#endif
/*
'main' for a BBXT is declared:
pascal void main(ExternalCallbackBlock *callbacks, WindowPtr w); [C]
The 'new' calling convention, which passes more information
and allows scriptability, is this:
pascal OSErr main(ExternalCallbackBlock *callbacks, WindowPtr w, long flags, AppleEvent *event, AppleEvent *reply);
*/

View File

@ -1,17 +0,0 @@
/* BBPython
A simple menu command to send the contents of a window to the Python interpreter
copyright © 1996 Just van Rossum, Letterror: just@knoware.nl
All Rights Reserved
*/
#include <MacHeaders68K>
#include <A4Stuff.h>
#include <SetUpA4.h> // for global variables, multiple segments, etc.
#include "ExternalInterface.h"
#include <Memory.h>
extern OSErr SendTextAsAE(ExternalCallbackBlock *callbacks, Ptr theText, long theSize, Str255 windowTitle);
extern OSErr LaunchPythonSlave(FSSpec * docSpec);
extern Boolean GetPythonSlaveSpec(FSSpec * docSpec);

View File

@ -1 +0,0 @@
(This file must be converted with BinHex 4.0) :#8*#8(NZFR0bB`"bFh*M8P0&4!%!N!F#GELF!*!%!3!!!!(c!!!!m`!!!))!q`" F!8h!!J!,!*!&T!!d!-3!C!B!N!DN!(`*3N*3H5jbFh*M,R*cFQ0bC@jMCA0ZFfP [ER4PER4cF`!!FR0bBe*6483"!!"!!!%!N"+b&)qr!*!'!R9ZBf9X!*!&13"1!%d !RJ3+4'pZeA3J8f&fC3#3"3`!6J!X!A@)0e0KGQ8JBfKKEQGPFb"dEb"dD'8J6@9 dFQphCA*VFb"%Ef0eE@9ZG#$5AM$6)'*PCQpbC5"H-6m#!*!&$!!A!#`!0k!#!!) !N!b""!!"!!!!$J!S!#J!M!'3!!#!998`#J!!!!3!!!*"!!!!J!!$!*!&3!%%!&3 "9!3$@@9c!*!'3!#U!&3!qJ3#6Qm!N!8)!$`!0J&8L$l58(PdD'pZ8faKGQ8ZF(R 6)'Pc)'j[G#"bG@jZD@jR,#!0GfpeE'3JH@pe)'aTDf8JG'mJE'pMBA4P)'Pd2`# 3"3J!#J!S!#UJ!J!"!!!!"J%!!&)!N!9(!#-J!!!!"RB`,M)Z-cPf-#ib,M-JU5" +GA0d)(CKEL"5Eh0cG@dJ,b"-CA4dCA*bEh)X)$aUGA0d3'aPG(4PFR*[FLjZE$i !!!%!!!!"m`!!!2-!!!###2`64#G-!!!!(!##!!4fCA*c!!!!+N4*9%`!!!!f38a 59!!!!%*#3PK'!!!!6N*#@%X!!!"D!!(rr`!!!+J)r"(m!)$rr`!!!"S!N!@!rrm !N!Q!rrm!!!!5!*!&J2rr!!!!RJ#3"-JY:

View File

@ -1,94 +0,0 @@
/*
* Launch the PythonSlave.py script.
* This works exactly as if you'd double clicked on the file in the Finder, which
* not surprisingly is how its implemented (via the AppleEvents route of course).
*
* Largely based on code submitted by Mark Roseman <roseman@cpsc.ucalgary.ca>
* Thanks!
*/
#include "BBPy.h"
pascal Boolean MyFileFilter(CInfoPBPtr PB);
FileFilterUPP gMyFileFilterUPP = NULL;
Boolean GetPythonSlaveSpec(FSSpec * docSpec) {
StandardFileReply reply;
SFTypeList typeList;
typeList[0] = 'TEXT';
//if (!gMyFileFilterUPP)
gMyFileFilterUPP = NewFileFilterProc( MyFileFilter );
StandardGetFile(gMyFileFilterUPP, 0, typeList, &reply);
DisposePtr((Ptr)gMyFileFilterUPP);
if(!reply.sfGood)
return 0; /* user cancelled */
docSpec->vRefNum = reply.sfFile.vRefNum;
docSpec->parID = reply.sfFile.parID;
BlockMove(reply.sfFile.name, docSpec->name, 64);
return 1;
}
pascal Boolean MyFileFilter(CInfoPBPtr PB) {
OSType fType; /* file type */
OSType fCreator; /* file creator */
fType =((HParmBlkPtr)PB)->fileParam.ioFlFndrInfo.fdType;
fCreator = ((HParmBlkPtr)PB)->fileParam.ioFlFndrInfo.fdCreator;
if (fType == 'TEXT' &&
fCreator == 'Pyth')
return 0;
return 1;
}
OSErr LaunchPythonSlave(FSSpec * docSpec) {
OSErr err;
FSSpec dirSpec;
AEAddressDesc finderAddress;
AppleEvent theEvent, theReply;
OSType finderSig = 'MACS';
AliasHandle DirAlias, FileAlias;
AEDesc fileList;
AEDesc aeDirDesc, listElem;
err = AECreateDesc(typeApplSignature, (Ptr)&finderSig, 4, &finderAddress);
if(err != noErr) return err;
err = AECreateAppleEvent('FNDR', 'sope', &finderAddress,
kAutoGenerateReturnID, kAnyTransactionID, &theEvent);
if(err != noErr) return err;
FSMakeFSSpec(docSpec->vRefNum, docSpec->parID, NULL, &dirSpec);
NewAlias(NULL, &dirSpec, &DirAlias);
NewAlias(NULL, docSpec, &FileAlias);
err = AECreateList(NULL, 0, 0, &fileList);
HLock((Handle)DirAlias);
AECreateDesc(typeAlias, (Ptr)*DirAlias, GetHandleSize((Handle)DirAlias), &aeDirDesc);
HUnlock((Handle)DirAlias);
if ((err = AEPutParamDesc(&theEvent, keyDirectObject, &aeDirDesc)) == noErr) {
AEDisposeDesc(&aeDirDesc);
HLock((Handle)FileAlias);
AECreateDesc(typeAlias, (Ptr)*FileAlias, GetHandleSize((Handle)FileAlias), &listElem);
HLock((Handle)FileAlias);
err = AEPutDesc(&fileList, 0, &listElem);
}
AEDisposeDesc(&listElem);
err = AEPutParamDesc(&theEvent, 'fsel', &fileList);
AEDisposeDesc(&fileList);
err = AESend(&theEvent, &theReply, kAENoReply+kAENeverInteract,
kAENormalPriority, kAEDefaultTimeout, 0L, 0L);
if(err != noErr) return err;
err = AEDisposeDesc(&theEvent);
if(err != noErr) return err;
err = AEDisposeDesc(&theReply);
return err;
}

View File

@ -1,94 +0,0 @@
/*
* Launch the PythonSlave.py script.
* This works exactly as if you'd double clicked on the file in the Finder, which
* not surprisingly is how its implemented (via the AppleEvents route of course).
*
* Largely based on code submitted by Mark Roseman <roseman@cpsc.ucalgary.ca>
* Thanks!
*/
#include "BBPy.h"
pascal Boolean MyFileFilter(CInfoPBPtr PB);
FileFilterUPP gMyFileFilterUPP = NULL;
Boolean GetPythonSlaveSpec(FSSpec * docSpec) {
StandardFileReply reply;
SFTypeList typeList;
typeList[0] = 'TEXT';
//if (!gMyFileFilterUPP)
gMyFileFilterUPP = NewFileFilterProc( MyFileFilter );
StandardGetFile(gMyFileFilterUPP, 0, typeList, &reply);
DisposePtr((Ptr)gMyFileFilterUPP);
if(!reply.sfGood)
return 0; /* user cancelled */
docSpec->vRefNum = reply.sfFile.vRefNum;
docSpec->parID = reply.sfFile.parID;
BlockMove(reply.sfFile.name, docSpec->name, 64);
return 1;
}
pascal Boolean MyFileFilter(CInfoPBPtr PB) {
OSType fType; /* file type */
OSType fCreator; /* file creator */
fType =((HParmBlkPtr)PB)->fileParam.ioFlFndrInfo.fdType;
fCreator = ((HParmBlkPtr)PB)->fileParam.ioFlFndrInfo.fdCreator;
if (fType == 'TEXT' &&
fCreator == 'Pyth')
return 0;
return 1;
}
OSErr LaunchPythonSlave(FSSpec * docSpec) {
OSErr err;
FSSpec dirSpec;
AEAddressDesc finderAddress;
AppleEvent theEvent, theReply;
OSType finderSig = 'MACS';
AliasHandle DirAlias, FileAlias;
AEDesc fileList;
AEDesc aeDirDesc, listElem;
err = AECreateDesc(typeApplSignature, (Ptr)&finderSig, 4, &finderAddress);
if(err != noErr) return err;
err = AECreateAppleEvent('FNDR', 'sope', &finderAddress,
kAutoGenerateReturnID, kAnyTransactionID, &theEvent);
if(err != noErr) return err;
FSMakeFSSpec(docSpec->vRefNum, docSpec->parID, NULL, &dirSpec);
NewAlias(NULL, &dirSpec, &DirAlias);
NewAlias(NULL, docSpec, &FileAlias);
err = AECreateList(NULL, 0, 0, &fileList);
HLock((Handle)DirAlias);
AECreateDesc(typeAlias, (Ptr)*DirAlias, GetHandleSize((Handle)DirAlias), &aeDirDesc);
HUnlock((Handle)DirAlias);
if ((err = AEPutParamDesc(&theEvent, keyDirectObject, &aeDirDesc)) == noErr) {
AEDisposeDesc(&aeDirDesc);
HLock((Handle)FileAlias);
AECreateDesc(typeAlias, (Ptr)*FileAlias, GetHandleSize((Handle)FileAlias), &listElem);
HLock((Handle)FileAlias);
err = AEPutDesc(&fileList, 0, &listElem);
}
AEDisposeDesc(&listElem);
err = AEPutParamDesc(&theEvent, 'fsel', &fileList);
AEDisposeDesc(&fileList);
err = AESend(&theEvent, &theReply, kAENoReply+kAENeverInteract,
kAENormalPriority, kAEDefaultTimeout, 0L, 0L);
if(err != noErr) return err;
err = AEDisposeDesc(&theEvent);
if(err != noErr) return err;
err = AEDisposeDesc(&theReply);
return err;
}

View File

@ -1,104 +0,0 @@
/* BBPython
A simple menu command to send the contents of a window to the Python interpreter
copyright © 1996 Just van Rossum, Letterror: just@knoware.nl
All Rights Reserved
*/
#include "BBPy.h"
OSErr SendTextAsAE(ExternalCallbackBlock *callbacks, Ptr theText, long theSize, Str255 windowTitle)
{
OSErr err;
AEDesc theEvent;
AEAddressDesc theTarget;
AppleEvent theReply;
AEDesc theTextDesc;
AEDesc theNameDesc;
OSType pythonSig = 'Pyth';
FSSpec docSpec;
short itemHit;
long time;
EventRecord theDummyEvent;
/* initialize AE descriptor for python's signature */
err = AECreateDesc (typeApplSignature, &pythonSig, sizeof(OSType), &theTarget);
if(err != noErr) return err;
/* initialize AE descriptor for the title of our window */
err = AECreateDesc (typeChar, &windowTitle[1], windowTitle[0], &theNameDesc);
if(err != noErr) return err;
/* initialize AE descriptor for the content of our window */
err = AECreateDesc ('TEXT', theText, theSize, &theTextDesc);
if(err != noErr) return err;
/* initialize AppleEvent */
err = AECreateAppleEvent ('pyth', 'EXEC', &theTarget, kAutoGenerateReturnID, kAnyTransactionID, &theEvent);
if(err != noErr) return err;
/* add the content of our window to the AppleEvent */
err = AEPutParamDesc (&theEvent, keyDirectObject, &theTextDesc);
if(err != noErr) return err;
/* add the title of our window to the AppleEvent */
err = AEPutParamDesc (&theEvent, 'NAME', &theNameDesc);
if(err != noErr) return err;
/* send the AppleEvent */
err = AESend (&theEvent, &theReply, kAEWaitReply, kAEHighPriority, kNoTimeOut, NULL, NULL);
if(err == connectionInvalid) {
// launch PythonSlave.py
itemHit = Alert(128, NULL);
if(itemHit == 2) return noErr; /* user cancelled */
if( ! GetPythonSlaveSpec(&docSpec) )
return noErr; /* user cancelled */
err = LaunchPythonSlave(&docSpec);
if(err != noErr) return err;
} else if(err != noErr)
return err;
/* clean up */
err = AEDisposeDesc (&theTarget);
if(err != noErr) return err;
err = AEDisposeDesc (&theNameDesc);
if(err != noErr) return err;
err = AEDisposeDesc (&theTextDesc);
if(err != noErr) return err;
err = AEDisposeDesc (&theEvent);
if(err != noErr) return err;
err = AEDisposeDesc (&theReply);
if(err != noErr) return err;
/* everything is cool */
return noErr;
}
pascal void main(ExternalCallbackBlock *callbacks, WindowPtr theWindow)
{
long oldA4;
OSErr err;
Handle windowContents;
Str255 windowTitle;
//RememberA0(); /* Can't find header file for this. Seems to work anyway. */
oldA4 = SetUpA4();
GetWTitle(theWindow, windowTitle);
windowContents = callbacks->GetWindowContents(theWindow);
HLock(windowContents);
err = SendTextAsAE(callbacks, *windowContents, GetHandleSize(windowContents), windowTitle);
if(err != noErr) callbacks->ReportOSError(err);
HUnlock(windowContents);
RestoreA4(oldA4);
}

View File

@ -1,46 +0,0 @@
'''
A really quick and dirty hack to extend PixMapWrapper
They are mere copies of the toImage and fromImage methods.
Riccardo Trocca (rtrocca@libero.it)
'''
from PixMapWrapper import *
import Numeric
class ExtPixMapWrapper(PixMapWrapper):
def toNumeric(self):
data = self.tostring()[1:] + chr(0)
bounds = self.bounds
tmp=Numeric.fromstring(data,Numeric.UnsignedInt8)
#tmp.shape=(bounds[3]-bounds[1],bounds[2]-bounds[0],4)
tmp.shape=(bounds[2]-bounds[0],bounds[3]-bounds[1],4)
return Numeric.transpose(tmp,(1,0,2))
def fromNumeric(self,num):
s=num.shape
x=num.shape[1]
y=num.shape[0]
#bands=1 Greyscale image
#bands=3 RGB image
#bands=4 RGBA image
if len(s)==2:
bands=1
num=Numeric.resize(num,(y,x,1))
else:
bands=num.shape[2]
if bands==1:
num=Numeric.concatenate((num,num,num),2)
bands=3
if bands==3:
alpha=Numeric.ones((y,x))*255
alpha.shape=(y,x,1)
num=Numeric.concatenate((num,alpha),2)
data=chr(0)+Numeric.transpose(num,(1,0,2)).astype(Numeric.UnsignedInt8).tostring()
PixMapWrapper.fromstring(self,data,x,y)

View File

@ -1,277 +0,0 @@
'''
ImageMac.py by Trocca Riccardo (rtrocca@libero.it)
This module provides functions to display images and Numeric arrays
It provides two classes ImageMacWin e NumericMacWin and two simple methods showImage and
showNumeric.
They work like this:
showImage(Image,"optional window title",zoomFactor)
the same for showNumeric
zoomfactor (defaults to 1) allows to zoom in the image by a factor of 1x 2x 3x and so on
I did't try with a 0.5x or similar.
The windows don't provide a scrollbar or a resize box.
Probably a better solution (and more similar to the original implementation in PIL and NumPy)
would be to save a temp file is some suitable format and then make an application (through appleevents) to open it.
Good guesses should be GraphicConverter or PictureViewer.
However the classes ImageMacWin e NumericMacWin use an extended version of PixMapWrapper in order to
provide an image buffer and then blit it in the window.
Being one of my first experiences with Python I didn't use Exceptions to signal error conditions, sorry.
'''
import W
from Carbon import Qd
from ExtPixMapWrapper import *
from Numeric import *
import Image
import macfs
class ImageMacWin(W.Window):
def __init__(self,size=(300,300),title="ImageMacWin"):
self.pm=ExtPixMapWrapper()
self.empty=1
self.size=size
W.Window.__init__(self,size,title)
def Show(self,image,resize=0):
#print "format: ", image.format," size: ",image.size," mode: ",image.mode
#print "string len :",len(image.tostring())
self.pm.fromImage(image)
self.empty=0
if resize:
self.size=(image.size[0]*resize,image.size[1]*resize)
W.Window.do_resize(self,self.size[0],self.size[1],self.wid)
self.do_drawing()
def do_drawing(self):
#print "do_drawing"
self.SetPort()
Qd.RGBForeColor( (0,0,0) )
Qd.RGBBackColor((65535, 65535, 65535))
Qd.EraseRect((0,0,self.size[0],self.size[1]))
if not self.empty:
#print "should blit"
self.pm.blit(0,0,self.size[0],self.size[1])
def do_update(self,macoswindowid,event):
#print "update"
self.do_drawing()
class NumericMacWin(W.Window):
def __init__(self,size=(300,300),title="ImageMacWin"):
self.pm=ExtPixMapWrapper()
self.empty=1
self.size=size
W.Window.__init__(self,size,title)
def Show(self,num,resize=0):
#print "shape: ", num.shape
#print "string len :",len(num.tostring())
self.pm.fromNumeric(num)
self.empty=0
if resize:
self.size=(num.shape[1]*resize,num.shape[0]*resize)
W.Window.do_resize(self,self.size[0],self.size[1],self.wid)
self.do_drawing()
def do_drawing(self):
#print "do_drawing"
self.SetPort()
Qd.RGBForeColor( (0,0,0) )
Qd.RGBBackColor((65535, 65535, 65535))
Qd.EraseRect((0,0,self.size[0],self.size[1]))
if not self.empty:
#print "should blit"
self.pm.blit(0,0,self.size[0],self.size[1])
def do_update(self,macoswindowid,event):
#print "update"
self.do_drawing()
'''
Some utilities: convert an Image to a NumPy array and viceversa.
The Image2Numeric function doesn't make any color space conversion.
The Numeric2Image function returns an L or RGB or RGBA images depending on the shape of
the array:
(x,y) -> 'L'
(x,y,1) -> 'L'
(x,y,3) -> 'RGB'
(x,y,4) -> 'RGBA'
'''
def Image2Numeric(im):
tmp=fromstring(im.tostring(),UnsignedInt8)
if (im.mode=='RGB')|(im.mode=='YCbCr'):
bands=3
if (im.mode=='RGBA')|(im.mode=='CMYK'):
bands=4
if (im.mode=='L'):
bands=1
tmp.shape=(im.size[0],im.size[1],bands)
return transpose(tmp,(1,0,2))
def Numeric2Image(num):
#sometimes a monoband image's shape can be (x,y,1), other times just (x,y). Here w deal with both
if len(num.shape)==3:
bands=num.shape[2]
if bands==1:
mode='L'
elif bands==3:
mode='RGB'
else:
mode='RGBA'
return Image.fromstring(mode,(num.shape[1],num.shape[0]),transpose(num,(1,0,2)).astype(UnsignedInt8).tostring())
else:
return Image.fromstring('L',(num.shape[1],num.shape[0]),transpose(num).astype(UnsignedInt8).tostring())
def showImage(im,title="ImageWin",zoomFactor=1):
imw=ImageMacWin((300,200),title)
imw.open()
try:
imw.Show(im,zoomFactor )
except MemoryError,e:
imw.close()
print "ImageMac.showImage: Insufficient Memory"
def showNumeric(num,title="NumericWin",zoomFactor=1):
#im=Numeric2Image(num)
numw=NumericMacWin((300,200),title)
numw.open()
try:
numw.Show(num,zoomFactor )
except MemoryError:
numw.close()
print "ImageMac.showNumeric Insufficient Memory"
'''
GimmeImage pops up a file dialog and asks for an image file.
it returns a PIL image.
Optional argument: a string to be displayed by the dialog.
'''
def GimmeImage(prompt="Image File:"):
import macfs
fsspec, ok = macfs.PromptGetFile(prompt)
if ok:
path = fsspec.as_pathname()
return Image.open(path)
return None
'''
This is just some experimental stuff:
Filter3x3 a convolution filter (too slow use signal tools instead)
diffBWImage subtracts 2 images contained in NumPy arrays
averageN it computes the average of a list incrementally
BWImage converts an RGB or RGBA image (in a NumPy array) to BW
SplitBands splits the bands of an Image (inside a NumPy)
NumHisto and PlotHisto are some experiments to plot an intesity histogram
'''
def Filter3x3(mul,fi,num):
(a,b,c,d,e,f,g,h,i)=fi
print fi
num.shape=(num.shape[0],num.shape[1])
res=zeros(num.shape)
for x in range(1,num.shape[0]-1):
for y in range(1,num.shape[1]-1):
xb=x-1
xa=x+1
yb=y-1
ya=y+1
res[x,y]=int((a*num[xb,yb]+b*num[x,yb]+c*num[xa,yb]+d*num[xb,y]+e*num[x,y]+f*num[xa,y]+g*num[xb,ya]+h*num[x,ya]+i*num[xa,ya])/mul)
return res
def diffBWImage(num1,num2):
return 127+(num1-num2)/2
def averageN(N,avrg,new):
return ((N-1)*avrg+new)/N
def BWImage(num):
if num.shape[2]==3:
bw=array(((0.3086,0.6094,0.0820)))
else:
bw=array(((0.3086,0.6094,0.0820,0)))
res=innerproduct(num,bw)
res.shape=(res.shape[0],res.shape[1])
return res
def SplitBands(num):
x=num.shape[0]
y=num.shape[1]
if num.shape[2]==3:
return (reshape(num[:,:,0],(x,y)),reshape(num[:,:,1],(x,y)),reshape(num[:,:,2],(x,y)))
else:
return (reshape(num[:,:,0],(x,y)),reshape(num[:,:,1],(x,y)),reshape(num[:,:,2],(x,y)),reshape(num[:,:,3],(x,y)))
def NumHisto(datas):
#print "type(datas) ",type(datas)
a=ravel(datas)
n=searchsorted(sort(a),arange(0,256))
n=concatenate([n,[len(a)]])
return n[1:]-n[:-1]
def PlotHisto(datas,ratio=1):
from graphite import *
from MLab import max
h=NumHisto(datas)
#print "histo: ",h
#print "histo.shape: ",h.shape
maxval=max(h)
#print "maxval ",maxval
h.shape=(256,1)
x=arange(0,256)
x.shape=(256,1)
datah=concatenate([x,h],1)
print "data: "
print datah
g=Graph()
g.datasets.append(Dataset(datah))
f0=PointPlot()
f0.lineStyle = LineStyle(width=2, color=red, kind=SOLID)
g.formats = [f0]
g.axes[X].range = [0,255]
g.axes[X].tickMarks[0].spacing = 10
#g.axes[X].tickMarks[0].labels = "%d"
g.axes[Y].range = [0,maxval/ratio]
g.bottom = 370
g.top =10
g.left=10
g.right=590
genOutput(g,'QD',size=(600,400))
def test():
import MacOS
import Image
import ImageFilter
import Numeric
fsspec, ok = macfs.PromptGetFile("Image File:")
if ok:
path = fsspec.as_pathname()
im=Image.open(path)
#im2=im.filter(ImageFilter.SMOOTH)
showImage(im,"normal")
num=Image2Numeric(im)
#num=Numeric.transpose(num,(1,0,2))
showNumeric(num,"Numeric")
print "num.shape ",num.shape
showImage(Numeric2Image(num),"difficile")
#showImage(im.filter(ImageFilter.SMOOTH),"smooth")
#showImage(im.filter(ImageFilter.FIND_EDGES).filter(ImageFilter.SHARPEN),"detail")
print "here"
else:
print "did not open file"
if __name__ == '__main__':
test()

View File

@ -1,269 +0,0 @@
from Carbon import Qt
from Carbon import QuickTime
import macfs
from Carbon import Qd
from Carbon.QuickDraw import srcCopy
from ExtPixMapWrapper import ExtPixMapWrapper
from Carbon.Qdoffs import *
import ImageMac
import W
def GetFrames(m):
frameCount=0
theTime=0
type=QuickTime.VideoMediaType
#type='MPEG'
flags=QuickTime.nextTimeMediaSample
flags=flags+QuickTime.nextTimeEdgeOK
while theTime>=0:
(theTime,duration)=m.GetMovieNextInterestingTime(flags,1,type,theTime,0)
#print "theTime ",theTime," duration ",duration
frameCount=frameCount+1
flags = QuickTime.nextTimeMediaSample
return frameCount-1
def GetMovieFromOpenFile():
fss, ok = macfs.StandardGetFile(QuickTime.MovieFileType)
mov = None
if ok:
movieResRef = Qt.OpenMovieFile(fss, 1)
mov, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
return mov
class ExtMovie:
def __init__(self,mov):
self.frames=0
self.frameArray=[]
self.movie=mov
self._countFrames()
r=self.movie.GetMovieBox()
self.myRect=(0,0,r[2]-r[0],r[3]-r[1])
self.movie.SetMovieBox(self.myRect)
self.pm=ExtPixMapWrapper()
self.pm.left=0
self.pm.top=0
self.pm.right=r[2]-r[0]
self.pm.bottom=r[3]-r[1]
self.gw=NewGWorld(32,self.myRect,None,None,0)
self.movie.SetMovieGWorld(self.gw.as_GrafPtr(), self.gw.GetGWorldDevice())
self.GotoFrame(0)
def _countFrames(self):
#deve contare il numero di frame, creare un array con i tempi per ogni frame
theTime=0
#type=QuickTime.VIDEO_TYPE
type=QuickTime.VideoMediaType
flags=QuickTime.nextTimeMediaSample+QuickTime.nextTimeEdgeOK
while theTime>=0:
(theTime,duration)=self.movie.GetMovieNextInterestingTime(flags,1,type,theTime,0)
self.frameArray.append((theTime,duration))
flags = QuickTime.nextTimeMediaSample
self.frames=self.frames+1
def GotoFrame(self,n):
if n<=self.frames:
self.curFrame=n
(port,device)=GetGWorld()
SetGWorld(self.gw.as_GrafPtr(),None)
(self.now,self.duration)=self.frameArray[n]
self.movie.SetMovieTimeValue(self.now)
pixmap=self.gw.GetGWorldPixMap()
if not LockPixels(pixmap):
print "not locked"
else:
#Qd.EraseRect(self.myRect)
#this draws the frame inside the current gworld
self.movie.MoviesTask(0)
#this puts it in the buffer pixmap
self.pm.grab(0,0,self.myRect[2],self.myRect[3])
UnlockPixels(pixmap)
#self.im=self.pm.toImage()
SetGWorld(port,device)
def NextFrame(self):
self.curFrame=self.curFrame+1
if self.curFrame>self.frames:
self.curFrame=0
self.GotoFrame(self.curFrame)
def isLastFrame():
return self.curFrame==self.frames
def GetImage(self):
return self.pm.toImage()
def GetImageN(self,n):
self.GotoFrame(n)
return self.pm.toImage()
def GetNumeric(self):
return self.pm.toNumeric()
def GetNumericN(self,n):
self.GotoFrame(n)
return self.pm.toNumeric()
def Blit(self,destRect):
Qd.RGBForeColor( (0,0,0) )
Qd.RGBBackColor((65535, 65535, 65535))
#Qd.MoveTo(10,10)
#Qd.LineTo(200,150)
Qd.CopyBits(self.gw.GetPortBitMapForCopyBits(),Qd.GetPort().GetPortBitMapForCopyBits(),self.myRect,destRect,srcCopy,None)
class MovieWin(W.Window):
def __init__(self,eMovie,title="MovieWin"):
self.ExtMovie=eMovie
def test():
import ImageFilter
from MLab import max
from MLab import min
from Numeric import *
Qt.EnterMovies()
m=GetMovieFromOpenFile()
em=ExtMovie(m)
print "Total frames:",em.frames," Current frame:",em.curFrame
#ImageMac.showImage(em.GetImage(),"frame 0",1)
#em.GotoFrame(500)
#ImageMac.showImage(em.GetImage().filter(ImageFilter.SMOOTH),"frame 500",2)
#ImageMac.showImage(em.GetImageN(1000),"frame 1000",2)
#r=array(((1,0,0,0),(0,0,0,0),(0,0,0,0),(0,0,0,0)))
#g=array(((0,0,0,0),(0,1,0,0),(0,0,0,0),(0,0,0,0)))
#b=array(((0,0,0,0),(0,0,0,0),(0,0,1,0),(0,0,0,0)))
#bw=array(((0.3086,0.6094,0.0820,0)))
#r2=array(((1,0,0,0)))
#ImageMac.showNumeric(em.GetNumericN(0),"frame 0",1)
#print em.GetNumericN(500).shape
#print "original (1,1)",em.GetNumericN(0)[100,100]
#print "product shape ",innerproduct(em.GetNumericN(0),r).shape
#print "product (1,1) ",innerproduct(em.GetNumericN(0),r)[100,100]
#ImageMac.showNumeric(ImageMac.BWImage(em.GetNumericN(50)))
#ImageMac.showNumeric(innerproduct(em.GetNumericN(500),r),"frame 500r",2)
#ImageMac.showNumeric(innerproduct(em.GetNumericN(500),g),"frame 500g",2)
#ImageMac.showNumeric(innerproduct(em.GetNumericN(500),b),"frame 500b",2)
#ImageMac.showNumeric(innerproduct(em.GetNumericN(500),r2),"frame 500r2",2)
#ImageMac.showNumeric(innerproduct(em.GetNumericN(10),bw),"frame 0bw",1)
#ImageMac.showNumeric(innerproduct(em.GetNumericN(400),bw),"frame 10bw",1)
#colordif=(em.GetNumericN(100)-em.GetNumericN(10))+(255,255,255,255)
#colordif=colordif/2
#ImageMac.showNumeric(colordif,"colordif",1)
#ImageMac.showNumeric(ImageMac.BWImage(colordif),"bwcolordif",1)
ilut=arange(0,256)
#ilut[118]=255
#ilut[119]=255
#ilut[120]=255
ilut[121]=255
ilut[122]=255
ilut[123]=255
ilut[124]=255
ilut[125]=255
ilut[126]=255
ilut[127]=255
ilut[128]=255
ilut[129]=255
#ilut[130]=255
#ilut[131]=255
#ilut[132]=255
mlut=ones(256)
mlut[118]=0
mlut[119]=0
mlut[120]=0
mlut[121]=0
mlut[122]=0
mlut[123]=0
mlut[124]=0
mlut[125]=0
mlut[126]=0
mlut[127]=0
mlut[128]=0
mlut[129]=0
mlut[130]=0
mlut[131]=0
mlut[132]=0
ImageMac.showImage(em.GetImageN(100),"provaImg",2)
ImageMac.showNumeric(em.GetNumericN(100),"provaNum",2)
ImageMac.showImage(em.GetImageN(100).filter(ImageFilter.SMOOTH),"frame 500",2)
#image=ImageMac.BWImage(em.GetNumericN(100))
#ImageMac.showNumeric(image)
#difimage=abs(image-ImageMac.BWImage(em.GetNumericN(10)))
#ImageMac.PlotHisto(difimage,32)
#ImageMac.showNumeric(difimage)
#difimage=127+(image-ImageMac.BWImage(em.GetNumericN(10)))/2
#ImageMac.PlotHisto(difimage,32)
#ImageMac.showNumeric(difimage)
#fimage=ImageMac.Filter3x3(16.0,(1,1,1,1,8,1,1,1,1),difimage)
#ImageMac.showNumeric(fimage)
#difimage2=choose(fimage.astype(UnsignedInt8),ilut)
#ImageMac.showNumeric(difimage2)
#(r,g,b,a)=ImageMac.SplitBands(em.GetNumericN(10))
#ImageMac.showNumeric(r,"r")
#ImageMac.showNumeric(g,"g")
#ImageMac.showNumeric(b,"b")
#ImageMac.showNumeric(a,"a")
#bwdif=abs(((innerproduct(em.GetNumericN(400),bw)-innerproduct(em.GetNumericN(10),bw))+255)/2)
#ImageMac.showNumeric(bwdif,"frame diff/bw",1)
#ImageMac.PlotHisto(bwdif)
#ImageMac.showNumeric(choose(bwdif.astype(UnsignedInt8),ilut),"frame diff/bw",1)
#ImageMac.PlotHisto(choose(bwdif.astype(UnsignedInt8),ilut))
#bwimage=ImageMac.BWImage(em.GetNumericN(100))
#ImageMac.showNumeric((ImageMac.BWImage(em.GetNumericN(90))+ImageMac.BWImage(em.GetNumericN(110))+ImageMac.BWImage(em.GetNumericN(130))+ImageMac.BWImage(em.GetNumericN(150))+ImageMac.BWImage(em.GetNumericN(170)))/5)
#bwdif=abs(((bwimage-ImageMac.BWImage(em.GetNumericN(10)))+255)/2)
#ImageMac.showNumeric(bwimage,"original frame",1)
#ImageMac.showNumeric(bwdif,"frame diff/bw",1)
#ImageMac.PlotHisto(bwdif)
#ImageMac.showNumeric(choose(bwdif.astype(UnsignedInt8),ilut),"frame diff/bw",1)
#mmask=choose(bwdif.astype(UnsignedInt8),mlut)
#ImageMac.showNumeric(255-255*mmask,"frame diff/bw",1)
#mmask.shape=bwimage.shape
#ImageMac.showNumeric(mmask*bwimage,"frame diff/bw",1)
#ImageMac.showNumeric((innerproduct(em.GetNumericN(300),bw)-innerproduct(em.GetNumericN(0),bw)),"frame diff/bw",1)
#ImageMac.showNumeric((innerproduct(em.GetNumericN(400)-em.GetNumericN(10),bw)),"frame diff2/bw",1)
#cdif=em.GetNumericN(400)-em.GetNumericN(10)
#ImageMac.showNumeric(,"frame diff2/bw",1)
#ImageMac.showNumeric(innerproduct(cdif,r),"frame 500r",1)
#ImageMac.showNumeric(innerproduct(cdif,g),"frame 500g",1)
#ImageMac.showNumeric(innerproduct(cdif,b),"frame 500b",1)
def test2():
Qt.EnterMovies()
m=GetMovieFromOpenFile()
if m==None:
print "no movie opened"
else:
em=ExtMovie(m)
print "Total frames: ",em.frames," Current frame:",em.curFrame
ImageMac.showImage(em.GetImage(),"frame 0",1)
if __name__ == '__main__':
test2()

View File

@ -1,22 +0,0 @@
ExtPixMapWrapper.py
ImageMac.py
Hello these are the classes to deal with Images and NumPy arrays I told
you about. I left everything unchanged, it is the same copy I use with
comments added. However I think that in ImageMac the only part worth including
in MacPython (if you think it is worth), is the first half, until GimmeImage.
After that it is almost rubbish I used in my CV experiments.
MovieUtils.py
This is another class I use. IT contais a lot of my experiments (unuseful), but
the first function GetFrames(). it is almost the translation of a QT sample.
GetMovieFromOpenFile() it is the usual shortcut to get a movie. (no error tracking
done).
The class ExtMovie requires a movie in the constructor and then
provides a method to take every single frame and convert it to an
Image or a NUmPy array.
If you think that it can be included in the qt examples I'll write comments and
polish it a bit. (exceptions handling)
Riccardo Trocca
P.S. Everything works with 2.0b1

View File

@ -1,60 +0,0 @@
========================================================================
Copyright (c) 1999 Bill Bedford
========================================================================
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that the copyright notice and warranty disclaimer appear in
supporting documentation.
Bill Bedford disclaims all warranties with regard to this software,
including all implied warranties of merchantability and fitness. In
no event shall Bill Bedford be liable for any special, indirect or
consequential damages or any damages whatsoever resulting from loss of
use, data or profits, whether in an action of contract, negligence or
other tortuous action, arising out of or in connection with the use or
performance of this software.
========================================================================
PythonDetectors is a set of Apple Data Detectors that will open an entry in
the Python Library from a keyword in contextual menus. It looks up either
module name and open the relevant page or looks up a built in function and
opens at the entry in the Builtin functions page.
If anyone would like more functionality please contact me.
To use it you must have Apple Data Detectors 1.0.2 installed This can be
obtained from http://www.apple.com/applescript/data_detectors/
Two action files are provided "OpenPythonLib" will open the library file
with whatever application is defined as the Internet Config 'file' helper.
"OpenPythonLib with NS" opens the library file with Netscape.
Instructions
============
1/ Open the two apple script files with the Script Editor and change the
first compiled line to point to the location of your Python Library
folder.
2/ Open the Apple Data Detectors Control Panel and choose Install Detector
File... from the File menu.
3/ Pick a Detector file from the dialog.
4/ Let the Data Detectors Control Panel optimize the detector.
5/ Choose Install Action File... from the File menu.
6/ Pick an action file from the dialog.
7/ The Data Detectors Control Panel will automatically place the new action
with its detector. You can click on the action in the control panel window
to view information about its use.
Gotchas
=======
Unfortunately ADD only works with the US keyboard installed.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,14 +0,0 @@
These items are plugins for Sherlock, the MacOS 8.5 all-singing-all-dancing
"find file" program. Drop them on your closed system folder and they will
automatically be put in the right location. They will even automatically warn
you when new versions become available!
The "Python" plugin searches the website, the ftp site and the startship site.
The "Python-FAQ" plugin searches the FAQ.
In case the file creator/type of these files was damaged in transit: to work they
need to be creator "fndf", type "issp".
Jack Jansen, CWI, 25-Jan-98
http://www.cwi.nl/~jack/macpython.html

View File

@ -1,41 +0,0 @@
Original README for Tabcleaner.py
tabcleaner.py is a utility that reformats leading whitespace in a Python source.
It uses tokenize.py (from the std distribution) to detect INDENTs and DEDENTs,
then reformats according to the user's options (tabs-only, spaces-only with
indent size n, or mixed with tab worth m and indent level of n).
Python does not care about the indent of comments and multi-linestrings.
tabcleaner places these at what Python considers the current indentlevel. About
half the time, this is correct; the rest of the time it is probably one indent
level less than what was desired. It is pretty much guaranteed to be
syntactically correct, (earlier versions broke on some triple-quoted strings).
With no args, (or "-h") prints usage text.
Contact: gmcm@hypernet.com
Additional comments: I have made a few slight changes. It was written to take
command line arguments, so that you can set parameters like the size of indents,
and whether you want the result to be all tabs, or all spaces, or a mixture of
both (an evil combination, if you ask me). It is set, be default, to change your
indentation to all tabs.
In the current version of Python, all the code in the standard library is
indented with only spaces. This is a somewhat awkward standard on the mac, so
most MacPython code is indented with only tabs. This script can be used to do any
version, but all tabs is the default, which seems to be the best option for the
Mac.
How to use it on a Mac:
The script is set up to take filenames (or directory names) on the command line.
To simulate this behaviour with MacPython, you can build an applet out of it
(with BuildApplet, which should be in your Python folder). Any files draggged and
dropped onto the resulting applet will be converted to all tabs, with a backup
copy havning been saved.
If you want the script to convert to space based indentation, your best bet is
probably to change the default on line 46 of the file.
-Chris Barker cbarker@jps.net

View File

@ -1,160 +0,0 @@
#!/usr/bin/python
import tokenize
import string
TABSONLY = 'TABSONLY'
SPACESONLY = 'SPACESONLY'
MIXED = 'MIXED'
class PyText:
def __init__(self, fnm, optdict):
self.optdict = optdict
self.fnm = fnm
self.txt = open(self.fnm, 'r').readlines()
self.indents = [(0, 0, )]
self.lnndx = 0
self.indentndx = 0
def getline(self):
if self.lnndx < len(self.txt):
txt = self.txt[self.lnndx]
self.lnndx = self.lnndx + 1
else:
txt = ''
return txt
def tokeneater(self, type, token, start, end, line):
if type == tokenize.INDENT:
(lvl, s) = self.indents[-1]
self.indents[-1] = (lvl, s, start[0]-1)
self.indents.append((lvl+1, start[0]-1,))
elif type == tokenize.DEDENT:
(lvl, s) = self.indents[-1]
self.indents[-1] = (lvl, s, start[0]-1)
self.indents.append((lvl-1, start[0]-1,))
elif type == tokenize.ENDMARKER:
(lvl, s) = self.indents[-1]
self.indents[-1] = (lvl, s, len(self.txt))
def split(self, ln):
content = string.lstrip(ln)
if not content:
return ('', '\n')
lead = ln[:len(ln) - len(content)]
lead = string.expandtabs(lead)
return (lead, content)
def process(self):
style = self.optdict.get('style', TABSONLY)
indent = string.atoi(self.optdict.get('indent', '4'))
tabsz = string.atoi(self.optdict.get('tabs', '8'))
print 'file %s -> style %s, tabsize %d, indent %d' % (self.fnm, style, tabsz, indent)
tokenize.tokenize(self.getline, self.tokeneater)
#import pprint
#pprint.pprint(self.indents)
new = []
for (lvl, s, e) in self.indents:
if s >= len(self.txt):
break
if s == e:
continue
oldlead, content = self.split(self.txt[s])
#print "oldlead", len(oldlead), `oldlead`
if style == TABSONLY:
newlead = '\t'*lvl
elif style == SPACESONLY:
newlead = ' '*(indent*lvl)
else:
sz = indent*lvl
t,spcs = divmod(sz, tabsz)
newlead = '\t'*t + ' '*spcs
new.append(newlead + content)
for ln in self.txt[s+1:e]:
lead, content = self.split(ln)
#print "lead:", len(lead)
new.append(newlead + lead[len(oldlead):] + content)
self.save(new)
#print "---", self.fnm
#for ln in new:
# print ln,
#print
def save(self, txt):
bakname = os.path.splitext(self.fnm)[0]+'.bak'
print "backing up", self.fnm, "to", bakname
#print os.getcwd()
try:
os.rename(self.fnm, bakname)
except os.error:
os.remove(bakname)
os.rename(self.fnm, bakname)
open(self.fnm, 'w').writelines(txt)
def test():
tc = PyText('test1.py')
tc.process()
tc = PyText('test1.py')
tc.process(style=TABSONLY)
tc = PyText('test1.py')
tc.process(style=MIXED, indent=4, tabs=8)
tc = PyText('test1.py')
tc.process(style=MIXED, indent=2, tabs=8)
def cleanfile(fnm, d):
if os.path.isdir(fnm) and not os.path.islink(fnm):
names = os.listdir(fnm)
for name in names:
fullnm = os.path.join(fnm, name)
if (os.path.isdir(fullnm) and not os.path.islink(fullnm)) or \
os.path.normcase(fullnm[-3:]) == ".py":
cleanfile(fullnm, d)
return
tc = PyText(fnm, d)
tc.process()
usage="""\
%s [options] [path...]
options
-T : reformat to TABS ONLY
-S : reformat to SPACES ONLY ( -i option is important)
-M : reformat to MIXED SPACES / TABS ( -t and -i options important)
-t<n> : tab is worth <n> characters
-i<n> : indents should be <n> characters
-h : print this text
path is file or directory
"""
if __name__ == '__main__':
import sys, getopt, os
opts, args = getopt.getopt(sys.argv[1:], "TSMht:i:")
d = {}
print `opts`
for opt in opts:
if opt[0] == '-T':
d['style'] = TABSONLY
elif opt[0] == '-S':
d['style'] = SPACESONLY
elif opt[0] == '-M':
d['style'] = MIXED
elif opt[0] == '-t':
d['tabs'] = opt[1]
elif opt[0] == '-i':
d['indent'] = opt[1]
elif opt[0] == '-h':
print usage % sys.argv[0]
sys.exit(0)
if not args:
print usage % sys.argv[0]
for arg in args:
cleanfile(arg, d)

View File

@ -1,67 +0,0 @@
"""mpwsystem -
A simple example of how to use Apple Events to implement a "system()"
call that invokes ToolServer on the command.
Contributed by Daniel Brotsky <dev@brotsky.com>.
(renamed from aesystem to mpwsystem by Jack)
system(cmd, infile = None, outfile = None, errfile = None)
1. Every call to system sets "lastStatus" and "lastOutput" to the
status and output
produced by the command when executed in ToolServer. (lastParameters
and lastAttributes
are set to the values of the AppleEvent result.)
2. system returns lastStatus unless the command result indicates a MacOS error,
in which case os.Error is raised with the errnum as associated value.
3. You can specify ToolServer-understandable pathnames for
redirection of input,
output, and error streams. By default, input is Dev:Null, output is captured
and returned to the caller, diagnostics are captured and returned to
the caller.
(There's a 64K limit to how much can be captured and returned this way.)"""
import os
import aetools
try: server
except NameError: server = aetools.TalkTo("MPSX", 1)
lastStatus = None
lastOutput = None
lastErrorOutput = None
lastScript = None
lastEvent = None
lastReply = None
lastParameters = None
lastAttributes = None
def system(cmd, infile = None, outfile = None, errfile = None):
global lastStatus, lastOutput, lastErrorOutput
global lastScript, lastEvent, lastReply, lastParameters, lastAttributes
cmdline = cmd
if infile: cmdline += " <" + infile
if outfile: cmdline += " >" + outfile
if errfile: cmdline += " " + str(chr(179)) + errfile
lastScript = "set Exit 0\r" + cmdline + "\rexit {Status}"
lastEvent = server.newevent("misc", "dosc", {"----" : lastScript})
(lastReply, lastParameters, lastAttributes) = server.sendevent(lastEvent)
if lastParameters.has_key('stat'): lastStatus = lastParameters['stat']
else: lastStatus = None
if lastParameters.has_key('----'): lastOutput = lastParameters['----']
else: lastOutput = None
if lastParameters.has_key('diag'): lastErrorOutput = lastParameters['diag']
else: lastErrorOutput = None
if lastParameters['errn'] != 0:
raise os.Error, lastParameters['errn']
return lastStatus
if __name__ == '__main__':
sts = system('alert "Hello World"')
print 'system returned', sts

View File

@ -1,277 +0,0 @@
/*
*
* This is a simple module to allow the
* user to compile and execute an applescript
* which is passed in as a text item.
*
* Sean Hummel <seanh@prognet.com>
* 1/20/98
* RealNetworks
*
* Jay Painter <jpaint@serv.net> <jpaint@gimp.org> <jpaint@real.com>
*
*
*/
#include "OSAm.h"
#include "ScriptRunner.h"
#include <AppleEvents.h>
/*
* Boiler plate generated from "genmodule.py"
*/
static PyObject *ErrorObject;
static char OSAm_DoCommand__doc__[] = "";
static PyObject *
OSAm_RunCompiledScript (self, args)
PyObject *self;
PyObject *args;
{
char *commandStr = NULL;
char *outpath = NULL;
OSErr myErr;
AEDesc temp;
EventRecord event;
temp.dataHandle = NULL;
if (!PyArg_ParseTuple (args, "s", &commandStr))
return NULL;
myErr = ExecuteScriptFile (commandStr, NULL, &temp);
if (temp.dataHandle != NULL && temp.descriptorType == 'TEXT')
{
char *line;
DescType typeCode;
long dataSize = 0;
OSErr err;
dataSize = AEGetDescDataSize (&temp);
if (dataSize > 0)
{
PyObject *result = PyString_FromStringAndSize (NULL,
dataSize);
if (!result)
{
printf ("OSAm.error Out of memory.\n");
Py_INCREF (Py_None);
AEDisposeDesc (&temp);
return Py_None;
}
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
{
AEDisposeDesc(&temp);
return PyMac_Error(err);
}
AEDisposeDesc(&temp);
return result;
}
}
if (myErr != noErr)
{
PyErr_Mac (ErrorObject, myErr);
return NULL;
}
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
OSAm_CompileAndSave (self, args)
PyObject *self;
PyObject *args;
{
char *commandStr = NULL;
char *outpath = NULL;
OSErr myErr;
AEDesc temp;
EventRecord event;
temp.dataHandle = NULL;
if (!PyArg_ParseTuple (args, "ss", &commandStr, &outpath))
return NULL;
myErr = CompileAndSave (commandStr, outpath, NULL, &temp);
if (temp.dataHandle != NULL && temp.descriptorType == 'TEXT')
{
char *line;
DescType typeCode;
long dataSize = 0;
OSErr err;
dataSize = AEGetDescDataSize (&temp);
if (dataSize > 0)
{
PyObject *result = PyString_FromStringAndSize (NULL,
dataSize);
if (!result)
{
printf ("OSAm.error Out of memory.\n");
Py_INCREF (Py_None);
AEDisposeDesc (&temp);
return Py_None;
}
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
{
AEDisposeDesc(&temp);
return PyMac_Error(err);
}
AEDisposeDesc(&temp);
return result;
}
}
if (myErr != noErr)
{
PyErr_Mac (ErrorObject, myErr);
return NULL;
}
Py_INCREF (Py_None);
return Py_None;
}
static PyObject *
OSAm_CompileAndExecute (self, args)
PyObject *self;
PyObject *args;
{
char *commandStr;
OSErr myErr;
AEDesc temp;
EventRecord event;
temp.dataHandle = NULL;
if (!PyArg_ParseTuple (args, "s", &commandStr))
return NULL;
myErr = CompileAndExecute (commandStr, &temp, NULL);
if (temp.dataHandle != NULL && temp.descriptorType == 'TEXT')
{
char *line;
DescType typeCode;
long dataSize = 0;
OSErr err;
dataSize = AEGetDescDataSize (&temp);
if (dataSize > 0)
{
PyObject *result = PyString_FromStringAndSize (NULL,
dataSize);
if (!result)
{
printf ("OSAm.error Out of memory.\n");
Py_INCREF (Py_None);
AEDisposeDesc (&temp);
return Py_None;
}
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
{
AEDisposeDesc(&temp);
return PyMac_Error(err);
}
AEDisposeDesc(&temp);
return result;
}
}
if (myErr != noErr)
{
PyErr_Mac (ErrorObject, myErr);
return NULL;
}
Py_INCREF (Py_None);
return Py_None;
}
/*
* List of methods defined in the module
*/
static struct PyMethodDef OSAm_methods[] =
{
{"CompileAndExecute",
(PyCFunction) OSAm_CompileAndExecute,
METH_VARARGS,
OSAm_DoCommand__doc__},
#if 0
{"CompileAndSave",
(PyCFunction) OSAm_CompileAndSave,
METH_VARARGS,
OSAm_DoCommand__doc__},
{"RunCompiledScript",
(PyCFunction) OSAm_RunCompiledScript,
METH_VARARGS,
OSAm_DoCommand__doc__},
#endif
{NULL, (PyCFunction) NULL, 0, NULL}
};
static char OSAm_module_documentation[] = "";
/*
* PYTHON Module Initalization
*/
void
initOSAm ()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4 ("OSAm",
OSAm_methods,
OSAm_module_documentation,
(PyObject *) NULL, PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict (m);
ErrorObject = PyString_FromString ("OSAm.error");
PyDict_SetItemString (d, "error", ErrorObject);
/* Check for errors */
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module OSAm");
}

View File

@ -1 +0,0 @@
initOSAm

View File

@ -1,30 +0,0 @@
/*
*
* This is a simple module to allow the
* user to compile and execute an applescript
* which is passed in as a text item.
*
* Sean Hummel <seanh@prognet.com>
* 1/20/98
* RealNetworks
*
* Jay Painter <jpaint@serv.net> <jpaint@gimp.org> <jpaint@real.com>
*
*
*/
#pragma once
/* Python API */
#include "Python.h"
#include "macglue.h"
/* Macintosh API */
#include <Types.h>
#include <AppleEvents.h>
#include <Processes.h>
#include <Files.h>
#include <Gestalt.h>
#include <Events.h>

Binary file not shown.

View File

@ -1,310 +0,0 @@
/*
*
* This is a simple module to allow the
* user to compile and execute an applescript
* which is passed in as a text item.
*
* Sean Hummel <seanh@prognet.com>
* 1/20/98
* RealNetworks
*
* Jay Painter <jpaint@serv.net> <jpaint@gimp.org> <jpaint@real.com>
*
*
*/
#include <Resources.h>
#include <Files.h>
#include <OSA.h>
#include <string.h>
#include "ScriptRunner.h"
#include <script.h>
#include <resources.h>
#ifdef TARGET_API_MAC_CARBON
static
p2cstr(StringPtr p)
{
unsigned char *c = p;
int len = c[0];
strncpy((char *)c+1, (char *)c, len);
c[len] = 0;
}
static c2pstr(const char *cc)
{
char *c = (char *)cc; /* Ouch */
int len = strlen(c);
if ( len > 255 ) len = 255;
strncpy(c, c+1, len);
c[0] = len;
}
#endif
OSAError LoadScriptingComponent (ComponentInstance * scriptingComponent);
#if 0
/*
* store the script as a compile script so that OSA
* components may load and execute the script easily
*/
OSAError
CompileAndSave (const char *text,
const char *outfile,
OSAActiveUPP proc,
AEDesc * result)
{
OSAError err2 = 0;
AEDesc theScript;
OSAID compiledScriptID = 0;
ComponentInstance scriptingComponent;
FSSpec outfilespec;
AEDesc theCompiledScript;
OSAID scriptid = kOSANullScript;
short saveres = 0;
/* Initialize theScript here because it is a struct */
theScript.dataHandle = NULL;
theCompiledScript.dataHandle = NULL;
/* open the component manager */
err2 = LoadScriptingComponent (&scriptingComponent);
if (err2)
return err2; /* <<< Fail quietly?? */
/* construct the AppleEvent Descriptor to contain the text of script */
AECreateDesc ('TEXT', text, strlen (text), &theScript);
err2 = OSACompile (scriptingComponent,
&theScript,
kOSAModeCompileIntoContext,
&scriptid);
if (err2)
{
OSAScriptError (scriptingComponent, kOSAErrorMessage, 'TEXT', result);
goto CleanUp;
}
err2 = OSAStore (scriptingComponent,
scriptid,
typeOSAGenericStorage,
kOSAModeCompileIntoContext,
&theCompiledScript);
if (err2)
{
OSAScriptError (scriptingComponent, kOSAErrorMessage, 'TEXT', result);
goto CleanUp;
}
c2pstr (outfile);
FSMakeFSSpec (0, 0, (StringPtr) outfile, &outfilespec);
p2cstr ((StringPtr) outfile);
FSpDelete (&outfilespec);
FSpCreateResFile (&outfilespec, 'ToyS', 'osas', smRoman);
saveres = CurResFile ();
if (saveres)
{
short myres = 0;
myres = FSpOpenResFile (&outfilespec, fsWrPerm);
UseResFile (myres);
AddResource (theCompiledScript.dataHandle, 'scpt', 128, "\p");
CloseResFile (myres);
UseResFile (saveres);
}
CleanUp:
if (theScript.dataHandle)
AEDisposeDesc (&theScript);
if (theCompiledScript.dataHandle)
AEDisposeDesc (&theCompiledScript);
if (scriptid)
OSADispose (scriptingComponent, scriptid);
if (scriptingComponent != 0)
CloseComponent (scriptingComponent);
return err2;
}
#endif
OSAError
CompileAndExecute (const char *text,
AEDesc * result,
OSAActiveUPP proc)
{
OSAError err2 = 0;
AEDesc theScript;
OSAID compiledScriptID = 0;
ComponentInstance scriptingComponent;
/* initialize theScript here because it is a struct */
theScript.dataHandle = NULL;
/* Open the component manager */
err2 = LoadScriptingComponent (&scriptingComponent);
if (err2)
return err2; /* <<< Fail quietly?? */
/* construct the AppleEvent Descriptor to contain the text of script */
AECreateDesc ('TEXT', text, strlen (text), &theScript);
err2 = OSASetActiveProc (scriptingComponent, proc, NULL);
if (err2)
goto CleanUp;
err2 = OSADoScript (scriptingComponent, &theScript, kOSANullScript, 'TEXT', 0, result);
if (err2)
{
OSAScriptError (scriptingComponent, kOSAErrorMessage, 'TEXT', result);
goto CleanUp;
}
CleanUp:
if (theScript.dataHandle)
AEDisposeDesc (&theScript);
if (scriptingComponent != 0)
CloseComponent (scriptingComponent);
return err2;
}
#if 0
/*
* This routine reads in a saved script file and executes
* the script contained within (from a 'scpt' resource.)
*/
OSAError
ExecuteScriptFile (const char *theFilePath,
OSAActiveUPP proc,
AEDesc * result)
{
OSAError err2;
short resRefCon;
AEDesc theScript;
OSAID compiledScriptID, scriptResultID;
ComponentInstance scriptingComponent;
FSSpec theFile;
c2pstr (theFilePath);
FSMakeFSSpec (0, 0, (StringPtr) theFilePath, &theFile);
p2cstr ((StringPtr) theFilePath);
/* open a connection to the OSA */
err2 = LoadScriptingComponent (&scriptingComponent);
if (err2)
return err2; /* <<< Fail quietly?? */
err2 = OSASetActiveProc (scriptingComponent, proc, NULL);
if (err2)
goto error;
/* now, try and read in the script
* Open the script file and get the resource
*/
resRefCon = FSpOpenResFile (&theFile, fsRdPerm);
if (resRefCon == -1)
return ResError ();
theScript.dataHandle = Get1IndResource (typeOSAGenericStorage, 1);
if ((err2 = ResError ()) || (err2 = resNotFound, theScript.dataHandle == NULL))
{
CloseResFile (resRefCon);
return err2;
}
theScript.descriptorType = typeOSAGenericStorage;
DetachResource (theScript.dataHandle);
CloseResFile (resRefCon);
err2 = noErr;
/* give a copy of the script to AppleScript */
err2 = OSALoad (scriptingComponent,
&theScript,
0L,
&compiledScriptID);
if (err2)
goto error;
AEDisposeDesc (&theScript);
theScript.dataHandle = NULL;
err2 = OSAExecute (scriptingComponent,
compiledScriptID,
kOSANullScript,
0,
&scriptResultID);
if (compiledScriptID)
OSAScriptError (scriptingComponent, kOSAErrorMessage, 'TEXT', result);
if (err2)
goto error;
/* If there was an error, return it. If there was a result, return it. */
(void) OSADispose (scriptingComponent, compiledScriptID);
if (err2)
goto error;
else
goto done;
error:
if (theScript.dataHandle)
AEDisposeDesc (&theScript);
done:
return err2;
}
#endif
OSAError
LoadScriptingComponent (ComponentInstance * scriptingComponent)
{
OSAError err2;
/* Open a connection to the Open Scripting Architecture */
*scriptingComponent = OpenDefaultComponent (kOSAComponentType,
kOSAGenericScriptingComponentSubtype);
err2 = GetComponentInstanceError (*scriptingComponent);
return err2;
}

View File

@ -1,30 +0,0 @@
/*
*
* This is a simple module to allow the
* user to compile and execute an applescript
* which is passed in as a text item.
*
* Sean Hummel <seanh@prognet.com>
* 1/20/98
* RealNetworks
*
* Jay Painter <jpaint@serv.net> <jpaint@gimp.org> <jpaint@real.com>
*
*
*/
#pragma once
#include <OSA.h>
OSAError CompileAndExecute (const char *text,
AEDesc *result,
OSAActiveUPP proc);
OSAError CompileAndSave (const char *text,
const char *outfile,
OSAActiveUPP proc,
AEDesc *result);
OSAError ExecuteScriptFile (const char *theFile,
OSAActiveUPP proc,
AEDesc *result);

View File

@ -1,37 +0,0 @@
* Data
*.CFM68K.slb
*.Lib
*.MAP
*.SYM
*.c
*.cp
*.cpp
*.dbg
*.dsp
*.h
*.hqx
*.idb
*.jack
*.lib
*.mcp
*.mcp.exp
*.mcp.xml
*.orig
*.prj
*.prj.exp
*.pyc
*.pyo
*.xSYM
*.µ
*.µ.exp
*Icon
*xMAP
*~[0-9]
.#*
.DS_Store
.cvsignore
@*
CVS
Makefile*
Setup.in
[(]*[)]

View File

@ -1,207 +0,0 @@
(':.DS_Store', None)
(':BeOS', None)
(':BuildApplet', None)
(':BuildApplication', None)
(':ConfigurePython', '')
(':Demo', '')
(':Demo:cwilib', None)
(':Demo:embed', None)
(':Demo:extend', None)
(':Demo:ibrowse', None)
(':Demo:pysvr', None)
(':Demo:stdwin', None)
(':Demo:www', None)
(':Doc', None)
(':EditPythonPrefs', None)
(':Extensions:4Suite-0.9.2', None)
(':Extensions:Icon', None)
(':Extensions:Imaging', '')
(':Extensions:Imaging:Tk', None)
(':Extensions:Imaging:libImaging', None)
(':Extensions:Numerical', None)
(':Extensions:Numerical-old', None)
(':Extensions:Pmw', None)
(':Extensions:PyDOM', None)
(':Extensions:PyOpenGL-1.5.6a2', None)
(':Extensions:PyXML-0.6.2', None)
(':Extensions:README', None)
(':Extensions:README.TOO', None)
(':Extensions:audio', None)
(':Extensions:example2:README', None)
(':Extensions:example3:README', None)
(':Extensions:example:README', None)
(':Extensions:img:Lib', '')
(':Extensions:img:Mac:genimgprojects.py', None)
(':Extensions:img:Mac:imgcolormap.carbon.slb', '')
(':Extensions:img:Mac:imgformat.carbon.slb', '')
(':Extensions:img:Mac:imggif.carbon.slb', '')
(':Extensions:img:Mac:imgjpeg.carbon.slb', '')
(':Extensions:img:Mac:imgop.carbon.slb', '')
(':Extensions:img:Mac:imgpbm.carbon.slb', '')
(':Extensions:img:Mac:imgpgm.carbon.slb', '')
(':Extensions:img:Mac:imgpng.carbon.slb', '')
(':Extensions:img:Mac:imgppm.carbon.slb', '')
(':Extensions:img:Mac:imgsgi.carbon.slb', '')
(':Extensions:img:Mac:imgtiff.carbon.slb', '')
(':Extensions:img:README.img', '')
(':Extensions:img:doc', None)
(':Extensions:img:setup.py', None)
(':Extensions:img:test', '')
(':Extensions:img:test:out-grey-b2t.pgm', None)
(':Extensions:img:test:out-grey-b2t.rgb', None)
(':Extensions:img:test:out-grey-t2b-greyviatiff.pgm', None)
(':Extensions:img:test:out-grey-t2b-rgbviatiff.ppm', None)
(':Extensions:img:test:out-grey-t2b.jpg', None)
(':Extensions:img:test:out-grey-t2b.pgm', None)
(':Extensions:img:test:out-grey-t2b.rgb', None)
(':Extensions:img:test:out-grey-t2b.tiff', None)
(':Extensions:img:test:out-icon.pbm', None)
(':Extensions:img:test:out-icon.pgm', None)
(':Extensions:img:test:out-map-t2b-2.gif', None)
(':Extensions:img:test:out-map-t2b.gif', None)
(':Extensions:img:test:out-mono-t2b.pbm', None)
(':Extensions:img:test:out-rgb-b2t-viagif.ppm', None)
(':Extensions:img:test:out-rgb-b2t.ppm', None)
(':Extensions:img:test:out-rgb-b2t.rgb', None)
(':Extensions:img:test:out-rgb-t2b-viagif.ppm', None)
(':Extensions:img:test:out-rgb-t2b-viajpeg.ppm', None)
(':Extensions:img:test:out-rgb-t2b.jpg', None)
(':Extensions:img:test:out-rgb-t2b.ppm', None)
(':Extensions:img:test:out-rgb-t2b.rgb', None)
(':Extensions:img:test:out-rgb-t2b.tiff', None)
(':Extensions:midi', None)
(':Extensions:pyexpat', None)
(':Extensions:pygui', None)
(':Extensions:saxlib', None)
(':Extensions:xmltok', None)
(':Grammar:Grammar', None)
(':Grammar:Icon', None)
(':Icon', None)
(':Include:Icon', None)
(':LICENSE', ':Relnotes:')
(':Lib', '')
(':Lib:dos-8x3', None)
(':Lib:plat-aix3', None)
(':Lib:plat-aix4', None)
(':Lib:plat-freebsd2', None)
(':Lib:plat-freebsd3', None)
(':Lib:plat-irix5', None)
(':Lib:plat-irix6', None)
(':Lib:plat-linux1', None)
(':Lib:plat-linux2', None)
(':Lib:plat-netbsd1', None)
(':Lib:plat-next3', None)
(':Lib:plat-sunos4', None)
(':Lib:plat-sunos5', None)
(':Mac:Build', None)
(':Mac:Compat:Icon', None)
(':Mac:Contrib:AECaptureParser', '')
(':Mac:Contrib:BBPy.lm:BBpy.r', None)
(':Mac:Contrib:BBPy.lm:Python', '')
(':Mac:Contrib:BBPy.lm:Python Keywords.rsrc', None)
(':Mac:Contrib:BBPy.lm:PythonBBLM.txt', '')
(':Mac:Contrib:BBPy:PythonSlave.py', '')
(':Mac:Contrib:BBPy:README', '')
(':Mac:Contrib:BBPy:Run as Python', '')
(':Mac:Contrib:BBPy:Run as Python.sit', None)
(':Mac:Contrib:BBPy:source', None)
(':Mac:Contrib:ImageHelpers', '')
(':Mac:Contrib:PythonDetector', '')
(':Mac:Contrib:PythonDetector:Icon', None)
(':Mac:Contrib:PythonDetector:OpenPythonLib', '')
(':Mac:Contrib:PythonDetector:OpenPythonLib with NS', '')
(':Mac:Contrib:PythonDetector:PythonDetector', '')
(':Mac:Contrib:PythonDetector:readme.txt', '')
(':Mac:Contrib:Sherlock', '')
(':Mac:Contrib:Tabcleaner', '')
(':Mac:Contrib:mpwsystem', '')
(':Mac:Contrib:osam:OSAm.carbon.slb', '')
(':Mac:Contrib:osam:OSAm.exp', None)
(':Mac:Contrib:osam:OSAm.ppc.slb.sit', None)
(':Mac:Demo', '')
(':Mac:Distributions', None)
(':Mac:GUSI-mods', None)
(':Mac:HISTORY', ':Relnotes:')
(':Mac:IDE scripts', None)
(':Mac:Icon', None)
(':Mac:Include:Icon', None)
(':Mac:Lib', '')
(':Mac:MPW', None)
(':Mac:Modules', None)
(':Mac:OSX', None)
(':Mac:OSX:README', None)
(':Mac:OSX:README.macosx.txt', None)
(':Mac:OSXResources', None)
(':Mac:Python:Icon', None)
(':Mac:ReadMe', ':ReadMe')
(':Mac:ReadMe-dev', None)
(':Mac:ReadMe-src', None)
(':Mac:ReadMe~0', None)
(':Mac:ReadmeSource', None)
(':Mac:Resources', None)
(':Mac:TODO', None)
(':Mac:Tools:CGI', '')
(':Mac:Tools:IDE', '')
(':Mac:Tools:Icon', None)
(':Mac:Tools:PyIDE', None)
(':Mac:Tools:bruce', None)
(':Mac:Tools:macfreeze', '')
(':Mac:Unsupported', None)
(':Mac:Wastemods:readme.txt', None)
(':Mac:_checkversion.py', '')
(':Mac:mwerks', None)
(':Mac:scripts', '')
(':Mac:tclmods:Icon', None)
(':Mac:tclmods:license-terms.txt', None)
(':Mac:think:Icon', None)
(':Misc', '')
(':Modules', None)
(':Objects:Icon', None)
(':Objects:listsort.txt', None)
(':PC', None)
(':PCbuild', None)
(':PLAN.txt', None)
(':Parser:Icon', None)
(':Parser:grammar.mak', None)
(':Python IDE', None)
(':Python:Icon', None)
(':PythonCarbonStandalone', None)
(':PythonCoreCarbon', '')
(':PythonInterpreter', '')
(':PythonStandCarbon', None)
(':PythonStandSmall', None)
(':PythonStandSmallCarbon', None)
(':PythonStandSmallShGUSI', None)
(':PythonStandSmallThreading', None)
(':PythonStandalone', None)
(':README', '')
(':RISCOS', None)
(':Tools:Icon', None)
(':Tools:README', '')
(':Tools:audiopy', '')
(':Tools:bgen', None)
(':Tools:compiler', '')
(':Tools:faqwiz', '')
(':Tools:framer', '')
(':Tools:freeze', '')
(':Tools:i18n', '')
(':Tools:idle', '')
(':Tools:modulator', None)
(':Tools:pynche', '')
(':Tools:scripts', '')
(':Tools:unicode:makeunicodedata.py', '')
(':Tools:versioncheck', '')
(':Tools:webchecker', '')
(':Tools:world', '')
(':config.h.in', None)
(':configure', None)
(':configure.in', None)
(':install-sh', None)
(':jack-scripts', None)
(':loop.py', None)
(':mac2unix-real.shar', None)
(':mac2unix.shar', None)
(':pyconfig.h.in', None)
(':pystone.py', None)
(':setup.py', None)
(':site-packages', None)

View File

@ -1,22 +0,0 @@
* Data
*.Lib
*.MAP
*.SYM
*.dbg
*.hqx
*.idb
*.pch
*.pyc
*.pyo
*.slb
*.xMAP
*.xSYM
*Icon
*_pch
*~[0-9]
.#*
.DS_Store
.cvsignore
@*
CVS
[(]*[)]

View File

@ -1,634 +0,0 @@
(':BeOS', None)
(':BuildApplet', None)
(':BuildApplication', None)
(':ConfigurePython', None)
(':ConfigurePythonCarbon', None)
(':ConfigurePythonClassic', None)
(':Demo', None)
(':Demo:embed', ':Demo:embed')
(':Demo:pysvr', ':Demo:pysvr')
(':Doc', None)
(':EditPythonPrefs', None)
(':Extensions:4Suite-0.9.2', None)
(':Extensions:Imaging', None)
(':Extensions:Makefile.pre.in', None)
(':Extensions:Numerical', None)
(':Extensions:Numerical-old', None)
(':Extensions:PyOpenGL-1.5.6a2', None)
(':Extensions:PyXML-0.6.2', None)
(':Extensions:README', None)
(':Extensions:README.TOO', None)
(':Extensions:example', None)
(':Extensions:example2', None)
(':Extensions:example3', None)
(':Extensions:img', None)
(':Extensions:midi', None)
(':Grammar:Grammar', None)
(':Grammar:Icon\r', None)
(':Grammar:Makefile', None)
(':Grammar:Makefile.in', None)
(':Icon\r', None)
(':Include', '')
(':LICENSE', None)
(':Lib', None)
(':Mac:Build:App.carbon.mcp', None)
(':Mac:Build:CF.carbon.mcp.exp', None)
(':Mac:Build:CF.carbon.mcp.xml', None)
(':Mac:Build:ColorPicker.carbon.mcp', None)
(':Mac:Build:ColorPicker.carbon.mcp.exp', None)
(':Mac:Build:ColorPicker.carbon.mcp.xml', None)
(':Mac:Build:ColorPicker.mcp', None)
(':Mac:Build:ColorPicker.mcp.exp', None)
(':Mac:Build:ColorPicker.mcp.xml', None)
(':Mac:Build:Dlg.mcp.exp', None)
(':Mac:Build:Dlg.mcp.xml', None)
(':Mac:Build:Drag.carbon.mcp.exp', None)
(':Mac:Build:Drag.carbon.mcp.xml', None)
(':Mac:Build:Drag.mcp.exp', None)
(':Mac:Build:Drag.mcp.xml', None)
(':Mac:Build:Help.mcp.exp', None)
(':Mac:Build:Help.mcp.xml', None)
(':Mac:Build:HtmlRender.prj', None)
(':Mac:Build:Icn.carbon.mcp.exp', None)
(':Mac:Build:Icn.carbon.mcp.xml', None)
(':Mac:Build:Menu.carbon.mcp.exp', None)
(':Mac:Build:Menu.carbon.mcp.xml', None)
(':Mac:Build:Menu.mcp.exp', None)
(':Mac:Build:Menu.mcp.xml', None)
(':Mac:Build:Mlte.carbon.mcp.exp', None)
(':Mac:Build:Mlte.carbon.mcp.xml', None)
(':Mac:Build:Mlte.mcp.exp', None)
(':Mac:Build:Mlte.mcp.xml', None)
(':Mac:Build:Printing.mcp', None)
(':Mac:Build:Printing.mcp.exp', None)
(':Mac:Build:Printing.mcp.xml', None)
(':Mac:Build:PythonCore.axp', None)
(':Mac:Build:PythonCore.exp', None)
(':Mac:Build:PythonCore.mcp', None)
(':Mac:Build:PythonCoreCarbon.exp', None)
(':Mac:Build:PythonInterpreter.mcp', None)
(':Mac:Build:PythonInterpreter.old.mcp', None)
(':Mac:Build:PythonStandSmall.mcp', None)
(':Mac:Build:PythonStandSmall.old.mcp', None)
(':Mac:Build:PythonStandalone.mcp', None)
(':Mac:Build:Qt.carbon.mcp.exp', None)
(':Mac:Build:Qt.mcp.exp', None)
(':Mac:Build:Snd.carbon.mcp.exp', None)
(':Mac:Build:Snd.carbon.mcp.xml', None)
(':Mac:Build:Snd.mcp.exp', None)
(':Mac:Build:Snd.mcp.xml', None)
(':Mac:Build:TE.carbon.mcp.exp', None)
(':Mac:Build:TE.carbon.mcp.xml', None)
(':Mac:Build:TE.mcp.exp', None)
(':Mac:Build:TE.mcp.xml', None)
(':Mac:Build:Win.carbon.mcp.exp', None)
(':Mac:Build:Win.carbon.mcp.xml', None)
(':Mac:Build:Win.mcp.exp', None)
(':Mac:Build:Win.mcp.xml', None)
(':Mac:Build:_AE.carbon.mcp', None)
(':Mac:Build:_AE.carbon.mcp.exp', None)
(':Mac:Build:_AE.carbon.mcp.xml', None)
(':Mac:Build:_AE.mcp', None)
(':Mac:Build:_AE.mcp.exp', None)
(':Mac:Build:_AE.mcp.xml', None)
(':Mac:Build:_AH.carbon.mcp', None)
(':Mac:Build:_AH.carbon.mcp.exp', None)
(':Mac:Build:_AH.carbon.mcp.xml', None)
(':Mac:Build:_Alias.carbon.mcp', None)
(':Mac:Build:_Alias.carbon.mcp.exp', None)
(':Mac:Build:_Alias.carbon.mcp.xml', None)
(':Mac:Build:_App.carbon.mcp', None)
(':Mac:Build:_App.carbon.mcp.exp', None)
(':Mac:Build:_App.carbon.mcp.xml', None)
(':Mac:Build:_App.mcp', None)
(':Mac:Build:_App.mcp.exp', None)
(':Mac:Build:_App.mcp.xml', None)
(':Mac:Build:_CF.carbon.mcp', None)
(':Mac:Build:_CF.carbon.mcp.exp', None)
(':Mac:Build:_CF.carbon.mcp.xml', None)
(':Mac:Build:_CG.carbon.mcp', None)
(':Mac:Build:_CG.carbon.mcp.exp', None)
(':Mac:Build:_CG.carbon.old.mcp', None)
(':Mac:Build:_CarbonEvt.carbon.mcp', None)
(':Mac:Build:_CarbonEvt.carbon.mcp.exp', None)
(':Mac:Build:_CarbonEvt.carbon.mcp.xml', None)
(':Mac:Build:_Cm.carbon.mcp', None)
(':Mac:Build:_Cm.carbon.mcp.exp', None)
(':Mac:Build:_Cm.carbon.mcp.xml', None)
(':Mac:Build:_Cm.mcp', None)
(':Mac:Build:_Cm.mcp.exp', None)
(':Mac:Build:_Cm.mcp.xml', None)
(':Mac:Build:_Ctl.carbon.mcp', None)
(':Mac:Build:_Ctl.carbon.mcp.exp', None)
(':Mac:Build:_Ctl.carbon.mcp.xml', None)
(':Mac:Build:_Ctl.mcp', None)
(':Mac:Build:_Ctl.mcp.exp', None)
(':Mac:Build:_Ctl.mcp.xml', None)
(':Mac:Build:_Dlg.carbon.mcp', None)
(':Mac:Build:_Dlg.carbon.mcp.exp', None)
(':Mac:Build:_Dlg.carbon.mcp.xml', None)
(':Mac:Build:_Dlg.mcp', None)
(':Mac:Build:_Dlg.mcp.exp', None)
(':Mac:Build:_Dlg.mcp.xml', None)
(':Mac:Build:_Drag.carbon.mcp', None)
(':Mac:Build:_Drag.carbon.mcp.exp', None)
(':Mac:Build:_Drag.carbon.mcp.xml', None)
(':Mac:Build:_Drag.mcp', None)
(':Mac:Build:_Drag.mcp.exp', None)
(':Mac:Build:_Drag.mcp.xml', None)
(':Mac:Build:_Evt.carbon.mcp', None)
(':Mac:Build:_Evt.carbon.mcp.exp', None)
(':Mac:Build:_Evt.carbon.mcp.xml', None)
(':Mac:Build:_Evt.mcp', None)
(':Mac:Build:_Evt.mcp.exp', None)
(':Mac:Build:_Evt.mcp.xml', None)
(':Mac:Build:_File.carbon.mcp', None)
(':Mac:Build:_File.carbon.mcp.exp', None)
(':Mac:Build:_File.carbon.mcp.xml', None)
(':Mac:Build:_Fm.carbon.mcp', None)
(':Mac:Build:_Fm.carbon.mcp.exp', None)
(':Mac:Build:_Fm.carbon.mcp.xml', None)
(':Mac:Build:_Fm.mcp', None)
(':Mac:Build:_Fm.mcp.exp', None)
(':Mac:Build:_Fm.mcp.xml', None)
(':Mac:Build:_Folder.carbon.mcp', None)
(':Mac:Build:_Folder.carbon.mcp.exp', None)
(':Mac:Build:_Folder.carbon.mcp.xml', None)
(':Mac:Build:_Help.carbon.mcp', None)
(':Mac:Build:_Help.carbon.mcp.exp', None)
(':Mac:Build:_Help.carbon.mcp.xml', None)
(':Mac:Build:_Help.mcp', None)
(':Mac:Build:_Help.mcp.exp', None)
(':Mac:Build:_Help.mcp.xml', None)
(':Mac:Build:_IBCarbon.carbon.mcp', None)
(':Mac:Build:_IBCarbon.carbon.mcp.exp', None)
(':Mac:Build:_IBCarbon.carbon.mcp.xml', None)
(':Mac:Build:_Icn.carbon.mcp', None)
(':Mac:Build:_Icn.carbon.mcp.exp', None)
(':Mac:Build:_Icn.carbon.mcp.xml', None)
(':Mac:Build:_Icn.mcp', None)
(':Mac:Build:_Icn.mcp.exp', None)
(':Mac:Build:_Icn.mcp.xml', None)
(':Mac:Build:_List.carbon.mcp', None)
(':Mac:Build:_List.carbon.mcp.exp', None)
(':Mac:Build:_List.carbon.mcp.xml', None)
(':Mac:Build:_List.mcp', None)
(':Mac:Build:_List.mcp.exp', None)
(':Mac:Build:_List.mcp.xml', None)
(':Mac:Build:_Menu.carbon.mcp', None)
(':Mac:Build:_Menu.carbon.mcp.exp', None)
(':Mac:Build:_Menu.carbon.mcp.xml', None)
(':Mac:Build:_Menu.mcp', None)
(':Mac:Build:_Menu.mcp.exp', None)
(':Mac:Build:_Menu.mcp.xml', None)
(':Mac:Build:_Mlte.carbon.mcp', None)
(':Mac:Build:_Mlte.carbon.mcp.exp', None)
(':Mac:Build:_Mlte.carbon.mcp.xml', None)
(':Mac:Build:_Mlte.mcp', None)
(':Mac:Build:_Mlte.mcp.exp', None)
(':Mac:Build:_Mlte.mcp.xml', None)
(':Mac:Build:_Qd.carbon.mcp', None)
(':Mac:Build:_Qd.carbon.mcp.exp', None)
(':Mac:Build:_Qd.carbon.mcp.xml', None)
(':Mac:Build:_Qd.mcp', None)
(':Mac:Build:_Qd.mcp.exp', None)
(':Mac:Build:_Qd.mcp.xml', None)
(':Mac:Build:_Qdoffs.carbon.mcp', None)
(':Mac:Build:_Qdoffs.carbon.mcp.exp', None)
(':Mac:Build:_Qdoffs.carbon.mcp.xml', None)
(':Mac:Build:_Qdoffs.mcp', None)
(':Mac:Build:_Qdoffs.mcp.exp', None)
(':Mac:Build:_Qdoffs.mcp.xml', None)
(':Mac:Build:_Qt.carbon.mcp', None)
(':Mac:Build:_Qt.carbon.mcp.exp', None)
(':Mac:Build:_Qt.carbon.mcp.xml', None)
(':Mac:Build:_Qt.mcp', None)
(':Mac:Build:_Qt.mcp.exp', None)
(':Mac:Build:_Qt.mcp.xml', None)
(':Mac:Build:_Res.carbon.mcp', None)
(':Mac:Build:_Res.carbon.mcp.exp', None)
(':Mac:Build:_Res.carbon.mcp.xml', None)
(':Mac:Build:_Res.mcp', None)
(':Mac:Build:_Res.mcp.exp', None)
(':Mac:Build:_Res.mcp.xml', None)
(':Mac:Build:_Scrap.carbon.mcp', None)
(':Mac:Build:_Scrap.carbon.mcp.exp', None)
(':Mac:Build:_Scrap.carbon.mcp.xml', None)
(':Mac:Build:_Scrap.mcp', None)
(':Mac:Build:_Scrap.mcp.exp', None)
(':Mac:Build:_Scrap.mcp.xml', None)
(':Mac:Build:_Snd.carbon.mcp', None)
(':Mac:Build:_Snd.carbon.mcp.exp', None)
(':Mac:Build:_Snd.carbon.mcp.xml', None)
(':Mac:Build:_Snd.mcp', None)
(':Mac:Build:_Snd.mcp.exp', None)
(':Mac:Build:_Snd.mcp.xml', None)
(':Mac:Build:_Sndihooks.carbon.mcp', None)
(':Mac:Build:_Sndihooks.carbon.mcp.exp', None)
(':Mac:Build:_Sndihooks.carbon.mcp.xml', None)
(':Mac:Build:_Sndihooks.mcp', None)
(':Mac:Build:_Sndihooks.mcp.exp', None)
(':Mac:Build:_Sndihooks.mcp.xml', None)
(':Mac:Build:_TE.carbon.mcp', None)
(':Mac:Build:_TE.carbon.mcp.exp', None)
(':Mac:Build:_TE.carbon.mcp.xml', None)
(':Mac:Build:_TE.mcp', None)
(':Mac:Build:_TE.mcp.exp', None)
(':Mac:Build:_TE.mcp.xml', None)
(':Mac:Build:_Win.carbon.mcp', None)
(':Mac:Build:_Win.carbon.mcp.exp', None)
(':Mac:Build:_Win.carbon.mcp.xml', None)
(':Mac:Build:_Win.mcp', None)
(':Mac:Build:_Win.mcp.exp', None)
(':Mac:Build:_Win.mcp.xml', None)
(':Mac:Build:_dummy_tkinter.mcp', None)
(':Mac:Build:_dummy_tkinter.mcp.exp', None)
(':Mac:Build:_dummy_tkinter.old.mcp', None)
(':Mac:Build:_hotshot.carbon.mcp', None)
(':Mac:Build:_hotshot.carbon.mcp.exp', None)
(':Mac:Build:_hotshot.carbon.mcp.xml', None)
(':Mac:Build:_hotshot.mcp', None)
(':Mac:Build:_hotshot.mcp.exp', None)
(':Mac:Build:_hotshot.mcp.xml', None)
(':Mac:Build:_symtable.carbon.mcp', None)
(':Mac:Build:_symtable.carbon.mcp.exp', None)
(':Mac:Build:_symtable.carbon.mcp.xml', None)
(':Mac:Build:_symtable.mcp', None)
(':Mac:Build:_symtable.mcp.exp', None)
(':Mac:Build:_symtable.mcp.xml', None)
(':Mac:Build:_testcapi.carbon.mcp', None)
(':Mac:Build:_testcapi.carbon.mcp.exp', None)
(':Mac:Build:_testcapi.carbon.mcp.xml', None)
(':Mac:Build:_testcapi.mcp', None)
(':Mac:Build:_testcapi.mcp.exp', None)
(':Mac:Build:_testcapi.mcp.xml', None)
(':Mac:Build:_weakref.carbon.mcp', None)
(':Mac:Build:_weakref.carbon.mcp.exp', None)
(':Mac:Build:_weakref.carbon.mcp.xml', None)
(':Mac:Build:_weakref.mcp', None)
(':Mac:Build:_weakref.mcp.exp', None)
(':Mac:Build:_weakref.mcp.xml', None)
(':Mac:Build:buildlibs.mcp', None)
(':Mac:Build:calldll.carbon.mcp', None)
(':Mac:Build:calldll.carbon.mcp.exp', None)
(':Mac:Build:calldll.carbon.mcp.xml', None)
(':Mac:Build:calldll.mcp', None)
(':Mac:Build:calldll.mcp.exp', None)
(':Mac:Build:calldll.mcp.xml', None)
(':Mac:Build:ctb.mcp', None)
(':Mac:Build:ctb.mcp.exp', None)
(':Mac:Build:ctb.mcp.xml', None)
(':Mac:Build:datetime.carbon.mcp', None)
(':Mac:Build:datetime.carbon.mcp.exp', None)
(':Mac:Build:datetime.carbon.mcp.xml', None)
(':Mac:Build:gdbm.carbon.mcp', None)
(':Mac:Build:gdbm.carbon.mcp.exp', None)
(':Mac:Build:gdbm.carbon.mcp.xml', None)
(':Mac:Build:gdbm.mcp', None)
(':Mac:Build:gdbm.mcp.exp', None)
(':Mac:Build:gdbm.mcp.xml', None)
(':Mac:Build:hfsplus.carbon.mcp', None)
(':Mac:Build:hfsplus.carbon.mcp.exp', None)
(':Mac:Build:hfsplus.carbon.mcp.xml', None)
(':Mac:Build:icglue.carbon.mcp', None)
(':Mac:Build:icglue.carbon.mcp.exp', None)
(':Mac:Build:icglue.carbon.mcp.xml', None)
(':Mac:Build:icglue.mcp', None)
(':Mac:Build:icglue.mcp.exp', None)
(':Mac:Build:icglue.mcp.xml', None)
(':Mac:Build:macspeech.mcp', None)
(':Mac:Build:macspeech.mcp.exp', None)
(':Mac:Build:macspeech.mcp.xml', None)
(':Mac:Build:pyexpat.carbon.mcp', None)
(':Mac:Build:pyexpat.carbon.mcp.exp', None)
(':Mac:Build:pyexpat.carbon.mcp.xml', None)
(':Mac:Build:pyexpat.mcp', None)
(':Mac:Build:pyexpat.mcp.exp', None)
(':Mac:Build:pyexpat.mcp.xml', None)
(':Mac:Build:pygusiconfig.carbon.lib', None)
(':Mac:Build:pygusiconfig.smcarbon.lib', None)
(':Mac:Build:temp_delete_me', None)
(':Mac:Build:waste.carbon.mcp', None)
(':Mac:Build:waste.carbon.mcp.exp', None)
(':Mac:Build:waste.carbon.mcp.xml', None)
(':Mac:Build:waste.mcp', None)
(':Mac:Build:waste.mcp.exp', None)
(':Mac:Build:waste.mcp.xml', None)
(':Mac:Build:xx.carbon.mcp', '')
(':Mac:Build:xx.carbon.mcp.exp', '')
(':Mac:Build:xx.carbon.mcp.xml', '')
(':Mac:Build:xxsubtype.carbon.mcp', None)
(':Mac:Build:xxsubtype.carbon.mcp.exp', None)
(':Mac:Build:xxsubtype.carbon.mcp.xml', None)
(':Mac:Build:zlib.carbon.mcp', None)
(':Mac:Build:zlib.carbon.mcp.exp', None)
(':Mac:Build:zlib.carbon.mcp.xml', None)
(':Mac:Build:zlib.mcp', None)
(':Mac:Build:zlib.mcp.exp', None)
(':Mac:Build:zlib.mcp.xml', None)
(':Mac:CVS', None)
(':Mac:Compat', None)
(':Mac:Contrib', None)
(':Mac:Contrib:PyIDE', None)
(':Mac:Contrib:PythonScript', None)
(':Mac:Contrib:readme.txt', None)
(':Mac:Demo:PICTbrowse', None)
(':Mac:Demo:applescript.html', None)
(':Mac:Demo:applescript:Disk_Copy:Special_Events.py', None)
(':Mac:Demo:applescript:Disk_Copy:Standard_Suite.py', None)
(':Mac:Demo:applescript:Disk_Copy:Utility_Events.py', None)
(':Mac:Demo:applescript:Disk_Copy:__init__.py', None)
(':Mac:Demo:applescript:makedisk.py', None)
(':Mac:Demo:building.html', None)
(':Mac:Demo:calldll', None)
(':Mac:Demo:cgi', None)
(':Mac:Demo:cgi.html', None)
(':Mac:Demo:embed', ':Mac:Demo:embed')
(':Mac:Demo:embed.html', ':Mac:Demo:embed.html')
(':Mac:Demo:embed:embeddemo PPC', None)
(':Mac:Demo:example0', None)
(':Mac:Demo:example0.html', None)
(':Mac:Demo:example1', None)
(':Mac:Demo:example1.html', None)
(':Mac:Demo:example2', None)
(':Mac:Demo:example2.html', None)
(':Mac:Demo:freezing.html', None)
(':Mac:Demo:html.icons', None)
(':Mac:Demo:imgbrowse', None)
(':Mac:Demo:index.html', None)
(':Mac:Demo:interslip', ':Mac:Demo:interslip')
(':Mac:Demo:mainloops.txt', None)
(':Mac:Demo:mlte:mlted.py', None)
(':Mac:Demo:mpwextensions.html', None)
(':Mac:Demo:plugins.html', None)
(':Mac:Demo:printing', None)
(':Mac:Demo:quicktime', None)
(':Mac:Demo:resources', None)
(':Mac:Demo:scripting', None)
(':Mac:Demo:sound', None)
(':Mac:Demo:speech', None)
(':Mac:Demo:standalone.html', None)
(':Mac:Demo:textedit', None)
(':Mac:Demo:textedit.html', None)
(':Mac:Demo:using.html', None)
(':Mac:Demo:waste', None)
(':Mac:Demo:waste.html', None)
(':Mac:Distributions', None)
(':Mac:GUSI-mods', None)
(':Mac:HISTORY', None)
(':Mac:IDE scripts', None)
(':Mac:IDE scripts:', None)
(':Mac:Icon\r', None)
(':Mac:Include', ':Mac:Include')
(':Mac:Lib', None)
(':Mac:MPW', None)
(':Mac:Modules', None)
(':Mac:OSX', None)
(':Mac:OSX:Makefile', None)
(':Mac:OSX:README', None)
(':Mac:OSX:README.macosx.txt', None)
(':Mac:OSXResources', None)
(':Mac:OSXResources:', None)
(':Mac:PlugIns:readme.txt', None)
(':Mac:Python', None)
(':Mac:Python:Icon\r', None)
(':Mac:ReadMe', None)
(':Mac:ReadMe-dev', ':')
(':Mac:ReadMe-src', None)
(':Mac:ReadMe~0', None)
(':Mac:Relnotes', None)
(':Mac:Relnotes-source', None)
(':Mac:Resources:Carbon.r', None)
(':Mac:Resources:balloons.bh', None)
(':Mac:Resources:bundle.rsrc', None)
(':Mac:Resources:dialogs.rsrc', None)
(':Mac:Resources:errors.rsrc', None)
(':Mac:Resources:gusiprefs.rsrc', None)
(':Mac:Resources:pythonpath.r', '')
(':Mac:Resources:tkpython.rsrc', None)
(':Mac:Resources:tkpython.rsrc-', None)
(':Mac:Resources:version.r', None)
(':Mac:TODO', None)
(':Mac:Tools:BBPy', None)
(':Mac:Tools:CGI', None)
(':Mac:Tools:IDE', None)
(':Mac:Tools:Icon\r', None)
(':Mac:Tools:PyIDE', None)
(':Mac:Tools:bruce', None)
(':Mac:Tools:macfreeze', None)
(':Mac:Tools:twit', None)
(':Mac:Unsupported', None)
(':Mac:Wastemods', None)
(':Mac:_checkversion.py', None)
(':Mac:mwerks:Icon\r', None)
(':Mac:mwerks:ShGUSIGlue.c', None)
(':Mac:mwerks:errno_unix.h', ':Mac:mwerks:')
(':Mac:mwerks:macuseshlstart.c', None)
(':Mac:mwerks:malloc', None)
(':Mac:mwerks:mwerks_carbonNOGUSI_config.h', None)
(':Mac:mwerks:mwerks_nscarbon_config.h', '')
(':Mac:mwerks:mwerks_shcarbon_config.h', '')
(':Mac:mwerks:mwerks_smcarbon_config.h', '')
(':Mac:mwerks:mwerks_thrcarbonsm_config.h', None)
(':Mac:mwerks:mwerks_threadsmall_config.h', '')
(':Mac:mwerks:mwerks_tkplugin_config.h', ':Mac:mwerks:')
(':Mac:mwerks:mwfopenrf.c', None)
(':Mac:mwerks:old', None)
(':Mac:mwerks:projects', None)
(':Mac:scripts', None)
(':Mac:tclmods', None)
(':Mac:think', None)
(':Mac:think:Icon\r', None)
(':Makefile.in', None)
(':Makefile.pre.in', None)
(':Misc', None)
(':Modules:.cvsignore', None)
(':Modules:Makefile.pre.in', None)
(':Modules:Setup.config.in', None)
(':Modules:Setup.dist', None)
(':Modules:Setup.in', None)
(':Modules:Setup.thread.in', None)
(':Modules:_bsddb.c', None)
(':Modules:_codecsmodule.c', None)
(':Modules:_curses_panel.c', None)
(':Modules:_cursesmodule.c', None)
(':Modules:_hotshot.c', None)
(':Modules:_localemodule.c', None)
(':Modules:_randommodule.c', None)
(':Modules:_sre.c', None)
(':Modules:_ssl.c', None)
(':Modules:_testcapimodule.c', None)
(':Modules:_tkinter.c', None)
(':Modules:_weakref.c', None)
(':Modules:addrinfo.h', None)
(':Modules:almodule.c', None)
(':Modules:ar_beos', None)
(':Modules:arraymodule.c', None)
(':Modules:audioop.c', None)
(':Modules:binascii.c', None)
(':Modules:bsddbmodule.c', None)
(':Modules:bz2module.c', None)
(':Modules:cPickle.c', None)
(':Modules:cStringIO.c', None)
(':Modules:ccpython.cc', None)
(':Modules:cdmodule.c', None)
(':Modules:cgen.py', None)
(':Modules:cgensupport.c', None)
(':Modules:cgensupport.h', None)
(':Modules:clmodule.c', None)
(':Modules:cmathmodule.c', None)
(':Modules:config.c.in', None)
(':Modules:cryptmodule.c', None)
(':Modules:cstubs', None)
(':Modules:cursesmodule.c', None)
(':Modules:datetimemodule.c', None)
(':Modules:dbmmodule.c', None)
(':Modules:dlmodule.c', None)
(':Modules:errnomodule.c', None)
(':Modules:expat', None)
(':Modules:fcntlmodule.c', None)
(':Modules:flmodule.c', None)
(':Modules:fmmodule.c', None)
(':Modules:fpectlmodule.c', None)
(':Modules:fpetestmodule.c', None)
(':Modules:gcmodule.c', None)
(':Modules:gdbmmodule.c', None)
(':Modules:getaddrinfo.c', None)
(':Modules:getbuildinfo.c', None)
(':Modules:getnameinfo.c', None)
(':Modules:getpath.c', None)
(':Modules:glmodule.c', None)
(':Modules:grpmodule.c', None)
(':Modules:imageop.c', None)
(':Modules:imgfile.c', None)
(':Modules:ld_so_aix', None)
(':Modules:ld_so_beos', None)
(':Modules:license.terms', None)
(':Modules:linuxaudiodev.c', None)
(':Modules:main.c', None)
(':Modules:makesetup', None)
(':Modules:makexp_aix', None)
(':Modules:mathmodule.c', None)
(':Modules:md5.h', None)
(':Modules:md5c.c', None)
(':Modules:md5module.c', None)
(':Modules:mmapmodule.c', None)
(':Modules:mpzmodule.c', None)
(':Modules:nismodule.c', None)
(':Modules:operator.c', None)
(':Modules:ossaudiodev.c', None)
(':Modules:parsermodule.c', None)
(':Modules:pcre-int.h', None)
(':Modules:pcre.h', None)
(':Modules:pcremodule.c', None)
(':Modules:posixmodule.c', None)
(':Modules:puremodule.c', None)
(':Modules:pwdmodule.c', None)
(':Modules:pyexpat.c', None)
(':Modules:pypcre.c', None)
(':Modules:python.c', None)
(':Modules:readline.c', None)
(':Modules:regexmodule.c', None)
(':Modules:regexpr.c', None)
(':Modules:regexpr.h', None)
(':Modules:resource.c', None)
(':Modules:rgbimgmodule.c', None)
(':Modules:rotormodule.c', None)
(':Modules:selectmodule.c', None)
(':Modules:sgimodule.c', None)
(':Modules:shamodule.c', None)
(':Modules:signalmodule.c', None)
(':Modules:socketmodule.c', None)
(':Modules:socketmodule.h', None)
(':Modules:soundex.c', None)
(':Modules:sre.h', None)
(':Modules:sre_constants.h', None)
(':Modules:stropmodule.c', None)
(':Modules:structmodule.c', None)
(':Modules:sunaudiodev.c', None)
(':Modules:svmodule.c', None)
(':Modules:symtablemodule.c', None)
(':Modules:syslogmodule.c', None)
(':Modules:tclNotify.c', None)
(':Modules:termios.c', None)
(':Modules:testcapi_long.h', None)
(':Modules:threadmodule.c', None)
(':Modules:timemodule.c', None)
(':Modules:timemodule.c~0', None)
(':Modules:timemodule.c~1', None)
(':Modules:timing.h', None)
(':Modules:timingmodule.c', None)
(':Modules:tkappinit.c', None)
(':Modules:ucnhash.c', None)
(':Modules:unicodedata.c', None)
(':Modules:unicodedata_db.h', None)
(':Modules:unicodedatabase.c', None)
(':Modules:unicodedatabase.h', None)
(':Modules:unicodename_db.h', None)
(':Modules:xreadlinesmodule.c', None)
(':Modules:xxmodule.c', '')
(':Modules:xxsubtype.c', None)
(':Modules:yuv.h', None)
(':Modules:yuvconvert.c', None)
(':Modules:zipimport.c', None)
(':Modules:zlibmodule.c', None)
(':Modules:zlibmodule.c~0', None)
(':Modules:zlibmodule.c~1', None)
(':Objects', None)
(':Objects:Icon\r', None)
(':PC', None)
(':PCbuild', None)
(':PLAN.txt', None)
(':Parser', None)
(':PlugIns', None)
(':Python', None)
(':Python IDE', None)
(':Python68K', None)
(':PythonApplet', None)
(':PythonCarbonStandalone', None)
(':PythonCore', None)
(':PythonCoreCarbon', None)
(':PythonFAT', None)
(':PythonInterpreter', None)
(':PythonInterpreterCarbon', None)
(':PythonInterpreterClassic', None)
(':PythonStandCarbon', None)
(':PythonStandSmall', None)
(':PythonStandSmallCarbon', None)
(':PythonStandSmallShGUSI', None)
(':PythonStandSmallThreading', None)
(':PythonStandalone', None)
(':README', None)
(':RISCOS', None)
(':Tools:README', None)
(':Tools:audiopy', None)
(':Tools:bgen', '')
(':Tools:compiler', None)
(':Tools:faqwiz', None)
(':Tools:framer', None)
(':Tools:freeze', '')
(':Tools:i18n', None)
(':Tools:idle', None)
(':Tools:modulator', '')
(':Tools:pynche', None)
(':Tools:scripts', None)
(':Tools:unicode:makeunicodedata.py', '')
(':Tools:versioncheck', None)
(':Tools:webchecker', None)
(':Tools:world', None)
(':acconfig.h', None)
(':config.h.in', None)
(':configure', None)
(':configure.in', None)
(':install-sh', None)
(':jack-scripts', None)
(':loop.py', None)
(':mac2unix.shar', None)
(':pyconfig.h.in', None)
(':pystone.py', None)
(':readmefiles', None)
(':setup.py', None)
(':site-packages', None)
(':Modules:itertoolsmodule.c', None)
(':Modules:_iconv_codec.c', None)
(':Mac:mwerks:mwerks_pyexpat_config.h', None)

View File

@ -1,22 +0,0 @@
* Data
*.Lib
*.MAP
*.SYM
*.dbg
*.hqx
*.idb
*.in
*.lib
*.pyc
*.pyo
*.slb
*.xMAP
*.xSYM
*~[0-9]
.#*
.cvsignore
@*
CVS
Makefile.pre.in
PyIDE-src
[(]*[)]

View File

@ -1,138 +0,0 @@
(':.DS_Store', None)
(':BeOS', None)
(':BuildApplet', None)
(':BuildApplication', None)
(':ConfigurePython', None)
(':ConfigurePythonCarbon', None)
(':ConfigurePythonClassic', None)
(':Demo', '')
(':Doc', None)
(':EditPythonPrefs', None)
(':Extensions:Icon\r', None)
(':Extensions:Imaging', None)
(':Extensions:Pmw', None)
(':Extensions:PyDOM', None)
(':Extensions:audio', None)
(':Extensions:img', '')
(':Extensions:midi', None)
(':Extensions:pyexpat', None)
(':Extensions:saxlib', None)
(':Extensions:xmltok', None)
(':Grammar:Grammar', '')
(':Grammar:Icon\r', None)
(':Grammar:Makefile', None)
(':Icon\r', None)
(':Include', '')
(':LICENSE', '')
(':Lib', '')
(':Mac:.DS_Store', None)
(':Mac:Build', '')
(':Mac:Build:PythonAppletCFM68K', None)
(':Mac:Build:PythonAppletPPC', None)
(':Mac:Build:PythonCFM68K', None)
(':Mac:Build:PythonCoreCFM68K', None)
(':Mac:Build:PythonCorePPC', None)
(':Mac:Build:PythonInterpreterCFM68K', None)
(':Mac:Build:PythonInterpreterPPC', None)
(':Mac:Build:PythonPPC', None)
(':Mac:Compat', '')
(':Mac:Contrib', '')
(':Mac:Demo', '')
(':Mac:Distributions:(vise)', None)
(':Mac:Distributions:68k-shared.exclude', None)
(':Mac:Distributions:68k-shared.include', None)
(':Mac:Distributions:68k-stand.exclude', None)
(':Mac:Distributions:68k-stand.include', None)
(':Mac:Distributions:binary.exclude', '')
(':Mac:Distributions:binary.include', '')
(':Mac:Distributions:dev.exclude', '')
(':Mac:Distributions:dev.include', '')
(':Mac:Distributions:gusi2.exclude', None)
(':Mac:Distributions:gusi2.include', None)
(':Mac:Distributions:readme.txt', '')
(':Mac:Distributions:src.exclude', '')
(':Mac:Distributions:src.include', '')
(':Mac:HISTORY', ':Relnotes:')
(':Mac:IDE scripts', '')
(':Mac:Icon\r', None)
(':Mac:Include', '')
(':Mac:Lib', '')
(':Mac:MPW', '')
(':Mac:Modules', '')
(':Mac:OSX', '')
(':Mac:OSXResources', '')
(':Mac:Python', '')
(':Mac:ReadMe', '')
(':Mac:ReadMe-dev', None)
(':Mac:ReadMe-src', ':ReadMe-src')
(':Mac:Resources', '')
(':Mac:TODO', None)
(':Mac:Tools:CGI', '')
(':Mac:Tools:CGI:BuildCGIApplet', None)
(':Mac:Tools:IDE', None)
(':Mac:Tools:Icon\r', None)
(':Mac:Tools:PyIDE', None)
(':Mac:Tools:bruce', None)
(':Mac:Tools:macfreeze', '')
(':Mac:Wastemods', '')
(':Mac:_checkversion.py', None)
(':Mac:mwerks', '')
(':Mac:mwerks:old', None)
(':Mac:mwerks:projects', None)
(':Mac:scripts', '')
(':Misc', '')
(':Modules', '')
(':Objects', '')
(':PC', None)
(':PCbuild', None)
(':Parser', '')
(':PlugIns', None)
(':Python', '')
(':Python IDE', None)
(':Python68K', None)
(':PythonApplet', None)
(':PythonCarbonStandalone', None)
(':PythonCore', None)
(':PythonCoreCarbon', None)
(':PythonFAT', None)
(':PythonInterpreter', None)
(':PythonInterpreterCarbon', None)
(':PythonInterpreterClassic', None)
(':PythonPPC', None)
(':PythonStandCarbon', None)
(':PythonStandSmall', None)
(':PythonStandSmallCarbon', None)
(':PythonStandSmallShGUSI', None)
(':PythonStandSmallThreading', None)
(':PythonStandalone', None)
(':README', '')
(':RISCOS', None)
(':Tools:Icon\r', None)
(':Tools:README', '')
(':Tools:audiopy', '')
(':Tools:bgen', '')
(':Tools:compiler', '')
(':Tools:faqwiz', '')
(':Tools:freeze', '')
(':Tools:i18n', '')
(':Tools:idle', '')
(':Tools:modulator', '')
(':Tools:pynche', '')
(':Tools:scripts', '')
(':Tools:unicode:makeunicodedata.py', '')
(':Tools:versioncheck', '')
(':Tools:webchecker', '')
(':Tools:world', '')
(':acconfig.h', None)
(':build.mac', None)
(':build.macstand', None)
(':configure', None)
(':install-sh', None)
(':jack-scripts', None)
(':loop.py', None)
(':mac2unix.shar', None)
(':mkapplet', None)
(':pystone.py', None)
(':setup.py', None)
(':site-packages', None)
(':Tools:framer', '')

View File

@ -1,602 +0,0 @@
This file contains the release notes of older MacPython versions.
Changes between 1.4 and 1.3.3
-------------------------------
Aside from all the changes Guido made to the machine-independent part
of Python (see NEWS for those)the following mac-specific changes have
been made:
- Preference file and other items in the System folder now have the
version number in their name, so old and new python installations
can coexist.
- Fixed a GUSI crash when exiting with files open.
- Fixed interference with some extensions that added resources that
looked like ours.
- Fixed slowness of Python in the background.
- About box added (at last...).
- New release of CWGUSI (1.8.0) incorporated. Note that for Tcl/Tk the
4.1p1 release is still used (4.2 was a little too late). Everything
ported to CW10.
- Applets can now turn off argc/argv processing (so they can do their
own initial AppleEvent handling). Applets can also delay opening the
console window until it is actually used (and, hence, not open it at
all by refraining from using it).
- MiniAEFrame: Preliminary AppleScript server support. Example code
provided, including an initial stab at writing CGI scripts in Python.
- macfs: FindApplication() locates application given 4-char creator
code.
- macfs: GetDates and SetDates get and set creation date, etc.
- FrameWork: preferred method of ending mainloop() is calling _quit().
- FrameWork: different menubar handling resulting in less flashing
during menu creation.
- FrameWork: added setarrowcursor and setwatchcursor functions.
- findertools: new module that makes various finder features
available.
- macostools: copy file times too.
- macostools: added touch() to tell finder about changes to a file.
- macerrors: New module with symbolic names for all os-releated
errors.
- EasyDialogs: ProgressBar fixed.
- aetools: start application if needed
- aetools: use aetools.error for server-generated errors, MacOS.error
for communication errors, etc.
- Finder_7_0_Suite: New module with the "simple" finder scripting
interface.
- mac (aka os): xstat() returns resourcesize, creator, type in
addition to stat() information.
- MacOS: added DebugStr method to drop to low-level debugger.
- MacOS: fixed splash() to actually draw the splash box:-)
- Ctl: fixed very nasty bug in DisposeControl and object deletion.
- Dlg: Added GetDialogWindow and other accessor functions
- Waste: fixed bug with object hanlder installation
- Waste: added tab support
- time: added strftime
- twit: a windowing debugger for Python (preliminary release)
- BBPy: a BBEdit extension that send scripts to the Python interpreter,
by Just van Rossum.
The following set of changes were already in place for the 1.4b3
release:
- The standard 68K Python is built for CFM68K. This means that PPC and
68K Python are now largely compatible, both supporting dynamically
loaded modules, python applets, etc.
As a result of this there have been numerous subtle changes in
filenames for PPC plugin modules and such, but these changes should
be transparent to Python programs.
The one missing module in cfm68k is Macspeech, for which no CFM68K
interface library is available (yet?).
- Raise MemoryError on stack overflow.
- Python now always uses 8-byte doubles.
- Removed mactcp, macdnr and stdwin modules from standard
distribution.
- New releases of Tcl/Tk (4.1p1), CWGUSI (1.7.2) and Waste (1.2f) have
been incorporated.
- Macfs.SetFolder method added, which sets initial folder for standard
file dialogs.
- New py_resource module to handle PYC resources.
- List mgr objects "selFlags" and "listFlags" members now accessible.
- QuickDraw got a few new symbolic constants.
- Qt and Cm modules now live in a separate dynamically loadable
module, so other toolbox modules work if you don't have QuickTime
installed.
- Old sound mgr calls {Set,Get}SoundVol removed, version number
interface changed.
- Added convenience routines setarrowcursor and setwatchcursor to
FrameWork.
- Bugfixes to time.sleep(), FrameWork, macostools,
- Minor fixes/additions/updates to demos and documentation in the Demo
folder.
- Internal changes:
- Ported to CW9
- mwerks_????_config.h organization rationalized
- Projects renamed to reflect architecture (ppc, cfm68k, 68k).
- various defines (HAVE_CONFIG_H, USE_MAC_DYNAMIC_LOADING) no longer
needed.
- shared-library architecture made more conforming to metrowerks
documentation. Check xx plugin projects if you have built your own
dynamically loaded modules.
Changes between 1.3.3 and 1.3.2
--------------------------------
A major change since 1.3.2 is in the organization of the files: The
Mac folder has mac-specific demo programs, attempts at documentation and
more. Browse the HTML files in Mac:Demo for more info.
Also, Toolbox:bgen is not needed anymore for normal use: the relevant
python modules have been moved to Mac:Lib:toolbox.
Other changes:
- Uses final Tk 4.1 and Tcl 7.5 distributions.
- Override preferences (stored in the interpreter/applet application)
allow overriding of system-wide preferences. Explained in
"using.html".
- New functionality in FrameWork.py:
- ScrolledWindow class
- enable(), settext(), setitem(), setmark(), seticon(),
checkmenu() and delete() methods for menu entries.
- event parameter added to idle() method
- windowbounds() function helps programmer with staggering windows.
- Erase only visRgn on an update event.
- TextEdit interface module added
- Waste interface module added
- Demos for waste, including skeleton for html editor
- Scrap manager interface added
- Ctl.FindControl() could return reference to deleted object. Fixed.
- GrafPorts have an _id attribute (address of grafport) allowing them
to be compared (since a new python object is created each time).
- Standard File folder no longer changed on chdir() (this was
introduced in 1.3.2).
- sys.argv can now be set if you option-drag or option-click a python
source.
- Various dialogs now have sensible defaults.
- binhextree is now a bit more intelligent about when to binhex.
- gensuitemodule fixed to hand '****' type arguments.
Changes between 1.3.2 and 1.3.1
-------------------------------
The main reason for the 1.3.2 distribution is the availability of Tk
for the mac. The Tk port and its integration in Python is definitely
not bug-free, hence this distribution should be treated as beta
software at best.
Another major change in this release is that the Python I/O system is
now based on the GUSI library. This is an I/O library that attempts to
mimic a Posix I/O system. Hence, modules like socket and select are
now available in MacPython. If you build dynamically loaded modules
and you use any unix-like feature such as stat() calls you should
compile using the GUSI include files.
A third major change is that the MacOS creator code has been changed
from 'PYTH' to 'Pyth', due to a conflict. This means that you will
have to change the creator of all your old python programs. The
distribution contains a script "FixCreator.py" that does this
recursively for a whole folder.
Here are all the changes since 1.3.1, in no particular order:
- complex number support added
- cmath module added
- startup options ("option-drag" dialog) can be retrieved from the
preferences file. EditPythonPrefs hasn't been updated yet, though.
- Creator changed from PYTH to Pyth
- {mac,os}.unlink is now also called {mac,os}.remove
- {mac,os}.mkdir second arg optional
- dup and fdopen calls added
- select module added
- socket module added
- open(file, '*r') for opening resource forks has been removed. It is
replaced by MacOS.openrf(file, 'r'), which returns a simple
file-like object to read (or write) resource forks.
- Added AppleEvent URL suite
- Added AppleEvent netscape suite
- QuickDraw globals are now all accessible, as Qd.qd.xxxx
Mac-specific changes between 1.3 and 1.3.1
--------------------------------------
Aside from the changes mentioned here there have also been some
changes in the core python, but these are not documented here.
However, these changes are mainly bugfixes, so there shouldn't be any
incompatabilities.
- imgsgi and imgpbm modules added
- Various hooks installed to allow integration with MacTk (currently
disabled)
- Added support for MacOS Fixed type in toolbox arguments (represented
as floats in python)
- Added option to keep output window open on normal termination
- Decreased minimum heapsize to run interpreter
- Added progress-bar to EasyDialogs
- Fixed socket.getportname()
- Renamed MACTCP.py to MACTCPconst.py
- Many fixes to FrameWork.py:
- Added window.SetPort() method
- Added optional bounds and resid parameters to Window.open()
- Fixed apple-menu DA handling
- Fixed activate-event handling
- Added default Application.makeusermenus() (File:Quit only)
- Fixed bug with keyboard input handling
- added idle() method, called from event loop if there are no events
pending
Toolbox modules:
- component manager module added
- quicktime module added
- font manager module added
- Added color window support
- Added support to obtain pixmap from a window
- Added BitMap type
- Added GrafPort type
- Added support for PenState, Patterns, FontInfo, RGB colors,
- Fixed GetPen and SetPt arguments
- Added read access to members of {C}GrafPort objects
- Added support for cursors
- Provide access to some QuickDraw globals
- Fixed InsetRect, OffsetRect, MapRect
- Added support for various handles such as PatHandle, CursHandle
- Added functions to access members of Window objects
Changes since 1.3beta3
----------------------
- MkPluginAliases.py now works in a virgin distribution environment. It is
also distributed as an applet.
- hexbin from binhex.py has been fixed
- various bits and pieces in readme files clarified
- mkapplet bug wrt owner resource (and, hence, trouble starting applets) fixed.
- Compiled with CodeWarrior 7.
- AE client modules generated with gensuitemodule.py now use keyword args.
- img modules updated to latest version (including pbm and sgi support).
- Everything compiled with all optimization options available. Let me know
if you suspect errors that are due to this.
Changes since Python 1.2 for the mac
------------------------------------
- PPC python now uses a shared library organization. This allows the
creation of dynamically loadable extension modules (contact me) and
creation of python applets (see mkapplet.py). A number of previously
builtin modules are now dynamically loaded. Dynamically loaded
modules are distributed in the PlugIns folder.
- Python modules can live in 'PYC ' resources (with a name equal to the
module name, so many modules can live in a single file). If you put a
file (in stead of a folder) in sys.path its resources will be searched.
See the PackLibDir script for creating such a file.
- new binhex module (partially working, hexbin has problems)
- Python now has a Preferences file, editable with
EditPythonPrefs. Remembered are the python 'home folder' and the
initial value for sys.path. If no preferences file is found a simple
one is created.
NOTE: this only works correctly if you start python the first time
from the correct folder.
- new img modules, to read/write/convert images in various formats
- new MacOS toolbox modules: AE, Ctl, Dlg, Event, List, Qd, Res, Snd
and Win. These provide access to various of the MacOS toolbox
interfaces. No documentation yet, but the __doc__ strings provide at
least the calling sequence (and Inside Mac will give you the
semantics). Minimal demos are provided for most toolbox interfaces,
and the 'scripts' directory has some more examples.
- AppleEvent client interfaces can be generated from aete/aeut
resources. No support for objects yet, nor for server interfaces.
- Lib:mac:FrameWork.py has an application framework (under
construction).
- (PPC Only) support for building Python applets: tiny standalone
python applications.
- fp = open(filename, '*r') opens resource-fork of a file for reading
(and similar for writing).
- option-dragging a file to the interpreter (or immedeately pressing
<option> after launching python) will bring up an Options dialog
allowing you to set options like import-tracing, etc.
- MacOS module method added: GetErrorString(OSErr) -> error string
- There is now a numbering convention for resource-ID's:
128-255 Resources used by the interpreter itself
256-511 Resources used by standard modules
512- Resources for applications
- macfs module changes:
- StandardGetFile without type arguments now shows all files
- PromptGetFile(prompt, ...) is like StandardGetFile but with a
prompt
- GetDirectory (let user select a folder) added
- GetFInfo and SetFInfo methods of FSSpec objects get/set finder
info. FInfo objects have attributes Creator, Type, etc.
- FindFolder (locate trash/preferences/etc) added
- mactcp/macdnr changes: bug fix wrt idle-loop.
- EditPythonPrefs script: change initial sys.path and python home
folder
- (PPC only) MkPluginAliases: Setup aliases for dynamically loadable
modules that live in a single shared library
- PackLibDir: Convert Lib directory to a single resource file
containing all .pyc code
- fixfiletypes: Set file types based on file extension over a whole
tree.
- RunLibScript: Run any script as main program, optionally redirecting
stdin/stdout, supplying arguments, etc.
- binhextree: Binhex all files in a tree, depending on the extension.
- (PPC only) mkapplet: Create a python applet from a sourcefile and
(optional) resourcefile.
PYTHON 1.2 FOR THE MACINTOSH
****************************
Python can be built on the Mac using either THINK C 6.0 (or 7.0), or
CodeWarrior 5.0 (for 68K and PPC). In the past it has also been compiled
with earlier versions of Think, but no guarantees are made that the
source is still compatible with those versions. (Think C 5.0 appears
to be OK.) Likewise, new compiler versions may effectively change the
language accepted (or the library provided!) and thus cause problems.
MPW is a special case -- it used to be possible to build Python as
an MPW tool using MPW 3.2, and this may still work, but I haven't
tried this lately. What I have tried, however, is building Python
as a shared library for CFM-68K, using the Symantec C compiler for MPW.
See subdirectory MPW and the README file there for more info.
1. Using Think C 6.0 (or 7.0)
=============================
1.1 The directory structure
---------------------------
I duplicate the UNIX directory structure from the distribution. The
subdirectories needed to compile are: Mac, Include, Parser, Python,
Objects, Modules. (Don't bother with Grammar and the parser
generator, nor with the Doc subdirectory.)
For running and testing, you also need Lib and its subdirectories test
and stdwin. You could also copy some things from the Demo/stdwin
directory (unfortunately most other demos are UNIX specific and even
many stdwin demos are).
Make sure there is no config.c file in the Modules subdirectory (if
you copy from a directory where you have done a UNIX build this might
occur). Also don't use the config.h generated on UNIX.
1.2 The project file
--------------------
I put all source files in one project, which I place in the parent
directory of the source directories.
1.2.1 Project type
(This is the Set Project Type... dialog in the Project menu.)
Set the creator to PYTH; turn on "far data"; leave "far code" and
"separate strs" unchecked (they just serve to bloat the application).
A partition size of 1000K should be enough to run the standard test
suite (which requires a lot of memory because it stress tests the
parser quite a bit) and most demos or medium-size applications. The
interpreter will do basic things in as little at 500K but this may
prevent parsing larger modules.
1.2.2 Compiler options
(This is the Options -> THINK C ... dialog in the Edit menu.)
- Start with Factory Settings.
- In the Prefix, remove #include <MacHeaders> and add
#define HAVE_CONFIG_H
- Choose any optimizer and debugger settings you like. - You
can choose 4-byte ints if you want. This requires that you
rebuild the ANSI and unix libraries with 4-bytes ints as well
(better make copies with names like ANSI 32 bit). With 4-byte
ints the interpreter is marginally bigger and somewhat (~10%)
slower, but Python programs can use strings and lists with
more than 32000 items (with 2-byte ints these can cause
crashes). The range of Python integers is not affected (these
are always represented as longs). In fact, nowadays I always
use 4-byte integers, since it is actually rather annoying that
strings >= 64K cause crashes.
1.2.3 Files to add
(This is the Add Files... dialog in the Source menu.)
The following source files must be added to the project. I use a
separate segment for each begin letter -- this avoids segment
overflow, except for 'c', where you have to put either ceval.c or
compile.c in a separate segment. You could also group them by
subdirectory or function, but you may still have to split segments
arbitrarily because of the 32000 bytes restriction.
- From Mac: all .c files.
- From Parser: acceler.c, grammar1.c,
myreadline.c, node.c, parser.c, parsetok.c, tokenizer.c.
- From Python: bltinmodule.c, ceval.c, cgensupport.c,
compile.c, errors.c, getargs.c getopt.c, graminit.c, import.c,
importdl.c, marshal.c, modsupport.c, mystrtoul.c,
pythonmain.c, pythonrun.c, sigcheck.c, structmember.c,
sysmodule.c, traceback.c (i.e. all .c files except dup2.c,
fmod.c, frozenmain.c, getcwd.c, getmtime.c, memmove.c,
sigcheck.c, strerror.c, strtod.c, thread.c)
- From Objects: all .c files except xxobject.c.
- From Modules: all the modules listed in config.c (in the Mac
subdirectory) in the initializer for inittab[], before
"ADDMODULE MARKER 2". Also add md5c.c if you add md5module.c,
and regexpr.c if you add regexmodule.c. (You'll find
macmodule.c in the Mac subdirectory, so it should already have
been added in a previous step.) Note that for most modules,
the source file is called <name>module.c, but for a few long
module names it is just <module>.c. Don't add stdwinmodule.c
yet,
The following THINK C libraries must be added: from Standard
Libraries, ANSI and unix; from Mac Libraries, MacTraps. I put each
library in a separate segment. Also see my earlier remark on 4-byte
ints.
1.4 Adding STDWIN
-----------------
STDWIN is built in two separate projects: stdwin.pi contains the core
STDWIN implementation from Ports/mac, textedit.pi contains the files
from Packs/textedit. Use the same compiler options as for Python and
the same general source setup (in a sister directory of the toplevel
Python directory). Put all sources in the same segment. To
stdwin.pi, also add Tools/strdup.c and Gen/wtextbreak.c.
The two projects can now be added as libraries to the Python project.
You must also add stdwinmodule.c and add "#define USE_STDWIN" to the
Prefix in the compiler options dialog (this only affects macmain.c and
config.c).
Note that stdwinmodule.c contains an #include statement that
references "stdwin.h" by relative path name -- if the stdwin toplevel
directory is not a sibling of the python toplevel directory, you may
have to adjust the number of colons in the pathname.
1.5 Resources
-------------
Since I created them with ResEdit I have no text source of the
resources needed to give the application an icon etc... You can copy
the size, bundle, file reference and icon resources from the
distributed Python application with ResEdit. THINK C automatically
copies resources into the application file from a file
<projectname>.rsrc.
1.6 Think C 5.0
---------------
Tim Gilbert adds one note that will be helpful to future Think C 5.0
users: When you have a really big project like python, and you want to
compile and run it, if you just hit Command-R, often Think C will
compile the remaining files, think for a moment, and then give you a
warning "internal error(ZREF)--please remove objects." Don't listen
to it. It is lying. What you should do instead is "Check Link..."
and _then_ hit Run. Why? Ask Symantec.
2. Using MicroWerks CodeWarrior 5.0
===================================
Essentially, follow the instructions for Think C.
XXX Should at least list the project options.
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>
PYTHON RELEASE NOTES FOR THE MACINTOSH
VERSION 1.1
For the most part, Python on the Mac works just like Python under UNIX.
The most important differences are:
- Since there is no shell environment on the Mac, the start-up file
has a fixed name: PythonStartup. If a file by this name exists
(either in the current folder or in the system folder) it is executed
when an interactive interpreter is started.
- The default search path for modules is different: first the current
directory is searched, then the subdirectories 'lib', 'lib:stdwin' and
'demo'. As always, you can change this (e.g. in your PythonStartup
file) by assigning or appending to sys.path -- use Macintosh pathnames!
(The default contains no absolute paths because these are unlikely
to make sense on other people's hard disks.)
- The user interface for typing interactive commands is different.
This is actually the THINK C console I/O module, which is based on
the Mac toolbox TextEdit. A standard Edit menu provides Cut, Copy,
Paste and Clear (Undo is only there for Desk Accessories). A minimal
File menu provides Quit, which immediately exits the application,
without the usual cleanup. You can Copy from previous output,
but you can't scroll back beyond the 24x80 screen. The TAB key
always brings you to the end of the current input line; indentation
must be entered with spaces (a single space is enough).
End-of-file is generated by Command-D; Command-Period interrupts.
There is an annoying limit in the length of an input line to a single
screen line (less the prompt). Use \ to input long statements.
Change your program if it requires long lines typed on input.
Even though there is no resize box, the window can be resized by
dragging its bottom right corner, but the maximum size is 24x80.
- Tabs in module files are interpreted as 4 (four!) spaces. This is
consistent with most Mac editors that I know. For individual files
you can change the tab size with a comment like
# vi:set tabsize=8:
(exactly as shown here, including the colons!). If you are consistent
in always using tabs for indentation on UNIX, your files will be
parsed correctly on the Mac, although they may look funny if you
have nicely lined-up comments or tables using tabs. Never using tabs
also works. Mixing tabs and spaces to simulate 4-character indentation
levels is likely to fail.
- You can start a script from the Finder by selecting the script and
the Python interpreter together and then double clicking. If you
make the owner of the script PYTH (the type should always be TEXT)
Python will be launched if you double click it!
There is no way to pass command line arguments to Python scripts.
- The set of built-in modules is different:
= Operating system functions for the 'os' module is provided by the
built-in module 'mac', not 'posix'. This doesn't have all the
functions from posix, for obvious reasons (if you know the Mac
O/S a little bit). The functions in os.path are provided by
macpath, they know about Mac pathnames etc.
= None of the UNIX specific modules ('socket', 'pwd', 'grp' etc.)
exists.
= Module 'stdwin' is always available. It uses the Mac version of
STDWIN, which interfaces directly with the Mac toolbox. The most
important difference is in the font names; setfont() has a second
argument specifying the point size and an optional third one
specifying the variation: a single letter character string,
'i' for italics, 'b' for bold. Note that when STDWIN is waiting
for events, the standard File and Edit menus are inactive but
still visible, and (most annoyingly) the Apple menu is also inactive;
conversely, menus put up by STDWIN are not active when the Python is
reading from the keyboard. If you open Python together with a text
file containing a Python script, the script will be executed and
a console window is only generated when the script uses standard
input or output. A script that uses STDWIN exclusively for its I/O
will have a working Apple menu and no extraneous File/Edit menus.
(This is because both stdwin and stdio try to initialize the
windowing environment; whoever gets there first owns the Apple menu.)
LIMITATIONS: a few recent additions to STDWIN for X11 have not yet
been added to the Mac version. There are no bitmap objects, and
the setwinpos() and setwinsize() methods are non--functional.
- Because launching an application on the Mac is so tedious, you will
want to edit your program with a desk accessory editor (e.g., Sigma
edit) and test the changed version without leaving Python. This is
possible but requires some care. Make sure the program is a module
file (filename must be a Python identifier followed by '.py'). You
can then import it when you test it for the first time. There are
now three possibilities: it contains a syntax error; it gets a runtime
error (unhandled exception); or it runs OK but gives wrong results.
(If it gives correct results, you are done testing and don't need
to read the rest of this paragraph. :-) Note that the following
is not Mac-specific -- it's just that on UNIX it's easier to restart
the entire script so it's rarely useful.
Recovery from a syntax error is easy: edit the file and import it
again.
Recovery from wrong output is almost as easy: edit the file and,
instead of importing it, call the function reload() with the module
name as argument (e.g., if your module is called foo, type
"reload(foo)").
Recovery from an exception is trickier. Once the syntax is correct,
a 'module' entry is placed in an internal table, and following import
statements will not re-read the file, even if the module's initialization
terminated with an error (one reason why this is done is so that
mutually recursive modules are initialized only once). You must
therefore force re-reading the module with reload(), however, if this
happens the first time you try to import the module, the import statement
itself has not completed, and your workspace does not know the module
name (even though the internal table of moduesl does!). The trick is
to first import the module again, then reload it. For instance,
"import foo; reload(foo)". Because the module object already exists
internally, the import statement does not attempt to execute the
module again -- it just places it in your workspace.
When you edit a module you don't have to worry about the corresponding
'.pyc' file (a "compiled" version of the module, which loads much faster
than the textual version): the interpreter notices that the '.py' file
has changed (because its modification time has changed) and ignores the
'.pyc' file. When parsing is successful, a new '.pyc' file is written;
if this fails (no write permission, disk full or whatever) it is
silently skipped but attempted again the next time the same module
is loaded. (Thus, if you plan to place a Python library on a read-only
disk, it is advisable to "warm the cache" by making the disk writable
and importing all modules once. The standard module 'importall' helps
in doing this.)

View File

@ -1,43 +0,0 @@
/***********************************************************
Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#ifndef Py_GETAPPLBYCREATOR_H
#define Py_GETAPPLBYCREATOR_H
#ifdef WITHOUT_FRAMEWORKS
#include <Types.h>
#include <Files.h>
#else
#include <Carbon/Carbon.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern OSErr FindApplicationFromCreator(OSType, FSSpecPtr);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1 +0,0 @@
#define BUILD 154

View File

@ -1,46 +0,0 @@
/* Useful #includes and #defines for programming a set of Unix
look-alike file system access functions on the Macintosh.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
*/
#ifndef Py_MACDEFS_H
#define Py_MACDEFS_H
#include <Types.h>
#include <Files.h>
#include <OSUtils.h>
#include <errno.h>
#include <string.h>
#ifdef __MWERKS__
#include "errno_unix.h"
#include <TextUtils.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* We may be able to use a std routine in think, don't know */
extern unsigned char *Pstring(char *);
extern char *getbootvol(void);
extern char *getwd(char *);
#ifndef USE_GUSI
extern int sync(void);
#endif
/* Universal constants: */
#define MAXPATH 256
#ifndef __MSL__
#define TRUE 1
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
#define EOS '\0'
#define SEP ':'
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,780 +0,0 @@
/***********************************************************
Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
/* config.h for Macintosh.
Valid only for CodeWarrior.
There's no point in giving exact version numbers of the compilers
since we don't update this file as each compiler comes out;
with CodeWarrior, we generally use the most recent version.
*/
#define USE_STACKCHECK
/* Define if on Macintosh (MPW or __MWERKS__ should also be defined) */
#ifndef macintosh
#define macintosh
#endif
#if defined(USE_GUSI2)
#define USE_GUSI
#endif
#ifndef USE_GUSI
#define DONT_HAVE_SYS_TYPES_H
#define DONT_HAVE_SYS_STAT_H
#define HAVE_STAT_H
#endif
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 1
/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r
and you want support for AIX C++ shared extension modules. */
#undef AIX_GENUINE_CPLUSPLUS
/* Define if your <unistd.h> contains bad prototypes for exec*()
(as it does on SGI IRIX 4.x) */
#undef BAD_EXEC_PROTOTYPES
/* Define if your compiler botches static forward declarations */
#define BAD_STATIC_FORWARD
/* Define this if you have BeOS threads */
#undef BEOS_THREADS
/* Define if you have the Mach cthreads package */
#undef C_THREADS
/* Define to `long' if <time.h> doesn't define. */
#undef clock_t
/* Defined on Solaris to see additional function prototypes. */
#undef __EXTENSIONS__
/* Define if getpgrp() must be called as getpgrp(0). */
#undef GETPGRP_HAVE_ARG
/* Define if gettimeofday() does not have second (timezone) argument
This is the case on Motorola V4 (R40V4.2) */
#undef GETTIMEOFDAY_NO_TZ
/* Define this if your time.h defines altzone */
#undef HAVE_ALTZONE
/* Define if --enable-ipv6 is specified */
#undef ENABLE_IPV6
/* Define if sockaddr has sa_len member */
#undef HAVE_SOCKADDR_SA_LEN
/* struct addrinfo (netdb.h) */
#undef HAVE_ADDRINFO
/* struct sockaddr_storage (sys/socket.h) */
#undef HAVE_SOCKADDR_STORAGE
/* Defined when any dynamic module loading is enabled */
/* #undef HAVE_DYNAMIC_LOADING */
/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */
#undef HAVE_GETC_UNLOCKED
/* Define this if you have some version of gethostbyname_r() */
#undef HAVE_GETHOSTBYNAME_R
/* Define this if you have the 3-arg version of gethostbyname_r() */
#undef HAVE_GETHOSTBYNAME_R_3_ARG
/* Define this if you have the 5-arg version of gethostbyname_r() */
#undef HAVE_GETHOSTBYNAME_R_5_ARG
/* Define this if you have the 6-arg version of gethostbyname_r() */
#undef HAVE_GETHOSTBYNAME_R_6_ARG
/* Defined to enable large file support when an off_t is bigger than a long
and long long is available and at least as big as an off_t. You may need
to add some flags for configuration and compilation to enable this mode.
E.g, for Solaris 2.7:
CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" OPT="-O2 $CFLAGS" \
configure
*/
#undef HAVE_LARGEFILE_SUPPORT
/* Define this if you have the type long long */
#define HAVE_LONG_LONG
/* Define if your compiler supports function prototypes */
#define HAVE_PROTOTYPES 1
/* Define if you have GNU PTH threads */
#undef HAVE_PTH
/* Define if you have readline 4.2 */
#undef HAVE_RL_COMPLETION_MATCHES
/* Define if your compiler supports variable length function prototypes
(e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */
#define HAVE_STDARG_PROTOTYPES
/* Define this if you have the type uintptr_t */
#undef HAVE_UINTPTR_T
/* Define if you have a useable wchar_t type defined in wchar.h; useable
means wchar_t must be 16-bit unsigned type. (see
Include/unicodeobject.h). */
#define HAVE_USABLE_WCHAR_T 1
/* Define if the compiler provides a wchar.h header file. */
#define HAVE_WCHAR_H 1
/* Define if you want to have a Unicode type. */
#define Py_USING_UNICODE 1
/* Define as the integral type used for Unicode representation. */
#define PY_UNICODE_TYPE wchar_t
/* Define as the size of the unicode type. */
#define Py_UNICODE_SIZE 2
/* Define if nice() returns success/failure instead of the new priority. */
#undef HAVE_BROKEN_NICE
/* Define if malloc(0) returns a NULL pointer */
#ifdef USE_MSL_MALLOC
#define MALLOC_ZERO_RETURNS_NULL
#else
#undef MALLOC_ZERO_RETURNS_NULL
#endif
/* Define if you have POSIX threads */
#ifdef USE_GUSI2
#define _POSIX_THREADS
#endif
/* Define if you want to build an interpreter with many run-time checks */
#undef Py_DEBUG
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT
/* Define if setpgrp() must be called as setpgrp(0, 0). */
#undef SETPGRP_HAVE_ARG
/* Define to empty if the keyword does not work. */
#undef signed
/* Define if i>>j for signed int i does not extend the sign bit
when i < 0
*/
#define SIGNED_RIGHT_SHIFT_ZERO_FILLS
/* The number of bytes in an off_t. */
#define SIZEOF_OFF_T 4
/* The number of bytes in a time_t. */
#define SIZEOF_TIME_T 4
/* The number of bytes in a pthread_t. */
#ifdef USE_GUSI2
#define SIZEOF_PTHREAD_T 4
#endif
/* Define to `int' if <sys/types.h> doesn't define. */
#undef socklen_t
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
(which you can't on SCO ODT 3.0). */
#undef SYS_SELECT_WITH_SYS_TIME
/* Define if a va_list is an array of some kind */
#undef VA_LIST_IS_ARRAY
/* Define to empty if the keyword does not work. */
#undef volatile
/* Define if you want SIGFPE handled (see Include/pyfpe.h). */
#undef WANT_SIGFPE_HANDLER
/* Define if you want wctype.h functions to be used instead of the
one supplied by Python itself. (see Include/unicodectype.h). */
#undef WANT_WCTYPE_FUNCTIONS
/* Define if you want cross-platform newline support for reading */
#define WITH_UNIVERSAL_NEWLINES
/* Define if you want to emulate SGI (IRIX 4) dynamic linking.
This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
Sequent Symmetry (Dynix), and Atari ST.
This requires the "dl-dld" library,
ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
as well as the "GNU dld" library,
ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
Don't bother on SunOS 4 or 5, they already have dynamic linking using
shared libraries */
#undef WITH_DL_DLD
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
dynamic linker (dyld) instead of the old-style (NextStep) dynamic
linker (rld). Dyld is necessary to support frameworks. */
#undef WITH_DYLD
/* Define if you want to compile in Python-specific mallocs */
#define WITH_PYMALLOC 1
/* Define if you want to produce an OpenStep/Rhapsody framework
(shared library plus accessory files). */
#undef WITH_NEXT_FRAMEWORK
/* Define if you want to use MacPython modules on MacOSX in unix-Python */
#define USE_TOOLBOX_OBJECT_GLUE
/* Define if you want to use SGI (IRIX 4) dynamic linking.
This requires the "dl" library by Jack Jansen,
ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
Don't bother on IRIX 5, it already has dynamic linking using SunOS
style shared libraries */
#undef WITH_SGI_DL
/* Define if you want to compile in rudimentary thread support */
/* #undef WITH_THREAD */
/* The number of bytes in a char. */
#define SIZEOF_CHAR 1
/* The number of bytes in a double. */
#define SIZEOF_DOUBLE 8
/* The number of bytes in a float. */
#define SIZEOF_FLOAT 4
/* The number of bytes in a fpos_t. */
#define SIZEOF_FPOS_T 4
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* The number of bytes in a short. */
#define SIZEOF_SHORT 2
/* The number of bytes in a uintptr_t. */
#define SIZEOF_UINTPTR_T 4
/* The number of bytes in a void *. */
#define SIZEOF_VOID_P 4
/* Define if you have the _getpty function. */
#undef HAVE__GETPTY
/* Define if you have the alarm function. */
#undef HAVE_ALARM
/* Define if you have the chown function. */
#undef HAVE_CHOWN
/* Define if you have clock. */
#define HAVE_CLOCK
/* Define if you have the confstr function. */
#undef HAVE_CONFSTR
/* Define if you have the ctermid function. */
#undef HAVE_CTERMID
/* Define if you have the ctermid_r function. */
#undef HAVE_CTERMID_R
/* Define if you have the dlopen function. */
#undef HAVE_DLOPEN
/* Define if you have the dup2 function. */
#undef HAVE_DUP2
/* Define if you have the execv function. */
#undef HAVE_EXECV
/* Define if you have the fdatasync function. */
#undef HAVE_FDATASYNC
/* Define if you have the flock function. */
#undef HAVE_FLOCK
/* Define if you have the fork function. */
#undef HAVE_FORK
/* Define if you have the forkpty function. */
#undef HAVE_FORKPTY
/* Define if you have the fpathconf function. */
#undef HAVE_FPATHCONF
/* Define if you have the fseek64 function. */
#undef HAVE_FSEEK64
/* Define if you have the fseeko function. */
#undef HAVE_FSEEKO
/* Define if you have the fstatvfs function. */
#undef HAVE_FSTATVFS
/* Define if you have the fsync function. */
#define HAVE_FSYNC
/* Define if you have the ftell64 function. */
#undef HAVE_FTELL64
/* Define if you have the ftello function. */
#undef HAVE_FTELLO
/* Define if you have the ftime function. */
#undef HAVE_FTIME
/* Define if you have the ftruncate function. */
#ifdef USE_GUSI
#define HAVE_FTRUNCATE
#endif
/* Define if you have the getcwd function. */
#define HAVE_GETCWD
/* Define if you have the getgroups function. */
#undef HAVE_GETGROUPS
/* Define if you have the gethostbyname function. */
#ifdef USE_GUSI
#define HAVE_GETHOSTBYNAME 1
#endif
/* Define if you have the getlogin function. */
#undef HAVE_GETLOGIN
/* Define if you have the getnameinfo function. */
#undef HAVE_GETNAMEINFO
/* Define if you have the getpeername function. */
#ifdef USE_GUSI
#define HAVE_GETPEERNAME
#endif
/* Define if you have the getpgid function. */
#undef HAVE_GETPGID
/* Define if you have the getpgrp function. */
#undef HAVE_GETPGRP
/* Define if you have the getpid function. */
#undef HAVE_GETPID
/* Define if you have the getpriority function. */
#undef HAVE_GETPRIORITY
/* Define if you have the getpwent function. */
#undef HAVE_GETPWENT
/* Define if you have the gettimeofday function. */
#ifdef USE_GUSI
#define HAVE_GETTIMEOFDAY
#endif
/* Define if you have the getwd function. */
#undef HAVE_GETWD
/* Define if you have the hstrerror function. */
#undef HAVE_HSTRERROR
/* Define if you have the hypot function. */
#define HAVE_HYPOT
/* Define if you have the inet_pton function. */
#undef HAVE_INET_PTON
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the link function. */
#undef HAVE_LINK
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the mkfifo function. */
#undef HAVE_MKFIFO
/* Define if you have the mktime function. */
#define HAVE_MKTIME
/* Define if you have the mremap function. */
#undef HAVE_MREMAP
/* Define if you have the nice function. */
#undef HAVE_NICE
/* Define if you have the openpty function. */
#undef HAVE_OPENPTY
/* Define if you have the pathconf function. */
#undef HAVE_PATHCONF
/* Define if you have the pause function. */
#undef HAVE_PAUSE
/* Define if you have the plock function. */
#undef HAVE_PLOCK
/* Define if you have the poll function. */
#undef HAVE_POLL
/* Define if you have the pthread_init function. */
#undef HAVE_PTHREAD_INIT
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the readlink function. */
#undef HAVE_READLINK
/* Define if you have the select function. */
#ifdef USE_GUSI
#define HAVE_SELECT
#endif
/* Define if you have the setegid function. */
#undef HAVE_SETEGID
/* Define if you have the seteuid function. */
#undef HAVE_SETEUID
/* Define if you have the setgid function. */
#undef HAVE_SETGID
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the setpgid function. */
#undef HAVE_SETPGID
/* Define if you have the setpgrp function. */
#undef HAVE_SETPGRP
/* Define if you have the setregid function. */
#undef HAVE_SETREGID
/* Define if you have the setreuid function. */
#undef HAVE_SETREUID
/* Define if you have the setsid function. */
#undef HAVE_SETSID
/* Define if you have the setuid function. */
#undef HAVE_SETUID
/* Define if you have the setvbuf function. */
#define HAVE_SETVBUF
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the siginterrupt function. */
#undef HAVE_SIGINTERRUPT
/* Define if you have the sigrelse function. */
#undef HAVE_SIGRELSE
/* Define if you have the snprintf function. */
#define HAVE_SNPRINTF
/* Define if you have the statvfs function. */
#undef HAVE_STATVFS
/* Define if you have the strdup function. */
#define HAVE_STRDUP
/* Define if you have the strerror function. */
#define HAVE_STRERROR
/* Define if you have the strftime function. */
#define HAVE_STRFTIME
/* Define if you have the strptime function. */
#undef HAVE_STRPTIME
/* Define if you have the symlink function. */
#undef HAVE_SYMLINK
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the tcgetpgrp function. */
#undef HAVE_TCGETPGRP
/* Define if you have the tcsetpgrp function. */
#undef HAVE_TCSETPGRP
/* Define if you have the tempnam function. */
#undef HAVE_TEMPNAM
/* Define if you have the timegm function. */
#undef HAVE_TIMEGM
/* Define if you have the times function. */
#undef HAVE_TIMES
/* Define if you have the tmpfile function. */
#define HAVE_TMPFILE
/* Define if you have the tmpnam function. */
#define HAVE_TMPNAM
/* Define if you have the tmpnam_r function. */
#undef HAVE_TMPNAM_R
/* Define if you have the truncate function. */
#define HAVE_TRUNCATE
/* Define if you have the uname function. */
#undef HAVE_UNAME
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
/* Define if you have the <db.h> header file. */
#undef HAVE_DB_H
/* Define if you have the <db1/ndbm.h> header file. */
#undef HAVE_DB1_NDBM_H
/* Define if you have the <db_185.h> header file. */
#undef HAVE_DB_185_H
/* Define if you have the <dirent.h> header file. */
#ifdef USE_GUSI
#define HAVE_DIRENT_H
#endif
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <gdbm/ndbm.h> header file. */
#undef HAVE_GDBM_NDBM_H
/* Define if you have the <libutil.h> header file. */
#undef HAVE_LIBUTIL_H
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H
/* Define if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H
/* Define if you have the <ndbm.h> header file. */
#undef HAVE_NDBM_H
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define if you have the <pthread.h> header file. */
#ifdef USE_GUSI2
#define HAVE_PTHREAD_H
#endif
/* Define if you have the <pty.h> header file. */
#undef HAVE_PTY_H
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H
/* Define if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the <sys/audioio.h> header file. */
#undef HAVE_SYS_AUDIOIO_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/lock.h> header file. */
#undef HAVE_SYS_LOCK_H
/* Define if you have the <sys/modem.h> header file. */
#undef HAVE_SYS_MODEM_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#ifdef USE_GUSI
#define HAVE_SYS_SOCKET_H
#endif
/* Define if you have the <sys/time.h> header file. */
#ifdef USE_GUSI
#define HAVE_SYS_TIME_H
#endif
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
/* Define if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <thread.h> header file. */
#undef HAVE_THREAD_H
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
/* Define if you have the <utime.h> header file. */
#define HAVE_UTIME_H
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the dld library (-ldld). */
#undef HAVE_LIBDLD
/* Define if you have the ieee library (-lieee). */
#undef HAVE_LIBIEEE
#ifdef __CYGWIN__
#ifdef USE_DL_IMPORT
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#else
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
#endif
#endif

View File

@ -1,140 +0,0 @@
"""A slow but simple dbm clone for the Mac.
For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).
XXX TO DO:
- reclaim free space (currently, space once occupied by deleted or expanded
items is never reused)
- support concurrent access (currently, if two processes take turns making
updates, they can mess up the index)
- support efficient access to large databases (currently, the whole index
is read when the database is opened, and some updates rewrite the whole index)
- support opening for read-only (flag = 'm')
"""
_os = __import__('os')
import __builtin__
_open = __builtin__.open
_BLOCKSIZE = 512
class _Database:
def __init__(self, file):
self._dirfile = file + '.dir'
self._datfile = file + '.dat'
self._bakfile = file + '.bak'
# Mod by Jack: create data file if needed
try:
f = _open(self._datfile, 'r')
except IOError:
f = _open(self._datfile, 'w')
f.close()
self._update()
def _update(self):
self._index = {}
try:
f = _open(self._dirfile)
except IOError:
pass
else:
while 1:
line = f.readline()
if not line: break
key, (pos, siz) = eval(line)
self._index[key] = (pos, siz)
f.close()
def _commit(self):
try: _os.unlink(self._bakfile)
except _os.error: pass
try: _os.rename(self._dirfile, self._bakfile)
except _os.error: pass
f = _open(self._dirfile, 'w')
for key, (pos, siz) in self._index.items():
f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
f.close()
def __getitem__(self, key):
pos, siz = self._index[key] # may raise KeyError
f = _open(self._datfile, 'rb')
f.seek(pos)
dat = f.read(siz)
f.close()
return dat
def _addval(self, val):
f = _open(self._datfile, 'rb+')
f.seek(0, 2)
pos = f.tell()
## Does not work under MW compiler
## pos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
## f.seek(pos)
npos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
f.write('\0'*(npos-pos))
pos = npos
f.write(val)
f.close()
return (pos, len(val))
def _setval(self, pos, val):
f = _open(self._datfile, 'rb+')
f.seek(pos)
f.write(val)
f.close()
return pos, (val)
def _addkey(self, key, (pos, siz)):
self._index[key] = (pos, siz)
f = _open(self._dirfile, 'a')
f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
f.close()
def __setitem__(self, key, val):
if not type(key) == type('') == type(val):
raise TypeError, "dbmac keys and values must be strings"
if not self._index.has_key(key):
(pos, siz) = self._addval(val)
self._addkey(key, (pos, siz))
else:
pos, siz = self._index[key]
oldblocks = (siz + _BLOCKSIZE - 1) / _BLOCKSIZE
newblocks = (len(val) + _BLOCKSIZE - 1) / _BLOCKSIZE
if newblocks <= oldblocks:
pos, siz = self._setval(pos, val)
self._index[key] = pos, siz
else:
pos, siz = self._addval(val)
self._index[key] = pos, siz
self._addkey(key, (pos, siz))
def __delitem__(self, key):
del self._index[key]
self._commit()
def keys(self):
return self._index.keys()
def has_key(self, key):
return self._index.has_key(key)
def __len__(self):
return len(self._index)
def close(self):
self._index = self._datfile = self._dirfile = self._bakfile = None
def open(file, flag = None, mode = None):
# flag, mode arguments are currently ignored
return _Database(file)

View File

@ -1,61 +0,0 @@
# Module 'maccache'
#
# Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes.
# XXX Should merge with module statcache
import os
# The cache.
# Keys are absolute pathnames;
# values are 0 (nothing), 1 (file) or [...] (dir).
#
cache = {}
# Current working directory.
#
cwd = os.getcwd()
# Constants.
#
NONE = 0
FILE = 1
LISTTYPE = type([])
def _stat(name):
name = os.path.join(cwd, name)
if cache.has_key(name):
return cache[name]
if os.path.isfile(name):
cache[name] = FILE
return FILE
try:
list = os.listdir(name)
except:
cache[name] = NONE
return NONE
cache[name] = list
if name[-1:] == ':': cache[name[:-1]] = list
else: cache[name+':'] = list
return list
def isdir(name):
st = _stat(name)
return type(st) == LISTTYPE
def isfile(name):
st = _stat(name)
return st == FILE
def exists(name):
st = _stat(name)
return st <> NONE
def listdir(name):
st = _stat(name)
if type(st) == LISTTYPE:
return st
else:
raise RuntimeError, 'list non-directory'

View File

@ -1,74 +0,0 @@
#
# mactty module - Use a terminal line as communications channel.
#
# Note that this module is not very complete or well-designed, but it
# will have to serve until I have time to write something better. A unix
# module with the same API is available too, contact me (jack@cwi.nl)
# if you need it.
#
# Usage:
# t = Tty(toolname)
# t.raw() Set in raw/no-echo mode
# t.baudrate(rate) Set baud rate
# t.reset() Back to normal
# t.read(len) Read up to 'len' bytes (but often reads less)
# t.readall(len) Read 'len' bytes
# t.timedread(len,tout) Read upto 'len' bytes, or until 'tout' seconds idle
# t.getmode() Get parameters as a string
# t.setmode(args) Set parameters
#
# Jack Jansen, CWI, January 1997
#
import ctb
DEBUG=1
class Tty:
def __init__(self, name=None):
self.connection = ctb.CMNew('Serial Tool', (10000, 10000, 0, 0, 0, 0))
#self.orig_data = self.connection.GetConfig()
#if name:
# self.connection.SetConfig(self.orig_data + ' Port "%s"'%name)
self.connection.Open(10)
sizes, status = self.connection.Status()
def getmode(self):
return self.connection.GetConfig()
def setmode(self, mode):
length = self.connection.SetConfig(mode)
if length != 0 and length != len(mode):
raise 'SetConfig Error', (mode[:length], mode[length:])
def raw(self):
pass
def baudrate(self, rate):
self.setmode(self.getmode()+' baud %d'%rate)
def reset(self):
self.setmode(self.orig_data)
def readall(self, length):
data = ''
while len(data) < length:
data = data + self.read(length-len(data))
return data
def timedread(self,length, timeout):
self.connection.Idle()
data, eom = self.connection.Read(length, ctb.cmData, timeout*10)
if DEBUG:
print 'Timedread(%d, %d)->%s'%(length, timeout, `data`)
return data
def read(self, length):
return self.timedread(length, 0x3fffffff)
def write(self, data):
if DEBUG:
print 'Write(%s)'%`data`
while data:
self.connection.Idle()
done = self.connection.Write(data, ctb.cmData, 0x3fffffff, 0)
self.connection.Idle()
data = data[done:]

View File

@ -1,80 +0,0 @@
import cwxmlgen
import cwtalker
import os
from Carbon import AppleEvents
import Carbon.File
def mkproject(outputfile, modulename, settings, force=0, templatename=None):
#
# Copy the dictionary
#
dictcopy = {}
for k, v in settings.items():
dictcopy[k] = v
#
# Generate the XML for the project
#
dictcopy['mac_projectxmlname'] = outputfile + '.xml'
dictcopy['mac_exportname'] = os.path.split(outputfile)[1] + '.exp'
if not dictcopy.has_key('mac_dllname'):
dictcopy['mac_dllname'] = modulename + '.ppc.slb'
if not dictcopy.has_key('mac_targetname'):
dictcopy['mac_targetname'] = modulename + '.ppc'
xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy, templatename=templatename)
xmlbuilder.generate()
if not force:
# We do a number of checks and all must succeed before we decide to
# skip the build-project step:
# 1. the xml file must exist, and its content equal to what we've generated
# 2. the project file must exist and be newer than the xml file
# 3. the .exp file must exist
if os.path.exists(dictcopy['mac_projectxmlname']):
fp = open(dictcopy['mac_projectxmlname'])
data = fp.read()
fp.close()
if data == dictcopy["tmp_projectxmldata"]:
if os.path.exists(outputfile) and \
os.stat(outputfile)[os.path.ST_MTIME] > os.stat(dictcopy['mac_projectxmlname'])[os.path.ST_MTIME]:
if os.path.exists(outputfile + '.exp'):
return
fp = open(dictcopy['mac_projectxmlname'], "w")
fp.write(dictcopy["tmp_projectxmldata"])
fp.close()
#
# Generate the export file
#
fp = open(outputfile + '.exp', 'w')
fp.write('init%s\n'%modulename)
if dictcopy.has_key('extraexportsymbols'):
for sym in dictcopy['extraexportsymbols']:
fp.write('%s\n'%sym)
fp.close()
#
# Generate the project from the xml
#
makeproject(dictcopy['mac_projectxmlname'], outputfile)
def makeproject(xmlfile, projectfile):
cw = cwtalker.MyCodeWarrior(start=1)
cw.send_timeout = AppleEvents.kNoTimeOut
xmlfss = Carbon.File.FSSpec(xmlfile)
prjfss = Carbon.File.FSSpec(projectfile)
cw.my_mkproject(prjfss, xmlfss)
cw.Close_Project()
def buildproject(projectfile):
cw = cwtalker.MyCodeWarrior(start=1)
cw.send_timeout = AppleEvents.kNoTimeOut
prjfss = Carbon.File.FSSpec(projectfile)
cw.open(prjfss)
cw.Make_Project() # XXX Should set target
cw.Close_Project()
def cleanproject(projectfile):
cw = cwtalker.MyCodeWarrior(start=1)
cw.send_timeout = AppleEvents.kNoTimeOut
prjfss = Carbon.File.FSSpec(projectfile)
cw.open(prjfss)
cw.Remove_Binaries()

View File

@ -1,36 +0,0 @@
import CodeWarrior
import aetools
import aetypes
# There is both a class "project document" and a property "project document".
# We want the class, but the property overrides it.
#
##class project_document(aetools.ComponentItem):
## """project document - a project document """
## want = 'PRJD'
project_document=aetypes.Type('PRJD')
class MyCodeWarrior(CodeWarrior.CodeWarrior):
# Bug in the CW OSA dictionary
def export(self, object, _attributes={}, **_arguments):
"""export: Export the project file as an XML file
Keyword argument _in: the XML file in which to export the project
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'CWIE'
_subcode = 'EXPT'
aetools.keysubst(_arguments, self._argmap_export)
_arguments['----'] = _object
_reply, _arguments, _attributes = self.send(_code, _subcode,
_arguments, _attributes)
if _arguments.has_key('errn'):
raise aetools.Error, aetools.decodeerror(_arguments)
# XXXX Optionally decode result
if _arguments.has_key('----'):
return _arguments['----']
def my_mkproject(self, prjfile, xmlfile):
self.make(new=project_document, with_data=xmlfile, as=prjfile)

View File

@ -1,142 +0,0 @@
# First attempt at automatically generating CodeWarior projects
import os
import MacOS
import string
Error="gencwproject.Error"
#
# These templates are executed in-order.
#
TEMPLATELIST= [
("tmp_allsources", "file", "template-allsources.xml", "sources"),
("tmp_linkorder", "file", "template-linkorder.xml", "sources"),
("tmp_grouplist", "file", "template-grouplist.xml", "sources"),
("tmp_alllibraries", "file", "template-alllibraries.xml", "libraries"),
("tmp_linkorderlib", "file", "template-linkorderlib.xml", "libraries"),
("tmp_grouplistlib", "file", "template-grouplistlib.xml", "libraries"),
("tmp_extrasearchdirs", "file", "template-searchdirs.xml", "extrasearchdirs"),
("tmp_projectxmldata", "file", "template.prj.xml", None)
]
class ProjectBuilder:
def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None):
self._adddefaults(dict)
if templatename == None:
if hasattr(MacOS, 'runtimemodel'):
templatename = 'template-%s'%MacOS.runtimemodel
else:
templatename = 'template'
if os.sep in templatename:
templatedir = templatename
else:
try:
packagedir = os.path.split(__file__)[0]
except NameError:
packagedir = os.curdir
templatedir = os.path.join(packagedir, templatename)
if not os.path.exists(templatedir):
raise Error, "Cannot find templatedir %s"%templatedir
self.dict = dict
if not dict.has_key('prefixname'):
if hasattr(MacOS, 'runtimemodel') and MacOS.runtimemodel == "carbon":
dict['prefixname'] = 'mwerks_shcarbon_pch'
else:
dict['prefixname'] = 'mwerks_plugin_config.h'
self.templatelist = templatelist
self.templatedir = templatedir
def _adddefaults(self, dict):
# Set all suitable defaults set for values which were omitted.
if not dict.has_key('mac_outputdir'):
dict['mac_outputdir'] = ':lib:'
if not dict.has_key('stdlibraryflags'):
dict['stdlibraryflags'] = 'Debug'
if not dict.has_key('libraryflags'):
dict['libraryflags'] = 'Debug'
if not dict.has_key('initialize'):
dict['initialize'] = '__initialize'
if not dict.has_key('mac_sysprefixtype'):
if os.path.isabs(dict['sysprefix']):
dict['mac_sysprefixtype'] = 'Absolute'
else:
dict['mac_sysprefixtype'] = 'Project' # XXX not sure this is right...
def generate(self):
for tmpl in self.templatelist:
self._generate_one_template(tmpl)
def _generate_one_template(self, tmpl):
resultname, datasource, dataname, key = tmpl
result = ''
if key:
# This is a multi-element rule. Run for every item in dict[key]
if self.dict.has_key(key):
keyvalues = self.dict[key]
try:
if not type(keyvalues) in (type(()), type([])):
raise Error, "List or tuple expected for %s"%key
for curkeyvalue in keyvalues:
if string.lower(curkeyvalue[:10]) == '{compiler}':
curkeyvalue = curkeyvalue[10:]
self.dict['pathtype'] = 'CodeWarrior'
elif string.lower(curkeyvalue[:9]) == '{project}':
curkeyvalue = curkeyvalue[9:]
self.dict['pathtype'] = 'Project'
elif curkeyvalue[0] == '{':
raise Error, "Unknown {} escape in %s"%curkeyvalue
elif os.path.isabs(curkeyvalue):
self.dict['pathtype'] = 'Absolute'
else:
self.dict['pathtype'] = 'Project'
if curkeyvalue[-2:] == ':*':
curkeyvalue = curkeyvalue[:-2]
self.dict['recursive'] = 'true'
else:
self.dict['recursive'] = 'false'
self.dict[key] = curkeyvalue
curkeyvalueresult = self._generate_one_value(datasource, dataname)
result = result + curkeyvalueresult
finally:
# Restore the list
self.dict[key] = keyvalues
self.dict['pathtype'] = None
del self.dict['pathtype']
self.dict['recursive'] = None
del self.dict['recursive']
else:
# Not a multi-element rule. Simply generate
result = self._generate_one_value(datasource, dataname)
# And store the result
self.dict[resultname] = result
def _generate_one_value(self, datasource, dataname):
if datasource == 'file':
filepath = os.path.join(self.templatedir, dataname)
fp = open(filepath, "r")
format = fp.read()
elif datasource == 'string':
format = dataname
else:
raise Error, 'Datasource should be file or string, not %s'%datasource
return format % self.dict
def _test():
dict = {
"mac_projectxmlname" : "controlstrip.prj.xml", # The XML filename (full path)
"mac_exportname" : "controlstrip.prj.exp", # Export file (relative to project)
"mac_outputdir" : ":", # The directory where the DLL is put (relative to project)
"mac_dllname" : "controlstrip.ppc.slb", # The DLL filename (within outputdir)
"mac_targetname" : "controlstrip.ppc", # The targetname within the project
"sysprefix" : sys.prefix, # Where the Python sources live
"mac_sysprefixtype" : "Absolute", # Type of previous pathname
"sources" : ["controlstripmodule.c"],
"extrasearchdirs": [], # -I and -L, in unix terms
}
pb = ProjectBuilder(dict)
pb.generate()
fp = open(dict["mac_projectxmlname"], "w")
fp.write(dict["tmp_projectxmldata"])
if __name__ == '__main__':
_test()

View File

@ -1,7 +0,0 @@
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(libraries)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>%(libraryflags)s</FILEFLAGS>
</FILE>

View File

@ -1,7 +0,0 @@
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(sources)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>

View File

@ -1,6 +0,0 @@
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(sources)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>

View File

@ -1,6 +0,0 @@
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(libraries)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>

View File

@ -1,5 +0,0 @@
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(sources)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>

View File

@ -1,5 +0,0 @@
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(libraries)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>

View File

@ -1,9 +0,0 @@
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(extrasearchdirs)s</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>%(pathtype)s</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>%(recursive)s</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>

View File

@ -1,710 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?codewarrior exportversion="1.0.1" ideversion="4.2" ?>
<!DOCTYPE PROJECT [
<!ELEMENT PROJECT (TARGETLIST, TARGETORDER, GROUPLIST, DESIGNLIST?)>
<!ELEMENT TARGETLIST (TARGET+)>
<!ELEMENT TARGET (NAME, SETTINGLIST, FILELIST?, LINKORDER?, SEGMENTLIST?, OVERLAYGROUPLIST?, SUBTARGETLIST?, SUBPROJECTLIST?, FRAMEWORKLIST)>
<!ELEMENT NAME (#PCDATA)>
<!ELEMENT USERSOURCETREETYPE (#PCDATA)>
<!ELEMENT PATH (#PCDATA)>
<!ELEMENT FILELIST (FILE*)>
<!ELEMENT FILE (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?, ROOTFILEREF?, FILEKIND?, FILEFLAGS?)>
<!ELEMENT PATHTYPE (#PCDATA)>
<!ELEMENT PATHROOT (#PCDATA)>
<!ELEMENT ACCESSPATH (#PCDATA)>
<!ELEMENT PATHFORMAT (#PCDATA)>
<!ELEMENT ROOTFILEREF (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
<!ELEMENT FILEKIND (#PCDATA)>
<!ELEMENT FILEFLAGS (#PCDATA)>
<!ELEMENT FILEREF (TARGETNAME?, PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
<!ELEMENT TARGETNAME (#PCDATA)>
<!ELEMENT SETTINGLIST ((SETTING|PANELDATA)+)>
<!ELEMENT SETTING (NAME?, (VALUE|(SETTING+)))>
<!ELEMENT PANELDATA (NAME, VALUE)>
<!ELEMENT VALUE (#PCDATA)>
<!ELEMENT LINKORDER (FILEREF*)>
<!ELEMENT SEGMENTLIST (SEGMENT+)>
<!ELEMENT SEGMENT (NAME, ATTRIBUTES?, FILEREF*)>
<!ELEMENT ATTRIBUTES (#PCDATA)>
<!ELEMENT OVERLAYGROUPLIST (OVERLAYGROUP+)>
<!ELEMENT OVERLAYGROUP (NAME, BASEADDRESS, OVERLAY*)>
<!ELEMENT BASEADDRESS (#PCDATA)>
<!ELEMENT OVERLAY (NAME, FILEREF*)>
<!ELEMENT SUBTARGETLIST (SUBTARGET+)>
<!ELEMENT SUBTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
<!ELEMENT SUBPROJECTLIST (SUBPROJECT+)>
<!ELEMENT SUBPROJECT (FILEREF, SUBPROJECTTARGETLIST)>
<!ELEMENT SUBPROJECTTARGETLIST (SUBPROJECTTARGET*)>
<!ELEMENT SUBPROJECTTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
<!ELEMENT FRAMEWORKLIST (FRAMEWORK+)>
<!ELEMENT FRAMEWORK (FILEREF, LIBRARYFILE?, VERSION?)>
<!ELEMENT LIBRARYFILE (FILEREF)>
<!ELEMENT VERSION (#PCDATA)>
<!ELEMENT TARGETORDER (ORDEREDTARGET|ORDEREDDESIGN)*>
<!ELEMENT ORDEREDTARGET (NAME)>
<!ELEMENT ORDEREDDESIGN (NAME, ORDEREDTARGET+)>
<!ELEMENT GROUPLIST (GROUP|FILEREF)*>
<!ELEMENT GROUP (NAME, (GROUP|FILEREF)*)>
<!ELEMENT DESIGNLIST (DESIGN+)>
<!ELEMENT DESIGN (NAME, DESIGNDATA)>
<!ELEMENT DESIGNDATA (#PCDATA)>
]>
<PROJECT>
<TARGETLIST>
<TARGET>
<NAME>%(mac_targetname)s</NAME>
<SETTINGLIST>
<!-- Settings for "Source Trees" panel -->
<SETTING><NAME>UserSourceTrees</NAME><VALUE></VALUE></SETTING>
<!-- Settings for "Access Paths" panel -->
<SETTING><NAME>AlwaysSearchUserPaths</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>UserSearchPaths</NAME>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
%(tmp_extrasearchdirs)s
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(sysprefix)sMac:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(sysprefix)sInclude:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(sysprefix)s</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
</SETTING>
<SETTING><NAME>SystemSearchPaths</NAME>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(sysprefix)s:GUSI2:include:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:MSL:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>CodeWarrior</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>SearchPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:MacOS Support:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>CodeWarrior</VALUE></SETTING>
</SETTING>
<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
</SETTING>
</SETTING>
<!-- Settings for "Debugger Runtime" panel -->
<SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWRuntimeSettings_CommandLine</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWRuntimeSettings_HostApplication</NAME>
<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
</SETTING>
<SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE></VALUE></SETTING>
<!-- Settings for "Target Settings" panel -->
<SETTING><NAME>Linker</NAME><VALUE>MacOS PPC Linker</VALUE></SETTING>
<SETTING><NAME>PreLinker</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>PostLinker</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Targetname</NAME><VALUE>%(mac_targetname)s</VALUE></SETTING>
<SETTING><NAME>OutputDirectory</NAME>
<SETTING><NAME>Path</NAME><VALUE>%(mac_outputdir)s</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>
<!-- Settings for "File Mappings" panel -->
<SETTING><NAME>FileMappings</NAME>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>APPL</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>Appl</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>MMLB</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>Lib Import PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>MPLF</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>Lib Import PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>MWCD</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>RSRC</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.bh</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>Balloon Help</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.c</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.c++</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.cc</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.cp</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.cpp</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.exp</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.h</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.p</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW Pascal PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.pas</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW Pascal PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.pch</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.pch++</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW C/C++ PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.r</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>MW Rez</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.s</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>PPCAsm</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>XCOF</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>XCOFF Import PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>docu</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>rsrc</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>shlb</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>PEF Import PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileType</NAME><VALUE>stub</VALUE></SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE>PEF Import PPC</VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
</SETTING>
<SETTING>
<SETTING><NAME>FileExtension</NAME><VALUE>.doc</VALUE></SETTING>
<SETTING><NAME>Compiler</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>Launchable</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
</SETTING>
</SETTING>
<!-- Settings for "Build Extras" panel -->
<SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>ActivateBrowser</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>DebuggerAppPath</NAME>
<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
</SETTING>
<SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>DebuggerWorkingDir</NAME>
<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
</SETTING>
<!-- Settings for "Debugger Target" panel -->
<SETTING><NAME>LogSystemMessages</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>AutoTargetDLLs</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>StopAtWatchpoints</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>PauseWhileRunning</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>PauseInterval</NAME><VALUE>5</VALUE></SETTING>
<SETTING><NAME>PauseUIFlags</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>AltExePath</NAME>
<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
</SETTING>
<SETTING><NAME>StopAtTempBPOnLaunch</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>CacheSymbolics</NAME><VALUE>true</VALUE></SETTING>
<SETTING><NAME>TempBPFunctionName</NAME><VALUE>main</VALUE></SETTING>
<SETTING><NAME>TempBPType</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "Remote Debug" panel -->
<SETTING><NAME>Enabled</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>ConnectionName</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>DownloadPath</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>LaunchRemoteApp</NAME><VALUE>false</VALUE></SETTING>
<SETTING><NAME>RemoteAppPath</NAME><VALUE></VALUE></SETTING>
<!-- Settings for "Auto-target" panel -->
<SETTING><NAME>OtherExecutables</NAME><VALUE></VALUE></SETTING>
<!-- Settings for "C/C++ Compiler" panel -->
<SETTING><NAME>MWFrontEnd_C_cplusplus</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_checkprotos</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_arm</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_trigraphs</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_onlystdkeywords</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_enumsalwaysint</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_mpwpointerstyle</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_prefixname</NAME><VALUE>%(prefixname)s</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_ansistrict</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_mpwcnewline</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_wchar_type</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_enableexceptions</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_dontreusestrings</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_poolstrings</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_dontinline</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_useRTTI</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_multibyteaware</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_unsignedchars</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_autoinline</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_booltruefalse</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_direct_to_som</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_som_env_check</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_alwaysinline</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_inlinelevel</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_ecplusplus</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_objective_c</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWFrontEnd_C_defer_codegen</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "C/C++ Warnings" panel -->
<SETTING><NAME>MWWarning_C_warn_illpragma</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_emptydecl</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_possunwant</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_unusedvar</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_unusedarg</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_extracomma</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_pedantic</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warningerrors</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_hidevirtual</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_implicitconv</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_notinlined</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWWarning_C_warn_structclass</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "MacOS Merge Panel" panel -->
<SETTING><NAME>MWMerge_MacOS_projectType</NAME><VALUE>Application</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_outputName</NAME><VALUE>Merge Out</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_outputCreator</NAME><VALUE>1061109567</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_outputType</NAME><VALUE>1095782476</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_suppressWarning</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_copyFragments</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_copyResources</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_flattenResource</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_flatFileName</NAME><VALUE>a.rsrc</VALUE></SETTING>
<SETTING><NAME>MWMerge_MacOS_flatFileOutputPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>MWMerge_MacOS_skipResources</NAME>
<SETTING><VALUE> </VALUE></SETTING>
<SETTING><VALUE>&#170;&#191;&#176;</VALUE></SETTING>
<SETTING><VALUE>&#223;^h</VALUE></SETTING>
<SETTING><VALUE>&#209;&#167;0</VALUE></SETTING>
</SETTING>
<!-- Settings for "Packager Panel" panel -->
<SETTING><NAME>MWMacOSPackager_UsePackager</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWMacOSPackager_FolderToPackage</NAME>
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>MWMacOSPackager_CreateClassicAlias</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWMacOSPackager_ClassicAliasMethod</NAME><VALUE>UseTargetOutput</VALUE></SETTING>
<SETTING><NAME>MWMacOSPackager_ClassicAliasPath</NAME>
<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>
<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
</SETTING>
<SETTING><NAME>MWMacOSPackager_CreatePkgInfo</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWMacOSPackager_PkgCreatorType</NAME><VALUE>????</VALUE></SETTING>
<SETTING><NAME>MWMacOSPackager_PkgFileType</NAME><VALUE>APPL</VALUE></SETTING>
<!-- Settings for "PPC CodeGen" panel -->
<SETTING><NAME>MWCodeGen_PPC_structalignment</NAME><VALUE>PPC</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_tracebacktables</NAME><VALUE>None</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_processor</NAME><VALUE>P601</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_readonlystrings</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_tocdata</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_profiler</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_fpcontract</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_schedule</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_peephole</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_processorspecific</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_altivec</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_vectortocdata</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWCodeGen_PPC_vrsave</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "PPC Disassembler" panel -->
<SETTING><NAME>MWDisassembler_PPC_showcode</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_extended</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_mix</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_nohex</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_showdata</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_showexceptions</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_showsym</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWDisassembler_PPC_shownames</NAME><VALUE>1</VALUE></SETTING>
<!-- Settings for "PPC Global Optimizer" panel -->
<SETTING><NAME>GlobalOptimizer_PPC_optimizationlevel</NAME><VALUE>Level0</VALUE></SETTING>
<SETTING><NAME>GlobalOptimizer_PPC_optfor</NAME><VALUE>Speed</VALUE></SETTING>
<!-- Settings for "PPC Linker" panel -->
<SETTING><NAME>MWLinker_PPC_linksym</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_symfullpath</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_linkmap</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_nolinkwarnings</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_dontdeadstripinitcode</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_permitmultdefs</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_linkmode</NAME><VALUE>Fast</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_initname</NAME><VALUE>%(initialize)s</VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_mainname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWLinker_PPC_termname</NAME><VALUE>__terminate</VALUE></SETTING>
<!-- Settings for "PPC PEF" panel -->
<SETTING><NAME>MWPEF_exports</NAME><VALUE>File</VALUE></SETTING>
<SETTING><NAME>MWPEF_libfolder</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_sortcode</NAME><VALUE>None</VALUE></SETTING>
<SETTING><NAME>MWPEF_expandbss</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_sharedata</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_olddefversion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_oldimpversion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_currentversion</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWPEF_fragmentname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWPEF_collapsereloads</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "PPC Project" panel -->
<SETTING><NAME>MWProject_PPC_type</NAME><VALUE>SharedLibrary</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_outfile</NAME><VALUE>%(mac_dllname)s</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_filecreator</NAME><VALUE>1350136936</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_filetype</NAME><VALUE>1936223330</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_size</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_minsize</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_stacksize</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_flags</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_symfilename</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcheader</NAME><VALUE>Native</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrctype</NAME><VALUE>1061109567</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcid</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcflags</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcstore</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWProject_PPC_rsrcmerge</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "PPCAsm Panel" panel -->
<SETTING><NAME>MWAssembler_PPC_auxheader</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_symmode</NAME><VALUE>Mac</VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_dialect</NAME><VALUE>PPC</VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_prefixfile</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_typecheck</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_warnings</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWAssembler_PPC_casesensitive</NAME><VALUE>0</VALUE></SETTING>
<!-- Settings for "Rez Compiler" panel -->
<SETTING><NAME>MWRez_Language_maxwidth</NAME><VALUE>80</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_script</NAME><VALUE>Roman</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_alignment</NAME><VALUE>Align1</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_filtermode</NAME><VALUE>FilterSkip</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_suppresswarnings</NAME><VALUE>0</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_escapecontrolchars</NAME><VALUE>1</VALUE></SETTING>
<SETTING><NAME>MWRez_Language_prefixname</NAME><VALUE></VALUE></SETTING>
<SETTING><NAME>MWRez_Language_filteredtypes</NAME><VALUE>'CODE' 'DATA' 'PICT'</VALUE></SETTING>
</SETTINGLIST>
<FILELIST>
%(tmp_allsources)s
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>MSL_ShLibRuntime_PPC.Lib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(mac_exportname)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
%(tmp_alllibraries)s
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>PythonCoreCarbon</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Library</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>CarbonLib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Library</FILEKIND>
<FILEFLAGS>%(stdlibraryflags)s</FILEFLAGS>
</FILE>
</FILELIST>
<LINKORDER>
%(tmp_linkorder)s
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>MSL_ShLibRuntime_PPC.Lib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(mac_exportname)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
%(tmp_linkorderlib)s
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>CarbonLib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>PythonCoreCarbon</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</LINKORDER>
</TARGET>
</TARGETLIST>
<TARGETORDER>
<ORDEREDTARGET><NAME>%(mac_targetname)s</NAME></ORDEREDTARGET>
</TARGETORDER>
<GROUPLIST>
<GROUP><NAME>Sources</NAME>
%(tmp_grouplist)s
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>%(mac_exportname)s</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUP>
<GROUP><NAME>Libraries</NAME>
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>MSL_ShLibRuntime_PPC.Lib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
%(tmp_grouplistlib)s
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>PythonCoreCarbon</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>%(mac_targetname)s</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>CarbonLib</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
</GROUP>
</GROUPLIST>
</PROJECT>

View File

@ -1,65 +0,0 @@
"""nsremote - Control Netscape from python.
Interface modelled after unix-interface done
by hassan@cs.stanford.edu.
Jack Jansen, CWI, January 1996.
"""
#
# Note: this module currently uses the funny SpyGlass AppleEvents, since
# these seem to be the only way to get the info from Netscape. It would
# be nicer to use the more "object oriented" standard OSA stuff, when it
# is implemented in Netscape.
#
import sys
import aetools
import Netscape
import MacOS
Error = 'nsremote.Error'
_talker = None
def _init():
global _talker
if _talker == None:
_talker = Netscape.Netscape()
def list(dpyinfo=""):
_init()
list = _talker.list_windows()
return map(lambda x: (x, 'version unknown'), list)
def geturl(windowid=0, dpyinfo=""):
_init()
if windowid == 0:
ids = _talker.list_windows()
if not ids:
raise Error, 'No netscape windows open'
windowid = ids[0]
info = _talker.get_window_info(windowid)
return info
def openurl(url, windowid=0, dpyinfo=""):
_init()
if windowid == 0:
_talker.OpenURL(url)
else:
_talker.OpenURL(url, toWindow=windowid)
def _test():
"""Test program: Open www.python.org in all windows, then revert"""
import sys
windows_and_versions = list()
windows_and_urls = map(lambda x: (x[0], geturl(x[0])[0]), windows_and_versions)
for id, version in windows_and_versions:
openurl('http://www.python.org/', windowid=id)
print 'Type return to revert to old contents-'
sys.stdin.readline()
for id, url in windows_and_urls:
openurl(url, id)
if __name__ == '__main__':
_test()

View File

@ -1,219 +0,0 @@
#
# General parser/loaders for preferences files and such
#
from Carbon import Res
import macfs
import struct
import MACFS
READ=1
READWRITE=3
Error = "Preferences.Error"
debug = 0
class NullLoader:
def __init__(self, data=None):
self.data = data
def load(self):
if self.data is None:
raise Error, "No default given"
return self.data
def save(self, data):
raise Error, "Cannot save to default value"
def delete(self, deep=0):
if debug:
print 'Attempt to delete default value'
raise Error, "Cannot delete default value"
_defaultdefault = NullLoader()
class ResLoader:
def __init__(self, filename, resid, resnum=None, resname=None, default=_defaultdefault):
self.filename = filename
self.fss = macfs.FSSpec(self.filename)
self.resid = resid
self.resnum = resnum
self.resname = resname
self.default = default
self.data = None
def load(self):
oldrh = Res.CurResFile()
try:
rh = Res.FSpOpenResFile(self.fss, READ)
except Res.Error:
self.data = self.default.load()
return self.data
try:
if self.resname:
handle = Res.Get1NamedResource(self.resid, self.resname)
else:
handle = Res.Get1Resource(self.resid, self.resnum)
except Res.Error:
self.data = self.default.load()
else:
if debug:
print 'Loaded', (self.resid, self.resnum, self.resname), 'from', self.fss.as_pathname()
self.data = handle.data
Res.CloseResFile(rh)
Res.UseResFile(oldrh)
return self.data
def save(self, data):
if self.data is None or self.data != data:
oldrh = Res.CurResFile()
rh = Res.FSpOpenResFile(self.fss, READWRITE)
try:
handle = Res.Get1Resource(self.resid, self.resnum)
except Res.Error:
handle = Res.Resource(data)
handle.AddResource(self.resid, self.resnum, '')
if debug:
print 'Added', (self.resid, self.resnum), 'to', self.fss.as_pathname()
else:
handle.data = data
handle.ChangedResource()
if debug:
print 'Changed', (self.resid, self.resnum), 'in', self.fss.as_pathname()
Res.CloseResFile(rh)
Res.UseResFile(oldrh)
def delete(self, deep=0):
if debug:
print 'Deleting in', self.fss.as_pathname(), `self.data`, deep
oldrh = Res.CurResFile()
rh = Res.FSpOpenResFile(self.fss, READWRITE)
try:
handle = Res.Get1Resource(self.resid, self.resnum)
except Res.Error:
if deep:
if debug: print 'deep in', self.default
self.default.delete(1)
else:
handle.RemoveResource()
if debug:
print 'Deleted', (self.resid, self.resnum), 'from', self.fss.as_pathname()
self.data = None
Res.CloseResFile(rh)
Res.UseResFile(oldrh)
class AnyResLoader:
def __init__(self, resid, resnum=None, resname=None, default=_defaultdefault):
self.resid = resid
self.resnum = resnum
self.resname = resname
self.default = default
self.data = None
def load(self):
try:
if self.resname:
handle = Res.GetNamedResource(self.resid, self.resname)
else:
handle = Res.GetResource(self.resid, self.resnum)
except Res.Error:
self.data = self.default.load()
else:
self.data = handle.data
return self.data
def save(self, data):
raise Error, "Cannot save AnyResLoader preferences"
def delete(self, deep=0):
raise Error, "Cannot delete AnyResLoader preferences"
class StructLoader:
def __init__(self, format, loader):
self.format = format
self.loader = loader
def load(self):
data = self.loader.load()
return struct.unpack(self.format, data)
def save(self, data):
data = apply(struct.pack, (self.format,)+data)
self.loader.save(data)
def delete(self, deep=0):
self.loader.delete(deep)
class PstringLoader:
def __init__(self, loader):
self.loader = loader
def load(self):
data = self.loader.load()
len = ord(data[0])
return data[1:1+len]
def save(self, data):
if len(data) > 255:
raise Error, "String too big for pascal-style"
self.loader.save(chr(len(data))+data)
def delete(self, deep=0):
self.loader.delete(deep)
class VersionLoader(StructLoader):
def load(self):
while 1:
data = self.loader.load()
if debug:
print 'Versionloader:', `data`
try:
rv = struct.unpack(self.format, data)
rv = self.versioncheck(rv)
return rv
except (struct.error, Error):
self.delete(1)
def versioncheck(self, data):
return data
class StrListLoader:
def __init__(self, loader):
self.loader = loader
def load(self):
data = self.loader.load()
num, = struct.unpack('h', data[:2])
data = data[2:]
rv = []
for i in range(num):
strlen = ord(data[0])
if strlen < 0: strlen = strlen + 256
str = data[1:strlen+1]
data = data[strlen+1:]
rv.append(str)
return rv
def save(self, list):
rv = struct.pack('h', len(list))
for str in list:
rv = rv + chr(len(str)) + str
self.loader.save(rv)
def delete(self, deep=0):
self.loader.delete(deep)
def preferencefile(filename, creator=None, type=None):
create = creator != None and type != None
vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, 'pref', create)
fss = macfs.FSSpec((vrefnum, dirid, ":Python:" + filename))
oldrf = Res.CurResFile()
if create:
try:
rh = Res.FSpOpenResFile(fss, READ)
except Res.Error:
Res.FSpCreateResFile(fss, creator, type, MACFS.smAllScripts)
else:
Res.CloseResFile(rh)
Res.UseResFile(oldrf)
return fss

View File

@ -1,90 +0,0 @@
"""Creation of PYC resources"""
import os
from Carbon import Res
import __builtin__
READ = 1
WRITE = 2
smAllScripts = -3
def Pstring(str):
"""Return a pascal-style string from a python-style string"""
if len(str) > 255:
raise ValueError, 'String too large'
return chr(len(str))+str
def create(dst, creator='Pyth'):
"""Create output file. Return handle and first id to use."""
try:
os.unlink(dst)
except os.error:
pass
Res.FSpCreateResFile(dst, creator, 'rsrc', smAllScripts)
return open(dst)
def open(dst):
output = Res.FSpOpenResFile(dst, WRITE)
Res.UseResFile(output)
return output
def writemodule(name, id, data, type='PYC ', preload=0, ispackage=0):
"""Write pyc code to a PYC resource with given name and id."""
# XXXX Check that it doesn't exist
# Normally, byte 4-7 are the time stamp, but that is not used
# for 'PYC ' resources. We abuse byte 4 as a flag to indicate
# that it is a package rather than an ordinary module.
# See also macimport.c. (jvr)
if ispackage:
data = data[:4] + '\377\0\0\0' + data[8:] # flag resource as package
else:
data = data[:4] + '\0\0\0\0' + data[8:] # clear mod date field, used as package flag
res = Res.Resource(data)
res.AddResource(type, id, name)
if preload:
attrs = res.GetResAttrs()
attrs = attrs | 0x04
res.SetResAttrs(attrs)
res.WriteResource()
res.ReleaseResource()
def frompycfile(file, name=None, preload=0, ispackage=0):
"""Copy one pyc file to the open resource file"""
if name == None:
d, name = os.path.split(file)
name = name[:-4]
id = findfreeid()
data = __builtin__.open(file, 'rb').read()
writemodule(name, id, data, preload=preload, ispackage=ispackage)
return id, name
def frompyfile(file, name=None, preload=0, ispackage=0):
"""Compile python source file to pyc file and add to resource file"""
import py_compile
py_compile.compile(file)
file = file +'c'
return frompycfile(file, name, preload=preload, ispackage=ispackage)
# XXXX Note this is incorrect, it only handles one type and one file....
_firstfreeid = None
def findfreeid(type='PYC '):
"""Find next free id-number for given resource type"""
global _firstfreeid
if _firstfreeid == None:
Res.SetResLoad(0)
highest = 511
num = Res.Count1Resources(type)
for i in range(1, num+1):
r = Res.Get1IndResource(type, i)
id, d1, d2 = r.GetResInfo()
highest = max(highest, id)
Res.SetResLoad(1)
_firstfreeid = highest+1
id = _firstfreeid
_firstfreeid = _firstfreeid+1
return id

View File

@ -1,123 +0,0 @@
from preferences import *
# Names of Python resources
PREFNAME_NAME="PythonPreferenceFileName"
# Resource IDs in the preferences file
PATH_ID = 228
DIR_ID = 228
POPT_ID = 228
GUSI_ID = 10240
# Override IDs (in the applet)
OVERRIDE_PATH_ID = 229
OVERRIDE_DIR_ID = 229
OVERRIDE_POPT_ID = 229
OVERRIDE_GUSI_ID = 10241
# version
CUR_VERSION=8
preffilename = PstringLoader(AnyResLoader('STR ', resname=PREFNAME_NAME)).load()
pref_fss = preferencefile(preffilename, 'Pyth', 'pref')
class PoptLoader(VersionLoader):
def __init__(self, loader):
VersionLoader.__init__(self, "bbbbbbbbbbbbbbbb", loader)
def versioncheck(self, data):
if data[0] == CUR_VERSION:
return data
print 'old resource'
raise Error, "old resource"
class GusiLoader:
def __init__(self, loader):
self.loader = loader
self.data = None
def load(self):
self.data = self.loader.load()
while self.data[10:14] != '0181':
self.loader.delete(1)
self.loader.load()
tp = self.data[0:4]
cr = self.data[4:8]
flags = ord(self.data[9])
return cr, tp
def save(self, (cr, tp)):
flags = ord(self.data[9])
newdata = tp + cr + self.data[8:]
self.loader.save(newdata)
popt_default_default = NullLoader(chr(CUR_VERSION) + 14*'\0' + '\001')
popt_default = AnyResLoader('Popt', POPT_ID, default=popt_default_default)
popt_loader = ResLoader(pref_fss, 'Popt', POPT_ID, default=popt_default)
popt = PoptLoader(popt_loader)
dir_default = AnyResLoader('alis', DIR_ID)
dir = ResLoader(pref_fss, 'alis', DIR_ID, default=dir_default)
gusi_default = AnyResLoader('GU\267I', GUSI_ID)
gusi_loader = ResLoader(pref_fss, 'GU\267I', GUSI_ID, default=gusi_default)
gusi = GusiLoader(gusi_loader)
path_default = AnyResLoader('STR#', PATH_ID)
path_loader = ResLoader(pref_fss, 'STR#', PATH_ID, default=path_default)
path = StrListLoader(path_loader)
class PythonOptions:
def __init__(self, popt=popt, dir=dir, gusi=gusi, path=path):
self.popt = popt
self.dir = dir
self.gusi = gusi
self.path = path
def load(self):
dict = {}
dict['path'] = self.path.load()
diralias = self.dir.load()
dirfss, dummy = macfs.RawAlias(diralias).Resolve()
dict['dir'] = dirfss
dict['creator'], dict['type'] = self.gusi.load()
flags = self.popt.load()
dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
dict['unbuffered'], dict['debugging'], dummy, dict['keep_console'], \
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
dict['nosite'], dict['nonavservice'], dict['delayconsole'], \
dict['divisionwarn'], dict['unixnewlines'] = flags
return dict
def save(self, dict):
self.path.save(dict['path'])
diralias = macfs.FSSpec(dict['dir']).NewAlias().data
self.dir.save(diralias)
self.gusi.save((dict['creator'], dict['type']))
flags = dict['version'], dict['inspect'], dict['verbose'], dict['optimize'], \
dict['unbuffered'], dict['debugging'], 0, dict['keep_console'], \
dict['nointopt'], dict['noargs'], dict['tabwarn'], \
dict['nosite'], dict['nonavservice'], dict['delayconsole'], \
dict['divisionwarn'], dict['unixnewlines']
self.popt.save(flags)
def AppletOptions(file):
fss = macfs.FSSpec(file)
a_popt = PoptLoader(ResLoader(fss, 'Popt', OVERRIDE_POPT_ID, default=popt_loader))
a_dir = ResLoader(fss, 'alis', OVERRIDE_DIR_ID, default=dir)
a_gusi = GusiLoader(
ResLoader(fss, 'GU\267I', OVERRIDE_GUSI_ID, default=gusi_loader))
a_path = StrListLoader(
ResLoader(fss, 'STR#', OVERRIDE_PATH_ID, default=path_loader))
return PythonOptions(a_popt, a_dir, a_gusi, a_path)
def _test():
import preferences
preferences.debug = 1
dict = PythonOptions().load()
for k in dict.keys():
print k, '\t', dict[k]
if __name__ == '__main__':
_test()

View File

@ -1,110 +0,0 @@
"""quietconsole - A module to keep console I/O quiet but dump it when needed"""
import types
import sys
class _PseudoStdin:
def __init__(self, stdouterr):
self.keep_stdin = sys.stdin
sys.stdin = self
self.keep_stdouterr = stdouterr
def __del__(self):
self.keep_stdin = self.keep_stdouterr = None
def _revert(self):
"""Return to old state, with true stdio"""
if self.keep_stdin == None:
return
sys.stdin = self.keep_stdin
self.keep_stdin = None
self.keep_stdouterr._revert(1)
self.keep_stdouterr = None
def read(self, *args):
self._revert()
return apply(sys.stdin.read, args)
def readlines(self, *args):
self._revert()
return apply(sys.stdin.readlines, args)
def readline(self, *args):
self._revert()
return apply(sys.stdin.readline, args)
def close(self):
self._revert()
sys.stdin.close()
class _PseudoStdouterr:
def __init__(self):
self.keep_stdout = sys.stdout
self.keep_stderr = sys.stderr
sys.stdout = sys.stderr = self
self.data = []
def __del__(self):
self.keep_stdout = self.keep_stderr = None
def _revert(self, dumpdata=0):
if self.keep_stdout == None:
return
sys.stdout = self.keep_stdout
sys.stderr = self.keep_stderr
sys.keep_stdout = self.keep_stderr = None
if dumpdata and self.data:
for d in self.data:
sys.stdout.write(d)
self.data = None
def write(self, arg):
self.data.append(arg)
def writelines(self, arg):
for d in arg:
self.data.append(arg)
def close(self):
self.keep_stdout = self.keep_stderr = self.data = None
beenhere = 0
def install():
global beenhere
if beenhere:
return
beenhere = 1
# There's no point in re-installing if the console has been active
obj = _PseudoStdouterr()
_PseudoStdin(obj)
# No need to keep the objects, they're saved in sys.std{in,out,err}
def revert():
if type(sys.stdin) == types.FileType:
return # Not installed
sys.stdin._revert()
def _test():
import time
install()
print "You will not see this yet"
time.sleep(1)
print "You will not see this yet"
time.sleep(1)
print "You will not see this yet"
time.sleep(1)
print "You will not see this yet"
time.sleep(1)
print "You will not see this yet"
time.sleep(1)
print "5 seconds have passed, now you may type something"
rv = sys.stdin.readline()
print "You typed", rv
if __name__ == '__main__':
_test()

View File

@ -1,207 +0,0 @@
"""AEservertest - Test AppleEvent server interface
(adapted from Guido's 'echo' program).
Build an applet from this source, and include the aete resource that you
want to test. Use the AEservertest script to try things.
"""
import sys
sys.stdout = sys.stderr
import traceback
import MacOS
from Carbon import AE
from Carbon.AppleEvents import *
from Carbon import Evt
from Carbon.Events import *
from Carbon import Menu
from Carbon import Dlg
from Carbon import Win
from Carbon.Windows import *
from Carbon import Qd
import macfs
import aetools
import EasyDialogs
kHighLevelEvent = 23 # Not defined anywhere for Python yet?
Quit='Quit'
def mymessage(str):
err = AE.AEInteractWithUser(kAEDefaultTimeout)
if err:
print str
EasyDialogs.Message(str)
def myaskstring(str, default=''):
err = AE.AEInteractWithUser(kAEDefaultTimeout)
if err:
return default
return EasyDialogs.AskString(str, default)
def main():
echo = EchoServer()
savepars = MacOS.SchedParams(0, 0) # Disable Python's own "event handling"
try:
try:
echo.mainloop(everyEvent, 0)
except Quit:
pass
finally:
apply(MacOS.SchedParams, savepars) # Let Python have a go at events
echo.close()
class EchoServer:
suites = ['aevt', 'core', 'reqd']
def __init__(self):
self.active = 0
#
# Install the handlers
#
for suite in self.suites:
AE.AEInstallEventHandler(suite, typeWildCard, self.aehandler)
print (suite, typeWildCard, self.aehandler)
self.active = 1
#
# Setup the apple menu and file/quit
#
self.appleid = 1
self.fileid = 2
Menu.ClearMenuBar()
self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
applemenu.AppendMenu("All about echo...;(-")
applemenu.InsertMenu(0)
self.filemenu = Menu.NewMenu(self.fileid, 'File')
self.filemenu.AppendMenu("Quit/Q")
self.filemenu.InsertMenu(0)
Menu.DrawMenuBar()
#
# Set interaction allowed (for the return values)
#
AE.AESetInteractionAllowed(kAEInteractWithAll)
def __del__(self):
self.close()
def close(self):
if self.active:
self.active = 0
for suite in self.suites:
AE.AERemoveEventHandler(suite, typeWildCard)
def mainloop(self, mask = everyEvent, timeout = 60*60):
while 1:
self.dooneevent(mask, timeout)
def dooneevent(self, mask = everyEvent, timeout = 60*60):
got, event = Evt.WaitNextEvent(mask, timeout)
if got:
self.lowlevelhandler(event)
def lowlevelhandler(self, event):
what, message, when, where, modifiers = event
h, v = where
if what == kHighLevelEvent:
msg = "High Level Event: %s %s" % \
(`code(message)`, `code(h | (v<<16))`)
self.handled_by_us = 0
try:
AE.AEProcessAppleEvent(event)
except AE.Error, err:
mymessage(msg + "\015AEProcessAppleEvent error: %s" % str(err))
traceback.print_exc()
else:
if self.handled_by_us == 0:
print msg, "Handled by AE, somehow"
else:
print msg, 'Handled by us.'
elif what == keyDown:
c = chr(message & charCodeMask)
if modifiers & cmdKey:
if c == '.':
raise KeyboardInterrupt, "Command-period"
else:
self.menuhit(Menu.MenuKey(message&charCodeMask))
##MacOS.HandleEvent(event)
elif what == mouseDown:
partcode, window = Win.FindWindow(where)
if partcode == inMenuBar:
result = Menu.MenuSelect(where)
self.menuhit(result)
elif what <> autoKey:
print "Event:", (eventname(what), message, when, (h, v), modifiers)
## MacOS.HandleEvent(event)
def menuhit(self, result):
id = (result>>16) & 0xffff # Hi word
item = result & 0xffff # Lo word
if id == self.appleid:
if item == 1:
mymessage("Echo -- echo AppleEvents")
elif id == self.fileid:
if item == 1:
raise Quit
def aehandler(self, request, reply):
print "Apple Event!"
self.handled_by_us = 1
parameters, attributes = aetools.unpackevent(request)
print "class =", `attributes['evcl'].type`,
print "id =", `attributes['evid'].type`
print "Parameters:"
keys = parameters.keys()
keys.sort()
for key in keys:
print "%s: %.150s" % (`key`, `parameters[key]`)
print " :", str(parameters[key])
print "Attributes:"
keys = attributes.keys()
keys.sort()
for key in keys:
print "%s: %.150s" % (`key`, `attributes[key]`)
parameters['----'] = self.askreplyvalue()
aetools.packevent(reply, parameters)
def askreplyvalue(self):
while 1:
str = myaskstring('Reply value to send (python-style)', 'None')
try:
rv = eval(str)
break
except:
pass
return rv
_eventnames = {
keyDown: 'keyDown',
autoKey: 'autoKey',
mouseDown: 'mouseDown',
mouseUp: 'mouseUp',
updateEvt: 'updateEvt',
diskEvt: 'diskEvt',
activateEvt: 'activateEvt',
osEvt: 'osEvt',
}
def eventname(what):
if _eventnames.has_key(what): return _eventnames[what]
else: return `what`
def code(x):
"Convert a long int to the 4-character code it really is"
s = ''
for i in range(4):
x, c = divmod(x, 256)
s = chr(c) + s
return s
if __name__ == '__main__':
main()

Binary file not shown.

View File

@ -1,475 +0,0 @@
# Look for scriptable applications -- that is, applications with an 'aete' resource
# Also contains (partially) reverse engineered 'aete' resource decoding
import MacOS
import os
import string
import sys
import types
import StringIO
from Carbon.Res import *
def main():
filename = ""
redirect(filename, realmain)
def redirect(filename, func, *args):
f = filename and open(filename, 'w')
save_stdout = sys.stdout
try:
if f: sys.stdout = f
return apply(func, args)
finally:
sys.stdout = save_stdout
if f: f.close()
def realmain():
#list('C:System Folder:Extensions:AppleScript\252')
#list('C:Tao AppleScript:Finder Liaison:Finder Liaison 1.0')
list('C:Tao AppleScript:Scriptable Text Editor')
#list('C:Internet:Eudora 1.4.2:Eudora1.4.2')
#list('E:Excel 4.0:Microsoft Excel')
#list('C:Internet:Netscape 1.0N:Netscape 1.0N')
#find('C:')
#find('D:')
#find('E:')
#find('F:')
def find(dir, maxlevel = 5):
hits = []
cur = CurResFile()
names = os.listdir(dir)
tuples = map(lambda x: (os.path.normcase(x), x), names)
tuples.sort()
names = map(lambda (x, y): y, tuples)
for name in names:
if name in (os.curdir, os.pardir): continue
fullname = os.path.join(dir, name)
if os.path.islink(fullname):
pass
if os.path.isdir(fullname):
if maxlevel > 0:
sys.stderr.write(" %s\n" % `fullname`)
hits = hits + find(fullname, maxlevel-1)
else:
ctor, type = MacOS.GetCreatorAndType(fullname)
if type in ('APPL', 'FNDR', 'zsys', 'INIT', 'scri', 'cdev'):
sys.stderr.write(" %s\n" % `fullname`)
try:
rf = OpenRFPerm(fullname, 0, '\1')
except MacOS.Error, msg:
print "Error:", fullname, msg
continue
UseResFile(rf)
n = Count1Resources('aete')
if rf <> cur:
CloseResFile(rf)
UseResFile(cur)
if n > 1:
hits.append(fullname)
sys.stderr.write("YES! %d in %s\n" % (n, `fullname`))
list(fullname)
return hits
def list(fullname):
cur = CurResFile()
rf = OpenRFPerm(fullname, 0, '\1')
try:
UseResFile(rf)
resources = []
for i in range(Count1Resources('aete')):
res = Get1IndResource('aete', 1+i)
resources.append(res)
for i in range(Count1Resources('aeut')):
res = Get1IndResource('aeut', 1+i)
resources.append(res)
print "\nLISTING aete+aeut RESOURCES IN", `fullname`
for res in resources:
print "decoding", res.GetResInfo(), "..."
data = res.data
try:
aete = decode(data)
showaete(aete)
print "Checking putaete..."
f = StringIO.StringIO()
putaete(f, aete)
newdata = f.getvalue()
if len(newdata) == len(data):
if newdata == data:
print "putaete created identical data"
else:
newaete = decode(newdata)
if newaete == aete:
print "putaete created equivalent data"
else:
print "putaete failed the test:"
showaete(newaete)
else:
print "putaete created different data:"
print `newdata`
except:
import traceback
traceback.print_exc()
sys.stdout.flush()
finally:
if rf <> cur:
CloseResFile(rf)
UseResFile(cur)
def decode(data):
f = StringIO.StringIO(data)
aete = generic(getaete, f)
aete = simplify(aete)
processed = f.tell()
unprocessed = len(f.read())
total = f.tell()
if unprocessed:
sys.stderr.write("%d processed + %d unprocessed = %d total\n" %
(processed, unprocessed, total))
return aete
def simplify(item):
if type(item) is types.ListType:
return map(simplify, item)
elif type(item) == types.TupleType and len(item) == 2:
return simplify(item[1])
else:
return item
# Here follows the aete resource decoder.
# It is presented bottom-up instead of top-down because there are direct
# references to the lower-level part-decoders from the high-level part-decoders.
def getbyte(f, *args):
c = f.read(1)
if not c:
raise EOFError, 'in getbyte' + str(args)
return ord(c)
def getword(f, *args):
getalign(f)
s = f.read(2)
if len(s) < 2:
raise EOFError, 'in getword' + str(args)
return (ord(s[0])<<8) | ord(s[1])
def getlong(f, *args):
getalign(f)
s = f.read(4)
if len(s) < 4:
raise EOFError, 'in getlong' + str(args)
return (ord(s[0])<<24) | (ord(s[1])<<16) | (ord(s[2])<<8) | ord(s[3])
def getostype(f, *args):
getalign(f)
s = f.read(4)
if len(s) < 4:
raise EOFError, 'in getostype' + str(args)
return s
def getpstr(f, *args):
c = f.read(1)
if len(c) < 1:
raise EOFError, 'in getpstr[1]' + str(args)
nbytes = ord(c)
if nbytes == 0: return ''
s = f.read(nbytes)
if len(s) < nbytes:
raise EOFError, 'in getpstr[2]' + str(args)
return s
def getalign(f):
if f.tell() & 1:
c = f.read(1)
##if c <> '\0':
## print 'align:', `c`
def getlist(f, description, getitem):
count = getword(f)
list = []
for i in range(count):
list.append(generic(getitem, f))
getalign(f)
return list
def alt_generic(what, f, *args):
print "generic", `what`, args
res = vageneric(what, f, args)
print '->', `res`
return res
def generic(what, f, *args):
if type(what) == types.FunctionType:
return apply(what, (f,) + args)
if type(what) == types.ListType:
record = []
for thing in what:
item = apply(generic, thing[:1] + (f,) + thing[1:])
record.append((thing[1], item))
return record
return "BAD GENERIC ARGS: %s" % `what`
getdata = [
(getostype, "type"),
(getpstr, "description"),
(getword, "flags")
]
getargument = [
(getpstr, "name"),
(getostype, "keyword"),
(getdata, "what")
]
getevent = [
(getpstr, "name"),
(getpstr, "description"),
(getostype, "suite code"),
(getostype, "event code"),
(getdata, "returns"),
(getdata, "accepts"),
(getlist, "optional arguments", getargument)
]
getproperty = [
(getpstr, "name"),
(getostype, "code"),
(getdata, "what")
]
getelement = [
(getostype, "type"),
(getlist, "keyform", getostype)
]
getclass = [
(getpstr, "name"),
(getostype, "class code"),
(getpstr, "description"),
(getlist, "properties", getproperty),
(getlist, "elements", getelement)
]
getcomparison = [
(getpstr, "operator name"),
(getostype, "operator ID"),
(getpstr, "operator comment"),
]
getenumerator = [
(getpstr, "enumerator name"),
(getostype, "enumerator ID"),
(getpstr, "enumerator comment")
]
getenumeration = [
(getostype, "enumeration ID"),
(getlist, "enumerator", getenumerator)
]
getsuite = [
(getpstr, "suite name"),
(getpstr, "suite description"),
(getostype, "suite ID"),
(getword, "suite level"),
(getword, "suite version"),
(getlist, "events", getevent),
(getlist, "classes", getclass),
(getlist, "comparisons", getcomparison),
(getlist, "enumerations", getenumeration)
]
getaete = [
(getword, "major/minor version in BCD"),
(getword, "language code"),
(getword, "script code"),
(getlist, "suites", getsuite)
]
# Display 'aete' resources in a friendly manner.
# This one's done top-down again...
def showaete(aete):
[version, language, script, suites] = aete
major, minor = divmod(version, 256)
print "\nVersion %d/%d, language %d, script %d" % \
(major, minor, language, script)
for suite in suites:
showsuite(suite)
def showsuite(suite):
[name, desc, code, level, version, events, classes, comps, enums] = suite
print "\nSuite %s -- %s (%s)" % (`name`, `desc`, `code`)
print "Level %d, version %d" % (level, version)
for event in events:
showevent(event)
for cls in classes:
showclass(cls)
for comp in comps:
showcomparison(comp)
for enum in enums:
showenumeration(enum)
def showevent(event):
[name, desc, code, subcode, returns, accepts, arguments] = event
print "\n Command %s -- %s (%s, %s)" % (`name`, `desc`, `code`, `subcode`)
print " returns", showdata(returns)
print " accepts", showdata(accepts)
for arg in arguments:
showargument(arg)
def showargument(arg):
[name, keyword, what] = arg
print " %s (%s)" % (name, `keyword`), showdata(what)
def showclass(cls):
[name, code, desc, properties, elements] = cls
print "\n Class %s (%s) -- %s" % (`name`, `code`, `desc`)
for prop in properties:
showproperty(prop)
for elem in elements:
showelement(elem)
def showproperty(prop):
[name, code, what] = prop
print " property %s (%s)" % (`name`, `code`), showdata(what)
def showelement(elem):
[code, keyform] = elem
print " element %s" % `code`, "as", keyform
def showcomparison(comp):
[name, code, comment] = comp
print " comparison %s (%s) -- %s" % (`name`, `code`, comment)
def showenumeration(enum):
[code, items] = enum
print "\n Enum %s" % `code`
for item in items:
showenumerator(item)
def showenumerator(item):
[name, code, desc] = item
print " %s (%s) -- %s" % (`name`, `code`, `desc`)
def showdata(data):
[type, description, flags] = data
return "%s -- %s %s" % (`type`, `description`, showdataflags(flags))
dataflagdict = {15: "optional", 14: "list", 13: "enum", 12: "mutable"}
def showdataflags(flags):
bits = []
for i in range(16):
if flags & (1<<i):
if i in dataflagdict.keys():
bits.append(dataflagdict[i])
else:
bits.append(`i`)
return '[%s]' % string.join(bits)
# Write an 'aete' resource.
# Closedly modelled after showaete()...
def putaete(f, aete):
[version, language, script, suites] = aete
putword(f, version)
putword(f, language)
putword(f, script)
putlist(f, suites, putsuite)
def putsuite(f, suite):
[name, desc, code, level, version, events, classes, comps, enums] = suite
putpstr(f, name)
putpstr(f, desc)
putostype(f, code)
putword(f, level)
putword(f, version)
putlist(f, events, putevent)
putlist(f, classes, putclass)
putlist(f, comps, putcomparison)
putlist(f, enums, putenumeration)
def putevent(f, event):
[name, desc, eventclass, eventid, returns, accepts, arguments] = event
putpstr(f, name)
putpstr(f, desc)
putostype(f, eventclass)
putostype(f, eventid)
putdata(f, returns)
putdata(f, accepts)
putlist(f, arguments, putargument)
def putargument(f, arg):
[name, keyword, what] = arg
putpstr(f, name)
putostype(f, keyword)
putdata(f, what)
def putclass(f, cls):
[name, code, desc, properties, elements] = cls
putpstr(f, name)
putostype(f, code)
putpstr(f, desc)
putlist(f, properties, putproperty)
putlist(f, elements, putelement)
putproperty = putargument
def putelement(f, elem):
[code, parts] = elem
putostype(f, code)
putlist(f, parts, putostype)
def putcomparison(f, comp):
[name, id, comment] = comp
putpstr(f, name)
putostype(f, id)
putpstr(f, comment)
def putenumeration(f, enum):
[code, items] = enum
putostype(f, code)
putlist(f, items, putenumerator)
def putenumerator(f, item):
[name, code, desc] = item
putpstr(f, name)
putostype(f, code)
putpstr(f, desc)
def putdata(f, data):
[type, description, flags] = data
putostype(f, type)
putpstr(f, description)
putword(f, flags)
def putlist(f, list, putitem):
putword(f, len(list))
for item in list:
putitem(f, item)
putalign(f)
def putalign(f):
if f.tell() & 1:
f.write('\0')
def putbyte(f, value):
f.write(chr(value))
def putword(f, value):
putalign(f)
f.write(chr((value>>8)&0xff))
f.write(chr(value&0xff))
def putostype(f, value):
putalign(f)
if type(value) != types.StringType or len(value) != 4:
raise TypeError, "ostype must be 4-char string"
f.write(value)
def putpstr(f, value):
if type(value) != types.StringType or len(value) > 255:
raise TypeError, "pstr must be string <= 255 chars"
f.write(chr(len(value)) + value)
# Call the main program
if __name__ == '__main__':
main()
else:
realmain()

View File

@ -1,45 +0,0 @@
"""cmtest - List all components in the system"""
from Carbon import Cm
from Carbon import Res
from Carbon import sys
def getstr255(r):
"""Get string from str255 resource"""
if not r.data: return ''
len = ord(r.data[0])
return r.data[1:1+len]
def getinfo(c):
"""Return (type, subtype, creator, fl1, fl2, name, description) for component"""
h1 = Res.Resource('')
h2 = Res.Resource('')
h3 = Res.Resource('')
type, subtype, creator, fl1, fl2 = c.GetComponentInfo(h1, h2, h3)
name = getstr255(h1)
description = getstr255(h2)
return type, subtype, creator, fl1, fl2, name, description
def getallcomponents():
"""Return list with info for all components, sorted"""
any = ('\0\0\0\0', '\0\0\0\0', '\0\0\0\0', 0, 0)
c = None
rv = []
while 1:
try:
c = Cm.FindNextComponent(c, any)
except Cm.Error:
break
rv.append(getinfo(c))
rv.sort()
return rv
def main():
"""Print info for all components"""
info = getallcomponents()
for type, subtype, creator, f1, f2, name, description in info:
print '%4.4s %4.4s %4.4s %s 0x%x 0x%x'%(type, subtype, creator, name, f1, f2)
print ' ', description
sys.exit(1)
main()

View File

@ -1,50 +0,0 @@
#
# Simple test program for ctb module: emulate a terminal.
# To simplify matters use the python console window for output.
#
import ctb
from Carbon import Evt
from Carbon import Events
import MacOS
import sys
def cb(err):
print 'Done, err=', err
def main():
if not ctb.available():
print 'Communications Toolbox not available'
sys.exit(1)
# Disable Python's event processing (we do that)
MacOS.SchedParams(1, 0)
print 'Minimal terminal emulator V1.0'
print '(type command-Q to exit)'
print
l = ctb.CMNew('Serial Tool', None)
l.Open(10)
l.SetConfig(l.GetConfig() + ' baud 4800')
while 1:
l.Idle() # Give time to ctb
ok, evt = Evt.WaitNextEvent(0xffff, 0)
if ok:
what, message, when, where, modifiers = evt
if what == Events.keyDown:
# It is ours. Check for command-. to terminate
ch = chr(message & Events.charCodeMask)
if ch == 'q' and (modifiers & Events.cmdKey):
break
l.Write(ch, ctb.cmData, -1, 0)
d, dummy = l.Read(1000, ctb.cmData, 1)
if d:
for ch in d:
if ch != '\r':
sys.stdout.write(ch)
sys.stdout.flush()
l.Close(-1, 1)
del l
main()

View File

@ -1,43 +0,0 @@
from Carbon import Drag
import time
xxxx=1
def decode_hfs(data):
import struct, macfs
tp = data[0:4]
cr = data[4:8]
flags = struct.unpack("h", data[8:10])
fss = macfs.RawFSSpec(data[10:])
return tp, cr, flags, fss
def tracker(msg, dragref, window):
pass
def dropper(dragref, window):
global xxxx
n = dragref.CountDragItems()
print 'Drop %d items:'%n
for i in range(1, n+1):
refnum = dragref.GetDragItemReferenceNumber(i)
print '%d (ItemReference 0x%x)'%(i, refnum)
nf = dragref.CountDragItemFlavors(refnum)
print ' %d flavors:'%nf
for j in range(1, nf+1):
ftype = dragref.GetFlavorType(refnum, j)
fflags = dragref.GetFlavorFlags(refnum, ftype)
print ' "%4.4s" 0x%x'%(ftype, fflags)
if ftype == 'hfs ':
datasize = dragref.GetFlavorDataSize(refnum, ftype)
data = dragref.GetFlavorData(refnum, ftype, datasize, 0)
print ' datasize', `data`
xxxx = data
print ' ->', decode_hfs(data)
def main():
print "Drag things onto output window. Press command-. to quit."
Drag.InstallTrackingHandler(tracker)
Drag.InstallReceiveHandler(dropper)
while 1:
time.sleep(100)
main()

View File

@ -1,155 +0,0 @@
"""'echo' -- an AppleEvent handler which handles all events the same.
It replies to each event by echoing the parameter back to the client.
This is a good way to find out how the Script Editor formats AppleEvents,
especially to figure out all the different forms an object specifier
can have (without having to rely on Apple's implementation).
"""
import sys
sys.stdout = sys.stderr
import traceback
import MacOS
from Carbon import AE
from Carbon.AppleEvents import *
from Carbon import Evt
from Carbon.Events import *
from Carbon import Menu
from Carbon import Dlg
from Carbon import Win
from Carbon.Windows import *
from Carbon import Qd
import aetools
import EasyDialogs
kHighLevelEvent = 23 # Not defined anywhere for Python yet?
def mymessage(str):
err = AE.AEInteractWithUser(kAEDefaultTimeout)
if err:
print str
EasyDialogs.Message(str)
def main():
echo = EchoServer()
saveparams = MacOS.SchedParams(0, 0) # Disable Python's own "event handling"
try:
echo.mainloop(everyEvent, 0)
finally:
apply(MacOS.SchedParams, saveparams) # Let Python have a go at events
echo.close()
class EchoServer:
#suites = ['aevt', 'core', 'reqd']
suites = ['****']
def __init__(self):
self.active = 0
for suite in self.suites:
AE.AEInstallEventHandler(suite, typeWildCard, self.aehandler)
print (suite, typeWildCard, self.aehandler)
self.active = 1
self.appleid = 1
Menu.ClearMenuBar()
self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
applemenu.AppendMenu("All about echo...;(-")
applemenu.InsertMenu(0)
Menu.DrawMenuBar()
def __del__(self):
self.close()
def close(self):
if self.active:
self.active = 0
for suite in self.suites:
AE.AERemoveEventHandler(suite, typeWildCard)
def mainloop(self, mask = everyEvent, timeout = 60*60):
while 1:
self.dooneevent(mask, timeout)
def dooneevent(self, mask = everyEvent, timeout = 60*60):
got, event = Evt.WaitNextEvent(mask, timeout)
if got:
self.lowlevelhandler(event)
def lowlevelhandler(self, event):
what, message, when, where, modifiers = event
h, v = where
if what == kHighLevelEvent:
msg = "High Level Event: %s %s" % \
(`code(message)`, `code(h | (v<<16))`)
try:
AE.AEProcessAppleEvent(event)
except AE.Error, err:
mymessage(msg + "\015AEProcessAppleEvent error: %s" % str(err))
traceback.print_exc()
else:
mymessage(msg + "\015OK!")
elif what == keyDown:
c = chr(message & charCodeMask)
if c == '.' and modifiers & cmdKey:
raise KeyboardInterrupt, "Command-period"
MacOS.HandleEvent(event)
elif what == mouseDown:
partcode, window = Win.FindWindow(where)
if partcode == inMenuBar:
result = Menu.MenuSelect(where)
id = (result>>16) & 0xffff # Hi word
item = result & 0xffff # Lo word
if id == self.appleid:
if item == 1:
mymessage("Echo -- echo AppleEvents")
elif what <> autoKey:
print "Event:", (eventname(what), message, when, (h, v), modifiers)
## MacOS.HandleEvent(event)
def aehandler(self, request, reply):
print "Apple Event!"
parameters, attributes = aetools.unpackevent(request)
print "class =", `attributes['evcl'].type`,
print "id =", `attributes['evid'].type`
print "Parameters:"
keys = parameters.keys()
keys.sort()
for key in keys:
print "%s: %.150s" % (`key`, `parameters[key]`)
print " :", str(parameters[key])
print "Attributes:"
keys = attributes.keys()
keys.sort()
for key in keys:
print "%s: %.150s" % (`key`, `attributes[key]`)
aetools.packevent(reply, parameters)
_eventnames = {
keyDown: 'keyDown',
autoKey: 'autoKey',
mouseDown: 'mouseDown',
mouseUp: 'mouseUp',
updateEvt: 'updateEvt',
diskEvt: 'diskEvt',
activateEvt: 'activateEvt',
osEvt: 'osEvt',
}
def eventname(what):
if _eventnames.has_key(what): return _eventnames[what]
else: return `what`
def code(x):
"Convert a long int to the 4-character code it really is"
s = ''
for i in range(4):
x, c = divmod(x, 256)
s = chr(c) + s
return s
if __name__ == '__main__':
main()

View File

@ -1,17 +0,0 @@
"""fgbgtest - See how many CPU cycles we get"""
import time
loopct = 0L
oldloopct = 0L
oldt = time.time()
while 1:
t = time.time()
if t - oldt >= 1:
if oldloopct:
print loopct-oldloopct,'in one second'
oldloopct = loopct
oldt = time.time()
loopct = loopct + 1

View File

@ -1,28 +0,0 @@
"""Test icglue module by printing all preferences. Note that the ic module,
not the icglue module, is what you should normally use."""
import icglue
from Carbon import Res
ici = icglue.ICStart('Pyth')
#ici.ICFindConfigFile()
h = Res.Resource("")
ici.ICBegin(1)
numprefs = ici.ICCountPref()
print "Number of preferences:", numprefs
for i in range(1, numprefs+1):
key = ici.ICGetIndPref(i)
print "Key: ", key
h.data = ""
attrs = ici.ICFindPrefHandle(key, h)
print "Attr: ", attrs
print "Data: ", `h.data[:64]`
ici.ICEnd()
del ici
import sys
sys.exit(1)

View File

@ -1,211 +0,0 @@
/* Use this file as a template to start implementing a module that
also declares object types. All occurrences of 'Xxo' should be changed
to something reasonable for your objects. After that, all other
occurrences of 'xx' should be changed to something reasonable for your
module. If your module is named foo your sourcefile should be named
foomodule.c.
You will probably want to delete all references to 'x_attr' and add
your own types of attributes instead. Maybe you want to name your
local variables other than 'self'. If your object type is needed in
other files, you'll have to create a file "foobarobject.h"; see
intobject.h for an example. */
/* Xxo objects */
#include "Python.h"
static PyObject *ErrorObject;
typedef struct {
PyObject_HEAD
PyObject *x_attr; /* Attributes dictionary */
} XxoObject;
static PyTypeObject Xxo_Type;
#define XxoObject_Check(v) ((v)->ob_type == &Xxo_Type)
static XxoObject *
newXxoObject(PyObject *arg)
{
XxoObject *self;
self = PyObject_New(XxoObject, &Xxo_Type);
if (self == NULL)
return NULL;
self->x_attr = NULL;
return self;
}
/* Xxo methods */
static void
Xxo_dealloc(XxoObject *self)
{
Py_XDECREF(self->x_attr);
PyObject_Del(self);
}
static PyObject *
Xxo_demo(XxoObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":demo"))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef Xxo_methods[] = {
{"demo", (PyCFunction)Xxo_demo, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
static PyObject *
Xxo_getattr(XxoObject *self, char *name)
{
if (self->x_attr != NULL) {
PyObject *v = PyDict_GetItemString(self->x_attr, name);
if (v != NULL) {
Py_INCREF(v);
return v;
}
}
return Py_FindMethod(Xxo_methods, (PyObject *)self, name);
}
static int
Xxo_setattr(XxoObject *self, char *name, PyObject *v)
{
if (self->x_attr == NULL) {
self->x_attr = PyDict_New();
if (self->x_attr == NULL)
return -1;
}
if (v == NULL) {
int rv = PyDict_DelItemString(self->x_attr, name);
if (rv < 0)
PyErr_SetString(PyExc_AttributeError,
"delete non-existing Xxo attribute");
return rv;
}
else
return PyDict_SetItemString(self->x_attr, name, v);
}
statichere PyTypeObject Xxo_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"Xxmodule.Xxo", /*tp_name*/
sizeof(XxoObject), /*tp_basicsize*/
0, /*tp_itemsize*/
/* methods */
(destructor)Xxo_dealloc, /*tp_dealloc*/
0, /*tp_print*/
(getattrfunc)Xxo_getattr, /*tp_getattr*/
(setattrfunc)Xxo_setattr, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
};
/* --------------------------------------------------------------------- */
/* Function of two integers returning integer */
static PyObject *
xx_foo(PyObject *self, PyObject *args)
{
long i, j;
long res;
if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
return NULL;
res = i+j; /* XXX Do something here */
return PyInt_FromLong(res);
}
/* Function of no arguments returning new Xxo object */
static PyObject *
xx_new(PyObject *self, PyObject *args)
{
XxoObject *rv;
if (!PyArg_ParseTuple(args, ":new"))
return NULL;
rv = newXxoObject(args);
if ( rv == NULL )
return NULL;
return (PyObject *)rv;
}
/* Example with subtle bug from extensions manual ("Thin Ice"). */
static PyObject *
xx_bug(PyObject *self, PyObject *args)
{
PyObject *list, *item;
if (!PyArg_ParseTuple(args, "O:bug", &list))
return NULL;
item = PyList_GetItem(list, 0);
/* Py_INCREF(item); */
PyList_SetItem(list, 1, PyInt_FromLong(0L));
PyObject_Print(item, stdout, 0);
printf("\n");
/* Py_DECREF(item); */
Py_INCREF(Py_None);
return Py_None;
}
/* Test bad format character */
static PyObject *
xx_roj(PyObject *self, PyObject *args)
{
PyObject *a;
long b;
if (!PyArg_ParseTuple(args, "O#:roj", &a, &b))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of functions defined in the module */
static PyMethodDef xx_methods[] = {
{"roj", xx_roj, METH_VARARGS},
{"foo", xx_foo, METH_VARARGS},
{"new", xx_new, METH_VARARGS},
{"bug", xx_bug, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initxx) */
DL_EXPORT(void)
initmkcwtest(void)
{
PyObject *m, *d;
/* Initialize the type of the new type object here; doing it here
* is required for portability to Windows without requiring C++. */
Xxo_Type.ob_type = &PyType_Type;
/* Create the module and add the functions */
m = Py_InitModule("mkcwtest", xx_methods);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyErr_NewException("xx.error", NULL, NULL);
PyDict_SetItemString(d, "error", ErrorObject);
}

View File

@ -1,12 +0,0 @@
import mkcwproject
import sys
dict = {
"sysprefix": sys.prefix,
"sources": ["mkcwtestmodule.c"],
"extrasearchdirs": [],
}
mkcwproject.mkproject("mkcwtest.prj", "mkcwtest", dict)
mkcwproject.buildproject("mkcwtest.prj")

View File

@ -1,4 +0,0 @@
The files in this folder are not maintained very well. They have worked at some
point in the past, but they may not work anymore. They may contain interesting
information, but they could also very well contain misinformation. Use at your
own risk.

View File

@ -1,63 +0,0 @@
# (Slightly less) primitive operations for sending Apple Events to applications.
# This could be the basis of a Script Editor like application.
from Carbon.AE import *
from Carbon.AppleEvents import *
import aetools
import types
class TalkTo:
def __init__(self, signature):
"""Create a communication channel with a particular application.
For now, the application must be given by its 4-character signature
(because I don't know yet how to do other target types).
"""
if type(signature) != types.StringType or len(signature) != 4:
raise TypeError, "signature should be 4-char string"
self.target = AECreateDesc(typeApplSignature, signature)
self.send_flags = kAEWaitReply
self.send_priority = kAENormalPriority
self.send_timeout = kAEDefaultTimeout
def newevent(self, code, subcode, parameters = {}, attributes = {}):
event = AECreateAppleEvent(code, subcode, self.target,
kAutoGenerateReturnID, kAnyTransactionID)
aetools.packevent(event, parameters, attributes)
return event
def sendevent(self, event):
reply = event.AESend(self.send_flags, self.send_priority,
self.send_timeout)
parameters, attributes = aetools.unpackevent(reply)
return reply, parameters, attributes
def send(self, code, subcode, parameters = {}, attributes = {}):
return self.sendevent(self.newevent(code, subcode, parameters, attributes))
def activate(self):
# Send undocumented but easily reverse engineered 'activate' command
self.send('misc', 'actv')
# This object is equivalent to "selection" in AppleScript
# (in the core suite, if that makes a difference):
get_selection = aetools.Property('sele', None)
# Test program. You can make it do what you want by passing parameters.
# The default gets the selection from Quill (Scriptable Text Editor).
def test(app = 'quil', suite = 'core', id = 'getd', arg = get_selection):
t = TalkTo(app)
t.activate()
if arg:
dict = {'----': arg}
else:
dict = {}
reply, parameters, attributes = t.send(suite, id, dict)
print reply, parameters
if parameters.has_key('----'): print "returns:", str(parameters['----'])
test()
# So we can see it:
import sys
sys.exit(1)

View File

@ -1,5 +0,0 @@
tell application "AEservertest"
activate
set x to window "testing"
open file x
end tell

View File

@ -1,13 +0,0 @@
import W
from Carbon.Controls import *
w = W.Window((200,200), "Test")
w.c = W.Button((5,5,100,50), "Test")
w.open()
print repr(w.c._control.GetControlData(0, 'dflt'))
str = '\001'
w.c._control.SetControlData(0, 'dflt', str)

View File

@ -1,92 +0,0 @@
# Test List module.
# Draw a window with all the files in the current folder.
# double-clicking will change folder.
#
# This test expects Win, Evt and FrameWork (and anything used by those)
# to work.
#
# Actually, it is more a test of FrameWork by now....
from FrameWork import *
from Carbon import Win
from Carbon import Qd
from Carbon import List
from Carbon import Lists
import os
class ListWindow(Window):
def open(self, name, where):
self.where = where
r = (40, 40, 400, 300)
w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555)
r2 = (0, 0, 345, 245)
Qd.SetPort(w)
self.wid = w
self.list = List.LNew(r2, (0, 0, 1, 1), (0,0), 0, w, 0, 1, 1, 1)
self.list.selFlags = Lists.lOnlyOne
self.filllist()
w.DrawGrowIcon()
self.do_postopen()
def do_activate(self, onoff, evt):
self.list.LActivate(onoff)
def do_update(self, *args):
self.list.LUpdate(self.wid.GetWindowPort().visRgn)
def do_contentclick(self, local, modifiers, evt):
dclick = self.list.LClick(local, modifiers)
if dclick:
h, v = self.list.LLastClick()
file = self.list.LGetCell(1000, (h, v))
self.where = os.path.join(self.where, file)
self.filllist()
def filllist(self):
"""Fill the list with the contents of the current directory"""
l = self.list
l.LSetDrawingMode(0)
l.LDelRow(0, 0)
contents = os.listdir(self.where)
l.LAddRow(len(contents), 0)
for i in range(len(contents)):
l.LSetCell(contents[i], (0, i))
l.LSetDrawingMode(1)
l.LUpdate(self.wid.GetWindowPort().visRgn)
class TestList(Application):
def __init__(self):
Application.__init__(self)
self.num = 0
self.listoflists = []
def makeusermenus(self):
self.filemenu = m = Menu(self.menubar, "File")
self.newitem = MenuItem(m, "New window...", "O", self.open)
self.quititem = MenuItem(m, "Quit", "Q", self.quit)
def open(self, *args):
import macfs
fss, ok = macfs.GetDirectory()
if not ok:
return
w = ListWindow(self)
w.open('Window %d'%self.num, fss.as_pathname())
self.num = self.num + 1
self.listoflists.append(w)
def quit(self, *args):
raise self
def do_about(self, id, item, window, event):
EasyDialogs.Message("""Test the List Manager interface.
Simple inward-only folder browser""")
def main():
App = TestList()
App.mainloop()
if __name__ == '__main__':
main()

View File

@ -1,18 +0,0 @@
# Show off SndPlay (and some resource manager functions).
# Get a list of all 'snd ' resources in the system and play them all.
from Carbon.Res import *
from Carbon.Snd import *
ch = SndNewChannel(0, 0, None)
print "Channel:", ch
type = 'snd '
for i in range(CountResources(type)):
r = GetIndResource(type, i+1)
print r.GetResInfo(), r.size
if r.GetResInfo()[0] == 1:
print "Skipping simple beep"
continue
ch.SndPlay(r, 0)

View File

@ -1,17 +0,0 @@
# Test TE module, simple version
from Carbon.Win import *
from Carbon.TE import *
from Carbon import Qd
r = (40, 40, 140, 140)
w = NewWindow(r, "TETextBox test", 1, 0, -1, 1, 0x55555555)
##w.DrawGrowIcon()
r = (10, 10, 90, 90)
Qd.SetPort(w)
t = TETextBox("Nobody expects the SPANISH inquisition", r, 1)
import time
time.sleep(10)

Some files were not shown because too many files have changed in this diff Show More