diff options
181 files changed, 0 insertions, 22664 deletions
diff --git a/Mac/Build/HtmlRender.prj b/Mac/Build/HtmlRender.prj Binary files differdeleted file mode 100644 index 5f917e2..0000000 --- a/Mac/Build/HtmlRender.prj +++ /dev/null diff --git a/Mac/Build/PythonCore.axp b/Mac/Build/PythonCore.axp deleted file mode 100644 index 035d7b8..0000000 --- a/Mac/Build/PythonCore.axp +++ /dev/null @@ -1,7 +0,0 @@ -__terminate -__initialize -__start -__ptmf_null -__vec_longjmp -longjmp -exit diff --git a/Mac/Build/PythonCore.mcp b/Mac/Build/PythonCore.mcp Binary files differdeleted file mode 100644 index 7ec096f..0000000 --- a/Mac/Build/PythonCore.mcp +++ /dev/null diff --git a/Mac/Build/PythonInterpreter.mcp b/Mac/Build/PythonInterpreter.mcp Binary files differdeleted file mode 100644 index 830d766..0000000 --- a/Mac/Build/PythonInterpreter.mcp +++ /dev/null diff --git a/Mac/Build/PythonStandSmall.mcp b/Mac/Build/PythonStandSmall.mcp Binary files differdeleted file mode 100644 index 131b9ba..0000000 --- a/Mac/Build/PythonStandSmall.mcp +++ /dev/null diff --git a/Mac/Build/PythonStandalone.mcp b/Mac/Build/PythonStandalone.mcp Binary files differdeleted file mode 100644 index 4514224..0000000 --- a/Mac/Build/PythonStandalone.mcp +++ /dev/null diff --git a/Mac/Build/_CG.carbon.mcp b/Mac/Build/_CG.carbon.mcp Binary files differdeleted file mode 100755 index da7927e..0000000 --- a/Mac/Build/_CG.carbon.mcp +++ /dev/null diff --git a/Mac/Build/_CG.carbon.mcp.exp b/Mac/Build/_CG.carbon.mcp.exp deleted file mode 100755 index bc94814..0000000 --- a/Mac/Build/_CG.carbon.mcp.exp +++ /dev/null @@ -1 +0,0 @@ -init_CG diff --git a/Mac/Build/_dummy_tkinter.mcp b/Mac/Build/_dummy_tkinter.mcp Binary files differdeleted file mode 100644 index c011b00..0000000 --- a/Mac/Build/_dummy_tkinter.mcp +++ /dev/null diff --git a/Mac/Build/_dummy_tkinter.mcp.exp b/Mac/Build/_dummy_tkinter.mcp.exp deleted file mode 100644 index 87b86e8..0000000 --- a/Mac/Build/_dummy_tkinter.mcp.exp +++ /dev/null @@ -1 +0,0 @@ -init_tkinter
\ No newline at end of file diff --git a/Mac/Build/buildlibs.mcp b/Mac/Build/buildlibs.mcp Binary files differdeleted file mode 100644 index d1684e1..0000000 --- a/Mac/Build/buildlibs.mcp +++ /dev/null diff --git a/Mac/Compat/sync.c b/Mac/Compat/sync.c deleted file mode 100644 index 1a8d3f9..0000000 --- a/Mac/Compat/sync.c +++ /dev/null @@ -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; - } -} diff --git a/Mac/Contrib/AECaptureParser/AECaptureParser.py b/Mac/Contrib/AECaptureParser/AECaptureParser.py deleted file mode 100644 index 3d74f64..0000000 --- a/Mac/Contrib/AECaptureParser/AECaptureParser.py +++ /dev/null @@ -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() diff --git a/Mac/Contrib/AECaptureParser/readme.txt b/Mac/Contrib/AECaptureParser/readme.txt deleted file mode 100644 index 1506111..0000000 --- a/Mac/Contrib/AECaptureParser/readme.txt +++ /dev/null @@ -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. diff --git a/Mac/Contrib/BBPy.lm/BBPy.c b/Mac/Contrib/BBPy.lm/BBPy.c deleted file mode 100644 index bcb8d4e..0000000 --- a/Mac/Contrib/BBPy.lm/BBPy.c +++ /dev/null @@ -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 ¶ms, - 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 ¶ms, - 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; -}
\ No newline at end of file diff --git a/Mac/Contrib/BBPy.lm/BBPythonLM.mcp b/Mac/Contrib/BBPy.lm/BBPythonLM.mcp Binary files differdeleted file mode 100644 index 232954b..0000000 --- a/Mac/Contrib/BBPy.lm/BBPythonLM.mcp +++ /dev/null diff --git a/Mac/Contrib/BBPy.lm/BBpy.r b/Mac/Contrib/BBPy.lm/BBpy.r deleted file mode 100644 index 7d80b4a..0000000 --- a/Mac/Contrib/BBPy.lm/BBpy.r +++ /dev/null @@ -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 -}; diff --git a/Mac/Contrib/BBPy.lm/Python b/Mac/Contrib/BBPy.lm/Python deleted file mode 100644 index 67ee70f..0000000 --- a/Mac/Contrib/BBPy.lm/Python +++ /dev/null @@ -1 +0,0 @@ -(This file must be converted with BinHex 4.0)
:!!"#3Na08LTMD!#3""5,!!!$"mhr5Qpj)A"PCQC`Gh"M!!!!!EE-IXm!N!d$!!)
!N!6rN!3!N!B5C!!!%Q3!!"*N!!!!i!!%"!$rN!3!N!B"E!!!!93!!!%l!!!68!)
""!$rN!3!N!pB!!!!J!3%"!#3#!%!!!!8rj!%!*!%rj!%!*!2!3!!!%3!!!"3!!!
!8!!!!!%!N!8"!*!&"3#3"%)$J!0'!)!(3!X!N")i!!!!Q!-!!)!%!#D3!!-!#)!
%!#D3!!-!")#N!"+!"!!QI!8#&*!!!`!-L!-!!#J!!!"!JJ!XJ+-!")!%!"jm"3"
!3B!!()#M!!b!"!!LI!8#&*!!!`!-1!!!!CJ$!!#!B`!-L'-!!%k!!#!!N!8*)%!
!N!GS!#)ZFh4KFR4IAdC50R*eEQa[Be)a0%*#6%e3BA*KE8*XEf0VJ+-!")!%!"C
m"3"!3)!!@$J&!!'3!!-!")#M!!`i"3!"N!!$!!b)!`!!+!!!!%##!#b!S`!%J!3
!(R`&!%""J!!FJ+-!$)!%!#*m"3)8N!!$!!`i!!!"Q!-!!)"M!!b)B`!!6S!!)$K
J!!"1J!!J!*!"!!*!(E!!P,QjPH(4MD'&bAep'8MCbG@jXEf05-64#3Na08'&
bB@e#E'pMD`"m#!+QN!!"!!L8)Ir!I'JEH(b!)hKmTbYi,!F!!%#"!#4m`c0i2)"
3H6L%G'Kp"80iI!B$H$N!!!")!!"45!!!#$KJ!!'!!3")1#%!3(`)!kC1J!!J!*!
""J!#3"P3!)LjKC'45G@jIAdCcD@P53c%h3N*-680KE'aLB@0V3Qa[BfYm#!+
QN!!"!!L8)Ir!I'NEH(b$)hKmT#YiI-8cH(cQ1hKp"d0iJBN!,%J!%&f!33!89'!
'2RaJ!0!`!rrrI!!C%&3$"Mk!!3")1#%!3(`)!kC1J!!J!*!""J!#3"P3!+5j
LBQaY3@4N8R9ZAep'8%-a0d*#6%e$B@aXBQ&MDd*XEf0V9@acE'aL!(`)!UD6iIr
mN!!"!!L8)Ir!I*mMH(bQ+hL!R`!)J"m!"(bN!&",rrl&J"m!"*!!(`!)J!%!5$J
K!%"m#!1QJq(rr%k!!#!!N!8*)%'!!3#3"83!,LjKC'45G@j#C@C[FQ9IAdCc8MC
bG@jXEf053c%h3N*-680KE'aLB@0V3Qa[BfYm#!+QNq(rr*!!!3!)P#(r`(bI)hK
mTLYiJ*m!#)!I!!4mT!"31+8!!8[rrMf!R`!%1!3!!C!!(`!)J!%!5$JK!%"m#!1
QJq(rr%k!!#!!N!8*)%'!!3#3"8`!+LjKC'45G@j8EepI4R050R*eEQa[Be*$-6G
#3Na03f&XE'*KBfY#E'pMDh`)!UDq`IrBN!!"!!L8)Iq3!(af'hKmQL0iI,XVH(c
F-hJl)!!!1q!!!$[!!!!lS!!"If2EH(p%dhK,rrd"I(FEH(lJ"h4qf!GdI!$!!%#
#!%KrBpYiId66H%[rr1&mB!GdI!$!!%##!"`l)!!"If2EH(p%dhK,rrc&I(FEH%J
!!"JiB!!&If6EH(q&ihK,rrjT5!!"Q&Fj"Mjqf!Gd5!!"+&IJ"MiS!!!!3B)!2(l
M"h4)!!(G,!-!!%'#!"`iB!%!If6EH(q&ihK,rrkaI(dEH%J!!"4qi!Gd,!!!+%#
#!!Jl`!!"1q!!!(lJ"h4m!-!!3))!3#JC!!""JJ$NIf2EH(p%dhK,rr`eI'!(G(`
B!!"!JJ#NIf2EH(p%dhK,rr`GI'!(G(`B!!""JJ#d5!!!L#`!!&a!JJ!8If2EH(p
%dhK,rr[j5!!!F#`!!!e"JJ!-,!!!#N##!"!S'3!!3B)!J%J!!&3X!!!P3))!)$K
J!!9rC0YiIiAMH%[rrAemI4Yi1q!!!8J!!$!X!!!T3))!+&I!"MiS!!!!3B)!($K
J!3"rC0YiIiAMH%[rrG&mI4Yi1m!!!(pMfhKr400i5rrlIAah'hKqi!Gd,!!!!%'
#!""AS!Bq+!!!!%##rXJl!!!!9k!'2LJ!!!""JJ!m9m!'2LJ!!!""JJ!-1!!"!%J
!!!Ji!!!&I!-(0(pNfhKrKH0i5rrpD94J"MiS!!!!3B)!#$X!!!&r!m0iJ!%!H$J
K!("m#!1QZX(rf%k!!#!!N!8*)%'!#J#3"!)m!$XZBfpXEh*cG(*IAdCM8M%d3N*
-69"KFQ&Y3Qa[BfY50R*eEQa[Be*$-6G#3Na03f&XE'*KBfY#E'pMD`!!!$L#!&4
8B!BqI!3!VP3$"M*1J!!J!*!"!!*!(&!!3,QPcB@a`D'&IAc0cG'4'D3!!I!J
#TT2Krrb6`IriNk(rp*!!!3!)P#(rX(ap'hKmRL0iI,mVH%J!!"KmB!Gd,!!!$8'
#!#3X!!!+3B)!((r$mhKrT1Yi5rrk-AaJ"h3X!!!!3),rf$KJ!!4ra20iIqAlH%[
rr&@!!3"B1#%!8(`)!kD$iIrmJm(rq)1Krr41J!!J!*!""J!-!N!@!!$iZBfp
XEh*MEfeYC@jdAep'8M%d3N*-69"KFQ&Y3Qa[BfY50R*eEQa[Be*$-6G#3Na03f&
XE'*KBfY#E'pMDh`)!UD6iIrmNm(rq*1Krr56JIr`N!!"!!L8)IqJI(`EH(bG)hJ
li!!"1'%!1(q%ihK,rrMCI(iEH%J!!+ar`!Gd,!!!)d'#!&a!J!!3,!!!)N#!!"4
)!!#!,!!!*d'#!!K)!!"d1'!!!$L"!$KrTHYi5rrkmAar'hKAi!Bq+!!!!%'#!&4
r`r0iIi6MH$LK!$KrTZYi5rrlfAar'hK)!!!i1'!!!$L"!$KrTHYi5rrkYAar'hK
Ai!Bq+!!!!%'#!"KrJq0i1)%!1(qPkhK,rrjPI(mEH$KK!$KrK10i5rribAaq'hK
r`!Gd,!!!!%'#!""Ai!Bq+!!!!%##rd4Ai!Bq+!!!!%'#!"3iB!!!1)%!1(qPkhK
,rrT0J!%!D$JK!'"m#!1QJq(rr)2"rrL$SIrdJi(rm%k!!#!!N!8*)%'!"!#3"!%
i!$FZ3f&XBh9XBA4P8R9ZFepI4P)a0%*#6%e3BA*KE8*XEf0V8N-a0d*#6%e$B@a
XBQ&MDd*XEf0V!!!!I!J#TT2Krrb6`IriNk(rp*!!!3!)P#(rS(ap'hKmRL0iJrd
!*NJ!!!Jlrrrr+"m!!%'#!%"r`r0iIq6lH$LK!%3i`3"!11%!2$N"!$K)!!#09'!
'2LJ!!!""JJ!BU!%!3#`!!3""J[r%,!!!"8'#rlb6r3!QJ!%!D$JK!'"m#!1QJq(
rr)2"rrL$SIrd6S!!)!#3"3NJ3B!$!*!&N!!!05j"C'TeFh45B@jRC9pI4P)a0%*
#6%e3BA*KE8*XEf0V8N-a0d*#6%e$B@aXBQ&MDd*XEf0V!(`)!UD3!!%!#*3Krm"
mD4YiI)-MH(bN+hKma60iI1BlH(d(3hL"L3!N5!!)dB""!"48B!BqI'!!d$!$rrp
m!"N39!-'2S!"!%Ji)3"!I!J$TNk!!#!!N!8*)%'!!*!'9!!Y,Q*LE'e(CA45G@j
IAdC33c%h3N*-680KE'aLB@0V3Qa[BfYX8P9X8R05E&*X!(`)!UD6iIrmNm(rq*1
Krr53!!%!#*3Krl"m[LYiL!-!'LJ!!!""JJ!-1k!!!%J!!!L$S`!51q!!!%J!!%5
!(J!!I+$k&)!$!"Cm"3"!3B!!$$KJ!!")!!#3!(`G++jm"3GdI-!(G(`&!!""JJ!
-1'!!!%J!!(3lr`!"1)3!!BM%!!"m`!Gd,!!!!%##rl5!(J!!I)$k&)!$!"Cm"!"
!3)!!1(ap)+jmB`Gd5!!!N5`$!!"!JJ!FJ"i!!(`!qK4m(3#ZI!!(G#`!!&p!JJ!
-1'!!!%J!!"5!(J!!I!$k&*!!(J!!1'!!!B!"!&Ji)3"3I!J$TS2Krrb$`IriJk(
rp%k!!#!!N!8*)%'!!`#3"!%!!#3ZE@&dBfKhEh*NAep'8M%d3N*-69"KFQ&Y3Qa
[BfY33f039@`!!$L#!&48B!BqI!3!VR!$!0"1J!!J!*!"!!*!(&!!3,QPcB@a
ZG@eIAc0cG'4'D3!!L!-!'LJ!!!""JJ!-1-!!!%J!!!L!``!511!!!%J!!'Km"LL
ZI!!(G#`!!#""JJ!J3)!!%#`!!!P"JJ!S5!!!3#`!!#0"JJ!`5!!!0)#N!!!i"3!
"N!!%!!!ij`!"5!!!+)#N!!!i"3!"N!!%!!!ij`!)5!!!&$KJrrp1J!!JI1-lH%k
!!##!T!!!J!-!&R`&!%""J2q3!%k!!#!!N!8*)%!!N!HB!#-ZE@&dBfKTEQ4PER4
IAdC5-64#3Na08'&bB@e#E'pMDe"9E!!!!)J$!"SS!!!!3B)!$$M!!!")!!!BJ--
!%NJ!!"#!T!!!1!8!!C!!"!!!J+3!!(`'++jm!!Gd,!!!$8'#!#JX!!!+3B)!))!
$!"Cm"3"!3B$rd%J!!"#!T!!!1!8!!C!!"!!!J+3!!(`'++jm!!Gd,!!!$8'#!!`
X!!!+6))!))!$!"Cm"3"!3B$rd%k!!#!!N!8*)%!!N!H-!#!ZC@&dAfaTEQ9IAdC
5-64#3Na08'&bB@e#E'pMDe"9E!!!I!J#TVlKrpb3!!%!#*3Krf"mHKYiI*XMH(b
m+hKmh60iI2ilH$[J!!!i!!!!N!!"!'L$'J!5IcMD&%J!!!`lH`!"1cN!!BKj!!"
mB`Gd5!!#@5`$!!""JJ!3J"S!&R`E!%""J2rFIhIEH%J!!!`lH`!"1rm!!AmifK5
)H3!!I'-(G%[rrENX!`!!3))!&)JC!!"m!!Gd,!!!Ad##!"#!'J!@I"X!3%'!rmK
r`r0iJ*S!*RbiZK4rj[YiL"S!'RcJ!0!`"rrrI!!j%&3("Mij!3"S5!!"5C,K!$L
6B3!mNZ%!3*0K!%55i3")9k!'2T!!!3"3Ni%!6$J!!!#3!!%!9)!"!'L3!!%!@*2
K!&ar`r0iJ*S!+MLK!$Ji`3"N5!!!GB!"!+Ji)3#JI!J$TVVKrpa1J!!J!*!"
"J!N!N!3"-!"(,Q&NC%PdC@eIAdC5-64#3Na08'&bB@e#E'pMDe9XD6%h3N*-68C
eEQ0dD@pZ5fPZC(033c%h3N*-680KE'aLB@0V3Qa[BfX!!!"m#!+QN!!"!!L8)Ir
!I'FEH(b$)hKmT#YiI-8cH)'(!"4)!!1jJ%%!&)!"!%Ji)3"!I!J$TNk!!#!!N!8
*)%'!!*!'1!"#,Q*LE'e"C'4'G@jMG'P[EP4[6'PcG&pI4P"$-6G#3Na03f&XE'*
KBfY#E'pMDe9X8M%b3N*-69"bEf0*EQC[8&9XI!J#TT!!!3!)P#(r`(aT'hKmJb0
iI+3VH(c&-hKmjMYiI3G$H)'*!"")!!-PJ%%!&)!"!%Ji)3"!I!J$TNk!!#!!N!8
*)%'!!*!'3!!h,Q*LE'e"C'48EfYPEP4[3R9QCQ9bAep'8%-a0d*#6%e$B@aXBQ&
MDd*XEf0V9@a3GP9XBP"9E!!!!$L#!&48B!BqI!3!VP3$"ha1J!!J!*!"!!*!
(&!!3,QPcFh"KBf9IAc0cG'4'D3!!I!J#TVpKrqb3!!%!#*3Kri"mI4YiI*iMH$[
L!"`iJJ&8J'3!!)!%!!53!'%!6*!!!3"3J'3!#)!%!!b3!'%!9*!!!3"BJ!3!%*!
!!3"F1f!!!$J!!!#3!!%!5$Z"!%a)!!$FIk2VH$L"!%K,rrXa,!-!!%'!!,`iS!!
!1)%!6$JE!!&m#31Q,"X!!%'!!#b!"!!!I!-!!%'"!"4mZbYi9+!31Ram!5j)!!!
F1)3!"$LP!!&#!2rF1hX!!9GJ%$TmI!%ZIk2VH$L#!"!iS3")5rrjA94J"MiS!!!
!3B)!)(qMkhL!J3")IfAEH$M!!!"rar0i5rrm18J!!$KrSqYiIq6lH$LK!%K,rrN
P9'!'2LJ!!!""JJ!FIk2VH)#"!%KrCGYi1-!!!Ar(mhK,rr`"Ik2VH$L"!%K,rrX
eJ'%!5)!G!"Cm!`"!3B$r()!"!)Ji)3#!I!J$TVYKrqa1J!!J!*!""J!8!N!3
"@!!k,P0MB@j'Eh*'G@jMG'P[ER0IAdC5-64#3Na08'&bB@e#E'pMDe*$-6G#3Na
03f&XE'*KBfY#E'pMDh`)!UD3!!%!#*3Krm#!S`!!2!@YeLJ!BfK!JJ!3J!-!##J
!!LC!J!!-1'$rcNJ!!*!!L!-!$#J!!!Y"J3#!1+)!*&3!%$TmT3!ZI+N$TNk!"#!
iB!!!5!!!D%[rp6NiB!!!5!!!A%[rrINiB!!!5!!!8%[rpU8iB!!!5!!!4+J$!#B
X!!%!3B)!#%J!!"Ji!!!)X!-!+$J!!!'B!`!U5!!!$$J!!!#B!`!U1'!!!%J!!"!
iB2q!5!!!#$KJrmk!!3")1#%!3(`)!kC1J!!J!*!""J!#3"X`!"5jYB@PZ!)!
-!!#3!%%!&(`*!kD!6!!%6S!%)%k!!#!!N!`$)93$)53$)4`#*3&8C'9Q!b)4D!3
PBfaKFh-&)K)JJJ)+%EJ4Z"(-%GJ4`")B%KJ4j")B%KJJJJ%5'!'3#3+3"3'3%J3
)N!m`N!S)N!HJN!D!N"3)N!CJN!C!N"3)N!3"J*!(3*!C#*!(3!L3"S#!#*!13%!
)N!S%J*!%3!L3#%#!#*!%3%!)N!@!N!X)J*!%#*!+!836!!!"!!!!!Q3!!!&N!!!
!S`#3mai!!3!"8(PdD!!!!"-%)3C3HA4SEfi!!!%!!!-ZF(N!!!!2!3#!!!!!!c%
Z-33a,M%X!!!!1!%!J!!!!"KAC@4ZCA0NBANX)%eKFQ0S)$FX)$)`-$%B9f9NEQ9
cC'&j,#"0BA*MD#!h,#!b-$!a!!!!Pf&ZC!N0BA0cCA*d$@*bC@&V$@0XBA0c$@0
[ER4TER9P$@4PCJeNC@`0C@aTCJePE(0P$@9iBf9`G!ePH'9M$@CTEQ&XE(N0CQp
b$@CbEfd0Cfa[BQ&X$@PQ$@PYF'pbG!eTEJeTF`eXB@eLC'%0EQpd$@pb$A"KFh-
0F(*TER30FQ&TFf80FQ9dGA*Z$A4bH3ehD'PXC3d!!!"8!*!,!3#3%`&`Gh"M!*!
6!3#3%63'8(PdD'pZ!*!&!3!!!!*N!!!"C!!!!+066e*8!qS!J!!F!(S!!d*#6%B
!!!!L9%9B9!!!!#jMCR*R!!!!1RCPFR-!!3"'!)!!!#!!N!F%)3!C!!!!F3#3"[r
r!!!"$!BkdC!!!!(rr`!!!#)!N!8#rrm!!!!e!*!%'&"jG'K[EL"-B@jRG@&RC5"
0BA"`D@jRF`p3HA4SEfiJ5f9jGfpbC(26q`:
\ No newline at end of file diff --git a/Mac/Contrib/BBPy.lm/Python Keywords.rsrc b/Mac/Contrib/BBPy.lm/Python Keywords.rsrc deleted file mode 100644 index f889e90..0000000 --- a/Mac/Contrib/BBPy.lm/Python Keywords.rsrc +++ /dev/null @@ -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`:
\ No newline at end of file diff --git a/Mac/Contrib/BBPy.lm/PythonBBLM.txt b/Mac/Contrib/BBPy.lm/PythonBBLM.txt deleted file mode 100644 index 540060a..0000000 --- a/Mac/Contrib/BBPy.lm/PythonBBLM.txt +++ /dev/null @@ -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
\ No newline at end of file diff --git a/Mac/Contrib/BBPy/PythonSlave.py b/Mac/Contrib/BBPy/PythonSlave.py deleted file mode 100644 index b60f034..0000000 --- a/Mac/Contrib/BBPy/PythonSlave.py +++ /dev/null @@ -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() diff --git a/Mac/Contrib/BBPy/README b/Mac/Contrib/BBPy/README deleted file mode 100644 index f8c32f7..0000000 --- a/Mac/Contrib/BBPy/README +++ /dev/null @@ -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> diff --git a/Mac/Contrib/BBPy/Run as Python b/Mac/Contrib/BBPy/Run as Python deleted file mode 100644 index 1ac6887..0000000 --- a/Mac/Contrib/BBPy/Run as Python +++ /dev/null @@ -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%:
\ No newline at end of file diff --git a/Mac/Contrib/BBPy/source/BB stuff/ExternalInterface.h b/Mac/Contrib/BBPy/source/BB stuff/ExternalInterface.h deleted file mode 100644 index 51d206d..0000000 --- a/Mac/Contrib/BBPy/source/BB stuff/ExternalInterface.h +++ /dev/null @@ -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); -*/ diff --git a/Mac/Contrib/BBPy/source/BB-stuff/ExternalInterface.h b/Mac/Contrib/BBPy/source/BB-stuff/ExternalInterface.h deleted file mode 100644 index 51d206d..0000000 --- a/Mac/Contrib/BBPy/source/BB-stuff/ExternalInterface.h +++ /dev/null @@ -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); -*/ diff --git a/Mac/Contrib/BBPy/source/BBPy.h b/Mac/Contrib/BBPy/source/BBPy.h deleted file mode 100644 index 22974ea..0000000 --- a/Mac/Contrib/BBPy/source/BBPy.h +++ /dev/null @@ -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); diff --git a/Mac/Contrib/BBPy/source/BBPy.rsrc b/Mac/Contrib/BBPy/source/BBPy.rsrc deleted file mode 100644 index 12e2d04..0000000 --- a/Mac/Contrib/BBPy/source/BBPy.rsrc +++ /dev/null @@ -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:
\ No newline at end of file diff --git a/Mac/Contrib/BBPy/source/BBPy_lauch.c b/Mac/Contrib/BBPy/source/BBPy_lauch.c deleted file mode 100644 index f9b964c..0000000 --- a/Mac/Contrib/BBPy/source/BBPy_lauch.c +++ /dev/null @@ -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; -} diff --git a/Mac/Contrib/BBPy/source/BBPy_launch.c b/Mac/Contrib/BBPy/source/BBPy_launch.c deleted file mode 100644 index f9b964c..0000000 --- a/Mac/Contrib/BBPy/source/BBPy_launch.c +++ /dev/null @@ -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; -} diff --git a/Mac/Contrib/BBPy/source/BBPy_main.c b/Mac/Contrib/BBPy/source/BBPy_main.c deleted file mode 100644 index a96b271..0000000 --- a/Mac/Contrib/BBPy/source/BBPy_main.c +++ /dev/null @@ -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); -} diff --git a/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py b/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py deleted file mode 100644 index ac261b5..0000000 --- a/Mac/Contrib/ImageHelpers/ExtPixMapWrapper.py +++ /dev/null @@ -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) - - - - diff --git a/Mac/Contrib/ImageHelpers/ImageMac.py b/Mac/Contrib/ImageHelpers/ImageMac.py deleted file mode 100644 index 44a38c5..0000000 --- a/Mac/Contrib/ImageHelpers/ImageMac.py +++ /dev/null @@ -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()
\ No newline at end of file diff --git a/Mac/Contrib/ImageHelpers/MovieUtils.py b/Mac/Contrib/ImageHelpers/MovieUtils.py deleted file mode 100644 index 89762f4..0000000 --- a/Mac/Contrib/ImageHelpers/MovieUtils.py +++ /dev/null @@ -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() -
\ No newline at end of file diff --git a/Mac/Contrib/ImageHelpers/ReadMe b/Mac/Contrib/ImageHelpers/ReadMe deleted file mode 100644 index b6267f7..0000000 --- a/Mac/Contrib/ImageHelpers/ReadMe +++ /dev/null @@ -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 diff --git a/Mac/Contrib/PythonDetector/OpenPythonLib b/Mac/Contrib/PythonDetector/OpenPythonLib Binary files differdeleted file mode 100644 index 87bc7be..0000000 --- a/Mac/Contrib/PythonDetector/OpenPythonLib +++ /dev/null diff --git a/Mac/Contrib/PythonDetector/OpenPythonLib with NS b/Mac/Contrib/PythonDetector/OpenPythonLib with NS Binary files differdeleted file mode 100644 index 08cb027..0000000 --- a/Mac/Contrib/PythonDetector/OpenPythonLib with NS +++ /dev/null diff --git a/Mac/Contrib/PythonDetector/PythonDetector b/Mac/Contrib/PythonDetector/PythonDetector Binary files differdeleted file mode 100644 index 6fc28b8..0000000 --- a/Mac/Contrib/PythonDetector/PythonDetector +++ /dev/null diff --git a/Mac/Contrib/PythonDetector/readme.txt b/Mac/Contrib/PythonDetector/readme.txt deleted file mode 100644 index e6b61da..0000000 --- a/Mac/Contrib/PythonDetector/readme.txt +++ /dev/null @@ -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. diff --git a/Mac/Contrib/Sherlock/Python-FAQ.src b/Mac/Contrib/Sherlock/Python-FAQ.src Binary files differdeleted file mode 100644 index c316c33..0000000 --- a/Mac/Contrib/Sherlock/Python-FAQ.src +++ /dev/null diff --git a/Mac/Contrib/Sherlock/Python-docs.src b/Mac/Contrib/Sherlock/Python-docs.src Binary files differdeleted file mode 100644 index f3423c4..0000000 --- a/Mac/Contrib/Sherlock/Python-docs.src +++ /dev/null diff --git a/Mac/Contrib/Sherlock/Python.src b/Mac/Contrib/Sherlock/Python.src Binary files differdeleted file mode 100644 index 5759537..0000000 --- a/Mac/Contrib/Sherlock/Python.src +++ /dev/null diff --git a/Mac/Contrib/Sherlock/readme.txt b/Mac/Contrib/Sherlock/readme.txt deleted file mode 100644 index 2603bfc..0000000 --- a/Mac/Contrib/Sherlock/readme.txt +++ /dev/null @@ -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 - diff --git a/Mac/Contrib/Tabcleaner/Tabcleaner.README b/Mac/Contrib/Tabcleaner/Tabcleaner.README deleted file mode 100644 index 821f7e1..0000000 --- a/Mac/Contrib/Tabcleaner/Tabcleaner.README +++ /dev/null @@ -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 diff --git a/Mac/Contrib/Tabcleaner/Tabcleaner.py b/Mac/Contrib/Tabcleaner/Tabcleaner.py deleted file mode 100644 index c6d3223..0000000 --- a/Mac/Contrib/Tabcleaner/Tabcleaner.py +++ /dev/null @@ -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) - - - - - - - - - - - - - - diff --git a/Mac/Contrib/mpwsystem/mpwsystem.py b/Mac/Contrib/mpwsystem/mpwsystem.py deleted file mode 100644 index 34646c4..0000000 --- a/Mac/Contrib/mpwsystem/mpwsystem.py +++ /dev/null @@ -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 - - diff --git a/Mac/Contrib/osam/OSAm.c b/Mac/Contrib/osam/OSAm.c deleted file mode 100644 index aa9a5da..0000000 --- a/Mac/Contrib/osam/OSAm.c +++ /dev/null @@ -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"); -} diff --git a/Mac/Contrib/osam/OSAm.exp b/Mac/Contrib/osam/OSAm.exp deleted file mode 100644 index d567a95..0000000 --- a/Mac/Contrib/osam/OSAm.exp +++ /dev/null @@ -1 +0,0 @@ -initOSAm diff --git a/Mac/Contrib/osam/OSAm.h b/Mac/Contrib/osam/OSAm.h deleted file mode 100644 index 2fd0469..0000000 --- a/Mac/Contrib/osam/OSAm.h +++ /dev/null @@ -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> diff --git a/Mac/Contrib/osam/OSAm.prj b/Mac/Contrib/osam/OSAm.prj Binary files differdeleted file mode 100644 index 527563c..0000000 --- a/Mac/Contrib/osam/OSAm.prj +++ /dev/null diff --git a/Mac/Contrib/osam/ScriptRunner.c b/Mac/Contrib/osam/ScriptRunner.c deleted file mode 100644 index 6f7d9ce..0000000 --- a/Mac/Contrib/osam/ScriptRunner.c +++ /dev/null @@ -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; -} diff --git a/Mac/Contrib/osam/ScriptRunner.h b/Mac/Contrib/osam/ScriptRunner.h deleted file mode 100644 index dda7bbb..0000000 --- a/Mac/Contrib/osam/ScriptRunner.h +++ /dev/null @@ -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); diff --git a/Mac/Distributions/(vise)/Python 2.3.vct b/Mac/Distributions/(vise)/Python 2.3.vct Binary files differdeleted file mode 100644 index 2e0cfd3..0000000 --- a/Mac/Distributions/(vise)/Python 2.3.vct +++ /dev/null diff --git a/Mac/Distributions/binary.exclude b/Mac/Distributions/binary.exclude deleted file mode 100644 index 9356cac..0000000 --- a/Mac/Distributions/binary.exclude +++ /dev/null @@ -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 -[(]*[)] diff --git a/Mac/Distributions/binary.include b/Mac/Distributions/binary.include deleted file mode 100644 index ad20729..0000000 --- a/Mac/Distributions/binary.include +++ /dev/null @@ -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) diff --git a/Mac/Distributions/dev.exclude b/Mac/Distributions/dev.exclude deleted file mode 100644 index c1cb22b..0000000 --- a/Mac/Distributions/dev.exclude +++ /dev/null @@ -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 -[(]*[)] diff --git a/Mac/Distributions/dev.include b/Mac/Distributions/dev.include deleted file mode 100644 index 962ca57..0000000 --- a/Mac/Distributions/dev.include +++ /dev/null @@ -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) diff --git a/Mac/Distributions/src.exclude b/Mac/Distributions/src.exclude deleted file mode 100644 index e63e55e..0000000 --- a/Mac/Distributions/src.exclude +++ /dev/null @@ -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 -[(]*[)] diff --git a/Mac/Distributions/src.include b/Mac/Distributions/src.include deleted file mode 100644 index ec735c7..0000000 --- a/Mac/Distributions/src.include +++ /dev/null @@ -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', '') diff --git a/Mac/HISTORY b/Mac/HISTORY deleted file mode 100644 index 5eb8fec..0000000 --- a/Mac/HISTORY +++ /dev/null @@ -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.) diff --git a/Mac/Include/getapplbycreator.h b/Mac/Include/getapplbycreator.h deleted file mode 100644 index 48c04e5..0000000 --- a/Mac/Include/getapplbycreator.h +++ /dev/null @@ -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 diff --git a/Mac/Include/macbuildno.h b/Mac/Include/macbuildno.h deleted file mode 100644 index f156479..0000000 --- a/Mac/Include/macbuildno.h +++ /dev/null @@ -1 +0,0 @@ -#define BUILD 154 diff --git a/Mac/Include/macdefs.h b/Mac/Include/macdefs.h deleted file mode 100644 index df7d6f7..0000000 --- a/Mac/Include/macdefs.h +++ /dev/null @@ -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 diff --git a/Mac/Include/pyconfig.h b/Mac/Include/pyconfig.h deleted file mode 100644 index 15b347c..0000000 --- a/Mac/Include/pyconfig.h +++ /dev/null @@ -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 diff --git a/Mac/Lib/dbmac.py b/Mac/Lib/dbmac.py deleted file mode 100644 index 0588dbd..0000000 --- a/Mac/Lib/dbmac.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/maccache.py b/Mac/Lib/maccache.py deleted file mode 100644 index 1e2b3d0..0000000 --- a/Mac/Lib/maccache.py +++ /dev/null @@ -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' diff --git a/Mac/Lib/mactty.py b/Mac/Lib/mactty.py deleted file mode 100644 index e09a50c..0000000 --- a/Mac/Lib/mactty.py +++ /dev/null @@ -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:] diff --git a/Mac/Lib/mkcwproject/__init__.py b/Mac/Lib/mkcwproject/__init__.py deleted file mode 100644 index d6920b6..0000000 --- a/Mac/Lib/mkcwproject/__init__.py +++ /dev/null @@ -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() - diff --git a/Mac/Lib/mkcwproject/cwtalker.py b/Mac/Lib/mkcwproject/cwtalker.py deleted file mode 100644 index 650fd43..0000000 --- a/Mac/Lib/mkcwproject/cwtalker.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/mkcwproject/cwxmlgen.py b/Mac/Lib/mkcwproject/cwxmlgen.py deleted file mode 100644 index 3d3e4b2..0000000 --- a/Mac/Lib/mkcwproject/cwxmlgen.py +++ /dev/null @@ -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() - diff --git a/Mac/Lib/mkcwproject/template-carbon/template-alllibraries.xml b/Mac/Lib/mkcwproject/template-carbon/template-alllibraries.xml deleted file mode 100644 index 1b10dbb..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-alllibraries.xml +++ /dev/null @@ -1,7 +0,0 @@ - <FILE> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(libraries)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - <FILEKIND>Library</FILEKIND> - <FILEFLAGS>%(libraryflags)s</FILEFLAGS> - </FILE> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-allsources.xml b/Mac/Lib/mkcwproject/template-carbon/template-allsources.xml deleted file mode 100644 index 5bca166..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-allsources.xml +++ /dev/null @@ -1,7 +0,0 @@ - <FILE> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(sources)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - <FILEKIND>Text</FILEKIND> - <FILEFLAGS></FILEFLAGS> - </FILE> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-grouplist.xml b/Mac/Lib/mkcwproject/template-carbon/template-grouplist.xml deleted file mode 100644 index a05364a..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-grouplist.xml +++ /dev/null @@ -1,6 +0,0 @@ - <FILEREF> - <TARGETNAME>%(mac_targetname)s</TARGETNAME> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(sources)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - </FILEREF> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-grouplistlib.xml b/Mac/Lib/mkcwproject/template-carbon/template-grouplistlib.xml deleted file mode 100644 index 043313c..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-grouplistlib.xml +++ /dev/null @@ -1,6 +0,0 @@ - <FILEREF> - <TARGETNAME>%(mac_targetname)s</TARGETNAME> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(libraries)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - </FILEREF> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-linkorder.xml b/Mac/Lib/mkcwproject/template-carbon/template-linkorder.xml deleted file mode 100644 index 7f24a7c..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-linkorder.xml +++ /dev/null @@ -1,5 +0,0 @@ - <FILEREF> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(sources)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - </FILEREF> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-linkorderlib.xml b/Mac/Lib/mkcwproject/template-carbon/template-linkorderlib.xml deleted file mode 100644 index ecd2c6b..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-linkorderlib.xml +++ /dev/null @@ -1,5 +0,0 @@ - <FILEREF> - <PATHTYPE>Name</PATHTYPE> - <PATH>%(libraries)s</PATH> - <PATHFORMAT>MacOS</PATHFORMAT> - </FILEREF> diff --git a/Mac/Lib/mkcwproject/template-carbon/template-searchdirs.xml b/Mac/Lib/mkcwproject/template-carbon/template-searchdirs.xml deleted file mode 100644 index ae1b353..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template-searchdirs.xml +++ /dev/null @@ -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> diff --git a/Mac/Lib/mkcwproject/template-carbon/template.prj.xml b/Mac/Lib/mkcwproject/template-carbon/template.prj.xml deleted file mode 100644 index 5c426a1..0000000 --- a/Mac/Lib/mkcwproject/template-carbon/template.prj.xml +++ /dev/null @@ -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>ª¿°</VALUE></SETTING> - <SETTING><VALUE>ß^h</VALUE></SETTING> - <SETTING><VALUE>ѧ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> diff --git a/Mac/Lib/nsremote.py b/Mac/Lib/nsremote.py deleted file mode 100644 index a12cd35..0000000 --- a/Mac/Lib/nsremote.py +++ /dev/null @@ -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() - diff --git a/Mac/Lib/preferences.py b/Mac/Lib/preferences.py deleted file mode 100644 index 8b77012..0000000 --- a/Mac/Lib/preferences.py +++ /dev/null @@ -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 - diff --git a/Mac/Lib/py_resource.py b/Mac/Lib/py_resource.py deleted file mode 100644 index 0faf1f1..0000000 --- a/Mac/Lib/py_resource.py +++ /dev/null @@ -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 diff --git a/Mac/Lib/pythonprefs.py b/Mac/Lib/pythonprefs.py deleted file mode 100644 index da28d02..0000000 --- a/Mac/Lib/pythonprefs.py +++ /dev/null @@ -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() - diff --git a/Mac/Lib/quietconsole.py b/Mac/Lib/quietconsole.py deleted file mode 100644 index 21e7755..0000000 --- a/Mac/Lib/quietconsole.py +++ /dev/null @@ -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() - - - - - diff --git a/Mac/Lib/test/AEservertest.py b/Mac/Lib/test/AEservertest.py deleted file mode 100644 index d474f43..0000000 --- a/Mac/Lib/test/AEservertest.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/AEservertest.rsrc b/Mac/Lib/test/AEservertest.rsrc Binary files differdeleted file mode 100644 index 268bc27..0000000 --- a/Mac/Lib/test/AEservertest.rsrc +++ /dev/null diff --git a/Mac/Lib/test/aete.py b/Mac/Lib/test/aete.py deleted file mode 100644 index 3945a86..0000000 --- a/Mac/Lib/test/aete.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/cmtest.py b/Mac/Lib/test/cmtest.py deleted file mode 100644 index bdbca23..0000000 --- a/Mac/Lib/test/cmtest.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/ctbtest.py b/Mac/Lib/test/ctbtest.py deleted file mode 100644 index 91824d3..0000000 --- a/Mac/Lib/test/ctbtest.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/dragtest.py b/Mac/Lib/test/dragtest.py deleted file mode 100644 index 28eb1a9..0000000 --- a/Mac/Lib/test/dragtest.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/echo.py b/Mac/Lib/test/echo.py deleted file mode 100644 index f84e13b..0000000 --- a/Mac/Lib/test/echo.py +++ /dev/null @@ -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() diff --git a/Mac/Lib/test/fgbgtimetest.py b/Mac/Lib/test/fgbgtimetest.py deleted file mode 100644 index fd2b649..0000000 --- a/Mac/Lib/test/fgbgtimetest.py +++ /dev/null @@ -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 - diff --git a/Mac/Lib/test/icgluetest.py b/Mac/Lib/test/icgluetest.py deleted file mode 100644 index dd34bd0..0000000 --- a/Mac/Lib/test/icgluetest.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/test/mkcwproj/mkcwtestmodule.c b/Mac/Lib/test/mkcwproj/mkcwtestmodule.c deleted file mode 100644 index 84d0e2d..0000000 --- a/Mac/Lib/test/mkcwproj/mkcwtestmodule.c +++ /dev/null @@ -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); -} diff --git a/Mac/Lib/test/mkcwproj/testmkcwproj.py b/Mac/Lib/test/mkcwproj/testmkcwproj.py deleted file mode 100644 index ac1cb8e..0000000 --- a/Mac/Lib/test/mkcwproj/testmkcwproj.py +++ /dev/null @@ -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") diff --git a/Mac/Lib/test/readme.txt b/Mac/Lib/test/readme.txt deleted file mode 100644 index dbf671f..0000000 --- a/Mac/Lib/test/readme.txt +++ /dev/null @@ -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. diff --git a/Mac/Lib/test/tell.py b/Mac/Lib/test/tell.py deleted file mode 100644 index fcacb7e..0000000 --- a/Mac/Lib/test/tell.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/test/test_finder_ae b/Mac/Lib/test/test_finder_ae deleted file mode 100644 index b6241a2..0000000 --- a/Mac/Lib/test/test_finder_ae +++ /dev/null @@ -1,5 +0,0 @@ -tell application "AEservertest" - activate - set x to window "testing" - open file x -end tell diff --git a/Mac/Lib/test/test_setcontroldata.py b/Mac/Lib/test/test_setcontroldata.py deleted file mode 100644 index 8167214..0000000 --- a/Mac/Lib/test/test_setcontroldata.py +++ /dev/null @@ -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)
\ No newline at end of file diff --git a/Mac/Lib/test/tlist.py b/Mac/Lib/test/tlist.py deleted file mode 100644 index 5b84fc5..0000000 --- a/Mac/Lib/test/tlist.py +++ /dev/null @@ -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() - diff --git a/Mac/Lib/test/tsnd.py b/Mac/Lib/test/tsnd.py deleted file mode 100644 index 919785a..0000000 --- a/Mac/Lib/test/tsnd.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/test/tte.py b/Mac/Lib/test/tte.py deleted file mode 100644 index bde7de2..0000000 --- a/Mac/Lib/test/tte.py +++ /dev/null @@ -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) diff --git a/Mac/Lib/test/twin.py b/Mac/Lib/test/twin.py deleted file mode 100644 index 0904d32..0000000 --- a/Mac/Lib/test/twin.py +++ /dev/null @@ -1,9 +0,0 @@ -# Test Win module - -from Win import * - -r = (40, 40, 400, 300) -w = NewWindow(r, "Hello world", 1, 0, -1, 1, 0x55555555) -w.DrawGrowIcon() -import time -time.sleep(10) diff --git a/Mac/MPW/Build b/Mac/MPW/Build deleted file mode 100644 index 5a46990..0000000 --- a/Mac/MPW/Build +++ /dev/null @@ -1,3 +0,0 @@ -Make {Parameters} -f Makefile >Make.out -Set Echo 1 -Make.out diff --git a/Mac/MPW/Makefile b/Mac/MPW/Makefile deleted file mode 100644 index 817198c..0000000 --- a/Mac/MPW/Makefile +++ /dev/null @@ -1,509 +0,0 @@ -# MPW Makefile to build Python as a shared library. -# This uses the development environment distributed on the OpenDoc CD: -# compiler (SC) is Symantec C for MPW, headers are Universal Headers. -# Running Python requires that the extensions CFM-68K and MixedModeInit are -# installed, and that the various shared libraries are in the Extensions folder. - -########################## -# Configurable variables # -########################## - -Top = ::: -CC = SC -CFlagsNoInclude = -woff -e -model cfmseg -b ¶ - -d HAVE_CONFIG_H=1 -d MPW=1 -d USE_MAC_SHARED_LIBRARY=1 -d USE_MAC_APPLET_SUPPORT -PythonIncludes = -i "{Top}"Mac: -i "{Top}"Include: -MacIncludes = -i "{CIncludes}" -CFlagsMac = {CFlagsNoInclude} {MacIncludes} {PythonIncludes} -CFlags = {CFlagsNoInclude} {PythonIncludes} {MacIncludes} -Objs = :Objs: -ExtensionsFolder = {SystemFolder}Extensions: - -######################## -# List of object files # -######################## - -ALL = ¶ - "{Objs}"acceler.c.o ¶ - "{Objs}"accessobject.c.o ¶ - "{Objs}"arraymodule.c.o ¶ - "{Objs}"atof.c.o ¶ - "{Objs}"strtod.c.o ¶ - "{Objs}"audioop.c.o ¶ - "{Objs}"bltinmodule.c.o ¶ - "{Objs}"ceval.c.o ¶ - "{Objs}"chdir.c.o ¶ - "{Objs}"classobject.c.o ¶ - "{Objs}"compile.c.o ¶ - "{Objs}"config.c.o ¶ - "{Objs}"errors.c.o ¶ - "{Objs}"fileobject.c.o ¶ - "{Objs}"floatobject.c.o ¶ -# "{Objs}"fmod.c.o ¶ - "{Objs}"frameobject.c.o ¶ - "{Objs}"funcobject.c.o ¶ - "{Objs}"gestaltmodule.c.o ¶ - "{Objs}"getargs.c.o ¶ - "{Objs}"getbootvol.c.o ¶ - "{Objs}"getopt.c.o ¶ - "{Objs}"getwd.c.o ¶ - "{Objs}"graminit.c.o ¶ - "{Objs}"grammar1.c.o ¶ - "{Objs}"imageop.c.o ¶ - "{Objs}"import.c.o ¶ - "{Objs}"importdl.c.o ¶ - "{Objs}"intobject.c.o ¶ - "{Objs}"intrcheck.c.o ¶ - "{Objs}"listobject.c.o ¶ - "{Objs}"longobject.c.o ¶ - "{Objs}"macfsmodule.c.o ¶ - "{Objs}"macgetargv.c.o ¶ - "{Objs}"macgetmtime.c.o ¶ - "{Objs}"macglue.c.o ¶ - "{Objs}"macguesstabsize.c.o ¶ - "{Objs}"macmodule.c.o ¶ - "{Objs}"macosmodule.c.o ¶ - "{Objs}"macsetfiletype.c.o ¶ - "{Objs}"macshlglue.c.o ¶ - "{Objs}"macstat.c.o ¶ - "{Objs}"mappingobject.c.o ¶ - "{Objs}"marshal.c.o ¶ -# "{Objs}"mathmodule.c.o ¶ - "{Objs}"md5c.c.o ¶ - "{Objs}"md5module.c.o ¶ - "{Objs}"methodobject.c.o ¶ - "{Objs}"mkdir.c.o ¶ - "{Objs}"modsupport.c.o ¶ - "{Objs}"moduleobject.c.o ¶ - "{Objs}"myreadline.c.o ¶ - "{Objs}"mystrtoul.c.o ¶ - "{Objs}"nfullpath.c.o ¶ - "{Objs}"node.c.o ¶ - "{Objs}"object.c.o ¶ - "{Objs}"opendir.c.o ¶ - "{Objs}"parser.c.o ¶ - "{Objs}"parsermodule.c.o ¶ - "{Objs}"parsetok.c.o ¶ - "{Objs}"pythonmain.c.o ¶ - "{Objs}"pythonrun.c.o ¶ - "{Objs}"rangeobject.c.o ¶ - "{Objs}"regexmodule.c.o ¶ - "{Objs}"regexpr.c.o ¶ - "{Objs}"rgbimgmodule.c.o ¶ - "{Objs}"rmdir.c.o ¶ - "{Objs}"rotormodule.c.o ¶ - "{Objs}"sigcheck.c.o ¶ - "{Objs}"stringobject.c.o ¶ - "{Objs}"stropmodule.c.o ¶ - "{Objs}"structmember.c.o ¶ - "{Objs}"structmodule.c.o ¶ - "{Objs}"sync.c.o ¶ - "{Objs}"sysmodule.c.o ¶ - "{Objs}"timemodule.c.o ¶ - "{Objs}"tokenizer.c.o ¶ - "{Objs}"traceback.c.o ¶ - "{Objs}"tupleobject.c.o ¶ - "{Objs}"typeobject.c.o ¶ - "{Objs}"AEmodule.c.o ¶ - "{Objs}"Ctlmodule.c.o ¶ - "{Objs}"Dlgmodule.c.o ¶ - "{Objs}"Evtmodule.c.o ¶ - "{Objs}"Menumodule.c.o ¶ - "{Objs}"Qdmodule.c.o ¶ - "{Objs}"Resmodule.c.o ¶ - "{Objs}"Sndmodule.c.o ¶ - "{Objs}"Winmodule.c.o ¶ - "{Objs}"ctbmodule.c.o ¶ -# "{Objs}"imgformat.c.o ¶ -# "{Objs}"macmain.c.o ¶ -# "{Objs}"stdwinmodule.c.o ¶ - -################ -# Main targets # -################ - -# Default target -all Ä PythonLib.slb PythonApplet - -# Install stuff -install Ä PythonLib.slb - Duplicate -y PythonLib.slb "{ExtensionsFolder}" - -# Uninstall stuff -uninstall Ä - Delete -i "{ExtensionsFolder}"PythonLib.slb - -# Delete intermediate build stuff and other temporary cruft -clean Ä - Delete -i "{Objs}"Å.o - Delete -i PythonLib PythonApplet xxmodule - Delete -i stdout stderr - Delete -i Å.pyc - -# Delete everything that can be reconstructed -clobber Ä clean - Delete -i Å.slb Å.NJ - -# Build 'xx' as a dynamically loadable module -xx Ä xxmodule.slb - -# Clean up (somewhat) - -######################### -# Build Applet template # -######################### - -PythonApplet Ä PythonLib.slb "{Objs}"macapplet.c.o - ILink ¶ - -o PythonApplet ¶ - -xm e ¶ - -model cfmseg ¶ - -c PYTa ¶ - "{Objs}"macapplet.c.o ¶ - "{CLibraries}"NuStdCLib.slb ¶ - "{Libraries}"NuInterfaceLib.slb ¶ - "{Libraries}"MixedModeLib.slb ¶ - "{Libraries}"NuIntEnv.slb ¶ - "{Libraries}"NuMathLib.o ¶ - "{Libraries}"NuMacRuntime.o ¶ - PythonLib.slb - -#################################### -# Build Python as a shared library # -#################################### - -Exports = PyExc_AttributeError - -PythonLib.slb Ä {ALL} - ILink ¶ - -o PythonLib ¶ - -xm s ¶ - -model cfmseg ¶ - -init __SINIT ¶ - -export {Exports} ¶ - "{CLibraries}"NuStdCLib.slb ¶ - "{Libraries}"NuInterfaceLib.slb ¶ - "{Libraries}"MixedModeLib.slb ¶ - "{Libraries}"NuIntEnv.slb ¶ - "{Libraries}"NuMathLib.o ¶ - "{Libraries}"NuMacRuntime.o ¶ - {ALL} - MakeFlat PythonLib -o PythonLib.slb - Echo "delete 'cfrg'(0);" | Rez -o PythonLib -a -m - -############################################# -# Build xx as a dynamically loadable module # -############################################# - -xxmodule.slb Ä PythonLib.slb "{Objs}"xxmodule.c.o - ILink ¶ - -o xxmodule ¶ - -xm s ¶ - -model cfmseg ¶ - -m initxx ¶ - "{Objs}"xxmodule.c.o ¶ - "{CLibraries}"NuStdCLib.slb ¶ - "{Libraries}"NuInterfaceLib.slb ¶ - "{Libraries}"MixedModeLib.slb ¶ - "{Libraries}"NuIntEnv.slb ¶ - "{Libraries}"NuMathLib.o ¶ - "{Libraries}"NuMacRuntime.o ¶ - PythonLib.slb - MakeFlat xxmodule -o xxmodule.slb - Echo "delete 'cfrg'(0);" | Rez -o xxmodule -a -m - Echo "delete 'cfrg'(0);" | Rez -o xxmodule.slb -a -m - -############################################## -# Targets to create the various object files # -############################################## - -"{Objs}"macapplet.c.o Ä "{Top}"Mac:macapplet.c - {CC} "{Top}"Mac:macapplet.c -o "{Objs}"macapplet.c.o -s macapplet.c {CFlags} - -"{Objs}"macmain.c.o Ä "{Top}"Mac:macmain.c - {CC} "{Top}"Mac:macmain.c -o "{Objs}"macmain.c.o -s macmain.c {CFlags} - -"{Objs}"pythonmain.c.o Ä "{Top}"Python:pythonmain.c - {CC} "{Top}"Python:pythonmain.c -o "{Objs}"pythonmain.c.o -s pythonmain.c {CFlags} - -"{Objs}"compile.c.o Ä "{Top}"Python:compile.c - {CC} "{Top}"Python:compile.c -o "{Objs}"compile.c.o -s compile.c {CFlags} - -"{Objs}"mystrtoul.c.o Ä "{Top}"Python:mystrtoul.c - {CC} "{Top}"Python:mystrtoul.c -o "{Objs}"mystrtoul.c.o -s mystrtoul.c {CFlags} - -"{Objs}"gestaltmodule.c.o Ä "{Top}"Mac:gestaltmodule.c - {CC} "{Top}"Mac:gestaltmodule.c -o "{Objs}"gestaltmodule.c.o -s gestaltmodule.c {CFlags} - -"{Objs}"macfsmodule.c.o Ä "{Top}"Mac:macfs:macfsmodule.c - {CC} "{Top}"Mac:macfs:macfsmodule.c -o "{Objs}"macfsmodule.c.o -s macfsmodule.c {CFlags} - -"{Objs}"macosmodule.c.o Ä "{Top}"Mac:macosmodule.c - {CC} "{Top}"Mac:macosmodule.c -o "{Objs}"macosmodule.c.o -s macosmodule.c {CFlags} - -"{Objs}"nfullpath.c.o Ä "{Top}"Mac:macfs:nfullpath.c - {CC} "{Top}"Mac:macfs:nfullpath.c -o "{Objs}"nfullpath.c.o -s nfullpath.c {CFlags} - -"{Objs}"tokenizer.c.o Ä "{Top}"Parser:tokenizer.c - {CC} "{Top}"Parser:tokenizer.c -o "{Objs}"tokenizer.c.o -s tokenizer.c {CFlags} - -"{Objs}"chdir.c.o Ä "{Top}"Mac:chdir.c - {CC} "{Top}"Mac:chdir.c -o "{Objs}"chdir.c.o -s chdir.c {CFlags} - -"{Objs}"config.c.o Ä "{Top}"Mac:config.c - {CC} "{Top}"Mac:config.c -o "{Objs}"config.c.o -s config.c {CFlags} - -"{Objs}"getopt.c.o Ä "{Top}"Python:getopt.c - {CC} "{Top}"Python:getopt.c -o "{Objs}"getopt.c.o -s getopt.c {CFlags} - -"{Objs}"getwd.c.o Ä "{Top}"Mac:getwd.c - {CC} "{Top}"Mac:getwd.c -o "{Objs}"getwd.c.o -s getwd.c {CFlags} - -"{Objs}"structmember.c.o Ä "{Top}"Python:structmember.c - {CC} "{Top}"Python:structmember.c -o "{Objs}"structmember.c.o -s structmember.c {CFlags} - -"{Objs}"stropmodule.c.o Ä "{Top}"Modules:stropmodule.c - {CC} "{Top}"Modules:stropmodule.c -o "{Objs}"stropmodule.c.o -s stropmodule.c {CFlags} - -"{Objs}"acceler.c.o Ä "{Top}"Parser:acceler.c - {CC} "{Top}"Parser:acceler.c -o "{Objs}"acceler.c.o -s acceler.c {CFlags} - -"{Objs}"graminit.c.o Ä "{Top}"Python:graminit.c - {CC} "{Top}"Python:graminit.c -o "{Objs}"graminit.c.o -s graminit.c {CFlags} - -"{Objs}"grammar1.c.o Ä "{Top}"Parser:grammar1.c - {CC} "{Top}"Parser:grammar1.c -o "{Objs}"grammar1.c.o -s grammar1.c {CFlags} - -"{Objs}"macguesstabsize.c.o Ä "{Top}"Mac:macguesstabsize.c - {CC} "{Top}"Mac:macguesstabsize.c -o "{Objs}"macguesstabsize.c.o -s macguesstabsize.c {CFlags} - -"{Objs}"node.c.o Ä "{Top}"Parser:node.c - {CC} "{Top}"Parser:node.c -o "{Objs}"node.c.o -s node.c {CFlags} - -"{Objs}"parser.c.o Ä "{Top}"Parser:parser.c - {CC} "{Top}"Parser:parser.c -o "{Objs}"parser.c.o -s parser.c {CFlags} - -"{Objs}"parsetok.c.o Ä "{Top}"Parser:parsetok.c - {CC} "{Top}"Parser:parsetok.c -o "{Objs}"parsetok.c.o -s parsetok.c {CFlags} - -"{Objs}"classobject.c.o Ä "{Top}"Objects:classobject.c - {CC} "{Top}"Objects:classobject.c -o "{Objs}"classobject.c.o -s classobject.c {CFlags} - -"{Objs}"import.c.o Ä "{Top}"Python:import.c - {CC} "{Top}"Python:import.c -o "{Objs}"import.c.o -s import.c {CFlags} - -"{Objs}"importdl.c.o Ä "{Top}"Python:importdl.c - {CC} "{Top}"Python:importdl.c -o "{Objs}"importdl.c.o -s importdl.c {CFlags} - -"{Objs}"macgetmtime.c.o Ä "{Top}"Mac:macgetmtime.c - {CC} "{Top}"Mac:macgetmtime.c -o "{Objs}"macgetmtime.c.o -s macgetmtime.c {CFlags} - -"{Objs}"macsetfiletype.c.o Ä "{Top}"Mac:macsetfiletype.c - {CC} "{Top}"Mac:macsetfiletype.c -o "{Objs}"macsetfiletype.c.o -s macsetfiletype.c {CFlags} - -"{Objs}"macstat.c.o Ä "{Top}"Mac:macstat.c - {CC} "{Top}"Mac:macstat.c -o "{Objs}"macstat.c.o -s macstat.c {CFlags} - -"{Objs}"macshlglue.c.o Ä "{Top}"Mac:macshlglue.c - {CC} "{Top}"Mac:macshlglue.c -o "{Objs}"macshlglue.c.o -s macshlglue.c {CFlags} - -"{Objs}"marshal.c.o Ä "{Top}"Python:marshal.c - {CC} "{Top}"Python:marshal.c -o "{Objs}"marshal.c.o -s marshal.c {CFlags} - -"{Objs}"timemodule.c.o Ä "{Top}"Modules:timemodule.c - {CC} "{Top}"Modules:timemodule.c -o "{Objs}"timemodule.c.o -s timemodule.c {CFlags} - -"{Objs}"fileobject.c.o Ä "{Top}"Objects:fileobject.c - {CC} "{Top}"Objects:fileobject.c -o "{Objs}"fileobject.c.o -s fileobject.c {CFlags} - -"{Objs}"frameobject.c.o Ä "{Top}"Objects:frameobject.c - {CC} "{Top}"Objects:frameobject.c -o "{Objs}"frameobject.c.o -s frameobject.c {CFlags} - -"{Objs}"funcobject.c.o Ä "{Top}"Objects:funcobject.c - {CC} "{Top}"Objects:funcobject.c -o "{Objs}"funcobject.c.o -s funcobject.c {CFlags} - -"{Objs}"intobject.c.o Ä "{Top}"Objects:intobject.c - {CC} "{Top}"Objects:intobject.c -o "{Objs}"intobject.c.o -s intobject.c {CFlags} - -"{Objs}"listobject.c.o Ä "{Top}"Objects:listobject.c - {CC} "{Top}"Objects:listobject.c -o "{Objs}"listobject.c.o -s listobject.c {CFlags} - -"{Objs}"mappingobject.c.o Ä "{Top}"Objects:mappingobject.c - {CC} "{Top}"Objects:mappingobject.c -o "{Objs}"mappingobject.c.o -s mappingobject.c {CFlags} - -"{Objs}"methodobject.c.o Ä "{Top}"Objects:methodobject.c - {CC} "{Top}"Objects:methodobject.c -o "{Objs}"methodobject.c.o -s methodobject.c {CFlags} - -"{Objs}"moduleobject.c.o Ä "{Top}"Objects:moduleobject.c - {CC} "{Top}"Objects:moduleobject.c -o "{Objs}"moduleobject.c.o -s moduleobject.c {CFlags} - -"{Objs}"object.c.o Ä "{Top}"Objects:object.c - {CC} "{Top}"Objects:object.c -o "{Objs}"object.c.o -s object.c {CFlags} - -"{Objs}"stringobject.c.o Ä "{Top}"Objects:stringobject.c - {CC} "{Top}"Objects:stringobject.c -o "{Objs}"stringobject.c.o -s stringobject.c {CFlags} - -"{Objs}"tupleobject.c.o Ä "{Top}"Objects:tupleobject.c - {CC} "{Top}"Objects:tupleobject.c -o "{Objs}"tupleobject.c.o -s tupleobject.c {CFlags} - -"{Objs}"accessobject.c.o Ä "{Top}"Objects:accessobject.c - {CC} "{Top}"Objects:accessobject.c -o "{Objs}"accessobject.c.o -s accessobject.c {CFlags} - -"{Objs}"floatobject.c.o Ä "{Top}"Objects:floatobject.c - {CC} "{Top}"Objects:floatobject.c -o "{Objs}"floatobject.c.o -s floatobject.c {CFlags} - -"{Objs}"longobject.c.o Ä "{Top}"Objects:longobject.c - {CC} "{Top}"Objects:longobject.c -o "{Objs}"longobject.c.o -s longobject.c {CFlags} - -"{Objs}"typeobject.c.o Ä "{Top}"Objects:typeobject.c - {CC} "{Top}"Objects:typeobject.c -o "{Objs}"typeobject.c.o -s typeobject.c {CFlags} - -"{Objs}"ceval.c.o Ä "{Top}"Python:ceval.c - {CC} "{Top}"Python:ceval.c -o "{Objs}"ceval.c.o -s ceval.c {CFlags} - -"{Objs}"errors.c.o Ä "{Top}"Python:errors.c - {CC} "{Top}"Python:errors.c -o "{Objs}"errors.c.o -s errors.c {CFlags} - -"{Objs}"intrcheck.c.o Ä "{Top}"Parser:intrcheck.c - {CC} "{Top}"Parser:intrcheck.c -o "{Objs}"intrcheck.c.o -s intrcheck.c {CFlags} - -"{Objs}"macglue.c.o Ä "{Top}"Mac:macglue.c - {CC} "{Top}"Mac:macglue.c -o "{Objs}"macglue.c.o -s macglue.c {CFlags} - -"{Objs}"macgetargv.c.o Ä "{Top}"Mac:macgetargv.c - {CC} "{Top}"Mac:macgetargv.c -o "{Objs}"macgetargv.c.o -s macgetargv.c {CFlagsMac} - -"{Objs}"modsupport.c.o Ä "{Top}"Python:modsupport.c - {CC} "{Top}"Python:modsupport.c -o "{Objs}"modsupport.c.o -s modsupport.c {CFlags} - -"{Objs}"sigcheck.c.o Ä "{Top}"Python:sigcheck.c - {CC} "{Top}"Python:sigcheck.c -o "{Objs}"sigcheck.c.o -s sigcheck.c {CFlags} - -"{Objs}"sysmodule.c.o Ä "{Top}"Python:sysmodule.c - {CC} "{Top}"Python:sysmodule.c -o "{Objs}"sysmodule.c.o -s sysmodule.c {CFlags} - -"{Objs}"traceback.c.o Ä "{Top}"Python:traceback.c - {CC} "{Top}"Python:traceback.c -o "{Objs}"traceback.c.o -s traceback.c {CFlags} - -"{Objs}"bltinmodule.c.o Ä "{Top}"Python:bltinmodule.c - {CC} "{Top}"Python:bltinmodule.c -o "{Objs}"bltinmodule.c.o -s bltinmodule.c {CFlags} - -"{Objs}"fopenRF.c.o Ä "{Top}"Mac:fopenRF.c - {CC} "{Top}"Mac:fopenRF.c -o "{Objs}"fopenRF.c.o -s fopenRF.c {CFlags} - -"{Objs}"stdwinmodule.c.o Ä "{Top}"Modules:stdwinmodule.c - {CC} "{Top}"Modules:stdwinmodule.c -o "{Objs}"stdwinmodule.c.o -s stdwinmodule.c {CFlags} - -"{Objs}"ctbmodule.c.o Ä "{Top}"Mac:ctb:ctbmodule.c - {CC} "{Top}"Mac:ctb:ctbmodule.c -o "{Objs}"ctbmodule.c.o -s ctbmodule.c {CFlags} - -"{Objs}"arraymodule.c.o Ä "{Top}"Modules:arraymodule.c - {CC} "{Top}"Modules:arraymodule.c -o "{Objs}"arraymodule.c.o -s arraymodule.c {CFlags} - -"{Objs}"getbootvol.c.o Ä "{Top}"Mac:getbootvol.c - {CC} "{Top}"Mac:getbootvol.c -o "{Objs}"getbootvol.c.o -s getbootvol.c {CFlags} - -"{Objs}"macmodule.c.o Ä "{Top}"Mac:macmodule.c - {CC} "{Top}"Mac:macmodule.c -o "{Objs}"macmodule.c.o -s macmodule.c {CFlags} - -"{Objs}"mkdir.c.o Ä "{Top}"Mac:mkdir.c - {CC} "{Top}"Mac:mkdir.c -o "{Objs}"mkdir.c.o -s mkdir.c {CFlags} - -"{Objs}"opendir.c.o Ä "{Top}"Mac:opendir.c - {CC} "{Top}"Mac:opendir.c -o "{Objs}"opendir.c.o -s opendir.c {CFlags} - -"{Objs}"rmdir.c.o Ä "{Top}"Mac:rmdir.c - {CC} "{Top}"Mac:rmdir.c -o "{Objs}"rmdir.c.o -s rmdir.c {CFlags} - -"{Objs}"sync.c.o Ä "{Top}"Mac:sync.c - {CC} "{Top}"Mac:sync.c -o "{Objs}"sync.c.o -s sync.c {CFlags} - -"{Objs}"audioop.c.o Ä "{Top}"Modules:audioop.c - {CC} "{Top}"Modules:audioop.c -o "{Objs}"audioop.c.o -s audioop.c {CFlags} - -"{Objs}"imageop.c.o Ä "{Top}"Modules:imageop.c - {CC} "{Top}"Modules:imageop.c -o "{Objs}"imageop.c.o -s imageop.c {CFlags} - -"{Objs}"imgformat.c.o Ä "{Top}"Modules:imgformat.c - {CC} "{Top}"Modules:imgformat.c -o "{Objs}"imgformat.c.o -s imgformat.c {CFlags} - -"{Objs}"macconsole.c.o Ä "{Top}"Mac:think:macconsole:macconsole.c - {CC} "{Top}"Mac:think:macconsole:macconsole.c -o "{Objs}"macconsole.c.o -s macconsole.c {CFlags} - -"{Objs}"myreadline.c.o Ä "{Top}"Parser:myreadline.c - {CC} "{Top}"Parser:myreadline.c -o "{Objs}"myreadline.c.o -s myreadline.c {CFlags} - -"{Objs}"pythonrun.c.o Ä "{Top}"Python:pythonrun.c - {CC} "{Top}"Python:pythonrun.c -o "{Objs}"pythonrun.c.o -s pythonrun.c {CFlags} - -"{Objs}"AEmodule.c.o Ä "{Top}"Tools:bgen:ae:AEmodule.c - {CC} "{Top}"Tools:bgen:ae:AEmodule.c -o "{Objs}"AEmodule.c.o -s AEmodule.c {CFlags} - -"{Objs}"Ctlmodule.c.o Ä "{Top}"Tools:bgen:ctl:Ctlmodule.c - {CC} "{Top}"Tools:bgen:ctl:Ctlmodule.c -o "{Objs}"Ctlmodule.c.o -s Ctlmodule.c {CFlags} - -"{Objs}"Dlgmodule.c.o Ä "{Top}"Tools:bgen:dlg:Dlgmodule.c - {CC} "{Top}"Tools:bgen:dlg:Dlgmodule.c -o "{Objs}"Dlgmodule.c.o -s Dlgmodule.c {CFlags} - -"{Objs}"Evtmodule.c.o Ä "{Top}"Tools:bgen:evt:Evtmodule.c - {CC} "{Top}"Tools:bgen:evt:Evtmodule.c -o "{Objs}"Evtmodule.c.o -s Evtmodule.c {CFlags} - -"{Objs}"Menumodule.c.o Ä "{Top}"Tools:bgen:menu:Menumodule.c - {CC} "{Top}"Tools:bgen:menu:Menumodule.c -o "{Objs}"Menumodule.c.o -s Menumodule.c {CFlags} - -"{Objs}"Qdmodule.c.o Ä "{Top}"Tools:bgen:qd:Qdmodule.c - {CC} "{Top}"Tools:bgen:qd:Qdmodule.c -o "{Objs}"Qdmodule.c.o -s Qdmodule.c {CFlags} - -"{Objs}"Resmodule.c.o Ä "{Top}"Tools:bgen:res:Resmodule.c - {CC} "{Top}"Tools:bgen:res:Resmodule.c -o "{Objs}"Resmodule.c.o -s Resmodule.c {CFlags} - -"{Objs}"Sndmodule.c.o Ä "{Top}"Tools:bgen:snd:Sndmodule.c - {CC} "{Top}"Tools:bgen:snd:Sndmodule.c -o "{Objs}"Sndmodule.c.o -s Sndmodule.c {CFlags} - -"{Objs}"Winmodule.c.o Ä "{Top}"Tools:bgen:win:Winmodule.c - {CC} "{Top}"Tools:bgen:win:Winmodule.c -o "{Objs}"Winmodule.c.o -s Winmodule.c {CFlags} - -"{Objs}"md5c.c.o Ä "{Top}"Modules:md5c.c - {CC} "{Top}"Modules:md5c.c -o "{Objs}"md5c.c.o -s md5c.c {CFlags} - -"{Objs}"md5module.c.o Ä "{Top}"Modules:md5module.c - {CC} "{Top}"Modules:md5module.c -o "{Objs}"md5module.c.o -s md5module.c {CFlags} - -"{Objs}"mathmodule.c.o Ä "{Top}"Modules:mathmodule.c - {CC} "{Top}"Modules:mathmodule.c -o "{Objs}"mathmodule.c.o -s mathmodule.c {CFlags} - -"{Objs}"parsermodule.c.o Ä "{Top}"Modules:parsermodule.c - {CC} "{Top}"Modules:parsermodule.c -o "{Objs}"parsermodule.c.o -s parsermodule.c {CFlags} - -"{Objs}"regexmodule.c.o Ä "{Top}"Modules:regexmodule.c - {CC} "{Top}"Modules:regexmodule.c -o "{Objs}"regexmodule.c.o -s regexmodule.c {CFlags} - -"{Objs}"regexpr.c.o Ä "{Top}"Modules:regexpr.c - {CC} "{Top}"Modules:regexpr.c -o "{Objs}"regexpr.c.o -s regexpr.c {CFlags} - -"{Objs}"rangeobject.c.o Ä "{Top}"Objects:rangeobject.c - {CC} "{Top}"Objects:rangeobject.c -o "{Objs}"rangeobject.c.o -s rangeobject.c {CFlags} - -"{Objs}"rgbimgmodule.c.o Ä "{Top}"Modules:rgbimgmodule.c - {CC} "{Top}"Modules:rgbimgmodule.c -o "{Objs}"rgbimgmodule.c.o -s rgbimgmodule.c {CFlags} - -"{Objs}"rotormodule.c.o Ä "{Top}"Modules:rotormodule.c - {CC} "{Top}"Modules:rotormodule.c -o "{Objs}"rotormodule.c.o -s rotormodule.c {CFlags} - -"{Objs}"structmodule.c.o Ä "{Top}"Modules:structmodule.c - {CC} "{Top}"Modules:structmodule.c -o "{Objs}"structmodule.c.o -s structmodule.c {CFlags} - -"{Objs}"getargs.c.o Ä "{Top}"Python:getargs.c - {CC} "{Top}"Python:getargs.c -o "{Objs}"getargs.c.o -s getargs.c {CFlags} - -"{Objs}"xxmodule.c.o Ä "{Top}"Modules:xxmodule.c - {CC} "{Top}"Modules:xxmodule.c -o "{Objs}"xxmodule.c.o -s xxmodule.c {CFlags} - -"{Objs}"atof.c.o Ä "{Top}"Python:atof.c - {CC} "{Top}"Python:atof.c -o "{Objs}"atof.c.o -s atof.c {CFlags} - -"{Objs}"strtod.c.o Ä "{Top}"Python:strtod.c - {CC} "{Top}"Python:strtod.c -o "{Objs}"strtod.c.o -s strtod.c {CFlags} - -"{Objs}"fmod.c.o Ä "{Top}"Python:fmod.c - {CC} "{Top}"Python:fmod.c -o "{Objs}"fmod.c.o -s fmod.c {CFlags} diff --git a/Mac/MPW/README b/Mac/MPW/README deleted file mode 100644 index 3d58230..0000000 --- a/Mac/MPW/README +++ /dev/null @@ -1,122 +0,0 @@ -Python and MPW -============== - -There is conditional code in Python for MPW. This has been used with -different compilers at various points in time. Right now it is being -used to turn the entire interpreter into a shared library on 68K Macs, -so we can build "applets" (see below). I have used MPW 3.2 and the OpenDoc -development environment from an OpenDoc CD released in 1984. This -contains the Symantec C compiler for MPW (version 7.0.4), the -Universal Headers (version 2.0a1), and early versions of CFM-68K (version 1.0a1) -(the Code Fragment Manager ported back to the 68K Mac) and -MixedModeInit (version 1.0d12), which are required to use shared libraries. - -I've created a Makefile that does everything, plus a three-line Build -script that calls Make and runs its output. The Makefile assumes that -it lives in a 1-deep subdirectory of the root, so e.g. the Python -Include directory can be referenced through "::Include". All object -files are collected in the subsubdirectory Objcode. - -I use these feature test macros: - -MPW for all MPW compilers (e.g. long double in <math.h>) -__SC__ for things specific to the Symantec C compiler - (e.g. doesn't like static forward) -__CFM68K__ for things specific to CFM-68K - (e.g. it requires the use of #pragma lib_export on|off) -HAVE_UNIVERSAL_HEADERS for things not yet in Think's headers (e.g. UPPs) -GENERATINGCFM for both PPC and 68K Code Fragment Manager - -MPW is defined in config.h (if it finds that applec is defined); -HAVE_UNIVERSAL_HEADERS is defined in macglue.h depending on whether it -thinks we are using Universal Headers. The others are defined by the -compiler or by the system headers. - -Compiler switches were a nightmare until I found I had to use -b. -This wasn't mentioned in the CFM-68K docs that came on the OpenDoc -CD-ROM. Apparently it is only needed for large projects... - - -Warning: Mixing Think C and MPW -=============================== - -(XXX Need to check what convention SC uses -- I hope it uses Think's.) - -If you are mixing Think C and MPW, you may experience weird errors in -previously correct modules. These disappear when you throw away the -module's .pyc file. The errors usually have to do with string -literals containing '\n' or '\r'. The reason is an incompatibility -between their handling of '\n' and '\r' -- in MPW C, '\n' actually is -ASCII CR while '\r' is ASCII LF, which is the reverse situation from -any other ASCII based C implementation. This behaviour is inherited -by Python compiled with MPW C. This is normally not a problem, but -*binary* files written by one system will be mis-interpreted by the -other, and this is what happens to the .pyc files. There is no easy -way to fix this in the source. (This is a real shame, since the -format of .pyc files was carefully designed to be independent of byte -order and integer size -- deviations in the ASCII character codes were -never anticipated.) - - -Building "Applets" for the Mac -============================== - -An "applet" is a tiny application that's written in a scripting language -but behaves like a real application. The behavior is much like that of -executable scripts in Unix -- but the implementation is entirely different. - -The applet's file can be small because it doesn't contain the actual -interpreter for the scripting language -- this has to be installed in the -Extensions folder (usually) before the applet will work. The applet file -itself only contains a tiny bootstrap program and the script itself -- -possibly "compiled" or otherwise encoded to save on parsing time and space, -and to make it harder to reverse engineer the script (some people care about -this). - -In Python's case, the Python interpreter, without its main program, is built -as a shared library that is dropped in the Extensions folder. Some more -shared libraries must also be present -- these form the C run-time system. -[[XXX perhaps we should link these in statically with the Python library, -for simpler distribution???]] On the 68K Mac, two more extensions are needed: -CFM-68K (the Code Fragment Manager) and MixedModeInit. These provide -functionality that's built in the Power Mac's OS. It seems that System 7.1.1 -or higher is also required. - -The applet file contains a small main program program, plus a 'PYC ' resource -named __main__ which contains the "compiled" version of the script. A 'PYC ' -resource contains exactly the same data as a ".pyc" file. (The advantage of -storing compiled modules as resources instead of files is that many modules -can be stored in a single file.) The applet's main -program initializes most of the toolbox managers (it uses the same sequence -as stdwin or the Think C console I/O library), then initializes Python, -then loads the resource and decodes it into a Python code object, and finally -passes the code object to the Python interpreter for execution. [[XXX Actually, -the applet's main program could be moved entirely to the shared library -- -there's nothing in it that's dependent on the applet's configuration. -The applet itself could then be reduced to main() { applet_main(); } ]] -[[XXX I tried this but it only save 512 bytes on a total of 10K -- the rest -is boilerplate that the linker always seems to create. Wonder how this is on -the Power Mac...]] - -A big restriction for applets is that they have no standard input and their -standard output and error streams are diverted to files called "stdout" and -"stderr". This means that in order to interact with the user, or even just -to provide some feedback while they're grinding along, they must make use of -Mac toolbox calls to create windows, etc. I plan to provide a library that at -least has the output functionality of the Think C Console I/O library or -CodeWarrior's SIOX. - -The current procedure to create an applet is not as simple as it could be. -I have written a Python script (which itself can be -- and has been -- made -into an applet!) which asks for a Python source file (input) and an existing -applet file (output). It adds a 'PYC ' resource to the applet named __main__, -which contains the compiled code of the script (it compiles on the fly, -so you don't need to have a .pyc file for the script). -Although this seems fairly simple, the practical complication is that you need -to copy the applet template first -- if you specify the template as the output, -you will overwrite the template! [[XXX I guess a simplification could be made -by using the convention that the applet built from a script has the same name -as the script but with ".py" stripped; the applet-making script could then -search for the template in a few common locations (e.g. the Python module -search path) and copy it, reducing the user interaction to just indicating the -Python source file to be converted into an applet.]] diff --git a/Mac/Modules/Printingmodule.c b/Mac/Modules/Printingmodule.c deleted file mode 100644 index e0c4017..0000000 --- a/Mac/Modules/Printingmodule.c +++ /dev/null @@ -1,465 +0,0 @@ -/****************************************************************** -Copyright 1998 by Just van Rossum, Den Haag, 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 name of Just van Rossum not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -JUST VAN ROSSUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL JUST VAN ROSSUM 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. - -******************************************************************/ - -#include "Python.h" -#include "macglue.h" -#include "pymactoolbox.h" -#include <Printing.h> - -static PyObject *ErrorObject; - -/* ----------------------------------------------------- */ - -static int -TPRect_Convert(PyObject *v, TPRect *r) -{ - if (v == Py_None) { - *r = NULL; - return 1; - } - return PyArg_Parse(v, "(hhhh)", &(*r)->left, &(*r)->top, &(*r)->right, &(*r)->bottom); -} - - -static char Pr_NewTPrintRecord__doc__[] = -"creates a new TPrint handle" -; - -static PyObject * -Pr_NewTPrintRecord(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - Handle hPrint; - - if (!PyArg_ParseTuple(args, "")) - return NULL; - hPrint = NewHandleClear((long) sizeof(TPrint)); - if ( hPrint == NULL ) { - PyErr_NoMemory(); - return NULL; - } - return (PyObject *)ResObj_New(hPrint); -} - -static char Pr_PrPurge__doc__[] = -"PrPurge() -> None" -; - -static PyObject * -Pr_PrPurge(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - - if (!PyArg_ParseTuple(args, "")) - return NULL; - PrPurge(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrNoPurge__doc__[] = -"PrNoPurge() -> None" -; - -static PyObject * -Pr_PrNoPurge(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - - if (!PyArg_ParseTuple(args, "")) - return NULL; - PrNoPurge(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrOpen__doc__[] = -"PrOpen() -> None" -; - -static PyObject * -Pr_PrOpen(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - - if (!PyArg_ParseTuple(args, "")) - return NULL; - PrOpen(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrClose__doc__[] = -"PrClose() -> None" -; - -static PyObject * -Pr_PrClose(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - - if (!PyArg_ParseTuple(args, "")) - return NULL; - PrClose(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrintDefault__doc__[] = -"PrintDefault(THPrint hPrint) -> None" -; - -static PyObject * -Pr_PrintDefault(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - PrintDefault(hPrint); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrValidate__doc__[] = -"PrValidate(THPrint hPrint) -> None" -; - -static PyObject * -Pr_PrValidate(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - PrValidate(hPrint); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrStlDialog__doc__[] = -"PrStlDialog(THPrint hPrint) -> Boolean" -; - -static PyObject * -Pr_PrStlDialog(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - Boolean rv; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - rv = PrStlDialog(hPrint); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - return Py_BuildValue("h", rv); -} - -static char Pr_PrJobDialog__doc__[] = -"PrJobDialog(THPrint hPrint) -> Boolean" -; - -static PyObject * -Pr_PrJobDialog(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - Boolean rv; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - rv = PrJobDialog(hPrint); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - return Py_BuildValue("h", rv); -} - -static char Pr_PrJobMerge__doc__[] = -"PrJobMerge(THPrint hPrintSrc, THPrint hPrintDst) -> none" -; - -static PyObject * -Pr_PrJobMerge(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrintSrc, hPrintDst; - - if (!PyArg_ParseTuple(args, "O&O&", ResObj_Convert, &hPrintSrc, ResObj_Convert, &hPrintDst)) - return NULL; - PrJobMerge(hPrintSrc, hPrintDst); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrOpenDoc__doc__[] = -"PrOpenDoc(THPrint hPrint) -> TPPrPort aTPPort" -; - -static PyObject * -Pr_PrOpenDoc(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - TPPrPort aTPPort; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - aTPPort = PrOpenDoc(hPrint, NULL, NULL); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - return Py_BuildValue("O&", GrafObj_New, aTPPort); -} - -static char Pr_PrCloseDoc__doc__[] = -"PrCloseDoc(TPPrPort pPrPort) -> None" -; - -static PyObject * -Pr_PrCloseDoc(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - TPPrPort pPrPort; - - if (!PyArg_ParseTuple(args, "O&", GrafObj_Convert, &pPrPort)) - return NULL; - PrCloseDoc(pPrPort); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrOpenPage__doc__[] = -"PrOpenPage(TPPrPort pPrPort, TPRect pPageFrame) -> None" -; - -static PyObject * -Pr_PrOpenPage(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - TPPrPort pPrPort; - Rect dummyrect = {0, 0, 0, 0}; - TPRect pPageFrame = &dummyrect; - - if (!PyArg_ParseTuple(args, "O&O&", GrafObj_Convert, &pPrPort, TPRect_Convert, &pPageFrame)) - return NULL; - PrOpenPage(pPrPort, pPageFrame); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrClosePage__doc__[] = -"PrClosePage(TPPrPort pPrPort) -> None" -; - -static PyObject * -Pr_PrClosePage(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - TPPrPort pPrPort; - - if (!PyArg_ParseTuple(args, "O&", GrafObj_Convert, &pPrPort)) - return NULL; - PrClosePage(pPrPort); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrPicFile__doc__[] = -"PrPicFile(THPrint hPrint) -> none" -; - -static PyObject * -Pr_PrPicFile(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - THPrint hPrint; - TPrStatus prStatus; - - if (!PyArg_ParseTuple(args, "O&", ResObj_Convert, &hPrint)) - return NULL; - PrPicFile(hPrint, NULL, NULL, NULL, &prStatus); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrGeneral__doc__[] = -"not implemented" -; - -static PyObject * -Pr_PrGeneral(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - - if (!PyArg_ParseTuple(args, "")) - return NULL; - //PrGeneral(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - Py_INCREF(Py_None); - return Py_None; -} - -static char Pr_PrDrvrVers__doc__[] = -"PrDrvrVers() -> version" -; - -static PyObject * -Pr_PrDrvrVers(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - short rv; - - if (!PyArg_ParseTuple(args, "")) - return NULL; - rv = PrDrvrVers(); - { - OSErr _err = PrError(); - if (_err != noErr) return PyMac_Error(_err); - } - return Py_BuildValue("h", rv); -} - -/* List of methods defined in the module */ - -static struct PyMethodDef Pr_methods[] = { - {"NewTPrintRecord", (PyCFunction)Pr_NewTPrintRecord, METH_VARARGS, Pr_NewTPrintRecord__doc__}, - {"PrPurge", (PyCFunction)Pr_PrPurge, METH_VARARGS, Pr_PrPurge__doc__}, - {"PrNoPurge", (PyCFunction)Pr_PrNoPurge, METH_VARARGS, Pr_PrNoPurge__doc__}, - {"PrOpen", (PyCFunction)Pr_PrOpen, METH_VARARGS, Pr_PrOpen__doc__}, - {"PrClose", (PyCFunction)Pr_PrClose, METH_VARARGS, Pr_PrClose__doc__}, - {"PrintDefault",(PyCFunction)Pr_PrintDefault, METH_VARARGS, Pr_PrintDefault__doc__}, - {"PrValidate", (PyCFunction)Pr_PrValidate, METH_VARARGS, Pr_PrValidate__doc__}, - {"PrStlDialog", (PyCFunction)Pr_PrStlDialog, METH_VARARGS, Pr_PrStlDialog__doc__}, - {"PrJobDialog", (PyCFunction)Pr_PrJobDialog, METH_VARARGS, Pr_PrJobDialog__doc__}, - {"PrJobMerge", (PyCFunction)Pr_PrJobMerge, METH_VARARGS, Pr_PrJobMerge__doc__}, - {"PrOpenDoc", (PyCFunction)Pr_PrOpenDoc, METH_VARARGS, Pr_PrOpenDoc__doc__}, - {"PrCloseDoc", (PyCFunction)Pr_PrCloseDoc, METH_VARARGS, Pr_PrCloseDoc__doc__}, - {"PrOpenPage", (PyCFunction)Pr_PrOpenPage, METH_VARARGS, Pr_PrOpenPage__doc__}, - {"PrClosePage", (PyCFunction)Pr_PrClosePage, METH_VARARGS, Pr_PrClosePage__doc__}, - {"PrPicFile", (PyCFunction)Pr_PrPicFile, METH_VARARGS, Pr_PrPicFile__doc__}, -// {"PrGeneral", (PyCFunction)Pr_PrGeneral, METH_VARARGS, Pr_PrGeneral__doc__}, - {"PrDrvrVers", (PyCFunction)Pr_PrDrvrVers, METH_VARARGS, Pr_PrDrvrVers__doc__}, - - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called initPrinting) */ - -static char Printing_module_documentation[] = -"" -; - -void initPrinting(); - -void -initPrinting() -{ - PyObject *m, *d; - - /* Create the module and add the functions */ - m = Py_InitModule4("Printing", Pr_methods, - Printing_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Printing.error"); - PyDict_SetItemString(d, "error", ErrorObject); - - /* XXXX Add constants here */ - -} - diff --git a/Mac/Modules/_dummy_tkinter.c b/Mac/Modules/_dummy_tkinter.c deleted file mode 100644 index 6faab91..0000000 --- a/Mac/Modules/_dummy_tkinter.c +++ /dev/null @@ -1,28 +0,0 @@ - -/* Dummy _tkinter module for use with Carbon. Gives (slightly) better error - * message when you try to use Tkinter. - */ - -/* Xxo objects */ - -#include "Python.h" - - -/* List of functions defined in the module */ - -static PyMethodDef xx_methods[] = { - {NULL, NULL} /* sentinel */ -}; - - - -DL_EXPORT(void) -init_tkinter(void) -{ - PyObject *m; - - /* Create the module and add the functions */ - m = Py_InitModule("_tkinter", xx_methods); - - PyErr_SetString(PyExc_ImportError, "Tkinter not supported under Carbon (yet)."); -} diff --git a/Mac/Modules/calldll.c b/Mac/Modules/calldll.c deleted file mode 100644 index f390a9d..0000000 --- a/Mac/Modules/calldll.c +++ /dev/null @@ -1,1194 +0,0 @@ -/*********************************************************** -Copyright 1991-1995 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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* Sanity check */ -#ifndef __powerc -#error Please port this code to your architecture first... -#endif - -/* -** Define to include testroutines (at the end) -*/ -#define TESTSUPPORT - -#include "Python.h" -#include "macglue.h" -#include "macdefs.h" -#include <CodeFragments.h> - -/* Prototypes for routines not in any include file (shame, shame) */ -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); - -static PyObject *ErrorObject; - -/* Debugging macro */ -#ifdef TESTSUPPORT -#define PARANOID(arg) \ - if ( arg == 0 ) {PyErr_SetString(ErrorObject, "Internal error: NULL arg!"); return 0; } -#else -#define PARANOID(arg) /*pass*/ -#endif - -/* Prototypes we use for routines and arguments */ - -typedef long anything; -typedef anything (*anyroutine)(...); - -/* Other constants */ -#define MAXNAME 31 /* Maximum size of names, for printing only */ -#define MAXARG 12 /* Maximum number of arguments */ - -/* -** Routines to convert arguments between Python and C. -** Note return-value converters return NULL if this argument (or return value) -** doesn't return anything. The call-wrapper code collects all return values, -** and does the expected thing based on the number of return values: return None, a single -** value or a tuple of values. -** -** Hence, optional return values are also implementable. -*/ -typedef anything (*py2c_converter)(PyObject *); -typedef PyObject *(*c2py_converter)(anything); -typedef PyObject *(*rv2py_converter)(anything); - - -/* Dummy routine for arguments that are output-only */ -static anything -py2c_dummy(arg) - PyObject *arg; -{ - return 0; -} - -/* Routine to allocate storage for output integers */ -static anything -py2c_alloc(arg) - PyObject *arg; -{ - char *ptr; - - if( (ptr=malloc(sizeof(anything))) == 0 ) - PyErr_NoMemory(); - return (anything)ptr; -} - -/* Dummy routine for arguments that are input-only */ -static PyObject * -c2py_dummy(arg) - anything arg; -{ - return 0; -} - -/* Dummy routine for void return value */ -static PyObject * -rv2py_none(arg) - anything arg; -{ - return 0; -} - -/* Routine to de-allocate storage for input-only arguments */ -static PyObject * -c2py_free(arg) - anything arg; -{ - if ( arg ) - free((char *)arg); - return 0; -} - -/* -** OSErr return value. -*/ -static PyObject * -rv2py_oserr(arg) - anything arg; -{ - OSErr err = (OSErr)arg; - - if (err) - return PyMac_Error(err); - return 0; -} - -/* -** Input integers of all sizes (PPC only) -*/ -static anything -py2c_in_int(arg) - PyObject *arg; -{ - return PyInt_AsLong(arg); -} - -/* -** Integer return values of all sizes (PPC only) -*/ -static PyObject * -rv2py_int(arg) - anything arg; -{ - return PyInt_FromLong((long)arg); -} - -/* -** Integer output parameters -*/ -static PyObject * -c2py_out_long(arg) - anything arg; -{ - PyObject *rv; - - PARANOID(arg); - rv = PyInt_FromLong(*(long *)arg); - free((char *)arg); - return rv; -} - -static PyObject * -c2py_out_short(arg) - anything arg; -{ - PyObject *rv; - - PARANOID(arg); - rv = PyInt_FromLong((long)*(short *)arg); - free((char *)arg); - return rv; -} - -static PyObject * -c2py_out_byte(arg) - anything arg; -{ - PyObject *rv; - - PARANOID(arg); - rv = PyInt_FromLong((long)*(char *)arg); - free((char *)arg); - return rv; -} - -/* -** Strings -*/ -static anything -py2c_in_string(arg) - PyObject *arg; -{ - return (anything)PyString_AsString(arg); -} - -/* -** Pascal-style strings -*/ -static anything -py2c_in_pstring(arg) - PyObject *arg; -{ - unsigned char *p; - int size; - - if( (size = PyString_Size(arg)) < 0) - return 0; - if ( size > 255 ) { - PyErr_SetString(ErrorObject, "Pstring must be <= 255 chars"); - return 0; - } - if( (p=(unsigned char *)malloc(256)) == 0 ) { - PyErr_NoMemory(); - return 0; - } - p[0] = size; - memcpy(p+1, PyString_AsString(arg), size); - return (anything)p; -} - -static anything -py2c_out_pstring(arg) - PyObject *arg; -{ - unsigned char *p; - - if( (p=(unsigned char *)malloc(256)) == 0 ) { - PyErr_NoMemory(); - return 0; - } - p[0] = 0; - return (anything)p; -} - -static PyObject * -c2py_out_pstring(arg) - anything arg; -{ - unsigned char *p = (unsigned char *)arg; - PyObject *rv; - - PARANOID(arg); - rv = PyString_FromStringAndSize((char *)p+1, p[0]); - free(p); - return rv; -} - -static PyObject * -rv2py_pstring(arg) - anything arg; -{ - unsigned char *p = (unsigned char *)arg; - PyObject *rv; - - if ( arg == NULL ) return NULL; - rv = PyString_FromStringAndSize((char *)p+1, p[0]); - return rv; -} - -/* -** C objects. -*/ -static anything -py2c_in_cobject(arg) - PyObject *arg; -{ - if ( arg == Py_None ) - return 0; - return (anything)PyCObject_AsVoidPtr(arg); -} - -static PyObject * -c2py_out_cobject(arg) - anything arg; -{ - void **ptr = (void **)arg; - PyObject *rv; - - PARANOID(arg); - if ( *ptr == 0 ) { - Py_INCREF(Py_None); - rv = Py_None; - } else { - rv = PyCObject_FromVoidPtr(*ptr, 0); - } - free((char *)ptr); - return rv; -} - -static PyObject * -rv2py_cobject(arg) - anything arg; -{ - void *ptr = (void *)arg; - PyObject *rv; - - if ( ptr == 0 ) return NULL; - rv = PyCObject_FromVoidPtr(ptr, 0); - return rv; -} - -/* -** Handles. -*/ -static anything -py2c_in_handle(arg) - PyObject *arg; -{ - Handle h = 0; - ResObj_Convert(arg, &h); - return (anything)h; -} - -static PyObject * -c2py_out_handle(arg) - anything arg; -{ - Handle *rv = (Handle *)arg; - PyObject *prv; - - PARANOID(arg); - if ( *rv == 0 ) { - Py_INCREF(Py_None); - prv = Py_None; - } else { - prv = ResObj_New(*rv); - } - free((char *)rv); - return prv; -} - -static PyObject * -rv2py_handle(arg) - anything arg; -{ - Handle rv = (Handle)arg; - - if ( rv == NULL ) return NULL; - return ResObj_New(rv); -} - -typedef struct { - char *name; /* Name */ - py2c_converter get; /* Get argument */ - int get_uses_arg; /* True if the above consumes an argument */ - c2py_converter put; /* Put result value */ -} conventry; - -static conventry converters[] = { - {"InByte", py2c_in_int, 1, c2py_dummy}, - {"InShort", py2c_in_int, 1, c2py_dummy}, - {"InLong", py2c_in_int, 1, c2py_dummy}, - {"OutLong", py2c_alloc, 0, c2py_out_long}, - {"OutShort", py2c_alloc, 0, c2py_out_short}, - {"OutByte", py2c_alloc, 0, c2py_out_byte}, - {"InString", py2c_in_string, 1, c2py_dummy}, - {"InPstring", py2c_in_pstring,1, c2py_free}, - {"OutPstring", py2c_out_pstring,0, c2py_out_pstring}, - {"InCobject", py2c_in_cobject,1, c2py_dummy}, - {"OutCobject", py2c_alloc, 0, c2py_out_cobject}, - {"InHandle", py2c_in_handle, 1, c2py_dummy}, - {"OutHandle", py2c_alloc, 0, c2py_out_handle}, - {0, 0, 0, 0} -}; - -typedef struct { - char *name; - rv2py_converter rtn; -} rvconventry; - -static rvconventry rvconverters[] = { - {"None", rv2py_none}, - {"OSErr", rv2py_oserr}, - {"Byte", rv2py_int}, - {"Short", rv2py_int}, - {"Long", rv2py_int}, - {"Pstring", rv2py_pstring}, - {"Cobject", rv2py_cobject}, - {"Handle", rv2py_handle}, - {0, 0} -}; - -static conventry * -getconverter(name) - char *name; -{ - int i; - char buf[256]; - - for(i=0; converters[i].name; i++ ) - if ( strcmp(name, converters[i].name) == 0 ) - return &converters[i]; - sprintf(buf, "Unknown argtype: %s", name); - PyErr_SetString(ErrorObject, buf); - return 0; -} - -static rvconventry * -getrvconverter(name) - char *name; -{ - int i; - char buf[256]; - - for(i=0; rvconverters[i].name; i++ ) - if ( strcmp(name, rvconverters[i].name) == 0 ) - return &rvconverters[i]; - sprintf(buf, "Unknown return value type: %s", name); - PyErr_SetString(ErrorObject, buf); - return 0; -} - -static int -argparse_conv(obj, ptr) - PyObject *obj; - conventry **ptr; -{ - char *name; - int i; - conventry *item; - - if( (name=PyString_AsString(obj)) == NULL ) - return 0; - if( (item=getconverter(name)) == NULL ) - return 0; - *ptr = item; - return 1; -} - -static int -argparse_rvconv(obj, ptr) - PyObject *obj; - rvconventry **ptr; -{ - char *name; - int i; - rvconventry *item; - - if( (name=PyString_AsString(obj)) == NULL ) - return 0; - if( (item=getrvconverter(name)) == NULL ) - return 0; - *ptr = item; - return 1; -} - -/* ----------------------------------------------------- */ - -/* Declarations for objects of type fragment */ - -typedef struct { - PyObject_HEAD - CFragConnectionID conn_id; - char name[MAXNAME+1]; -} cdfobject; - -static PyTypeObject Cdftype; - - - -/* ---------------------------------------------------------------- */ - -/* Declarations for objects of type routine */ - -typedef struct { - PyObject_HEAD - anyroutine rtn; - char name[MAXNAME+1]; -} cdrobject; - -static PyTypeObject Cdrtype; - - - -/* ---------------------------------------------------------------- */ - -/* Declarations for objects of type callable */ - - -typedef struct { - PyObject_HEAD - cdrobject *routine; /* The routine to call */ - int npargs; /* Python argument count */ - int ncargs; /* C argument count + 1 */ - rvconventry *rvconv; /* Return value converter */ - conventry *argconv[MAXARG]; /* Value converter list */ -} cdcobject; - -static PyTypeObject Cdctype; - - - -/* -------------------------------------------------------- */ - - -static struct PyMethodDef cdr_methods[] = { - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static cdrobject * -newcdrobject(name, routine) - unsigned char *name; - anyroutine routine; -{ - cdrobject *self; - int nlen; - - self = PyObject_NEW(cdrobject, &Cdrtype); - if (self == NULL) - return NULL; - if ( name[0] > MAXNAME ) - nlen = MAXNAME; - else - nlen = name[0]; - memcpy(self->name, name+1, nlen); - self->name[nlen] = '\0'; - self->rtn = routine; - return self; -} - -static void -cdr_dealloc(self) - cdrobject *self; -{ - PyObject_DEL(self); -} - -static PyObject * -cdr_repr(self) - cdrobject *self; -{ - PyObject *s; - char buf[256]; - - sprintf(buf, "<Calldll routine %s address 0x%x>", self->name, self->rtn); - s = PyString_FromString(buf); - return s; -} - -static char Cdrtype__doc__[] = -"C Routine address" -; - -static PyTypeObject Cdrtype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "calldll.routine", /*tp_name*/ - sizeof(cdrobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdr_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)cdr_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Cdrtype__doc__ /* Documentation string */ -}; - -/* End of code for routine objects */ -/* -------------------------------------------------------- */ - - -static struct PyMethodDef cdc_methods[] = { - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static cdcobject * -newcdcobject(routine, npargs, ncargs, rvconv, argconv) - cdrobject *routine; - int npargs; - int ncargs; - rvconventry *rvconv; - conventry *argconv[]; -{ - cdcobject *self; - int i; - - self = PyObject_NEW(cdcobject, &Cdctype); - if (self == NULL) - return NULL; - self->routine = routine; - Py_INCREF(routine); - self->npargs = npargs; - self->ncargs = ncargs; - self->rvconv = rvconv; - for(i=0; i<MAXARG; i++) - if ( i < ncargs ) - self->argconv[i] = argconv[i]; - else - self->argconv[i] = 0; - return self; -} - -static void -cdc_dealloc(self) - cdcobject *self; -{ - Py_XDECREF(self->routine); - PyObject_DEL(self); -} - - -static PyObject * -cdc_repr(self) - cdcobject *self; -{ - PyObject *s; - char buf[256]; - int i; - - sprintf(buf, "<callable %s = %s(", self->rvconv->name, self->routine->name); - for(i=0; i< self->ncargs; i++) { - strcat(buf, self->argconv[i]->name); - if ( i < self->ncargs-1 ) - strcat(buf, ", "); - } - strcat(buf, ") >"); - - s = PyString_FromString(buf); - return s; -} - -/* -** And this is what we all do it for: call a C function. -*/ -static PyObject * -cdc_call(self, args, kwargs) - cdcobject *self; - PyObject *args; - PyObject *kwargs; -{ - char buf[256]; - int i, pargindex; - anything c_args[MAXARG] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - anything c_rv; - conventry *cp; - PyObject *curarg; - anyroutine func; - PyObject *returnvalues[MAXARG+1]; - PyObject *rv; - - if( kwargs ) { - PyErr_SetString(PyExc_TypeError, "Keyword args not allowed"); - return 0; - } - if( !PyTuple_Check(args) ) { - PyErr_SetString(PyExc_TypeError, "Arguments not in tuple"); - return 0; - } - if( PyTuple_Size(args) != self->npargs ) { - sprintf(buf, "%d arguments, expected %d", PyTuple_Size(args), self->npargs); - PyErr_SetString(PyExc_TypeError, buf); - return 0; - } - - /* Decode arguments */ - pargindex = 0; - for(i=0; i<self->ncargs; i++) { - cp = self->argconv[i]; - if ( cp->get_uses_arg ) { - curarg = PyTuple_GET_ITEM(args, pargindex); - pargindex++; - } else { - curarg = (PyObject *)NULL; - } - c_args[i] = (*cp->get)(curarg); - } - if (PyErr_Occurred()) - return 0; - - /* Call function */ - func = self->routine->rtn; - c_rv = (*func)(c_args[0], c_args[1], c_args[2], c_args[3], - c_args[4], c_args[5], c_args[6], c_args[7], - c_args[8], c_args[9], c_args[10], c_args[11]); - - /* Decode return value, and store into returnvalues if needed */ - pargindex = 0; - curarg = (*self->rvconv->rtn)(c_rv); - if ( curarg ) - returnvalues[pargindex++] = curarg; - - /* Decode returnvalue parameters and cleanup any storage allocated */ - for(i=0; i<self->ncargs; i++) { - cp = self->argconv[i]; - curarg = (*cp->put)(c_args[i]); - if(curarg) - returnvalues[pargindex++] = curarg; - /* NOTE: We only check errors at the end (so we free() everything) */ - } - if ( PyErr_Occurred() ) { - /* An error did occur. Free the python objects created */ - for(i=0; i<pargindex; i++) - Py_XDECREF(returnvalues[i]); - return NULL; - } - - /* Zero and one return values cases are special: */ - if ( pargindex == 0 ) { - Py_INCREF(Py_None); - return Py_None; - } - if ( pargindex == 1 ) - return returnvalues[0]; - - /* More than one return value: put in a tuple */ - rv = PyTuple_New(pargindex); - for(i=0; i<pargindex; i++) - if(rv) - PyTuple_SET_ITEM(rv, i, returnvalues[i]); - else - Py_XDECREF(returnvalues[i]); - return rv; -} - -static char Cdctype__doc__[] = -"" -; - -static PyTypeObject Cdctype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "calldll.callable", /*tp_name*/ - sizeof(cdcobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdc_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)cdc_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)cdc_call, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Cdctype__doc__ /* Documentation string */ -}; - -/* End of code for callable objects */ -/* ---------------------------------------------------------------- */ - -static char cdf_keys__doc__[] = -"Return list of symbol names in fragment"; - -static PyObject * -cdf_keys(self, args) - cdfobject *self; - PyObject *args; -{ - long symcount; - PyObject *rv, *obj; - Str255 symname; - Ptr dummy1; - CFragSymbolClass dummy2; - int i; - OSErr err; - - if (!PyArg_ParseTuple(args, "")) - return NULL; - if ( (err=CountSymbols(self->conn_id, &symcount)) < 0 ) - return PyMac_Error(err); - if ( (rv=PyList_New(symcount)) == NULL ) - return NULL; - for (i=0; i<symcount; i++) { - if ((err=GetIndSymbol(self->conn_id, i, symname, &dummy1, &dummy2)) < 0 ) { - Py_XDECREF(rv); - return PyMac_Error(err); - } - if ((obj=PyString_FromStringAndSize((char *)symname+1, symname[0])) == NULL ) { - Py_XDECREF(rv); - return PyMac_Error(err); - } - if (PyList_SetItem(rv, i, obj) < 0 ) { - Py_XDECREF(rv); - return NULL; - } - } - return rv; -} - - -static struct PyMethodDef cdf_methods[] = { - {"keys", (PyCFunction)cdf_keys, METH_VARARGS, - cdf_keys__doc__}, - - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -static cdfobject * -newcdfobject(conn_id, name) - CFragConnectionID conn_id; - unsigned char *name; -{ - cdfobject *self; - int nlen; - - self = PyObject_NEW(cdfobject, &Cdftype); - if (self == NULL) - return NULL; - self->conn_id = conn_id; - if ( name[0] > MAXNAME ) - nlen = MAXNAME; - else - nlen = name[0]; - strncpy(self->name, (char *)name+1, nlen); - self->name[nlen] = '\0'; - return self; -} - -static void -cdf_dealloc(self) - cdfobject *self; -{ - PyObject_DEL(self); -} - -static PyObject * -cdf_repr(self) - cdfobject *self; -{ - PyObject *s; - char buf[256]; - - sprintf(buf, "<fragment %s connection, id 0x%x>", self->name, self->conn_id); - s = PyString_FromString(buf); - return s; -} - -static PyObject * -cdf_getattr_helper(self, name) - cdfobject *self; - char *name; -{ - unsigned char *rtn_name; - anyroutine rtn; - OSErr err; - Str255 errMessage; - CFragSymbolClass class; - char buf[256]; - - rtn_name = Pstring(name); - err = FindSymbol(self->conn_id, rtn_name, (Ptr *)&rtn, &class); - if ( err ) { - sprintf(buf, "%.*s: %s", rtn_name[0], rtn_name+1, PyMac_StrError(err)); - PyErr_SetString(ErrorObject, buf); - return NULL; - } - if( class != kTVectorCFragSymbol ) { - PyErr_SetString(ErrorObject, "Symbol is not a routine"); - return NULL; - } - - return (PyObject *)newcdrobject(rtn_name, rtn); -} - -static PyObject * -cdf_getattr(self, name) - cdfobject *self; - char *name; -{ - PyObject *rv; - - if ((rv=Py_FindMethod(cdf_methods, (PyObject *)self, name))) - return rv; - PyErr_Clear(); - return cdf_getattr_helper(self, name); -} - -/* -------------------------------------------------------- */ -/* Code to access cdf objects as mappings */ - -static int -cdf_length(self) - cdfobject *self; -{ - long symcount; - OSErr err; - - err = CountSymbols(self->conn_id, &symcount); - if ( err ) { - PyMac_Error(err); - return -1; - } - return symcount; -} - -static PyObject * -cdf_subscript(self, key) - cdfobject *self; - PyObject *key; -{ - char *name; - - if ((name=PyString_AsString(key)) == 0 ) - return 0; - return cdf_getattr_helper(self, name); -} - -static int -cdf_ass_sub(self, v, w) - cdfobject *self; - PyObject *v, *w; -{ - /* XXXX Put w in self under key v */ - return 0; -} - -static PyMappingMethods cdf_as_mapping = { - (inquiry)cdf_length, /*mp_length*/ - (binaryfunc)cdf_subscript, /*mp_subscript*/ - (objobjargproc)cdf_ass_sub, /*mp_ass_subscript*/ -}; - -/* -------------------------------------------------------- */ - -static char Cdftype__doc__[] = -"Code Fragment library symbol table" -; - -static PyTypeObject Cdftype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "calldll.fragment", /*tp_name*/ - sizeof(cdfobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)cdf_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)cdf_getattr, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)cdf_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - &cdf_as_mapping, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - - /* Space for future expansion */ - 0L,0L,0L,0L, - Cdftype__doc__ /* Documentation string */ -}; - -/* End of code for fragment objects */ -/* -------------------------------------------------------- */ - - -static char cdll_getlibrary__doc__[] = -"Load a shared library fragment and return the symbol table" -; - -static PyObject * -cdll_getlibrary(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - Str255 frag_name; - OSErr err; - Str255 errMessage; - Ptr main_addr; - CFragConnectionID conn_id; - char buf[256]; - - if (!PyArg_ParseTuple(args, "O&", PyMac_GetStr255, frag_name)) - return NULL; - - /* Find the library connection ID */ - err = GetSharedLibrary(frag_name, kCompiledCFragArch, kLoadCFrag, &conn_id, &main_addr, - errMessage); - if ( err ) { - sprintf(buf, "%.*s: %s", errMessage[0], errMessage+1, PyMac_StrError(err)); - PyErr_SetString(ErrorObject, buf); - return NULL; - } - return (PyObject *)newcdfobject(conn_id, frag_name); -} - -static char cdll_getdiskfragment__doc__[] = -"Load a fragment from a disk file and return the symbol table" -; - -static PyObject * -cdll_getdiskfragment(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - FSSpec fsspec; - Str255 frag_name; - OSErr err; - Str255 errMessage; - Ptr main_addr; - CFragConnectionID conn_id; - char buf[256]; - Boolean isfolder, didsomething; - - if (!PyArg_ParseTuple(args, "O&O&", PyMac_GetFSSpec, &fsspec, - PyMac_GetStr255, frag_name)) - return NULL; - err = ResolveAliasFile(&fsspec, 1, &isfolder, &didsomething); - if ( err ) - return PyErr_Mac(ErrorObject, err); - - /* Load the fragment (or return the connID if it is already loaded */ - err = GetDiskFragment(&fsspec, 0, 0, frag_name, - kLoadCFrag, &conn_id, &main_addr, - errMessage); - if ( err ) { - sprintf(buf, "%.*s: %s", errMessage[0], errMessage+1, PyMac_StrError(err)); - PyErr_SetString(ErrorObject, buf); - return NULL; - } - return (PyObject *)newcdfobject(conn_id, frag_name); -} - -static char cdll_newcall__doc__[] = -"" -; - -static PyObject * -cdll_newcall(self, args) - PyObject *self; /* Not used */ - PyObject *args; -{ - cdrobject *routine; - conventry *argconv[MAXARG] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - rv2py_converter rvconv; - int npargs, ncargs; - - /* Note: the next format depends on MAXARG */ - if (!PyArg_ParseTuple(args, "O!O&|O&O&O&O&O&O&O&O&O&O&O&O&", &Cdrtype, &routine, - argparse_rvconv, &rvconv, - argparse_conv, &argconv[0], argparse_conv, &argconv[1], - argparse_conv, &argconv[2], argparse_conv, &argconv[3], - argparse_conv, &argconv[4], argparse_conv, &argconv[5], - argparse_conv, &argconv[6], argparse_conv, &argconv[7], - argparse_conv, &argconv[8], argparse_conv, &argconv[9], - argparse_conv, &argconv[10], argparse_conv, &argconv[11])) - return NULL; - npargs = 0; - for(ncargs=0; ncargs < MAXARG && argconv[ncargs]; ncargs++) { - if( argconv[ncargs]->get_uses_arg ) npargs++; - } - return (PyObject *)newcdcobject(routine, npargs, ncargs, rvconv, argconv); -} - -/* List of methods defined in the module */ - -static struct PyMethodDef cdll_methods[] = { - {"getlibrary", (PyCFunction)cdll_getlibrary, METH_VARARGS, - cdll_getlibrary__doc__}, - {"getdiskfragment", (PyCFunction)cdll_getdiskfragment, METH_VARARGS, - cdll_getdiskfragment__doc__}, - {"newcall", (PyCFunction)cdll_newcall, METH_VARARGS, - cdll_newcall__doc__}, - - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called initcalldll) */ - -static char calldll_module_documentation[] = -"" -; - -void -initcalldll() -{ - PyObject *m, *d; - - /* Create the module and add the functions */ - m = Py_InitModule4("calldll", cdll_methods, - calldll_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("calldll.error"); - PyDict_SetItemString(d, "error", ErrorObject); - - /* XXXX Add constants here */ - - /* Check for errors */ - if (PyErr_Occurred()) - Py_FatalError("can't initialize module calldll"); -} - -#ifdef TESTSUPPORT - -/* Test routine */ -int cdll_b_bbbbbbbb(char a1,char a2,char a3,char a4,char a5,char a6,char a7,char a8) -{ - return a1+a2+a3+a4+a5+a6+a7+a8; -} - -short cdll_h_hhhhhhhh(short a1,short a2,short a3,short a4,short a5,short a6,short a7,short a8) -{ - return a1+a2+a3+a4+a5+a6+a7+a8; -} - -int cdll_l_llllllll(int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8) -{ - return a1+a2+a3+a4+a5+a6+a7+a8; -} - -void cdll_N_ssssssss(char *a1,char *a2,char *a3,char *a4,char *a5,char *a6,char *a7,char *a8) -{ - printf("cdll_N_ssssssss args: %s %s %s %s %s %s %s %s\n", a1, a2, a3, a4, - a5, a6, a7, a8); -} - -OSErr cdll_o_l(long l) -{ - return (OSErr)l; -} - -void cdll_N_pp(unsigned char *in, unsigned char *out) -{ - out[0] = in[0] + 5; - strcpy((char *)out+1, "Was: "); - memcpy(out+6, in+1, in[0]); -} - -void cdll_N_bb(char a1, char *a2) -{ - *a2 = a1; -} - -void cdll_N_hh(short a1, short *a2) -{ - *a2 = a1; -} - -void cdll_N_ll(long a1, long *a2) -{ - *a2 = a1; -} - -void cdll_N_sH(char *a1, Handle a2) -{ - int len; - - len = strlen(a1); - SetHandleSize(a2, len); - HLock(a2); - memcpy(*a2, a1, len); - HUnlock(a2); -} -#endif diff --git a/Mac/Modules/htmlrender/HtmlRendermodule.c b/Mac/Modules/htmlrender/HtmlRendermodule.c deleted file mode 100644 index 08df21f..0000000 --- a/Mac/Modules/htmlrender/HtmlRendermodule.c +++ /dev/null @@ -1,818 +0,0 @@ - -/* ======================= Module HtmlRender ======================== */ - -#include "Python.h" - - - -#define SystemSevenOrLater 1 - -#include "macglue.h" -#include <Memory.h> -#include <Dialogs.h> -#include <Menus.h> -#include <Controls.h> - -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyTypeObject Window_Type; -#define WinObj_Check(x) ((x)->ob_type == &Window_Type) - -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyTypeObject Dialog_Type; -#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) - -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); - -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); - -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); - -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); - -extern PyObject *WinObj_WhichWindow(WindowPtr); - -#include <HTMLRendering.h> - -static PyObject *Html_Error; - -/* --------------------- Object type HtmlObject --------------------- */ - -PyTypeObject HtmlObject_Type; - -#define HtmlObj_Check(x) ((x)->ob_type == &HtmlObject_Type) - -typedef struct HtmlObjectObject { - PyObject_HEAD - HRReference ob_itself; -} HtmlObjectObject; - -PyObject *HtmlObj_New(itself) - HRReference itself; -{ - HtmlObjectObject *it; - it = PyObject_NEW(HtmlObjectObject, &HtmlObject_Type); - if (it == NULL) return NULL; - it->ob_itself = itself; - return (PyObject *)it; -} -HtmlObj_Convert(v, p_itself) - PyObject *v; - HRReference *p_itself; -{ - if (!HtmlObj_Check(v)) - { - PyErr_SetString(PyExc_TypeError, "HtmlObject required"); - return 0; - } - *p_itself = ((HtmlObjectObject *)v)->ob_itself; - return 1; -} - -static void HtmlObj_dealloc(self) - HtmlObjectObject *self; -{ - /* Cleanup of self->ob_itself goes here */ - PyObject_DEL(self); -} - -static PyObject *HtmlObj_HRDisposeReference(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRDisposeReference(_self->ob_itself); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRSetGrafPtr(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - GrafPtr grafPtr; - if (!PyArg_ParseTuple(_args, "O&", - GrafObj_Convert, &grafPtr)) - return NULL; - _err = HRSetGrafPtr(_self->ob_itself, - grafPtr); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRActivate(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRActivate(_self->ob_itself); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRDeactivate(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRDeactivate(_self->ob_itself); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRDraw(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - RgnHandle updateRgnH; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &updateRgnH)) - return NULL; - _err = HRDraw(_self->ob_itself, - updateRgnH); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRSetRenderingRect(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Rect renderingRect; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetRect, &renderingRect)) - return NULL; - _err = HRSetRenderingRect(_self->ob_itself, - &renderingRect); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGetRenderedImageSize(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Point renderingSize; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRGetRenderedImageSize(_self->ob_itself, - &renderingSize); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildPoint, renderingSize); - return _res; -} - -static PyObject *HtmlObj_HRScrollToLocation(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Point location; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRScrollToLocation(_self->ob_itself, - &location); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildPoint, location); - return _res; -} - -static PyObject *HtmlObj_HRForceQuickdraw(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Boolean forceQuickdraw; - if (!PyArg_ParseTuple(_args, "b", - &forceQuickdraw)) - return NULL; - _err = HRForceQuickdraw(_self->ob_itself, - forceQuickdraw); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRSetScrollbarState(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - HRScrollbarState hScrollbarState; - HRScrollbarState vScrollbarState; - if (!PyArg_ParseTuple(_args, "hh", - &hScrollbarState, - &vScrollbarState)) - return NULL; - _err = HRSetScrollbarState(_self->ob_itself, - hScrollbarState, - vScrollbarState); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRSetDrawBorder(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Boolean drawBorder; - if (!PyArg_ParseTuple(_args, "b", - &drawBorder)) - return NULL; - _err = HRSetDrawBorder(_self->ob_itself, - drawBorder); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRSetGrowboxCutout(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Boolean allowCutout; - if (!PyArg_ParseTuple(_args, "b", - &allowCutout)) - return NULL; - _err = HRSetGrowboxCutout(_self->ob_itself, - allowCutout); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGoToFile(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - FSSpec fsspec; - Boolean addToHistory; - Boolean forceRefresh; - if (!PyArg_ParseTuple(_args, "O&bb", - PyMac_GetFSSpec, &fsspec, - &addToHistory, - &forceRefresh)) - return NULL; - _err = HRGoToFile(_self->ob_itself, - &fsspec, - addToHistory, - forceRefresh); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGoToURL(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - char * url; - Boolean addToHistory; - Boolean forceRefresh; - if (!PyArg_ParseTuple(_args, "sbb", - &url, - &addToHistory, - &forceRefresh)) - return NULL; - _err = HRGoToURL(_self->ob_itself, - url, - addToHistory, - forceRefresh); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGoToAnchor(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - char * anchorName; - if (!PyArg_ParseTuple(_args, "s", - &anchorName)) - return NULL; - _err = HRGoToAnchor(_self->ob_itself, - anchorName); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGoToPtr(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - char *buffer__in__; - long buffer__len__; - int buffer__in_len__; - Boolean addToHistory; - Boolean forceRefresh; - if (!PyArg_ParseTuple(_args, "s#bb", - &buffer__in__, &buffer__in_len__, - &addToHistory, - &forceRefresh)) - return NULL; - buffer__len__ = buffer__in_len__; - _err = HRGoToPtr(_self->ob_itself, - buffer__in__, buffer__len__, - addToHistory, - forceRefresh); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - buffer__error__: ; - return _res; -} - -static PyObject *HtmlObj_HRGetRootURL(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Handle rootURLH; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &rootURLH)) - return NULL; - _err = HRGetRootURL(_self->ob_itself, - rootURLH); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGetBaseURL(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Handle baseURLH; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &baseURLH)) - return NULL; - _err = HRGetBaseURL(_self->ob_itself, - baseURLH); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGetHTMLURL(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - Handle HTMLURLH; - if (!PyArg_ParseTuple(_args, "O&", - ResObj_Convert, &HTMLURLH)) - return NULL; - _err = HRGetHTMLURL(_self->ob_itself, - HTMLURLH); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGetTitle(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - StringPtr title; - if (!PyArg_ParseTuple(_args, "s", - &title)) - return NULL; - _err = HRGetTitle(_self->ob_itself, - title); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRGetHTMLFile(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - FSSpec fsspec; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRGetHTMLFile(_self->ob_itself, - &fsspec); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildFSSpec, fsspec); - return _res; -} - -static PyObject *HtmlObj_HRUnregisterWasURLVisitedUPP(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - HRUnregisterWasURLVisitedUPP(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRUnregisterNewURLUPP(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - HRUnregisterNewURLUPP(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *HtmlObj_HRUnregisterURLToFSSpecUPP(_self, _args) - HtmlObjectObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - HRUnregisterURLToFSSpecUPP(_self->ob_itself); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyMethodDef HtmlObj_methods[] = { - {"HRDisposeReference", (PyCFunction)HtmlObj_HRDisposeReference, 1, - "() -> None"}, - {"HRSetGrafPtr", (PyCFunction)HtmlObj_HRSetGrafPtr, 1, - "(GrafPtr grafPtr) -> None"}, - {"HRActivate", (PyCFunction)HtmlObj_HRActivate, 1, - "() -> None"}, - {"HRDeactivate", (PyCFunction)HtmlObj_HRDeactivate, 1, - "() -> None"}, - {"HRDraw", (PyCFunction)HtmlObj_HRDraw, 1, - "(RgnHandle updateRgnH) -> None"}, - {"HRSetRenderingRect", (PyCFunction)HtmlObj_HRSetRenderingRect, 1, - "(Rect renderingRect) -> None"}, - {"HRGetRenderedImageSize", (PyCFunction)HtmlObj_HRGetRenderedImageSize, 1, - "() -> (Point renderingSize)"}, - {"HRScrollToLocation", (PyCFunction)HtmlObj_HRScrollToLocation, 1, - "() -> (Point location)"}, - {"HRForceQuickdraw", (PyCFunction)HtmlObj_HRForceQuickdraw, 1, - "(Boolean forceQuickdraw) -> None"}, - {"HRSetScrollbarState", (PyCFunction)HtmlObj_HRSetScrollbarState, 1, - "(HRScrollbarState hScrollbarState, HRScrollbarState vScrollbarState) -> None"}, - {"HRSetDrawBorder", (PyCFunction)HtmlObj_HRSetDrawBorder, 1, - "(Boolean drawBorder) -> None"}, - {"HRSetGrowboxCutout", (PyCFunction)HtmlObj_HRSetGrowboxCutout, 1, - "(Boolean allowCutout) -> None"}, - {"HRGoToFile", (PyCFunction)HtmlObj_HRGoToFile, 1, - "(FSSpec fsspec, Boolean addToHistory, Boolean forceRefresh) -> None"}, - {"HRGoToURL", (PyCFunction)HtmlObj_HRGoToURL, 1, - "(char * url, Boolean addToHistory, Boolean forceRefresh) -> None"}, - {"HRGoToAnchor", (PyCFunction)HtmlObj_HRGoToAnchor, 1, - "(char * anchorName) -> None"}, - {"HRGoToPtr", (PyCFunction)HtmlObj_HRGoToPtr, 1, - "(Buffer buffer, Boolean addToHistory, Boolean forceRefresh) -> None"}, - {"HRGetRootURL", (PyCFunction)HtmlObj_HRGetRootURL, 1, - "(Handle rootURLH) -> None"}, - {"HRGetBaseURL", (PyCFunction)HtmlObj_HRGetBaseURL, 1, - "(Handle baseURLH) -> None"}, - {"HRGetHTMLURL", (PyCFunction)HtmlObj_HRGetHTMLURL, 1, - "(Handle HTMLURLH) -> None"}, - {"HRGetTitle", (PyCFunction)HtmlObj_HRGetTitle, 1, - "(StringPtr title) -> None"}, - {"HRGetHTMLFile", (PyCFunction)HtmlObj_HRGetHTMLFile, 1, - "() -> (FSSpec fsspec)"}, - {"HRUnregisterWasURLVisitedUPP", (PyCFunction)HtmlObj_HRUnregisterWasURLVisitedUPP, 1, - "() -> None"}, - {"HRUnregisterNewURLUPP", (PyCFunction)HtmlObj_HRUnregisterNewURLUPP, 1, - "() -> None"}, - {"HRUnregisterURLToFSSpecUPP", (PyCFunction)HtmlObj_HRUnregisterURLToFSSpecUPP, 1, - "() -> None"}, - {NULL, NULL, 0} -}; - -PyMethodChain HtmlObj_chain = { HtmlObj_methods, NULL }; - -static PyObject *HtmlObj_getattr(self, name) - HtmlObjectObject *self; - char *name; -{ - return Py_FindMethodInChain(&HtmlObj_chain, (PyObject *)self, name); -} - -#define HtmlObj_setattr NULL - -#define HtmlObj_compare NULL - -#define HtmlObj_repr NULL - -#define HtmlObj_hash NULL - -PyTypeObject HtmlObject_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "HtmlRender.HtmlObject", /*tp_name*/ - sizeof(HtmlObjectObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor) HtmlObj_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc) HtmlObj_getattr, /*tp_getattr*/ - (setattrfunc) HtmlObj_setattr, /*tp_setattr*/ - (cmpfunc) HtmlObj_compare, /*tp_compare*/ - (reprfunc) HtmlObj_repr, /*tp_repr*/ - (PyNumberMethods *)0, /* tp_as_number */ - (PySequenceMethods *)0, /* tp_as_sequence */ - (PyMappingMethods *)0, /* tp_as_mapping */ - (hashfunc) HtmlObj_hash, /*tp_hash*/ -}; - -/* ------------------- End object type HtmlObject ------------------- */ - - -static PyObject *Html_HRGetHTMLRenderingLibVersion(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - NumVersion returnVers; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = HRGetHTMLRenderingLibVersion(&returnVers); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildNumVersion, returnVers); - return _res; -} - -static PyObject *Html_HRNewReference(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - HRReference hrRef; - OSType rendererType; - GrafPtr grafPtr; - if (!PyArg_ParseTuple(_args, "O&O&", - PyMac_GetOSType, &rendererType, - GrafObj_Convert, &grafPtr)) - return NULL; - _err = HRNewReference(&hrRef, - rendererType, - grafPtr); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - HtmlObj_New, hrRef); - return _res; -} - -static PyObject *Html_HRFreeMemory(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - SInt32 _rv; - Size inBytesNeeded; - if (!PyArg_ParseTuple(_args, "l", - &inBytesNeeded)) - return NULL; - _rv = HRFreeMemory(inBytesNeeded); - _res = Py_BuildValue("l", - _rv); - return _res; -} - -static PyObject *Html_HRScreenConfigurationChanged(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - HRScreenConfigurationChanged(); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Html_HRIsHREvent(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - Boolean _rv; - EventRecord eventRecord; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetEventRecord, &eventRecord)) - return NULL; - _rv = HRIsHREvent(&eventRecord); - _res = Py_BuildValue("b", - _rv); - return _res; -} - -static PyObject *Html_HRUtilCreateFullURL(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - char * rootURL; - char * linkURL; - Handle fullURLH; - if (!PyArg_ParseTuple(_args, "ssO&", - &rootURL, - &linkURL, - ResObj_Convert, &fullURLH)) - return NULL; - _err = HRUtilCreateFullURL(rootURL, - linkURL, - fullURLH); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Html_HRUtilGetFSSpecFromURL(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - char * rootURL; - char * linkURL; - FSSpec destSpec; - if (!PyArg_ParseTuple(_args, "ss", - &rootURL, - &linkURL)) - return NULL; - _err = HRUtilGetFSSpecFromURL(rootURL, - linkURL, - &destSpec); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - PyMac_BuildFSSpec, destSpec); - return _res; -} - -static PyObject *Html_HRUtilGetURLFromFSSpec(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSStatus _err; - FSSpec fsspec; - Handle urlHandle; - if (!PyArg_ParseTuple(_args, "O&O&", - PyMac_GetFSSpec, &fsspec, - ResObj_Convert, &urlHandle)) - return NULL; - _err = HRUtilGetURLFromFSSpec(&fsspec, - urlHandle); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *Html_HRHTMLRenderingLibAvailable(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - int _rv; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _rv = HRHTMLRenderingLibAvailable(); - _res = Py_BuildValue("i", - _rv); - return _res; -} - -static PyMethodDef Html_methods[] = { - {"HRGetHTMLRenderingLibVersion", (PyCFunction)Html_HRGetHTMLRenderingLibVersion, 1, - "() -> (NumVersion returnVers)"}, - {"HRNewReference", (PyCFunction)Html_HRNewReference, 1, - "(OSType rendererType, GrafPtr grafPtr) -> (HRReference hrRef)"}, - {"HRFreeMemory", (PyCFunction)Html_HRFreeMemory, 1, - "(Size inBytesNeeded) -> (SInt32 _rv)"}, - {"HRScreenConfigurationChanged", (PyCFunction)Html_HRScreenConfigurationChanged, 1, - "() -> None"}, - {"HRIsHREvent", (PyCFunction)Html_HRIsHREvent, 1, - "(EventRecord eventRecord) -> (Boolean _rv)"}, - {"HRUtilCreateFullURL", (PyCFunction)Html_HRUtilCreateFullURL, 1, - "(char * rootURL, char * linkURL, Handle fullURLH) -> None"}, - {"HRUtilGetFSSpecFromURL", (PyCFunction)Html_HRUtilGetFSSpecFromURL, 1, - "(char * rootURL, char * linkURL) -> (FSSpec destSpec)"}, - {"HRUtilGetURLFromFSSpec", (PyCFunction)Html_HRUtilGetURLFromFSSpec, 1, - "(FSSpec fsspec, Handle urlHandle) -> None"}, - {"HRHTMLRenderingLibAvailable", (PyCFunction)Html_HRHTMLRenderingLibAvailable, 1, - "() -> (int _rv)"}, - {NULL, NULL, 0} -}; - - - - -void initHtmlRender() -{ - PyObject *m; - PyObject *d; - - - - - m = Py_InitModule("HtmlRender", Html_methods); - d = PyModule_GetDict(m); - Html_Error = PyMac_GetOSErrException(); - if (Html_Error == NULL || - PyDict_SetItemString(d, "Error", Html_Error) != 0) - Py_FatalError("can't initialize HtmlRender.Error"); - HtmlObject_Type.ob_type = &PyType_Type; - Py_INCREF(&HtmlObject_Type); - if (PyDict_SetItemString(d, "HtmlObjectType", (PyObject *)&HtmlObject_Type) != 0) - Py_FatalError("can't initialize HtmlObjectType"); -} - -/* ===================== End module HtmlRender ====================== */ - diff --git a/Mac/Modules/htmlrender/htmlscan.py b/Mac/Modules/htmlrender/htmlscan.py deleted file mode 100644 index 81f107c..0000000 --- a/Mac/Modules/htmlrender/htmlscan.py +++ /dev/null @@ -1,63 +0,0 @@ -# Scan an Apple header file, generating a Python file of generator calls. - -import sys -import os -from bgenlocations import TOOLBOXDIR, BGENDIR -sys.path.append(BGENDIR) - -from scantools import Scanner - -LONG = "HtmlRendering" -SHORT = "html" -OBJECT = "HRReference" - -def main(): -## input = LONG + ".h" - input = "Macintosh HD:ufs:jack:SWdev:Universal:Interfaces:CIncludes:HTMLRendering.h" - output = SHORT + "gen.py" - defsoutput = TOOLBOXDIR + LONG + ".py" - scanner = MyScanner(input, output, defsoutput) - scanner.scan() - scanner.close() - print "=== Testing definitions output code ===" - execfile(defsoutput, {}, {}) - print "=== Done scanning and generating, now importing the generated code... ===" - exec "import " + SHORT + "support" - print "=== Done. It's up to you to compile it now! ===" - -class MyScanner(Scanner): - - def destination(self, type, name, arglist): - classname = "Function" - listname = "functions" - if arglist: - t, n, m = arglist[0] - if t == OBJECT and m == "InMode": - classname = "Method" - listname = "methods" - return classname, listname - - def makeblacklistnames(self): - return [ - "HRDisposeReference", - ] - - def makeblacklisttypes(self): - return [ - "HRNewURLUPP", - "HRURLToFSSpecUPP", - "HRWasURLVisitedUPP", - ] - - def makerepairinstructions(self): - return [ - ([('char', '*', 'OutMode'), ('UInt32', '*', 'InMode')], - [('InBuffer', '*', 'InMode')]), - ] - - def writeinitialdefs(self): - self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") - - -if __name__ == "__main__": - main() diff --git a/Mac/Modules/htmlrender/htmlsupport.py b/Mac/Modules/htmlrender/htmlsupport.py deleted file mode 100644 index e769018..0000000 --- a/Mac/Modules/htmlrender/htmlsupport.py +++ /dev/null @@ -1,213 +0,0 @@ -# This script generates the Dialogs interface for Python. -# It uses the "bgen" package to generate C code. -# It execs the file dlggen.py which contain the function definitions -# (dlggen.py was generated by dlgscan.py, scanning the <Dialogs.h> header file). - -from macsupport import * - -# Create the type objects - -HRReference = OpaqueByValueType("HRReference", "HtmlObj") - -HRScrollbarState = Type("HRScrollbarState", "h") -URLSourceType = Type("URLSourceType", "H") -GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj") -RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") -char_ptr = Type("char *", "s") -StringPtr = Type("StringPtr", "s") - -### An OptHandle is either a handle or None (in case NULL is passed in). -### This is needed for GetDialogItem(). -##OptHandle = OpaqueByValueType("Handle", "OptResObj") -## -##ModalFilterProcPtr = InputOnlyType("PyObject*", "O") -##ModalFilterProcPtr.passInput = lambda name: "NewModalFilterProc(Dlg_PassFilterProc(%s))" % name -##ModalFilterUPP = ModalFilterProcPtr -## -## -##DITLMethod = Type("DITLMethod", "h") -##DialogItemIndex = Type("DialogItemIndex", "h") -##DialogItemType = Type("DialogItemType", "h") -##DialogItemIndexZeroBased = Type("DialogItemIndexZeroBased", "h") -##AlertType = Type("AlertType", "h") -##StringPtr = Str255 -##EventMask = Type("EventMask", "h") -## -includestuff = includestuff + """ -#include <HTMLRendering.h> -""" -## -###ifndef HAVE_UNIVERSAL_HEADERS -###define NewModalFilterProc(x) (x) -###endif -## -###define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */ -## -##/* XXX Shouldn't this be a stack? */ -##static PyObject *Dlg_FilterProc_callback = NULL; -## -##static PyObject *DlgObj_New(DialogPtr); /* Forward */ -## -##static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, -## EventRecord *event, -## short *itemHit) -##{ -## Boolean rv; -## PyObject *args, *res; -## PyObject *callback = Dlg_FilterProc_callback; -## if (callback == NULL) -## return 0; /* Default behavior */ -## Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ -## args = Py_BuildValue("O&O&", WinObj_WhichWindow, dialog, PyMac_BuildEventRecord, event); -## if (args == NULL) -## res = NULL; -## else { -## res = PyEval_CallObject(callback, args); -## Py_DECREF(args); -## } -## if (res == NULL) { -## PySys_WriteStderr("Exception in Dialog Filter\\n"); -## PyErr_Print(); -## *itemHit = -1; /* Fake return item */ -## return 1; /* We handled it */ -## } -## else { -## Dlg_FilterProc_callback = callback; -## if (PyInt_Check(res)) { -## *itemHit = PyInt_AsLong(res); -## rv = 1; -## } -## else -## rv = PyObject_IsTrue(res); -## } -## Py_DECREF(res); -## return rv; -##} -## -##static ModalFilterProcPtr -##Dlg_PassFilterProc(PyObject *callback) -##{ -## PyObject *tmp = Dlg_FilterProc_callback; -## Dlg_FilterProc_callback = NULL; -## if (callback == Py_None) { -## Py_XDECREF(tmp); -## return NULL; -## } -## Py_INCREF(callback); -## Dlg_FilterProc_callback = callback; -## Py_XDECREF(tmp); -## return &Dlg_UnivFilterProc; -##} -## -##static PyObject *Dlg_UserItemProc_callback = NULL; -## -##static pascal void Dlg_UnivUserItemProc(DialogPtr dialog, -## short item) -##{ -## PyObject *args, *res; -## -## if (Dlg_UserItemProc_callback == NULL) -## return; /* Default behavior */ -## Dlg_FilterProc_callback = NULL; /* We'll restore it when call successful */ -## args = Py_BuildValue("O&h", WinObj_WhichWindow, dialog, item); -## if (args == NULL) -## res = NULL; -## else { -## res = PyEval_CallObject(Dlg_UserItemProc_callback, args); -## Py_DECREF(args); -## } -## if (res == NULL) { -## PySys_WriteStderr("Exception in Dialog UserItem proc\\n"); -## PyErr_Print(); -## } -## Py_XDECREF(res); -## return; -##} -## -##extern PyMethodChain WinObj_chain; -##""" -## - -# Define a class which specializes our object definition -class MyObjectDefinition(GlobalObjectDefinition): - pass -## def __init__(self, name, prefix = None, itselftype = None): -## GlobalObjectDefinition.__init__(self, name, prefix, itselftype) -## self.basechain = "&WinObj_chain" -## def outputInitStructMembers(self): -## GlobalObjectDefinition.outputInitStructMembers(self) -## Output("SetWRefCon(itself, (long)it);") -## def outputCheckNewArg(self): -## Output("if (itself == NULL) return Py_None;") -## def outputCheckConvertArg(self): -## Output("if (v == Py_None) { *p_itself = NULL; return 1; }") -## Output("if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);") -## Output(" return 1; }") - def outputFreeIt(self, itselfname): - Output("HRDisposeReference(%s);", itselfname) - -# Create the generator groups and link them -module = MacModule('HtmlRender', 'Html', includestuff, finalstuff, initstuff) -object = MyObjectDefinition('HtmlObject', 'HtmlObj', 'HRReference') -module.addobject(object) - -# Create the generator classes used to populate the lists -Function = OSErrFunctionGenerator -Method = OSErrMethodGenerator - -# Create and populate the lists -functions = [] -methods = [] -execfile("htmlgen.py") - -f = Function(int, 'HRHTMLRenderingLibAvailable') -functions.append(f) - -# add the populated lists to the generator groups -for f in functions: module.add(f) -for f in methods: object.add(f) - -### Some methods that are currently macro's in C, but will be real routines -### in MacOS 8. -## -##f = Method(ExistingDialogPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode)) -##object.add(f) -##f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode)) -##object.add(f) -##f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode)) -##object.add(f) -##f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode)) -##object.add(f) -##f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode)) -##object.add(f) -## -##setuseritembody = """ -## PyObject *new = NULL; -## -## -## if (!PyArg_ParseTuple(_args, "|O", &new)) -## return NULL; -## -## if (Dlg_UserItemProc_callback && new && new != Py_None) { -## PyErr_SetString(Dlg_Error, "Another UserItemProc is already installed"); -## return NULL; -## } -## -## if (new == Py_None) { -## new = NULL; -## _res = Py_None; -## Py_INCREF(Py_None); -## } else { -## Py_INCREF(new); -## _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemProc(Dlg_UnivUserItemProc)); -## } -## -## Dlg_UserItemProc_callback = new; -## return _res; -##""" -##f = ManualGenerator("SetUserItemHandler", setuseritembody) -##module.add(f) - -# generate output -SetOutputFileName('HtmlRendermodule.c') -module.generate() diff --git a/Mac/Modules/macconfig.c b/Mac/Modules/macconfig.c deleted file mode 100644 index 7a6d3d9..0000000 --- a/Mac/Modules/macconfig.c +++ /dev/null @@ -1,322 +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. - -******************************************************************/ - -/* Macintosh Python configuration file */ - -#include "Python.h" -/* Table of built-in modules. - These are initialized when first imported. - Note: selection of optional extensions is now generally done by the - makesetup script. */ - -extern void initarray(); -extern void initmath(); -#ifndef WITHOUT_COMPLEX -extern void initcmath(); -#endif -extern void initparser(); -extern void initmac(); -extern void initMacOS(); -extern void initregex(); -extern void initstrop(); -extern void initstruct(); -extern void inittime(); -extern void initdbm(); -extern void initfcntl(); -extern void initnis(); -extern void initpwd(); -extern void initgrp(); -extern void initcrypt(); -extern void initselect(); -extern void init_socket(); -extern void initaudioop(); -extern void initimageop(); -extern void initrgbimg(); -extern void initmd5(); -extern void initmpz(); -extern void initrotor(); -extern void inital(); -extern void initcd(); -extern void initcl(); -extern void initfm(); -extern void initgl(); -extern void initimgfile(); -extern void initimgformat(); -extern void initsgi(); -extern void initsv(); -extern void initfl(); -extern void initthread(); -extern void inittiming(); -extern void initsignal(); -extern void initdl(); -extern void initsyslog(); -extern void initgestalt(); -extern void initbinascii(); -extern void initoperator(); -extern void initerrno(); -extern void initpcre(); -extern void initunicodedata(); -extern void init_codecs(); -extern void initNav(); -extern void inithfsplus(); -#ifdef USE_MACCTB -extern void initctb(); -#endif -#ifdef USE_MACSPEECH -extern void initmacspeech(); -#endif -#ifdef USE_IC -extern void initicglue(); -#endif -#ifdef USE_TOOLBOX -#ifndef USE_CORE_TOOLBOX -#define USE_CORE_TOOLBOX -#endif -extern void init_AH(); -extern void init_App(); -extern void init_Fm(); -extern void init_Help(); -extern void init_IBCarbon(); -extern void init_Icn(); -extern void init_List(); -extern void init_Mlte(); -extern void init_Qdoffs(); -extern void init_Snd(); -extern void init_Sndihooks(); -extern void init_Scrap(); -extern void init_TE(); -extern void initColorPicker(); -extern void initPrinting(); -extern void init_CF(); -#endif -#ifdef USE_CORE_TOOLBOX -extern void init_AE(); -extern void init_Ctl(); -extern void init_Dlg(); -extern void init_Drag(); -extern void init_Evt(); -extern void init_File(); -extern void init_Folder(); -extern void init_Menu(); -extern void init_Qd(); -extern void init_Res(); -extern void init_Win(); -#endif -#ifdef USE_QT -extern void init_Cm(); -extern void init_Qt(); -#endif - -#ifdef USE_IMG -extern void initimgcolormap(); -extern void initimgformat(); -extern void initimggif(); -extern void initimgjpeg(); -extern void initimgpbm(); -extern void initimgppm(); -extern void initimgpgm(); -extern void initimgtiff(); -extern void initimgsgi(); -extern void initimgpng(); -extern void initimgop(); -#endif -#ifdef USE_TK -extern void init_tkinter(); -#endif -#ifdef USE_GUSI -extern void init_socket(); -extern void initselect(); -#endif -#ifdef USE_WASTE -extern void initwaste(); -#endif -#ifdef USE_GDBM -extern void initgdbm(); -#endif -#ifdef USE_ZLIB -extern void initzlib(); -#endif -#ifdef WITH_THREAD -extern void initthread(); -#endif -#ifdef WITH_HOTSHOT -extern void init_hotshot(); -#endif -#ifdef USE_PYEXPAT -extern void initpyexpat(); -#endif -extern void initgc(); -extern void init_random(); - -extern void initcPickle(); -extern void initcStringIO(); -extern void init_codecs(); -extern void initsha(); -extern void init_locale(); -extern void init_sre(); -extern void initxreadlines(); -extern void initzipimport(); -extern void inititertools(); -/* -- ADDMODULE MARKER 1 -- */ - -extern void PyMarshal_Init(); -extern void initimp(); - -struct _inittab _PyImport_Inittab[] = { - - {"array", initarray}, - {"math", initmath}, -#ifndef WITHOUT_COMPLEX - {"cmath", initcmath}, -#endif - {"parser", initparser}, - {"mac", initmac}, - {"MacOS", initMacOS}, - {"regex", initregex}, - {"strop", initstrop}, - {"struct", initstruct}, - {"time", inittime}, - {"audioop", initaudioop}, - {"imageop", initimageop}, - {"rgbimg", initrgbimg}, - {"md5", initmd5}, - {"rotor", initrotor}, - {"gestalt", initgestalt}, - {"binascii", initbinascii}, - {"operator", initoperator}, - {"errno", initerrno}, - {"pcre", initpcre}, - {"unicodedata", initunicodedata}, - {"_codecs", init_codecs}, - {"sha", initsha}, - {"Nav", initNav}, -#ifdef USE_MACCTB - {"ctb", initctb}, -#endif -/* This could probably be made to work on other compilers... */ -#ifdef USE_MACSPEECH - {"macspeech", initmacspeech}, -#endif -#ifdef USE_IC - {"icglue", initicglue}, -#endif -#ifdef USE_CORE_TOOLBOX - {"_AE", init_AE}, - {"_Ctl", init_Ctl}, - {"_Dlg", init_Dlg}, - {"_Drag", init_Drag}, - {"_Evt", init_Evt}, - {"_File", init_File}, - {"_Folder", init_Folder}, - {"_Menu", init_Menu}, - {"_Qd", init_Qd}, - {"_Win", init_Win}, - {"_Res", init_Res}, -#endif -#ifdef USE_TOOLBOX - {"_AH", init_AH}, - {"_App", init_App}, - {"_Fm", init_Fm}, - {"_IBCarbon", init_IBCarbon}, - {"_Icn", init_Icn}, - {"_List", init_List}, - {"_Mlte", init_Mlte}, - {"_Qdoffs", init_Qdoffs}, - {"_Snd", init_Snd}, - {"_Sndihooks", init_Sndihooks}, - /* Carbon scrap manager is completely different */ - {"_Scrap", init_Scrap}, - {"_TE", init_TE}, - {"ColorPicker", initColorPicker}, - {"_CF", init_CF}, - {"hfsplus", inithfsplus}, -#endif /* USE_TOOLBOX */ -#ifdef USE_QT - {"_Cm", init_Cm}, - {"_Qt", init_Qt}, -#endif -#ifdef USE_IMG - {"imgcolormap", initimgcolormap}, - {"imgformat", initimgformat}, - {"imggif", initimggif}, - {"imgjpeg", initimgjpeg}, - {"imgpbm", initimgpbm}, - {"imgppm", initimgppm}, - {"imgpgm", initimgpgm}, - {"imgtiff", initimgtiff}, - {"imgsgi", initimgsgi}, - {"imgpng", initimgpng}, - {"imgop", initimgop}, -#endif -#ifdef USE_TK - {"_tkinter", init_tkinter}, -#endif -#ifdef USE_GUSI - {"_socket", init_socket}, - {"select", initselect}, -#endif -#ifdef USE_WASTE - {"waste", initwaste}, -#endif -#ifdef USE_GDBM - {"gdbm", initgdbm}, -#endif /* USE_GDBM */ -#ifdef USE_ZLIB - {"zlib", initzlib}, -#endif -#ifdef WITH_THREAD - {"thread", initthread}, -#endif -#ifdef WITH_HOTSHOT - {"_hotshot", init_hotshot}, -#endif -#ifdef USE_PYEXPAT - {"pyexpat", initpyexpat}, -#endif - {"gc", initgc}, - {"_random", init_random}, - {"cPickle", initcPickle}, - {"cStringIO", initcStringIO}, - {"_locale", init_locale}, - {"_sre", init_sre}, - {"xreadlines", initxreadlines}, - {"zipimport", initzipimport}, - {"itertools", inititertools}, -/* -- ADDMODULE MARKER 2 -- */ - - /* This module "lives in" with marshal.c */ - {"marshal", PyMarshal_Init}, - - /* This module "lives in" with import.c */ - {"imp", initimp}, - - /* These entries are here for sys.builtin_module_names */ - {"__main__", NULL}, - {"__builtin__", NULL}, - {"exceptions", NULL}, - {"sys", NULL}, - - /* Sentinel */ - {0, 0} -}; diff --git a/Mac/Modules/macmodule.c b/Mac/Modules/macmodule.c deleted file mode 100644 index fb62286..0000000 --- a/Mac/Modules/macmodule.c +++ /dev/null @@ -1,727 +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. - -******************************************************************/ - -/* Mac module implementation */ - -#include "Python.h" -#include "structseq.h" -#include "ceval.h" - -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#ifdef USE_GUSI -/* Remove defines from macstat.h */ -#undef S_IFMT -#undef S_IFDIR -#undef S_IFREG -#undef S_IREAD -#undef S_IWRITE -#undef S_IEXEC - -#include <sys/types.h> -#include <sys/stat.h> -#else /* USE_GUSI */ -#endif /* USE_GUSI */ - -#ifdef USE_GUSI2 -#include <unistd.h> -#include <fcntl.h> -#else -#define mode_t int -#include <fcntl.h> -#ifdef _POSIX -#include <unistd.h> -#include <stat.h> -#endif -#endif - -/* Optional routines, for some compiler/runtime combinations */ -#if defined(USE_GUSI) || !defined(__MWERKS__) -#define WEHAVE_FDOPEN -#endif -#if defined(MPW) || defined(USE_GUSI) -#define WEHAVE_DUP -#endif -#if defined(USE_GUSI) -#define WEHAVE_FSTAT -#endif - -#include "macdefs.h" -#ifdef USE_GUSI -#include <dirent.h> -#else -#include "dirent.h" -#endif - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - -/* Prototypes for Unix simulation on Mac */ - -#ifndef USE_GUSI - -int chdir(const char *path); -int mkdir(const char *path, int mode); -DIR * opendir(char *); -void closedir(DIR *); -struct dirent * readdir(DIR *); -int rmdir(const char *path); -int sync(void); - -int unlink(const char *); - -#endif /* USE_GUSI */ - -char *getwd(char *); -char *getbootvol(void); - - -/* Set a MAC-specific error from errno, and return NULL */ - -static PyObject * -mac_error() -{ - return PyErr_SetFromErrno(PyExc_OSError); -} - -/* MAC generic methods */ - -static PyObject * -mac_1str(args, func) - PyObject *args; - int (*func)(const char *); -{ - char *path1; - int res; - if (!PyArg_ParseTuple(args, "s", &path1)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(path1); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -mac_2str(args, func) - PyObject *args; - int (*func)(const char *, const char *); -{ - char *path1, *path2; - int res; - if (!PyArg_ParseTuple(args, "ss", &path1, &path2)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(path1, path2); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -mac_strint(args, func) - PyObject *args; - int (*func)(const char *, int); -{ - char *path; - int i; - int res; - if (!PyArg_ParseTuple(args, "si", &path, &i)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(path, i); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -mac_chdir(self, args) - PyObject *self; - PyObject *args; -{ - return mac_1str(args, chdir); -} - -static PyObject * -mac_close(self, args) - PyObject *self; - PyObject *args; -{ - int fd, res; - if (!PyArg_ParseTuple(args, "i", &fd)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = close(fd); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef WEHAVE_DUP - -static PyObject * -mac_dup(self, args) - PyObject *self; - PyObject *args; -{ - int fd; - if (!PyArg_ParseTuple(args, "i", &fd)) - return NULL; - Py_BEGIN_ALLOW_THREADS - fd = dup(fd); - Py_END_ALLOW_THREADS - if (fd < 0) - return mac_error(); - return PyInt_FromLong((long)fd); -} - -#endif - -#ifdef WEHAVE_FDOPEN -static PyObject * -mac_fdopen(self, args) - PyObject *self; - PyObject *args; -{ - extern int fclose(FILE *); - int fd; - char *mode = "r"; - int bufsize = -1; - FILE *fp; - PyObject *f; - if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) - return NULL; - Py_BEGIN_ALLOW_THREADS - fp = fdopen(fd, mode); - Py_END_ALLOW_THREADS - if (fp == NULL) - return mac_error(); - f = PyFile_FromFile(fp, "<fdopen>", mode, fclose); - if (f != NULL) - PyFile_SetBufSize(f, bufsize); - return f; -} -#endif - -static PyObject * -mac_getcwd(self, args) - PyObject *self; - PyObject *args; -{ - char path[MAXPATHLEN]; - char *res; - if (!PyArg_ParseTuple(args, "")) - return NULL; - Py_BEGIN_ALLOW_THREADS -#ifdef USE_GUSI - res = getcwd(path, sizeof path); -#else - res = getwd(path); -#endif - Py_END_ALLOW_THREADS - if (res == NULL) { - return mac_error(); - } - return PyString_FromString(res); -} - -static PyObject * -mac_listdir(self, args) - PyObject *self; - PyObject *args; -{ - char *name; - PyObject *d, *v; - DIR *dirp; - struct dirent *ep; - if (!PyArg_ParseTuple(args, "s", &name)) - return NULL; -#ifdef USE_GUSI - /* Work around a bug in GUSI: if you opendir() a file it will - ** actually opendir() the parent directory. - */ - { - struct stat stb; - int res; - - res = stat(name, &stb); - if ( res < 0 ) - return mac_error(); - if (!S_ISDIR(stb.st_mode) ) { - errno = ENOTDIR; - return mac_error(); - } - } -#endif - - Py_BEGIN_ALLOW_THREADS - if ((dirp = opendir(name)) == NULL) { - Py_BLOCK_THREADS - return mac_error(); - } - if ((d = PyList_New(0)) == NULL) { - closedir(dirp); - Py_BLOCK_THREADS - return NULL; - } - while ((ep = readdir(dirp)) != NULL) { - v = PyString_FromString(ep->d_name); - if (v == NULL) { - Py_DECREF(d); - d = NULL; - break; - } - if (PyList_Append(d, v) != 0) { - Py_DECREF(v); - Py_DECREF(d); - d = NULL; - break; - } - Py_DECREF(v); - } - closedir(dirp); - Py_END_ALLOW_THREADS - - return d; -} - -static PyObject * -mac_lseek(self, args) - PyObject *self; - PyObject *args; -{ - int fd; - int where; - int how; - long res; - if (!PyArg_ParseTuple(args, "iii", &fd, &where, &how)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = lseek(fd, (long)where, how); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - return PyInt_FromLong(res); -} - -static PyObject * -mac_mkdir(self, args) - PyObject *self; - PyObject *args; -{ - int res; - char *path; - int mode = 0777; /* Unused */ - if (!PyArg_ParseTuple(args, "s|i", &path, &mode)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = mkdir(path, mode); - Py_END_ALLOW_THREADS - if (res < 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -mac_open(self, args) - PyObject *self; - PyObject *args; -{ - char *path; - int mode; - int perm; /* Accepted but ignored */ - int fd; - if (!PyArg_ParseTuple(args, "si|i", &path, &mode, &perm)) - return NULL; - Py_BEGIN_ALLOW_THREADS - fd = open(path, mode); - Py_END_ALLOW_THREADS - if (fd < 0) - return mac_error(); - return PyInt_FromLong((long)fd); -} - -static PyObject * -mac_read(self, args) - PyObject *self; - PyObject *args; -{ - int fd, size; - PyObject *buffer; - if (!PyArg_ParseTuple(args, "ii", &fd, &size)) - return NULL; - buffer = PyString_FromStringAndSize((char *)NULL, size); - if (buffer == NULL) - return NULL; - Py_BEGIN_ALLOW_THREADS - size = read(fd, PyString_AsString(buffer), size); - Py_END_ALLOW_THREADS - if (size < 0) { - Py_DECREF(buffer); - return mac_error(); - } - _PyString_Resize(&buffer, size); - return buffer; -} - -static PyObject * -mac_rename(self, args) - PyObject *self; - PyObject *args; -{ - return mac_2str(args, rename); -} - -static PyObject * -mac_rmdir(self, args) - PyObject *self; - PyObject *args; -{ - return mac_1str(args, rmdir); -} - -static char stat_result__doc__[] = -"stat_result: Result from stat or lstat.\n\n\ -This object may be accessed either as a tuple of\n\ - (mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\ -or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ -\n\ -See os.stat for more information.\n"; - -#define COMMON_STAT_RESULT_FIELDS \ - { "st_mode", "protection bits" }, \ - { "st_ino", "inode" }, \ - { "st_dev", "device" }, \ - { "st_nlink", "number of hard links" }, \ - { "st_uid", "user ID of owner" }, \ - { "st_gid", "group ID of owner" }, \ - { "st_size", "total size, in bytes" }, \ - { "st_atime", "time of last access" }, \ - { "st_mtime", "time of last modification" }, \ - { "st_ctime", "time of last change" }, - - - -static PyStructSequence_Field stat_result_fields[] = { - COMMON_STAT_RESULT_FIELDS - {0} -}; - -static PyStructSequence_Desc stat_result_desc = { - "mac.stat_result", - stat_result__doc__, - stat_result_fields, - 10 -}; - -static PyTypeObject StatResultType; - -static PyObject * -_pystat_from_struct_stat(struct stat st, void* _mst) -{ - PyObject *v; - - v = PyStructSequence_New(&StatResultType); - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode)); - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino)); - PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev)); - PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st.st_nlink)); - PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st.st_uid)); - PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st.st_gid)); - PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long)st.st_size)); - PyStructSequence_SET_ITEM(v, 7, - PyFloat_FromDouble((double)st.st_atime)); - PyStructSequence_SET_ITEM(v, 8, - PyFloat_FromDouble((double)st.st_mtime)); - PyStructSequence_SET_ITEM(v, 9, - PyFloat_FromDouble((double)st.st_ctime)); - if (PyErr_Occurred()) { - Py_DECREF(v); - return NULL; - } - - return v; -} - - -static PyObject * -mac_stat(self, args) - PyObject *self; - PyObject *args; -{ - struct stat st; - char *path; - int res; - if (!PyArg_ParseTuple(args, "s", &path)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = stat(path, &st); - Py_END_ALLOW_THREADS - if (res != 0) - return mac_error(); - - return _pystat_from_struct_stat(st, NULL); -} - -#ifdef WEHAVE_FSTAT -static PyObject * -mac_fstat(self, args) - PyObject *self; - PyObject *args; -{ - struct stat st; - long fd; - int res; - if (!PyArg_ParseTuple(args, "l", &fd)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = fstat((int)fd, &st); - Py_END_ALLOW_THREADS - if (res != 0) - return mac_error(); - - return _pystat_from_struct_stat(st, NULL); -} -#endif /* WEHAVE_FSTAT */ - -static PyObject * -mac_sync(self, args) - PyObject *self; - PyObject *args; -{ - int res; - if (!PyArg_ParseTuple(args, "")) - return NULL; - Py_BEGIN_ALLOW_THREADS -#ifdef USE_GUSI2 - sync(); - res = 0; -#else - res = sync(); -#endif - Py_END_ALLOW_THREADS - if (res != 0) - return mac_error(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -mac_unlink(self, args) - PyObject *self; - PyObject *args; -{ - return mac_1str(args, (int (*)(const char *))unlink); -} - -static PyObject * -mac_write(self, args) - PyObject *self; - PyObject *args; -{ - int fd, size; - char *buffer; - if (!PyArg_ParseTuple(args, "is#", &fd, &buffer, &size)) - return NULL; - Py_BEGIN_ALLOW_THREADS - size = write(fd, buffer, size); - Py_END_ALLOW_THREADS - if (size < 0) - return mac_error(); - return PyInt_FromLong((long)size); -} - -#ifdef USE_MALLOC_DEBUG -void *mstats(char *); - -static PyObject * -mac_mstats(self, args) - PyObject*self; - PyObject *args; -{ - mstats("python"); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* USE_MALLOC_DEBUG */ - -static struct PyMethodDef mac_methods[] = { - {"chdir", mac_chdir, 1}, - {"close", mac_close, 1}, -#ifdef WEHAVE_DUP - {"dup", mac_dup, 1}, -#endif -#ifdef WEHAVE_FDOPEN - {"fdopen", mac_fdopen, 1}, -#endif -#ifdef WEHAVE_FSTAT - {"fstat", mac_fstat, 1}, -#endif - {"getcwd", mac_getcwd, 1}, - {"listdir", mac_listdir, 1}, - {"lseek", mac_lseek, 1}, - {"mkdir", mac_mkdir, 1}, - {"open", mac_open, 1}, - {"read", mac_read, 1}, - {"rename", mac_rename, 1}, - {"rmdir", mac_rmdir, 1}, - {"stat", mac_stat, 1}, - {"sync", mac_sync, 1}, - {"remove", mac_unlink, 1}, - {"unlink", mac_unlink, 1}, - {"write", mac_write, 1}, -#ifdef USE_MALLOC_DEBUG - {"mstats", mac_mstats, 1}, -#endif - - {NULL, NULL} /* Sentinel */ -}; - -static int -ins(PyObject *d, char *symbol, long value) -{ - PyObject* v = PyInt_FromLong(value); - if (!v || PyDict_SetItemString(d, symbol, v) < 0) - return -1; /* triggers fatal error */ - - Py_DECREF(v); - return 0; -} - -static int -all_ins(PyObject *d) -{ -#ifdef F_OK - if (ins(d, "F_OK", (long)F_OK)) return -1; -#endif -#ifdef R_OK - if (ins(d, "R_OK", (long)R_OK)) return -1; -#endif -#ifdef W_OK - if (ins(d, "W_OK", (long)W_OK)) return -1; -#endif -#ifdef X_OK - if (ins(d, "X_OK", (long)X_OK)) return -1; -#endif -#ifdef NGROUPS_MAX - if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; -#endif -#ifdef TMP_MAX - if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; -#endif -#ifdef WNOHANG - if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; -#endif -#ifdef O_RDONLY - if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; -#endif -#ifdef O_WRONLY - if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; -#endif -#ifdef O_RDWR - if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; -#endif -#ifdef O_NDELAY - if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; -#endif -#ifdef O_NONBLOCK - if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; -#endif -#ifdef O_APPEND - if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; -#endif -#ifdef O_DSYNC - if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; -#endif -#ifdef O_RSYNC - if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; -#endif -#ifdef O_SYNC - if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; -#endif -#ifdef O_NOCTTY - if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; -#endif -#ifdef O_CREAT - if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; -#endif -#ifdef O_EXCL - if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; -#endif -#ifdef O_TRUNC - if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; -#endif -#ifdef O_BINARY - if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; -#endif -#ifdef O_TEXT - if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; -#endif - -#ifdef HAVE_SPAWNV - if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; - if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; - if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; - if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; - if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; -#endif - -#if defined(PYOS_OS2) - if (insertvalues(d)) return -1; -#endif - return 0; -} - - -void -initmac() -{ - PyObject *m, *d; - - m = Py_InitModule("mac", mac_methods); - d = PyModule_GetDict(m); - - if (all_ins(d)) - return; - - /* Initialize mac.error exception */ - PyDict_SetItemString(d, "error", PyExc_OSError); - - PyStructSequence_InitType(&StatResultType, &stat_result_desc); - PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType); - -} diff --git a/Mac/Python/getapplbycreator.c b/Mac/Python/getapplbycreator.c deleted file mode 100644 index 8c0b00f..0000000 --- a/Mac/Python/getapplbycreator.c +++ /dev/null @@ -1,163 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* -** FindApplicationFromCreator uses the Desktop Database to -** locate the creator application for the given document -** -** this routine will check the desktop database of all local -** disks, then the desktop databases of all server volumes -** (so up to two passes will be made) -** -** This code was created from FindApplicationFromDocument -** routine, origin unknown. -*/ - -#ifdef WITHOUT_FRAMEWORKS -#include <Types.h> -#include <Files.h> -#include <Errors.h> -#else -#include <Carbon/Carbon.h> -#endif -#include "getapplbycreator.h" - - -OSErr FindApplicationFromCreator(OSType creator, - FSSpecPtr applicationFSSpecPtr) -{ - enum { localPass, remotePass, donePass } volumePass; - DTPBRec desktopParams; - HParamBlockRec hfsParams; - short volumeIndex; - Boolean foundFlag; - GetVolParmsInfoBuffer volumeInfoBuffer; - OSErr retCode; - -/* dkj 12/94 initialize flag to false (thanks to Peter Baral for pointing out this bug) */ - foundFlag = false; - - volumePass = localPass; - volumeIndex = 0; - - do { - /* - ** first, find the vRefNum of the volume whose Desktop Database - ** we're checking this time - */ - - volumeIndex++; - - /* convert the volumeIndex into a vRefNum */ - - hfsParams.volumeParam.ioNamePtr = nil; - hfsParams.volumeParam.ioVRefNum = 0; - hfsParams.volumeParam.ioVolIndex = volumeIndex; - retCode = PBHGetVInfoSync(&hfsParams); - - /* a nsvErr indicates that the current pass is over */ - if (retCode == nsvErr) goto SkipThisVolume; - if (retCode != noErr) goto Bail; - - /* - ** call GetVolParms to determine if this volume is a server - ** (a remote volume) - */ - - hfsParams.ioParam.ioBuffer = (Ptr) &volumeInfoBuffer; - hfsParams.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer); - retCode = PBHGetVolParmsSync(&hfsParams); - if (retCode != noErr) goto Bail; - - /* - ** if the vMServerAdr field of the volume information buffer - ** is zero, this is a local volume; skip this volume - ** if it's local on a remote pass or remote on a local pass - */ - - if ((volumeInfoBuffer.vMServerAdr != 0) != - (volumePass == remotePass)) goto SkipThisVolume; - - /* okay, now we've found the vRefNum for our desktop database call */ - - desktopParams.ioVRefNum = hfsParams.volumeParam.ioVRefNum; - - /* - ** find the path refNum for the desktop database for - ** the volume we're interested in - */ - - desktopParams.ioNamePtr = nil; - - retCode = PBDTGetPath(&desktopParams); - if (retCode == noErr && desktopParams.ioDTRefNum != 0) { - - /* - ** use the GetAPPL call to find the preferred application - ** for opening any document with this one's creator - */ - - desktopParams.ioIndex = 0; - desktopParams.ioFileCreator = creator; - desktopParams.ioNamePtr = applicationFSSpecPtr->name; - retCode = PBDTGetAPPLSync(&desktopParams); - - if (retCode == noErr) { - /* - ** okay, found it; fill in the application file spec - ** and set the flag indicating we're done - */ - - applicationFSSpecPtr->parID = desktopParams.ioAPPLParID; - applicationFSSpecPtr->vRefNum = desktopParams.ioVRefNum; - foundFlag = true; - - } - } - - SkipThisVolume: - /* - ** if retCode indicates a no such volume error or if this - ** was the first pass, it's time to move on to the next pass - */ - - if (retCode == nsvErr) { - volumePass++; - volumeIndex = 0; - } - - } while (foundFlag == false && volumePass != donePass); - -Bail: - if (retCode == nsvErr) - return fnfErr; /* More logical than "No such volume" */ - return retCode; -} diff --git a/Mac/Python/gusiconfig.cpp b/Mac/Python/gusiconfig.cpp deleted file mode 100644 index ec6b57d..0000000 --- a/Mac/Python/gusiconfig.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Generated with the GUSIConfig application and then hand-modified by jack. - */ - -#define GUSI_SOURCE -#include <GUSIConfig.h> -#include <sys/cdefs.h> -#include <Resources.h> - -#include "Python.h" -#include "macglue.h" -#include "pythonresources.h" - -static void -PyMac_GUSISpin(bool wait) -{ - static Boolean inForeground = true; - int maxsleep = 6; /* 6 ticks is "normal" sleeptime */ - - if (PyMac_ConsoleIsDead) return; - - if ( !wait ) - maxsleep = 0; - - PyMac_DoYield(maxsleep, 0); /* XXXX or is it safe to call python here? */ -} - - -/* Declarations of Socket Factories */ - -__BEGIN_DECLS -void GUSIwithInetSockets(); -void GUSIwithLocalSockets(); -void GUSIwithMTInetSockets(); -void GUSIwithMTTcpSockets(); -void GUSIwithMTUdpSockets(); -void GUSIwithOTInetSockets(); -void GUSIwithOTTcpSockets(); -void GUSIwithOTUdpSockets(); -void GUSIwithPPCSockets(); -void GUSISetupFactories(); -__END_DECLS - -/* Configure Socket Factories */ - -void GUSISetupFactories() -{ -#ifdef GUSISetupFactories_BeginHook - GUSISetupFactories_BeginHook -#endif - GUSIwithInetSockets(); -#ifdef GUSISetupFactories_EndHook - GUSISetupFactories_EndHook -#endif -} - -/* Declarations of File Devices */ - -__BEGIN_DECLS -void GUSIwithDConSockets(); -void GUSIwithNullSockets(); -void GUSISetupDevices(); -__END_DECLS - -/* Configure File Devices */ - -void GUSISetupDevices() -{ -#ifdef GUSISetupDevices_BeginHook - GUSISetupDevices_BeginHook -#endif -#ifdef GUSISetupDevices_EndHook - GUSISetupDevices_EndHook -#endif -} - -#ifndef __cplusplus -#error GUSISetupConfig() needs to be written in C++ -#endif - -GUSIConfiguration::FileSuffix sSuffices[] = { - "", '????', '????' -}; -extern "C" void GUSISetupConfig() -{ - Handle h; - short oldrh, prefrh = -1; - short resource_id = GUSIConfiguration::kNoResource; - - oldrh = CurResFile(); - - /* Try override from the application resource fork */ - UseResFile(PyMac_AppRefNum); - h = Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID); - if ( h ) { - resource_id = GUSIOPTIONSOVERRIDE_ID; - } else { - /* Next try normal resource from preference file */ - UseResFile(oldrh); - prefrh = PyMac_OpenPrefFile(); - h = Get1Resource('GU\267I', GUSIOPTIONS_ID); - if ( h ) { - resource_id = GUSIOPTIONS_ID; - } else { - /* Finally try normal resource from application */ - if ( prefrh != -1 ) { - CloseResFile(prefrh); - prefrh = -1; - } - resource_id = GUSIOPTIONS_ID; - } - } - - /* Now we have the right resource file topmost and the id. Init GUSI. */ - GUSIConfiguration * config = - GUSIConfiguration::CreateInstance(resource_id); - - /* Finally restore the old resource file */ - if ( prefrh != -1) CloseResFile(prefrh); - UseResFile(oldrh); - - config->ConfigureDefaultTypeCreator('TEXT', 'R*ch'); -#if 0 - config->ConfigureSuffices( - sizeof(sSuffices)/sizeof(GUSIConfiguration::FileSuffix)-1, sSuffices); -#endif - config->ConfigureAutoInitGraf(false); - config->ConfigureAutoSpin(false); - config->ConfigureHandleAppleEvents(false); - config->ConfigureSigInt(false); - config->ConfigureSigPipe(true); - - GUSISetHook(GUSI_SpinHook, (GUSIHook)PyMac_GUSISpin); - -} - -/**************** END GUSI CONFIGURATION *************************/ diff --git a/Mac/Python/macapplication.c b/Mac/Python/macapplication.c deleted file mode 100644 index 4c71234..0000000 --- a/Mac/Python/macapplication.c +++ /dev/null @@ -1,83 +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. - -******************************************************************/ - -/* Macintosh Python main program for both applets and interpreter */ - -#include <Resources.h> -#include <CodeFragments.h> - -extern void PyMac_InitApplication(void); -#ifdef USE_MAC_APPLET_SUPPORT -extern void PyMac_InitApplet(void); -#endif /* USE_MAC_APPLET_SUPPORT */ - -/* From the MSL runtime: */ -extern void __initialize(void); - -/* -** Alternative initialization entry point for some very special cases. -** Use this in stead of __initialize in the PEF settings to remember (and -** re-open as resource file) the application. This is needed if we link against -** a dynamic library that, in its own __initialize routine, opens a resource -** file. This would mess up our finding of override preferences. -** Only set this entrypoint in your apps if you notice sys.path or some such is -** messed up. -*/ -static int application_fss_valid; -static FSSpec application_fss; - -OSErr pascal -__initialize_remember_app_fsspec(CFragInitBlockPtr data) -{ - /* Call the MW runtime's initialization routine */ - __initialize(); - if ( data == nil ) return noErr; - if ( data->fragLocator.where == kDataForkCFragLocator ) { - application_fss = *data->fragLocator.u.onDisk.fileSpec; - application_fss_valid = 1; - } else if ( data->fragLocator.where == kResourceCFragLocator ) { - application_fss = *data->fragLocator.u.inSegs.fileSpec; - application_fss_valid = 1; - } - return noErr; -} - -void -main() { - if ( application_fss_valid ) - (void)FSpOpenResFile(&application_fss, fsRdPerm); -#ifdef USE_MAC_APPLET_SUPPORT - { - Handle mainpyc; - - mainpyc = Get1NamedResource('PYC ', "\p__main__"); - if (mainpyc != NULL) - PyMac_InitApplet(); - else - PyMac_InitApplication(); - } -#else - PyMac_InitApplication(); -#endif /* USE_MAC_APPLET_SUPPORT */ -} diff --git a/Mac/Python/macgetargv.c b/Mac/Python/macgetargv.c deleted file mode 100644 index f301bab..0000000 --- a/Mac/Python/macgetargv.c +++ /dev/null @@ -1,247 +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. - -******************************************************************/ - -/* Construct argc and argv for main() by using Apple Events */ -/* From Jack's implementation for STDWIN */ - -#include <stdlib.h> - -#ifdef WITHOUT_FRAMEWORKS -#include <Types.h> -#include <Files.h> -#include <Events.h> -#include <Memory.h> -#include <Processes.h> -#include <Errors.h> -#include <AppleEvents.h> -#include <AEObjects.h> -#include <Fonts.h> -#include <TextEdit.h> -#include <Menus.h> -#include <Dialogs.h> -#include <Windows.h> -#else -#include <Carbon/Carbon.h> -#endif /* WITHOUT_FRAMEWORKS */ - -typedef long refcontype; - -#include "Python.h" -#include "macglue.h" - -#define PATHNAMELEN 256 - -static int arg_count; -static char *arg_vector[256]; -FSSpec PyMac_ApplicationFSSpec; -char PyMac_ApplicationPath[PATHNAMELEN]; - -/* Duplicate a string to the heap. We also export this since it isn't standard -** and others use it -*/ -#ifndef HAVE_STRDUP -char * -strdup(const char *src) -{ - char *dst = malloc(strlen(src) + 1); - if (dst) - strcpy(dst, src); - return dst; -} -#endif - -/* Initialize FSSpec and full name of current application */ - -OSErr -PyMac_init_process_location(void) -{ - ProcessSerialNumber currentPSN; - ProcessInfoRec info; - OSErr err; - static int applocation_inited; - - if ( applocation_inited ) return 0; - currentPSN.highLongOfPSN = 0; - currentPSN.lowLongOfPSN = kCurrentProcess; - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = NULL; - info.processAppSpec = &PyMac_ApplicationFSSpec; - if ( err=GetProcessInformation(¤tPSN, &info)) - return err; - if ( err=PyMac_GetFullPathname(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath, PATHNAMELEN) ) - return err; - applocation_inited = 1; - return 0; -} - -/* Check that there aren't any args remaining in the event */ - -static OSErr -get_missing_params(const AppleEvent *theAppleEvent) -{ - DescType theType; - Size actualSize; - OSErr err; - - err = AEGetAttributePtr(theAppleEvent, keyMissedKeywordAttr, typeWildCard, - &theType, nil, 0, &actualSize); - if (err == errAEDescNotFound) - return noErr; - else - return errAEEventNotHandled; -} - -static int got_one; /* Flag that we can stop getting events */ - -/* Handle the Print or Quit events (by failing) */ - -static pascal OSErr -handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon) -{ - #pragma unused (reply, refCon) - got_one = 1; - return errAEEventNotHandled; -} - -/* Handle the Open Application event (by ignoring it) */ - -static pascal OSErr -handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon) -{ - #pragma unused (reply, refCon) -#if 0 - /* Test by Jack: would removing this facilitate debugging? */ - got_one = 1; -#endif - return get_missing_params(theAppleEvent); -} - -/* Handle the Open Document event, by adding an argument */ - -static pascal OSErr -handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, refcontype refCon) -{ - #pragma unused (reply, refCon) - OSErr err; - AEDescList doclist; - AEKeyword keywd; - DescType rttype; - long i, ndocs, size; - FSSpec fss; - char path[PATHNAMELEN]; - - got_one = 1; - if ((err = AEGetParamDesc(theAppleEvent, - keyDirectObject, typeAEList, &doclist))) - return err; - if ((err = get_missing_params(theAppleEvent))) - return err; - if ((err = AECountItems(&doclist, &ndocs))) - return err; - for(i = 1; i <= ndocs; i++) { - err = AEGetNthPtr(&doclist, i, typeFSS, - &keywd, &rttype, &fss, sizeof(fss), &size); - if (err) - break; - PyMac_GetFullPathname(&fss, path, PATHNAMELEN); - arg_vector[arg_count++] = strdup(path); - } - return err; -} - -/* Install standard core event handlers */ -AEEventHandlerUPP open_doc_upp; -AEEventHandlerUPP open_app_upp; -AEEventHandlerUPP not_upp; - -static void -set_ae_handlers(void) -{ - open_doc_upp = NewAEEventHandlerUPP(&handle_open_doc); - open_app_upp = NewAEEventHandlerUPP(&handle_open_app); - not_upp = NewAEEventHandlerUPP(&handle_not); - - AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, - open_app_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, - open_doc_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, - not_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, - not_upp, 0L, false); -} - -/* Uninstall standard core event handlers */ - -static void -reset_ae_handlers(void) -{ - AERemoveEventHandler(kCoreEventClass, kAEOpenApplication, - open_app_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, - open_doc_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEPrintDocuments, - not_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, - not_upp, false); -} - -/* Wait for events until a core event has been handled */ - -static void -event_loop(void) -{ - EventRecord event; - int n; - int ok; - - got_one = 0; - for (n = 0; n < 100 && !got_one; n++) { - ok = GetNextEvent(everyEvent, &event); - if (ok && event.what == kHighLevelEvent) { - AEProcessAppleEvent(&event); - } - } -} - -/* Get the argv vector, return argc */ - -int -PyMac_GetArgv(char ***pargv, int noevents) -{ - arg_count = 0; - (void)PyMac_init_process_location(); - arg_vector[arg_count++] = strdup(PyMac_ApplicationPath); - - if( !noevents ) { - set_ae_handlers(); - event_loop(); - reset_ae_handlers(); - } - - arg_vector[arg_count] = NULL; - - *pargv = arg_vector; - return arg_count; -} diff --git a/Mac/Python/macgetcompiler.c b/Mac/Python/macgetcompiler.c deleted file mode 100644 index b5da2bf..0000000 --- a/Mac/Python/macgetcompiler.c +++ /dev/null @@ -1,61 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* Return a string representing the compiler name */ - -#include "pyconfig.h" -#include "Python.h" - -#ifdef __MWERKS__ -#ifdef USE_GUSI2 -#define HASGUSI "" -#else -#define HASGUSI " WITHOUT_GUSI2" -#endif - -#ifdef WITH_THREAD -#define HASTHREAD "" -#else -#define HASTHREAD " WITHOUT_THREAD" -#endif - -#define COMPILER " [CW" HASGUSI HASTHREAD"]" -#endif - -#ifdef MPW -#define COMPILER " [Apple MPW]" -#endif - -const char * -Py_GetCompiler(void) -{ - return COMPILER; -} diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c deleted file mode 100644 index d98d481..0000000 --- a/Mac/Python/macgetpath.c +++ /dev/null @@ -1,442 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -#include "Python.h" -#include "osdefs.h" -#include "macglue.h" -#include "macdefs.h" -#include "pythonresources.h" -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#define PATHNAMELEN 256 - -/* Return the initial python search path. This is called once from -** initsys() to initialize sys.path. -** -** If USE_BUILTIN_PATH is defined the path defined here is used -** (after prepending the python home dir to each item). -** If it is not defined the path is gotten from a resource in the -** Preferences file. -** -** XXXX This code needs cleaning up. The routines here have moved -** around quite a bit, and they're pretty messy for that reason. -*/ - -#include <Files.h> -#include <Aliases.h> -#include <Folders.h> -#include <Resources.h> -#include <TextUtils.h> -#include <Dialogs.h> - -#ifndef USE_BUILTIN_PATH -static char *PyMac_GetPythonPath(); -#endif - -#define PYTHONPATH "\ -:\n\ -:Lib\n\ -:Lib:stdwin\n\ -:Lib:test\n\ -:Lib:mac" - -static int -getpreffilefss(FSSpec *fssp) -{ - static int diditbefore=0; - static int rv = 1; - static FSSpec fss; - short prefdirRefNum; - long prefdirDirID; - long pyprefdirDirID; - Handle namehandle; - OSErr err; - - if ( !diditbefore ) { - if ( (namehandle=GetNamedResource('STR ', PREFFILENAME_NAME)) == NULL ) { - (void)StopAlert(NOPREFNAME_ID, NULL); - exit(1); - } - - if ( **namehandle == '\0' ) { - /* Empty string means don't use preferences file */ - rv = 0; - } else { - /* There is a filename, construct the fsspec */ - if ( FindFolder(kOnSystemDisk, 'pref', kDontCreateFolder, &prefdirRefNum, - &prefdirDirID) != noErr ) { - /* Something wrong with preferences folder */ - (void)StopAlert(NOPREFDIR_ID, NULL); - exit(1); - } - /* make fsspec for the "Python" folder inside the prefs folder */ - err = FSMakeFSSpec(prefdirRefNum, prefdirDirID, "\pPython", &fss); - if (err == fnfErr) { - /* it doesn't exist: create it */ - err = FSpDirCreate(&fss, smSystemScript, &pyprefdirDirID); - } else { - /* it does exist, now find out the dirID of the Python prefs folder, brrr. */ - CInfoPBRec info; - info.dirInfo.ioVRefNum = fss.vRefNum; - info.dirInfo.ioDrDirID = fss.parID; - info.dirInfo.ioNamePtr = fss.name; - info.dirInfo.ioFDirIndex = 0; - info.dirInfo.ioACUser = 0; - err = PBGetCatInfo(&info, 0); - if (err == noErr) { - pyprefdirDirID = info.dirInfo.ioDrDirID; - } - } - if (err != noErr) { - (void)StopAlert(NOPREFDIR_ID, NULL); - exit(1); - } - HLock(namehandle); - err = FSMakeFSSpec(fss.vRefNum, pyprefdirDirID, (unsigned char *)*namehandle, &fss); - HUnlock(namehandle); - if (err != noErr && err != fnfErr) { - (void)StopAlert(NOPREFDIR_ID, NULL); - exit(1); - } - } - ReleaseResource(namehandle); - diditbefore = 1; - } - *fssp = fss; - return rv; -} - -char * -Py_GetPath() -{ - /* Modified by Jack to do something a bit more sensible: - ** - Prepend the python home-directory (which is obtained from a Preferences - ** resource) - ** - Add : - */ - static char *pythonpath; - char *p, *endp; - int newlen; - char *curwd; - - if ( pythonpath ) return pythonpath; -#ifndef USE_BUILTIN_PATH - if ( pythonpath = PyMac_GetPythonPath() ) - return pythonpath; - printf("Warning: No pythonpath resource found, using builtin default\n"); -#endif - curwd = PyMac_GetPythonDir(); - p = PYTHONPATH; - endp = p; - pythonpath = malloc(2); - if ( pythonpath == NULL ) return PYTHONPATH; - strcpy(pythonpath, ":"); - while (*endp) { - endp = strchr(p, '\n'); - if ( endp == NULL ) - endp = p + strlen(p); - newlen = strlen(pythonpath) + 1 + strlen(curwd) + (endp-p); - pythonpath = realloc(pythonpath, newlen+1); - if ( pythonpath == NULL ) return PYTHONPATH; - strcat(pythonpath, "\n"); - if ( *p == ':' ) { - p++; - strcat(pythonpath, curwd); - strncat(pythonpath, p, (endp-p)); - newlen--; /* Ok, ok, we've allocated one byte too much */ - } else { - /* We've allocated too much in this case */ - newlen -= strlen(curwd); - pythonpath = realloc(pythonpath, newlen+1); - if ( pythonpath == NULL ) return PYTHONPATH; - strncat(pythonpath, p, (endp-p)); - } - pythonpath[newlen] = '\0'; - p = endp + 1; - } - return pythonpath; -} - - -/* -** Open/create the Python Preferences file, return the handle -*/ -short -PyMac_OpenPrefFile() -{ - AliasHandle handle; - FSSpec dirspec; - short prefrh; - OSErr err; - - if ( !getpreffilefss(&dirspec)) - return -1; - prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); - if ( prefrh < 0 ) { - FSpCreateResFile(&dirspec, 'Pyth', 'pref', 0); - prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); - if ( prefrh == -1 ) { - /* This "cannot happen":-) */ - printf("Cannot create preferences file, error %d\n", ResError()); - exit(1); - } - if ( (err=PyMac_init_process_location()) != 0 ) { - printf("Cannot get application location, error %d\n", err); - exit(1); - } - dirspec = PyMac_ApplicationFSSpec; - dirspec.name[0] = 0; - if ((err=NewAlias(NULL, &dirspec, &handle)) != 0 ) { - printf("Cannot make alias to application directory, error %d\n", err); - exit(1); - } - AddResource((Handle)handle, 'alis', PYTHONHOME_ID, "\p"); - UpdateResFile(prefrh); - - } else { - UseResFile(prefrh); - } - return prefrh; -} - -/* -** Return the name of the Python directory -*/ -char * -PyMac_GetPythonDir() -{ - static int diditbefore = 0; - static char name[PATHNAMELEN] = {':', '\0'}; - AliasHandle handle; - FSSpec dirspec; - Boolean modified = 0; - short oldrh, prefrh = -1, homerh; - - if ( diditbefore ) - return name; - - oldrh = CurResFile(); - - /* First look for an override in the application file */ - UseResFile(PyMac_AppRefNum); - handle = (AliasHandle)Get1Resource('alis', PYTHONHOMEOVERRIDE_ID); - UseResFile(oldrh); - if ( handle != NULL ) { - homerh = PyMac_AppRefNum; - } else { - /* Try to open preferences file in the preferences folder. */ - prefrh = PyMac_OpenPrefFile(); - handle = (AliasHandle)Get1Resource('alis', PYTHONHOME_ID); - if ( handle == NULL ) { - /* (void)StopAlert(BADPREFFILE_ID, NULL); */ - diditbefore=1; - return ":"; - } - homerh = prefrh; - } - /* It exists. Resolve it (possibly updating it) */ - if ( ResolveAlias(NULL, handle, &dirspec, &modified) != noErr ) { - (void)StopAlert(BADPREFFILE_ID, NULL); - diditbefore=1; - return ":"; - } - if ( modified ) { - ChangedResource((Handle)handle); - UpdateResFile(homerh); - } - if ( prefrh != -1 ) CloseResFile(prefrh); - UseResFile(oldrh); - - if ( PyMac_GetFullPathname(&dirspec, name, PATHNAMELEN) == 0 ) { - strcat(name, ":"); - } else { - /* If all fails, we return the current directory */ - printf("Python home dir exists but I cannot find the pathname!!\n"); - name[0] = 0; - (void)getcwd(name, sizeof(name)); - } - diditbefore = 1; - return name; -} - -#ifndef USE_BUILTIN_PATH -char * -PyMac_GetPythonPath(void) -{ - short oldrh, prefrh = -1; - char *rv; - int i, newlen; - Str255 pathitem; - int resource_id; - OSErr err; - Handle h; - - oldrh = CurResFile(); - /* - ** This is a bit tricky. We check here whether the application file - ** contains an override. This is to forestall us finding another STR# resource - ** with "our" id and using that for path initialization - */ - UseResFile(PyMac_AppRefNum); - SetResLoad(0); - if ( (h=Get1Resource('STR#', PYTHONPATHOVERRIDE_ID)) ) { - ReleaseResource(h); - resource_id = PYTHONPATHOVERRIDE_ID; - } else { - resource_id = PYTHONPATH_ID; - } - SetResLoad(1); - UseResFile(oldrh); - - /* Open the preferences file only if there is no override */ - if ( resource_id != PYTHONPATHOVERRIDE_ID ) - prefrh = PyMac_OpenPrefFile(); - /* At this point, we may or may not have the preferences file open, and it - ** may or may not contain a sys.path STR# resource. We don't care, if it doesn't - ** exist we use the one from the application (the default). - ** We put an initial '\n' in front of the path that we don't return to the caller - */ - if( (rv = malloc(2)) == NULL ) - goto out; - strcpy(rv, "\n"); - - for(i=1; ; i++) { - GetIndString(pathitem, resource_id, i); - if( pathitem[0] == 0 ) - break; - if ( pathitem[0] >= 9 && strncmp((char *)pathitem+1, "$(PYTHON)", 9) == 0 ) { - /* We have to put the directory in place */ - char *dir = PyMac_GetPythonDir(); - - newlen = strlen(rv) + strlen(dir) + (pathitem[0]-9) + 2; - if( (rv=realloc(rv, newlen)) == NULL) - goto out; - strcat(rv, dir); - /* Skip a colon at the beginning of the item */ - if ( pathitem[0] > 9 && pathitem[1+9] == ':' ) { - memcpy(rv+strlen(rv), pathitem+1+10, pathitem[0]-10); - newlen--; - } else { - memcpy(rv+strlen(rv), pathitem+1+9, pathitem[0]-9); - } - rv[newlen-2] = '\n'; - rv[newlen-1] = 0; - } else if ( pathitem[0] >= 14 && strncmp((char *)pathitem+1, "$(APPLICATION)", 14) == 0 ) { - /* This is the application itself */ - - if ( (err=PyMac_init_process_location()) != 0 ) { - printf("Cannot get application location, error %d\n", err); - exit(1); - } - - newlen = strlen(rv) + strlen(PyMac_ApplicationPath) + 2; - if( (rv=realloc(rv, newlen)) == NULL) - goto out; - strcpy(rv+strlen(rv), PyMac_ApplicationPath); - rv[newlen-2] = '\n'; - rv[newlen-1] = 0; - - } else { - /* Use as-is */ - newlen = strlen(rv) + (pathitem[0]) + 2; - if( (rv=realloc(rv, newlen)) == NULL) - goto out; - memcpy(rv+strlen(rv), pathitem+1, pathitem[0]); - rv[newlen-2] = '\n'; - rv[newlen-1] = 0; - } - } - if( strlen(rv) == 1) { - free(rv); - rv = NULL; - } - if ( rv ) { - rv[strlen(rv)-1] = 0; - rv++; - } -out: - if ( prefrh != -1) CloseResFile(prefrh); - UseResFile(oldrh); - return rv; -} -#endif /* !USE_BUILTIN_PATH */ - -void -PyMac_PreferenceOptions(PyMac_PrefRecord *pr) -{ - short oldrh, prefrh = -1; - Handle handle; - int size; - PyMac_PrefRecord *p; - int action; - - - oldrh = CurResFile(); - - /* Attempt to load overrides from application */ - UseResFile(PyMac_AppRefNum); - handle = Get1Resource('Popt', PYTHONOPTIONSOVERRIDE_ID); - UseResFile(oldrh); - - /* Otherwise get options from prefs file or any other open resource file */ - if ( handle == NULL ) { - prefrh = PyMac_OpenPrefFile(); - handle = GetResource('Popt', PYTHONOPTIONS_ID); - } - if ( handle == NULL ) { - return; - } - HLock(handle); - size = GetHandleSize(handle); - p = (PyMac_PrefRecord *)*handle; - if ( p->version == POPT_VERSION_CURRENT && size == sizeof(PyMac_PrefRecord) ) { - *pr = *p; - } else { - action = CautionAlert(BADPREFERENCES_ID, NULL); - if ( action == BADPREF_DELETE ) { - OSErr err; - - RemoveResource(handle); - if ( (err=ResError()) ) printf("RemoveResource: %d\n", err); - if ( prefrh != -1 ) { - UpdateResFile(prefrh); - if ( (err=ResError()) ) printf("UpdateResFile: %d\n", err); - } - } else if ( action == BADPREF_QUIT ) - exit(1); - } - HUnlock(handle); - - if ( prefrh != -1) CloseResFile(prefrh); - UseResFile(oldrh); -} diff --git a/Mac/Python/macgetplatform.c b/Mac/Python/macgetplatform.c deleted file mode 100644 index 3640d76..0000000 --- a/Mac/Python/macgetplatform.c +++ /dev/null @@ -1,39 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -#include "Python.h" - -const char * -Py_GetPlatform(void) -{ - return "mac"; -} - diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c deleted file mode 100644 index 3711610..0000000 --- a/Mac/Python/macglue.c +++ /dev/null @@ -1,617 +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. - -******************************************************************/ - - -#include "Python.h" - -#include "macglue.h" -#include "marshal.h" -#include "import.h" -#include "importdl.h" -#include "pymactoolbox.h" - -#include "pythonresources.h" - -#ifdef WITHOUT_FRAMEWORKS -#include <OSUtils.h> /* for Set(Current)A5 */ -#include <Files.h> -#include <StandardFile.h> -#include <Resources.h> -#include <Memory.h> -#include <Windows.h> -#include <Traps.h> -#include <Processes.h> -#include <Fonts.h> -#include <Menus.h> -#include <TextUtils.h> -#include <LowMem.h> -#include <Events.h> -#else -#include <Carbon/Carbon.h> -#endif - -#ifdef __MWERKS__ -#include <SIOUX.h> -extern void SIOUXSetupMenus(void); -extern void SIOUXDoAboutBox(void); -#endif -#ifdef USE_GUSI -/* Functions we redefine because they're in obscure libraries */ -extern void SpinCursor(short x); -extern void RotateCursor(short x); -extern pascal unsigned char * PLstrcpy(unsigned char *, const unsigned char *); -extern pascal short PLstrcmp(const unsigned char *, const unsigned char *); -extern pascal char *PLstrrchr(const unsigned char *, short); - -#endif - -/* The ID of the Sioux apple menu */ -#define SIOUX_APPLEID 32000 - -#include <signal.h> -#include <stdio.h> - -/* -** When less than this amount of stackspace is left we -** raise a MemoryError. -*/ -#ifndef MINIMUM_STACK_SIZE -#define MINIMUM_STACK_SIZE 8192 -#endif - -/* -** On MacOSX StackSpace() lies: it gives the distance from heap end to stack pointer, -** but the stack cannot grow that far due to rlimit values. We cannot get at this value -** from Carbon, so we set a maximum to the stack here that is based on the default -** stack limit of 512K. -*/ -#define MAXIMUM_STACK_SIZE (256*1024) - -/* -** We have to be careful, since we can't handle -** things like updates (and they'll keep coming back if we don't -** handle them). Note that we don't know who has windows open, so -** even handing updates off to SIOUX under MW isn't going to work. -*/ -#define MAINLOOP_EVENTMASK (mDownMask|keyDownMask|osMask|activMask) - -#include <signal.h> - -/* XXX We should include Errors.h here, but it has a name conflict -** with the python errors.h. */ -#define fnfErr -43 - -/* Interrupt code variables: */ -static int interrupted; /* Set to true when cmd-. seen */ -static RETSIGTYPE intcatcher(int); - -#if !TARGET_API_MAC_OSX -static int PyMac_Yield(void); -#endif - -/* -** These are the real scheduling parameters that control what we check -** in the event loop, and how often we check. The values are initialized -** from pyMac_SchedParamStruct. -*/ - -struct real_sched_param_struct { - int check_interrupt; /* if true check for command-dot */ - int process_events; /* if nonzero enable evt processing, this mask */ - int besocial; /* if nonzero be a little social with CPU */ - unsigned long check_interval; /* how often to check, in ticks */ - unsigned long bg_yield; /* yield so long when in background */ - /* these are computed from previous and clock and such */ - int enabled; /* check_interrupt OR process_event OR yield */ - unsigned long next_check; /* when to check/yield next, in ticks */ -}; - -static struct real_sched_param_struct schedparams = - { 1, MAINLOOP_EVENTMASK, 1, 15, 15, 1, 0}; - -/* -** Workaround for sioux/gusi combo: set when we are exiting -*/ -int PyMac_ConsoleIsDead; - -/* -** Sioux menu bar, saved early so we can restore it -*/ -static MenuBarHandle sioux_mbar; - -/* -** The python-code event handler -*/ -static PyObject *python_event_handler; - -/* Given an FSSpec, return the FSSpec of the parent folder */ - -static OSErr -get_folder_parent (FSSpec * fss, FSSpec * parent) -{ - CInfoPBRec rec; - short err; - - * parent = * fss; - rec.hFileInfo.ioNamePtr = parent->name; - rec.hFileInfo.ioVRefNum = parent->vRefNum; - rec.hFileInfo.ioDirID = parent->parID; - rec.hFileInfo.ioFDirIndex = -1; - rec.hFileInfo.ioFVersNum = 0; - if (err = PBGetCatInfoSync (& rec)) - return err; - parent->parID = rec.dirInfo.ioDrParID; -/* parent->name[0] = 0; */ - return 0; -} - -/* Given an FSSpec return a full, colon-separated pathname */ - -OSErr -PyMac_GetFullPathname (FSSpec *fss, char *buf, int length) -{ - short err; - FSSpec fss_parent, fss_current; - char tmpbuf[1024]; - int plen; - - fss_current = *fss; - plen = fss_current.name[0]; - if ( plen+2 > length ) { - *buf = 0; - return errFSNameTooLong; - } - memcpy(buf, &fss_current.name[1], plen); - buf[plen] = 0; - /* Special case for disk names */ - if ( fss_current.parID <= 1 ) { - buf[plen++] = ':'; - buf[plen] = 0; - return 0; - } - while (fss_current.parID > 1) { - /* Get parent folder name */ - if (err = get_folder_parent(&fss_current, &fss_parent)) { - *buf = 0; - return err; - } - fss_current = fss_parent; - /* Prepend path component just found to buf */ - plen = fss_current.name[0]; - if (strlen(buf) + plen + 1 > 1024) { - /* Oops... Not enough space (shouldn't happen) */ - *buf = 0; - return errFSNameTooLong; - } - memcpy(tmpbuf, &fss_current.name[1], plen); - tmpbuf[plen] = ':'; - strcpy(&tmpbuf[plen+1], buf); - if ( strlen(tmpbuf) > length ) { - *buf = 0; - return errFSNameTooLong; - } - strcpy(buf, tmpbuf); - } - return 0; -} - - -#ifdef USE_GUSI -/* -** SpinCursor (needed by GUSI) drags in heaps of stuff, so we -** provide a dummy here. -*/ -void SpinCursor(short x) { /* Dummy */ } -void RotateCursor(short x) { /* Dummy */ } - - -/* Called at exit() time thru atexit(), to stop event processing */ -void -PyMac_StopGUSISpin() { - PyMac_ConsoleIsDead = 1; -} - -#endif /* USE_GUSI */ - - -/* Convert C to Pascal string. Returns pointer to static buffer. */ -unsigned char * -Pstring(char *str) -{ - static Str255 buf; - int len; - - len = strlen(str); - if (len > 255) - len = 255; - buf[0] = (unsigned char)len; - strncpy((char *)buf+1, str, len); - return buf; -} - - -#ifdef USE_STACKCHECK -/* Check for stack overflow */ -int -PyOS_CheckStack() -{ - char here; - static char *sentinel = 0; - static PyThreadState *thread_for_sentinel = 0; - - if ( sentinel == 0 ) { - unsigned long stackspace = StackSpace(); - -#ifdef MAXIMUM_STACK_SIZE - /* See the comment at the definition */ - if ( stackspace > MAXIMUM_STACK_SIZE ) - stackspace = MAXIMUM_STACK_SIZE; -#endif - sentinel = &here - stackspace + MINIMUM_STACK_SIZE; - } - if ( thread_for_sentinel == 0 ) { - thread_for_sentinel = PyThreadState_Get(); - } - if ( &here < sentinel ) { - if (thread_for_sentinel == PyThreadState_Get()) { - return -1; - } - } - return 0; -} -#endif /* USE_STACKCHECK */ - -#if !TARGET_API_MAC_OSX -void -PyErr_SetInterrupt(void) -{ - interrupted = 1; -} - -/* The catcher routine (which may not be used for all compilers) */ -static RETSIGTYPE -intcatcher(sig) - int sig; -{ - interrupted = 1; - signal(SIGINT, intcatcher); -} - -void -PyOS_InitInterrupts() -{ - if (signal(SIGINT, SIG_IGN) != SIG_IGN) - signal(SIGINT, intcatcher); -} - -void -PyOS_FiniInterrupts() -{ -} - -/* Check whether we are in the foreground */ -static int -PyMac_InForeground(void) -{ - static ProcessSerialNumber ours; - static inited; - ProcessSerialNumber curfg; - Boolean eq; - - if ( inited == 0 ) { - (void)GetCurrentProcess(&ours); - inited = 1; - } - if ( GetFrontProcess(&curfg) < 0 ) - eq = 1; - else if ( SameProcess(&ours, &curfg, &eq) < 0 ) - eq = 1; - return (int)eq; -} - -/* -** This routine scans the event queue looking for cmd-. -*/ -static void -scan_event_queue(force) - int force; -{ - if ( interrupted || (!schedparams.check_interrupt && !force) ) - return; - if ( CheckEventQueueForUserCancel() ) - interrupted = 1; -} - -int -PyErr_CheckSignals() -{ - if (schedparams.enabled) { - if ( interrupted || (unsigned long)TickCount() > schedparams.next_check ) { - scan_event_queue(0); - if (interrupted) { - interrupted = 0; - PyErr_SetNone(PyExc_KeyboardInterrupt); - return -1; - } - if ( PyMac_Yield() < 0) - return -1; - schedparams.next_check = (unsigned long)TickCount() - + schedparams.check_interval; - } - } - return 0; -} - -int -PyOS_InterruptOccurred() -{ - scan_event_queue(0); - if ( !interrupted ) - return 0; - interrupted = 0; - return 1; -} -#endif - -int -PyMac_SetEventHandler(PyObject *evh) -{ - if ( evh && python_event_handler ) { - PyErr_SetString(PyExc_RuntimeError, "Python event handler already set"); - return 0; - } - if ( python_event_handler ) - Py_DECREF(python_event_handler); - if ( evh ) - Py_INCREF(evh); - python_event_handler = evh; - return 1; -} - -/* -** Handle an event, either one found in the mainloop eventhandler or -** one passed back from the python program. -*/ -void -PyMac_HandleEventIntern(evp) - EventRecord *evp; -{ -#ifdef __MWERKS__ - { - int siouxdidit; - - /* If SIOUX wants it we're done */ - siouxdidit = SIOUXHandleOneEvent(evp); - if ( siouxdidit ) - return; - } -#else - /* Other compilers are just unlucky... */ -#endif /* !__MWERKS__ */ -} - -/* -** Handle an event, either through HandleEvent or by passing it to the Python -** event handler. -*/ -int -PyMac_HandleEvent(evp) - EventRecord *evp; -{ - PyObject *rv; - - if ( python_event_handler ) { - rv = PyObject_CallFunction(python_event_handler, "(O&)", - PyMac_BuildEventRecord, evp); - if ( rv ) - Py_DECREF(rv); - else - return -1; /* Propagate exception */ - } else { - PyMac_HandleEventIntern(evp); - } - return 0; -} - -#if !TARGET_API_MAC_OSX -/* -** Yield the CPU to other tasks without processing events. -*/ -int -PyMac_DoYield(int maxsleep, int maycallpython) -{ - EventRecord ev; - int gotone; - long latest_time_ready; - static int in_here = 0; - - in_here++; - - /* - ** Check which of the eventloop cases we have: - ** - process events - ** - don't process events but do yield - ** - do neither - */ - if( in_here > 1 || !schedparams.process_events || - (python_event_handler && !maycallpython) ) { - if ( maxsleep >= 0 ) { - /* XXXX Need to do something here */ - } - } else { - latest_time_ready = TickCount() + maxsleep; - do { - /* XXXX Hack by Jack. - ** In time.sleep() you can click to another application - ** once only. If you come back to Python you cannot get away - ** again. - **/ - gotone = WaitNextEvent(schedparams.process_events, &ev, maxsleep, NULL); - /* Get out quickly if nothing interesting is happening */ - if ( !gotone || ev.what == nullEvent ) - break; - if ( PyMac_HandleEvent(&ev) < 0 ) { - in_here--; - return -1; - } - maxsleep = latest_time_ready - TickCount(); - } while ( maxsleep > 0 ); - } - in_here--; - return 0; -} - -/* -** Process events and/or yield the CPU to other tasks if opportune -*/ -int -PyMac_Yield() { - unsigned long maxsleep; - - if( PyMac_InForeground() ) - maxsleep = 0; - else - maxsleep = schedparams.bg_yield; - - return PyMac_DoYield(maxsleep, 1); -} - -/* -** Return current scheduler parameters -*/ -void -PyMac_GetSchedParams(PyMacSchedParams *sp) -{ - sp->check_interrupt = schedparams.check_interrupt; - sp->process_events = schedparams.process_events; - sp->besocial = schedparams.besocial; - sp->check_interval = schedparams.check_interval / 60.0; - sp->bg_yield = schedparams.bg_yield / 60.0; -} - -/* -** Set current scheduler parameters -*/ -void -PyMac_SetSchedParams(PyMacSchedParams *sp) -{ - schedparams.check_interrupt = sp->check_interrupt; - schedparams.process_events = sp->process_events; - schedparams.besocial = sp->besocial; - schedparams.check_interval = (unsigned long)(sp->check_interval*60); - schedparams.bg_yield = (unsigned long)(sp->bg_yield*60); - if ( schedparams.check_interrupt || schedparams.process_events || - schedparams.besocial ) - schedparams.enabled = 1; - else - schedparams.enabled = 0; - schedparams.next_check = 0; /* Check immedeately */ -} - -/* -** Install our menu bar. -*/ -void -PyMac_InitMenuBar() -{ - MenuHandle applemenu; - Str255 about_text; - static unsigned char about_sioux[] = "\pAbout SIOUX"; - - if ( sioux_mbar ) return; - if ( (sioux_mbar=GetMenuBar()) == NULL || GetMenuHandle(SIOUX_APPLEID) == NULL) { - /* Sioux menu not installed yet. Do so */ - SIOUXSetupMenus(); - if ( (sioux_mbar=GetMenuBar()) == NULL ) - return; - } - if ( (applemenu=GetMenuHandle(SIOUX_APPLEID)) == NULL ) return; - GetMenuItemText(applemenu, 1, about_text); - if ( about_text[0] == about_sioux[0] && - strncmp((char *)(about_text+1), (char *)(about_sioux+1), about_text[0]) == 0 ) - SetMenuItemText(applemenu, 1, "\pAbout Python..."); -} - -/* -** Restore sioux menu bar -*/ -void -PyMac_RestoreMenuBar() -{ - MenuBarHandle curmenubar; - - curmenubar = GetMenuBar(); - if ( sioux_mbar ) { - SetMenuBar(sioux_mbar); - DrawMenuBar(); - } else { - PyMac_InitMenuBar(); - DrawMenuBar(); - } -} - -void -PyMac_RaiseConsoleWindow() -{ - /* Note: this is a hack. SIOUXTextWindow is SIOUX's internal structure - ** and we happen to know that the first entry is the window pointer. - */ - extern WindowRef *SIOUXTextWindow; - - if ( SIOUXTextWindow == NULL || *SIOUXTextWindow == NULL ) - return; - if ( FrontWindow() != *SIOUXTextWindow ) - BringToFront(*SIOUXTextWindow); -} - -/* -** Our replacement about box -*/ - -#include "patchlevel.h" - -void -SIOUXDoAboutBox(void) -{ - DialogPtr theDialog; - WindowPtr theWindow; - short item; - short fontID; - - if( (theDialog = GetNewDialog(ABOUT_ID, NULL, (WindowPtr)-1)) == NULL ) - return; - theWindow = GetDialogWindow(theDialog); - SetPortWindowPort(theWindow); - GetFNum("\pPython-Sans", &fontID); - if (fontID == 0) - fontID = kFontIDGeneva; - TextFont(fontID); - TextSize(9); - ParamText(Pstring(PY_VERSION), "\p", "\p", "\p"); - ShowWindow(theWindow); - ModalDialog(NULL, &item); - DisposeDialog(theDialog); -} - -#endif /* !TARGET_API_MAC_OSX */ diff --git a/Mac/Python/macimport.c b/Mac/Python/macimport.c deleted file mode 100644 index e6c432b..0000000 --- a/Mac/Python/macimport.c +++ /dev/null @@ -1,445 +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. - -******************************************************************/ - - -#include "Python.h" - -#include "macglue.h" -#include "marshal.h" -#include "import.h" -#include "importdl.h" - -#include "pythonresources.h" - -#include <Types.h> -#include <Files.h> -#include <Resources.h> -#include <CodeFragments.h> -#include <StringCompare.h> - -typedef void (*dl_funcptr)(); -#define FUNCNAME_PATTERN "init%.200s" - -static int -fssequal(FSSpec *fs1, FSSpec *fs2) -{ - if ( fs1->vRefNum != fs2->vRefNum || fs1->parID != fs2->parID ) - return 0; - return EqualString(fs1->name, fs2->name, false, true); -} -/* -** findnamedresource - Common code for the various *ResourceModule functions. -** Check whether a file contains a resource of the correct name and type, and -** optionally return the value in it. -*/ -static int -findnamedresource( - PyStringObject *obj, - char *module, - char *filename, - OSType restype, - StringPtr dataptr) -{ - FSSpec fss; - FInfo finfo; - short oldrh, filerh; - int ok; - Handle h; - - /* - ** Find_module takes care of interning all - ** sys.path components. We then keep a record of all sys.path - ** components for which GetFInfo has failed (usually because the - ** component in question is a folder), and we don't try opening these - ** as resource files again. - */ -#define MAXPATHCOMPONENTS 32 - static PyStringObject *not_a_file[MAXPATHCOMPONENTS]; - static int max_not_a_file = 0; - int i; - - if (obj && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { - for( i=0; i< max_not_a_file; i++ ) - if ( obj == not_a_file[i] ) - return 0; - } - if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { - /* doesn't exist or is folder */ - if ( obj && max_not_a_file < MAXPATHCOMPONENTS && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { - Py_INCREF(obj); - not_a_file[max_not_a_file++] = obj; - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# %s is not a file\n", filename); - } - return 0; - } - if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { - /* - ** Special case: the application itself. Use a shortcut to - ** forestall opening and closing the application numerous times - ** (which is dead slow when running from CDROM) - */ - oldrh = CurResFile(); - UseResFile(PyMac_AppRefNum); - filerh = -1; - } else { - if ( FSpGetFInfo(&fss, &finfo) != noErr ) { - /* doesn't exist or is folder */ - if ( obj && max_not_a_file < MAXPATHCOMPONENTS && PyString_Check(obj) && PyString_CHECK_INTERNED(obj) ) { - Py_INCREF(obj); - not_a_file[max_not_a_file++] = obj; - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# %s is not a file\n", filename); - } - return 0; - } - oldrh = CurResFile(); - filerh = FSpOpenResFile(&fss, fsRdPerm); - if ( filerh == -1 ) - return 0; - UseResFile(filerh); - } - if ( dataptr == NULL ) - SetResLoad(0); - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# Look for ('PYC ', %s) in %s\n", module, filename); - h = Get1NamedResource(restype, Pstring(module)); - SetResLoad(1); - ok = (h != NULL); - if ( ok && dataptr != NULL ) { - HLock(h); - /* XXXX Unsafe if resource not correctly formatted! */ - /* for ppc we take the first pstring */ - *dataptr = **h; - memcpy(dataptr+1, (*h)+1, (int)*dataptr); - HUnlock(h); - } - if ( filerh != -1 ) - CloseResFile(filerh); - UseResFile(oldrh); - return ok; -} - -/* -** Returns true if the argument has a resource fork, and it contains -** a 'PYC ' resource of the correct name -*/ -int -PyMac_FindResourceModule(obj, module, filename) -PyStringObject *obj; -char *module; -char *filename; -{ - int ok; - - ok = findnamedresource(obj, module, filename, 'PYC ', (StringPtr)0); - return ok; -} - -/* -** Returns true if the argument has a resource fork, and it contains -** a 'PYD ' resource of the correct name -*/ -int -PyMac_FindCodeResourceModule(obj, module, filename) -PyStringObject *obj; -char *module; -char *filename; -{ - int ok; - - ok = findnamedresource(obj, module, filename, 'PYD ', (StringPtr)0); - return ok; -} - - -/* -** Load the specified module from a code resource -*/ -PyObject * -PyMac_LoadCodeResourceModule(name, pathname) - char *name; - char *pathname; -{ - PyObject *m, *d, *s; - char funcname[258]; - char *lastdot, *shortname, *packagecontext; - dl_funcptr p = NULL; - Str255 fragmentname; - CFragConnectionID connID; - Ptr mainAddr; - Str255 errMessage; - OSErr err; - char buf[512]; - Ptr symAddr; - CFragSymbolClass class; - - if ((m = _PyImport_FindExtension(name, name)) != NULL) { - Py_INCREF(m); - return m; - } - lastdot = strrchr(name, '.'); - if (lastdot == NULL) { - packagecontext = NULL; - shortname = name; - } - else { - packagecontext = name; - shortname = lastdot+1; - } - PyOS_snprintf(funcname, sizeof(funcname), FUNCNAME_PATTERN, shortname); - if( !findnamedresource((PyStringObject *)0, name, pathname, 'PYD ', fragmentname)) { - PyErr_SetString(PyExc_ImportError, "PYD resource not found"); - return NULL; - } - - /* Load the fragment - (or return the connID if it is already loaded */ - err = GetSharedLibrary(fragmentname, kCompiledCFragArch, - kLoadCFrag, &connID, &mainAddr, - errMessage); - if ( err ) { - PyOS_snprintf(buf, sizeof(buf), "%.*s: %.200s", - errMessage[0], errMessage+1, - PyMac_StrError(err)); - PyErr_SetString(PyExc_ImportError, buf); - return NULL; - } - /* Locate the address of the correct init function */ - err = FindSymbol(connID, Pstring(funcname), &symAddr, &class); - if ( err ) { - PyOS_snprintf(buf, sizeof(buf), "%s: %.200s", - funcname, PyMac_StrError(err)); - PyErr_SetString(PyExc_ImportError, buf); - return NULL; - } - p = (dl_funcptr)symAddr; - if (p == NULL) { - PyErr_Format(PyExc_ImportError, - "dynamic module does not define init function (%.200s)", - funcname); - return NULL; - } - _Py_PackageContext = packagecontext; - (*p)(); - _Py_PackageContext = NULL; - if (PyErr_Occurred()) - return NULL; - if (_PyImport_FixupExtension(name, name) == NULL) - return NULL; - - m = PyDict_GetItemString(PyImport_GetModuleDict(), name); - if (m == NULL) { - PyErr_SetString(PyExc_SystemError, - "dynamic module not initialized properly"); - return NULL; - } - /* Remember the filename as the __file__ attribute */ - d = PyModule_GetDict(m); - s = PyString_FromString(pathname); - if (s == NULL || PyDict_SetItemString(d, "__file__", s) != 0) - PyErr_Clear(); /* Not important enough to report */ - Py_XDECREF(s); - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # pyd fragment %#s loaded from %s\n", - name, fragmentname, pathname); - Py_INCREF(m); - return m; -} - -/* -** Load the specified module from a resource -*/ -PyObject * -PyMac_LoadResourceModule(module, filename) -char *module; -char *filename; -{ - FSSpec fss; - FInfo finfo; - short oldrh, filerh; - Handle h; - OSErr err; - PyObject *m, *co; - long num, size; - - if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) - goto error; - if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { - /* - ** Special case: the application itself. Use a shortcut to - ** forestall opening and closing the application numerous times - ** (which is dead slow when running from CDROM) - */ - oldrh = CurResFile(); - UseResFile(PyMac_AppRefNum); - filerh = -1; - } else { - if ( (err=FSpGetFInfo(&fss, &finfo)) != noErr ) - goto error; - oldrh = CurResFile(); - filerh = FSpOpenResFile(&fss, fsRdPerm); - if ( filerh == -1 ) { - err = ResError(); - goto error; - } - UseResFile(filerh); - } - h = Get1NamedResource('PYC ', Pstring(module)); - if ( h == NULL ) { - err = ResError(); - goto error; - } - HLock(h); - /* - ** XXXX The next few lines are intimately tied to the format of pyc - ** files. I'm not sure whether this code should be here or in import.c -- Jack - */ - size = GetHandleSize(h); - if ( size < 8 ) { - PyErr_SetString(PyExc_ImportError, "Resource too small"); - co = NULL; - } else { - num = (*h)[0] & 0xff; - num = num | (((*h)[1] & 0xff) << 8); - num = num | (((*h)[2] & 0xff) << 16); - num = num | (((*h)[3] & 0xff) << 24); - if ( num != PyImport_GetMagicNumber() ) { - PyErr_SetString(PyExc_ImportError, "Bad MAGIC in resource"); - co = NULL; - } else { - co = PyMarshal_ReadObjectFromString((*h)+8, size-8); - /* - ** 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 py_resource.py. (jvr) - */ - if ((*h)[4] & 0xff) { - /* it's a package */ - /* Set __path__ to the package name */ - PyObject *d, *s; - int err; - - m = PyImport_AddModule(module); - if (m == NULL) { - co = NULL; - goto packageerror; - } - d = PyModule_GetDict(m); - s = PyString_InternFromString(module); - if (s == NULL) { - co = NULL; - goto packageerror; - } - err = PyDict_SetItemString(d, "__path__", s); - Py_DECREF(s); - if (err != 0) { - co = NULL; - goto packageerror; - } - } - } - } -packageerror: - HUnlock(h); - if ( filerh != -1 ) - CloseResFile(filerh); - else - ReleaseResource(h); - UseResFile(oldrh); - if ( co ) { - m = PyImport_ExecCodeModuleEx(module, co, "<pyc resource>"); - Py_DECREF(co); - } else { - m = NULL; - } - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # pyc resource from %s\n", - module, filename); - return m; -error: - { - char buf[512]; - - PyOS_snprintf(buf, sizeof(buf), "%s: %s", filename, PyMac_StrError(err)); - PyErr_SetString(PyExc_ImportError, buf); - return NULL; - } -} - -/* -** Look for a module in a single folder. Upon entry buf and len -** point to the folder to search, upon exit they refer to the full -** pathname of the module found (if any). -*/ -struct filedescr * -PyMac_FindModuleExtension(char *buf, size_t *lenp, char *module) -{ - struct filedescr *fdp; - unsigned char fnbuf[64]; - int modnamelen = strlen(module); - FSSpec fss; - short refnum; - long dirid; - - /* - ** Copy the module name to the buffer (already :-terminated) - ** We also copy the first suffix, if this matches immedeately we're - ** lucky and return immedeately. - */ - if ( !_PyImport_Filetab[0].suffix ) - return 0; - - strcpy(buf+*lenp, _PyImport_Filetab[0].suffix); - if ( FSMakeFSSpec(0, 0, Pstring(buf), &fss) == noErr ) - return _PyImport_Filetab; - /* - ** We cannot check for fnfErr (unfortunately), it can mean either that - ** the file doesn't exist (fine, we try others) or the path leading to it. - */ - refnum = fss.vRefNum; - dirid = fss.parID; - if ( refnum == 0 || dirid == 0 ) /* Fail on nonexistent dir */ - return 0; - /* - ** We now have the folder parameters. Setup the field for the filename - */ - if ( modnamelen > 54 ) return 0; /* Leave room for extension */ - strcpy((char *)fnbuf+1, module); - buf[*lenp] = '\0'; - - for( fdp = _PyImport_Filetab+1; fdp->suffix; fdp++ ) { - strcpy((char *)fnbuf+1+modnamelen, fdp->suffix); - fnbuf[0] = strlen((char *)fnbuf+1); - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# trying %s%s\n", buf, fdp->suffix); - if ( FSMakeFSSpec(refnum, dirid, fnbuf, &fss) == noErr ) { - /* Found it. */ - strcpy(buf+*lenp, fdp->suffix); - return fdp; - } - } - return 0; -} diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c deleted file mode 100644 index d257142..0000000 --- a/Mac/Python/macmain.c +++ /dev/null @@ -1,640 +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. - -******************************************************************/ - -/* Python interpreter main program */ - -#include "Python.h" -#include "pythonresources.h" -#include "import.h" -#include "marshal.h" -#include "macglue.h" - -#ifdef WITHOUT_FRAMEWORKS -#include <Memory.h> -#include <Resources.h> -#include <stdio.h> -#include <Events.h> -#include <Windows.h> -#include <Fonts.h> -#include <Balloons.h> -#include <CFBundle.h> -#include <CFURL.h> -#include <CFString.h> -#include <CFBase.h> -#include <CFArray.h> -#include <Gestalt.h> -#include <Appearance.h> -#else -#include <Carbon/Carbon.h> -#endif /* WITHOUT_FRAMEWORKS */ - -#ifdef __MWERKS__ -#include <SIOUX.h> -#define USE_SIOUX -extern int ccommand(char ***); -#if __profile__ == 1 -#include <profiler.h> -#endif /* __profile__ */ -#endif /* __MWERKS__ */ - -#include <unistd.h> -#ifdef USE_MAC_SHARED_LIBRARY -extern PyMac_AddLibResources(void); -#endif - -#define STARTUP "PythonStartup" - -#define COPYRIGHT \ - "Type \"copyright\", \"credits\" or \"license\" for more information." - -short PyMac_AppRefNum; /* RefNum of application resource fork */ - -/* For Py_GetArgcArgv(); set by main() */ -static char **orig_argv; -static int orig_argc; - -/* A flag which remembers whether the user has acknowledged all the console -** output (by typing something) -*/ -#define STATE_UNKNOWN 0 -#define STATE_LASTREAD 1 -#define STATE_LASTWRITE 2 -int console_output_state = STATE_UNKNOWN; - -PyMac_PrefRecord PyMac_options; - -static void PyMac_Main(int, char **, char *); /* Forward */ -void PyMac_Exit(int); /* Forward */ - -/* Initialize the Mac toolbox world */ - -static void -init_mac_world(void) -{ - InitCursor(); -} - -/* -** PyMac_InteractiveOptions - Allow user to set options if option key is pressed -*/ -static void -PyMac_InteractiveOptions(PyMac_PrefRecord *p, int *argcp, char ***argvp) -{ - KeyMap rmap; - unsigned char *map; - short item, type; - ControlHandle handle; - DialogPtr dialog; - Rect rect; - - /* - ** If the preferences disallows interactive options we return, - ** similarly of <option> isn't pressed. - */ - if (p->nointopt) return; - - GetKeys(rmap); - map = (unsigned char *)rmap; - if ( ( map[0x3a>>3] & (1<<(0x3a&7)) ) == 0 ) /* option key is 3a */ - return; - - dialog = GetNewDialog(OPT_DIALOG, NULL, (WindowPtr)-1); - if ( dialog == NULL ) { - printf("Option dialog not found - cannot set options\n"); - return; - } - SetDialogDefaultItem(dialog, OPT_OK); - SetDialogCancelItem(dialog, OPT_CANCEL); - - /* Set default values */ -#define SET_OPT_ITEM(num, var) \ - GetDialogItem(dialog, (num), &type, (Handle *)&handle, &rect); \ - SetControlValue(handle, (short)p->var); - - SET_OPT_ITEM(OPT_INSPECT, inspect); - SET_OPT_ITEM(OPT_VERBOSE, verbose); - /* OPT_VERBOSEVERBOSE is default off */ - SET_OPT_ITEM(OPT_OPTIMIZE, optimize); - SET_OPT_ITEM(OPT_UNBUFFERED, unbuffered); - SET_OPT_ITEM(OPT_DEBUGGING, debugging); - GetDialogItem(dialog, OPT_KEEPALWAYS, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ALWAYS)); - GetDialogItem(dialog, OPT_KEEPOUTPUT, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_OUTPUT)); - GetDialogItem(dialog, OPT_KEEPERROR, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ERROR)); - GetDialogItem(dialog, OPT_KEEPNEVER, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_NEVER)); -/* SET_OPT_ITEM(OPT_KEEPCONSOLE, keep_console); */ - SET_OPT_ITEM(OPT_TABWARN, tabwarn); - SET_OPT_ITEM(OPT_NOSITE, nosite); - SET_OPT_ITEM(OPT_DIVISIONWARN, divisionwarn); - SET_OPT_ITEM(OPT_UNIXNEWLINES, unixnewlines); - /* The rest are not settable interactively */ - -#undef SET_OPT_ITEM - - while (1) { - handle = NULL; - ModalDialog(NULL, &item); - if ( item == OPT_OK ) - break; - if ( item == OPT_CANCEL ) { - DisposeDialog(dialog); - exit(0); - } - if ( item == OPT_CMDLINE ) { - int old_argc = *argcp; - int i; - int new_argc, newer_argc; - char **new_argv, **newer_argv; - - new_argc = ccommand(&new_argv); - newer_argc = (new_argc-1) + old_argc; - newer_argv = malloc((newer_argc+1)*sizeof(char *)); - if( !newer_argv ) - Py_FatalError("Cannot malloc argv\n"); - for(i=0; i<old_argc; i++) - newer_argv[i] = (*argvp)[i]; - for(i=old_argc; i<=newer_argc; i++) /* Copy the NULL too */ - newer_argv[i] = new_argv[i-old_argc+1]; - *argvp = newer_argv; - *argcp = newer_argc; - - /* XXXX Is it not safe to use free() here, apparently */ - } -#define OPT_ITEM(num, var) \ - if ( item == (num) ) { \ - p->var = !p->var; \ - GetDialogItem(dialog, (num), &type, (Handle *)&handle, &rect); \ - SetControlValue(handle, (short)p->var); \ - } - - OPT_ITEM(OPT_INSPECT, inspect); - OPT_ITEM(OPT_VERBOSE, verbose); - if ( item == OPT_VERBOSEVERBOSE ) { - if ( p->verbose == 2 ) - p->verbose = 1; - else - p->verbose = 2; - GetDialogItem(dialog, OPT_VERBOSE, &type, (Handle *)&handle, &rect); - SetControlValue(handle, 1); - } - GetDialogItem(dialog, OPT_VERBOSEVERBOSE, &type, (Handle *)&handle, &rect); - SetControlValue(handle, p->verbose == 2); - OPT_ITEM(OPT_OPTIMIZE, optimize); - OPT_ITEM(OPT_UNBUFFERED, unbuffered); - OPT_ITEM(OPT_DEBUGGING, debugging); - if ( item == OPT_KEEPALWAYS ) p->keep_console = POPT_KEEPCONSOLE_ALWAYS; - if ( item == OPT_KEEPOUTPUT ) p->keep_console = POPT_KEEPCONSOLE_OUTPUT; - if ( item == OPT_KEEPERROR ) p->keep_console = POPT_KEEPCONSOLE_ERROR; - if ( item == OPT_KEEPNEVER ) p->keep_console = POPT_KEEPCONSOLE_NEVER; - GetDialogItem(dialog, OPT_KEEPALWAYS, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ALWAYS)); - GetDialogItem(dialog, OPT_KEEPOUTPUT, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_OUTPUT)); - GetDialogItem(dialog, OPT_KEEPERROR, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_ERROR)); - GetDialogItem(dialog, OPT_KEEPNEVER, &type, (Handle *)&handle, &rect); - SetControlValue(handle, (short)(p->keep_console == POPT_KEEPCONSOLE_NEVER)); - OPT_ITEM(OPT_TABWARN, tabwarn); - OPT_ITEM(OPT_NOSITE, nosite); - OPT_ITEM(OPT_DIVISIONWARN, divisionwarn); - OPT_ITEM(OPT_UNIXNEWLINES, unixnewlines); - -#undef OPT_ITEM - } - DisposeDialog(dialog); -} - -/* -** Initialization code, shared by interpreter and applets -*/ -static void -init_common(int *argcp, char ***argvp, int embedded) -{ - /* Remember resource fork refnum, for later */ - PyMac_AppRefNum = CurResFile(); - - /* Initialize toolboxes */ - init_mac_world(); - -#ifdef USE_MAC_SHARED_LIBRARY - /* Add the shared library to the stack of resource files */ - (void)PyMac_init_process_location(); - PyMac_AddLibResources(); -#endif - -#if defined(USE_GUSI) - atexit(PyMac_StopGUSISpin); -#endif - -#ifdef USE_SIOUX - /* Set various SIOUX flags. Some are changed later based on options */ - SIOUXSettings.asktosaveonclose = 0; - SIOUXSettings.showstatusline = 0; - SIOUXSettings.tabspaces = 4; -#endif - - /* Get options from preference file (or from applet resource fork) */ - PyMac_options.keep_console = POPT_KEEPCONSOLE_OUTPUT; /* default-default */ - PyMac_options.unixnewlines = 1; - PyMac_PreferenceOptions(&PyMac_options); - - if ( embedded ) { - static char *emb_argv[] = {"embedded-python", 0}; - - *argcp = 1; - *argvp = emb_argv; - } else { - /* Create argc/argv. Do it before we go into the options event loop. - ** In MachoPython we skip this step if we already have plausible - ** command line arguments. - */ - *argcp = PyMac_GetArgv(argvp, PyMac_options.noargs); -#ifndef NO_ARGV0_CHDIR - if (*argcp >= 1 && (*argvp)[0] && (*argvp)[0][0]) { - /* Workaround for MacOS X, which currently (DP4) doesn't set - ** the working folder correctly - */ - char app_wd[256], *p; - - strncpy(app_wd, (*argvp)[0], 256); - p = strrchr(app_wd, ':'); - if ( p ) *p = 0; - chdir(app_wd); - } -#endif - /* Do interactive option setting, if allowed and <option> depressed */ - PyMac_InteractiveOptions(&PyMac_options, argcp, argvp); - } - - /* Copy selected options to where the machine-independent stuff wants it */ - Py_VerboseFlag = PyMac_options.verbose; -/* Py_SuppressPrintingFlag = PyMac_options.suppress_print; */ - Py_OptimizeFlag = PyMac_options.optimize; - Py_DebugFlag = PyMac_options.debugging; - Py_NoSiteFlag = PyMac_options.nosite; - Py_TabcheckFlag = PyMac_options.tabwarn; - Py_DivisionWarningFlag = PyMac_options.divisionwarn; - if ( PyMac_options.noargs ) { - /* don't process events at all without the scripts permission */ - PyMacSchedParams scp; - - PyMac_GetSchedParams(&scp); - scp.process_events = 0; - /* Should we disable command-dot as well? */ - PyMac_SetSchedParams(&scp); - } - - /* Set buffering */ - if (PyMac_options.unbuffered) { -#ifndef MPW - setbuf(stdout, (char *)NULL); - setbuf(stderr, (char *)NULL); -#else - /* On MPW (3.2) unbuffered seems to hang */ - setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); - setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ); -#endif - } -#if __profile__ == 1 - /* collectSummary or collectDetailed, timebase, #routines, max stack depth */ - ProfilerInit(collectSummary, bestTimeBase, 8000, 250); -#endif - - /* Tell the rest of python about our argc/argv */ - orig_argc = *argcp; /* For Py_GetArgcArgv() */ - orig_argv = *argvp; - Py_SetProgramName((*argvp)[0]); -} - -/* -** Inspection mode after script/applet termination -*/ -static int -run_inspect(void) -{ - int sts = 0; - - if (PyMac_options.inspect && isatty((int)fileno(stdin))) - sts = PyRun_AnyFile(stdin, "<stdin>") != 0; - return sts; -} - -#ifdef USE_MAC_APPLET_SUPPORT -/* Applet support */ - -/* Run a compiled Python Python script from 'PYC ' resource __main__ */ -static int -run_main_resource(void) -{ - Handle h; - long size; - PyObject *code; - PyObject *result; - - h = GetNamedResource('PYC ', "\p__main__"); - if (h == NULL) { - Alert(NOPYC_ALERT, NULL); - return 1; - } - size = GetResourceSizeOnDisk(h); - HLock(h); - code = PyMarshal_ReadObjectFromString(*h + 8, (int)(size - 8)); - HUnlock(h); - ReleaseResource(h); - if (code == NULL) { - PyErr_Print(); - return 1; - } - result = PyImport_ExecCodeModule("__main__", code); - Py_DECREF(code); - if (result == NULL) { - PyErr_Print(); - return 1; - } - Py_DECREF(result); - return 0; -} - -/* Initialization sequence for applets */ -void -PyMac_InitApplet(void) -{ - int argc; - char **argv; - int err; - - init_common(&argc, &argv, 0); - - Py_Initialize(); - PySys_SetArgv(argc, argv); - - err = run_main_resource(); - - err = (run_inspect() || err); - - fflush(stderr); - fflush(stdout); - PyMac_Exit(err); - /* XXX Should we bother to Py_Exit(sts)? */ -} - -/* -** Hook for embedding python. -*/ -void -PyMac_Initialize(void) -{ - int argc; - char **argv; - - init_common(&argc, &argv, 1); - Py_Initialize(); - PySys_SetArgv(argc, argv); -} - -#endif /* USE_MAC_APPLET_SUPPORT */ - -/* For normal application */ -void -PyMac_InitApplication(void) -{ - int argc; - char **argv; - OSType filetype; - - static char scriptpath[1024]; - char *script = NULL; - - init_common(&argc, &argv, 0); - - if ( argc > 1 ) { - /* We're running a script. Attempt to change current directory */ - char curwd[256], *endp; - - strcpy(curwd, argv[1]); - endp = strrchr(curwd, ':'); - if ( endp && endp > curwd ) { - *endp = '\0'; - - chdir(curwd); - } - /* Check that the first argument is a text file */ - filetype = PyMac_getfiletype(argv[1]); - if ( filetype != 'TEXT' && filetype != 0 ) { - Alert(NOTASCRIPT_ID, NULL); - exit(0); - } - } - PyMac_Main(argc, argv, script); -} - -/* Main program */ - -static void -PyMac_Main(int argc, char **argv, char *filename) -{ - int sts; - char *command = NULL; - FILE *fp = stdin; - - if ( filename ) { - /* Someone else has found our "script" already */ - argv[0] = filename; - } else { - filename = argv[1]; - argv++; - argc--; - } - - if (Py_VerboseFlag || - (command == NULL && filename == NULL && isatty((int)fileno(fp)))) - fprintf(stderr, "%s %s on %s\n%s\n", - "Python", - Py_GetVersion(), Py_GetPlatform(), COPYRIGHT); - - if (filename != NULL) { - if ((fp = fopen(filename, "r" PY_STDIOTEXTMODE)) == NULL) { - fprintf(stderr, "%s: can't open file '%s'\n", - argv[0], filename); - PyMac_Exit(2); - } - } - - /* We initialize the menubar here, hoping SIOUX is initialized by now */ - PyMac_InitMenuBar(); - - Py_Initialize(); - -#if 0 - /* According to Martin v. Loewis this is a bad idea... */ - PyUnicode_SetDefaultEncoding(PyMac_getscript()); -#endif - - PySys_SetArgv(argc, argv); - - if (filename == NULL && isatty((int)fileno(fp))) { - FILE *fp = fopen(STARTUP, "r" PY_STDIOTEXTMODE); - if (fp != NULL) { - (void) PyRun_SimpleFile(fp, STARTUP); - PyErr_Clear(); - fclose(fp); - } - } - sts = PyRun_AnyFile( - fp, filename == NULL ? "<stdin>" : filename) != 0; - if (filename != NULL) - fclose(fp); - - if ( filename != NULL || command != NULL ) - sts = (run_inspect() || sts); - - Py_Exit(sts); - /*NOTREACHED*/ -} - -/* -** Reset the "unseen output" flag -*/ -void -PyMac_OutputSeen(void) -{ - if ( console_output_state == STATE_UNKNOWN ) - PyMac_InitMenuBar(); - console_output_state = STATE_LASTREAD; -} - -/* -** Set the "unseen output" flag -*/ -void -PyMac_OutputNotSeen(void) -{ - if ( console_output_state == STATE_UNKNOWN ) - PyMac_InitMenuBar(); - console_output_state = STATE_LASTWRITE; -} - -/* -** Override abort() - The default one is not what we want. -*/ -void -abort(void) -{ - console_output_state = STATE_LASTWRITE; - PyMac_Exit(1); -} - -/* -** Terminate application -*/ -void -PyMac_Exit(int status) -{ -#ifdef USE_SIOUX - int keep = 0; -#endif - -#if __profile__ == 1 - ProfilerDump("\pPython Profiler Results"); - ProfilerTerm(); -#endif - -#ifdef USE_SIOUX - switch (PyMac_options.keep_console) { - case POPT_KEEPCONSOLE_NEVER: - keep = 0; - break; - case POPT_KEEPCONSOLE_OUTPUT: - if (console_output_state == STATE_LASTWRITE || - console_output_state == STATE_UNKNOWN ) - keep = 1; - else - keep = 0; - break; - case POPT_KEEPCONSOLE_ERROR: - keep = (status != 0); - break; - default: - keep = 1; - } - if (keep) { - SIOUXSettings.standalone = 1; - SIOUXSettings.autocloseonquit = 0; - SIOUXSetTitle("\p\307terminated\310"); - PyMac_RaiseConsoleWindow(); - PyMac_RestoreMenuBar(); -#ifdef USE_MSL - /* - ** Temporary workaround: autocloseonquit clearing does not - ** currently work for the MSL/GUSI combo. - */ - while(getchar() > 0); -#endif - } - else - SIOUXSettings.autocloseonquit = 1; -#endif /* USE_SIOUX */ - - exit(status); -} - -/* Make the *original* argc/argv available to other modules. - This is rare, but it is needed by the secureware extension. */ - -void -Py_GetArgcArgv(int *argc,char ***argv) -{ - *argc = orig_argc; - *argv = orig_argv; -} - -/* More cruft that shouldn't really be here, used in sysmodule.c */ -/* Return the program name -- some code out there needs this. */ -char * -Py_GetProgramFullPath(void) -{ - return orig_argv[0]; -} - -char * -Py_GetPrefix(void) -{ - return PyMac_GetPythonDir(); -} - -char * -Py_GetExecPrefix(void) -{ - return PyMac_GetPythonDir(); -} - -int -PyMac_GetDelayConsoleFlag(void) -{ - return (int)PyMac_options.delayconsole; -} - diff --git a/Mac/Python/macsetfiletype.c b/Mac/Python/macsetfiletype.c deleted file mode 100644 index b2d9531..0000000 --- a/Mac/Python/macsetfiletype.c +++ /dev/null @@ -1,75 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* - * macsetfiletype - Set the mac's idea of file type - * - */ - -#include "Python.h" -#include "macglue.h" -#include "macdefs.h" - -int -PyMac_setfiletype(name, creator, type) -char *name; -long creator, type; -{ - FInfo info; - FSSpec fss; - unsigned char *pname; - - pname = (StringPtr) Pstring(name); - if (FSMakeFSSpec(0, 0, pname, &fss) < 0 ) - return -1; - if ( FSpGetFInfo(&fss, &info) < 0 ) - return -1; - info.fdType = type; - info.fdCreator = creator; - return FSpSetFInfo(&fss, &info); -} - -long -PyMac_getfiletype(name) -char *name; -{ - FInfo info; - unsigned char *pname; - FSSpec fss; - - pname = (StringPtr) Pstring(name); - if (FSMakeFSSpec(0, 0, pname, &fss) < 0 ) - return -1; - if ( FSpGetFInfo(&fss, &info) < 0 ) - return -1; - return info.fdType; -} - diff --git a/Mac/Python/macshlglue.c b/Mac/Python/macshlglue.c deleted file mode 100644 index d88d443..0000000 --- a/Mac/Python/macshlglue.c +++ /dev/null @@ -1,128 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* -** Shared library initialization code. -** -** This code calls the MetroWerks shared-library initialization code -** and performs one extra step: it remembers the FSSpec of the file -** we are loaded from, so we can later call PyMac_AddLibResources to -** add the file to our resource file chain. -** -** This file is needed for PythonCore and for any dynamically loaded -** module that has interesting resources in its .slb file. -** Use by replacing __initialize in the "CFM preferences" init field -** by __initialize_with_resources. -*/ - -#include <Types.h> -#include <Quickdraw.h> -#include <SegLoad.h> -#include <CodeFragments.h> -#include <Files.h> -#include <Resources.h> - -/* Defined in the MSL runtime: */ -extern void __initialize(void); - -/* Defined either in macglue.c or in a MPW library: */ -extern pascal short PLstrcmp(const unsigned char *, const unsigned char *); - -/* -** Variables passed from shared lib initialization to PyMac_AddLibResources. -*/ -static int library_fss_valid; -static FSSpec library_fss; - -/* -** Routine called upon fragment load. We attempt to save the FSSpec from which we're -** loaded. We always return noErr (we just continue without the resources). -*/ -OSErr pascal -__initialize_with_resources(CFragInitBlockPtr data) -{ - /* Call the MW runtime's initialization routine */ - __initialize(); - - if ( data == nil ) return noErr; - if ( data->fragLocator.where == kDataForkCFragLocator ) { - library_fss = *data->fragLocator.u.onDisk.fileSpec; - library_fss_valid = 1; - } else if ( data->fragLocator.where == kResourceCFragLocator ) { - library_fss = *data->fragLocator.u.inSegs.fileSpec; - library_fss_valid = 1; - } - return noErr; -} - -/* -** compare two FSSpecs, return true if equal, false if different -** XXX where could this function live? (jvr) -*/ - -static int -FSpCompare(FSSpec *fss1, FSSpec *fss2) { - if (fss1->vRefNum != fss2->vRefNum) - return 0; - if (fss1->parID != fss2->parID) - return 0; - return !PLstrcmp(fss1->name, fss2->name); -} - -/* XXX can't include "macglue.h" somehow (jvr) */ -extern FSSpec PyMac_ApplicationFSSpec; /* Application location (from macargv.c) */ - -/* -** Insert the library resources into the search path. Put them after -** the resources from the application (which we assume is the current -** resource file). Again, we ignore errors. -*/ -void -PyMac_AddLibResources() -{ - if ( !library_fss_valid || FSpCompare(&library_fss, &PyMac_ApplicationFSSpec)) - return; - (void)FSpOpenResFile(&library_fss, fsRdPerm); -} - -/* -** Dummy main() program to keep linker happy: we want to -** use the MW AppRuntime in our shared library (better than building -** custom runtime libraries as we did before) but AppRuntime -** expects a main program. Note that it -*/ - -#pragma export off -int -main(int argc, char **argv) { - DebugStr("\pCannot happen: PythonCore dummy main called!"); -} -#pragma export reset diff --git a/Mac/Python/pyGUSISIOUX.cp b/Mac/Python/pyGUSISIOUX.cp deleted file mode 100644 index 4e63ebe..0000000 --- a/Mac/Python/pyGUSISIOUX.cp +++ /dev/null @@ -1,239 +0,0 @@ -/* -** Modified version of GUSISIOUX.cp especially for Python. -** Changes (by Jack): -** - Optionally delay the console window until something is written to it. -** - Tell the upper layers whether the last command was a read or a write. -** - Tell SIOUX not to use WaitNextEvent (both Python and SIOUX trying to be -** nice to background apps means we're yielding almost 100% of the time). -** - Make sure signals are processed when returning from read/write. -*/ -#define GUSI_SOURCE -#include "GUSIInternal.h" -#include "GUSISIOUX.h" -#include "GUSIDevice.h" -#include "GUSIDescriptor.h" -#include "GUSIBasics.h" -#include "GUSIDiag.h" -//#ifndef WITHOUT_JACK_MODS -//#include "GUSIConfig.h" -//#endif - -#include <LowMem.h> - -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <errno.h> -#include <console.h> - -#include "Python.h" -#include "macglue.h" -extern Boolean SIOUXUseWaitNextEvent; - -static PyReadHandler sInConsole = 0L; -static PyWriteHandler sOutConsole = 0L; -static PyWriteHandler sErrConsole = 0L; - -inline bool hasCustomConsole(void) { return sInConsole != 0L; } - -class GUSISIOUXSocket : public GUSISocket { -public: - ~GUSISIOUXSocket(); - - -ssize_t read(const GUSIScatterer & buffer); -ssize_t write(const GUSIGatherer & buffer); -virtual int ioctl(unsigned int request, va_list arg); -virtual int fstat(struct stat * buf); -virtual int isatty(); -bool select(bool * canRead, bool * canWrite, bool *); - - static GUSISIOUXSocket * Instance(int fd); -private: - GUSISIOUXSocket(int fd); - static bool initialized; - static void Initialize(); - int fFd; -}; -class GUSISIOUXDevice : public GUSIDevice { -public: - static GUSISIOUXDevice * Instance(); - - -virtual bool Want(GUSIFileToken & file); -virtual GUSISocket * open(GUSIFileToken &, int flags); -private: - GUSISIOUXDevice() {} - - static GUSISIOUXDevice * sInstance; -}; - -GUSISIOUXSocket * GUSISIOUXSocket::Instance(int fd) -{ - return new GUSISIOUXSocket(fd); -} -// This declaration lies about the return type -extern "C" void SIOUXHandleOneEvent(EventRecord *userevent); - -bool GUSISIOUXSocket::initialized = false; - -GUSISIOUXSocket::GUSISIOUXSocket(int fd) : fFd(fd) -{ - if (!hasCustomConsole()) { - if (!PyMac_GetDelayConsoleFlag() && !initialized) - Initialize(); - /* Tell the upper layers there's no unseen output */ - PyMac_OutputSeen(); - } -} - -void -GUSISIOUXSocket::Initialize() -{ - if(!initialized && !hasCustomConsole()) - { - initialized = true; - InstallConsole(0); - GUSISetHook(GUSI_EventHook+nullEvent, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+mouseDown, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+mouseUp, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+updateEvt, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+diskEvt, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+activateEvt, (GUSIHook)SIOUXHandleOneEvent); - GUSISetHook(GUSI_EventHook+osEvt, (GUSIHook)SIOUXHandleOneEvent); - PyMac_InitMenuBar(); - } -} -GUSISIOUXSocket::~GUSISIOUXSocket() -{ - if ( !initialized || hasCustomConsole() ) - return; - - initialized = false; - RemoveConsole(); -} -ssize_t GUSISIOUXSocket::read(const GUSIScatterer & buffer) -{ - if(hasCustomConsole()) - { - if(fFd == 0) - return buffer.SetLength( - sInConsole((char *) buffer.Buffer(), (int)buffer.Length())); - - return 0; - } - - if ( !initialized ) Initialize(); - GUSIStdioFlush(); - PyMac_OutputSeen(); - PyMac_RaiseConsoleWindow(); - return buffer.SetLength( - ReadCharsFromConsole((char *) buffer.Buffer(), (int)buffer.Length())); - GUSIContext::Yield(kGUSIPoll); -} -ssize_t GUSISIOUXSocket::write(const GUSIGatherer & buffer) -{ - if(hasCustomConsole()) - { - if(fFd == 1) - return sOutConsole((char *) buffer.Buffer(), (int)buffer.Length()); - else if(fFd == 2) - return sErrConsole((char *) buffer.Buffer(), (int)buffer.Length()); - - return 0; - } - - ssize_t rv; - - if ( !initialized ) Initialize(); - PyMac_OutputNotSeen(); - SIOUXUseWaitNextEvent = false; - rv = WriteCharsToConsole((char *) buffer.Buffer(), (int)buffer.Length()); - GUSIContext::Yield(kGUSIPoll); - return rv; -} -int GUSISIOUXSocket::ioctl(unsigned int request, va_list) -{ - switch (request) { - case FIOINTERACTIVE: - return 0; - default: - return GUSISetPosixError(EOPNOTSUPP); - } -} -int GUSISIOUXSocket::fstat(struct stat * buf) -{ - GUSISocket::fstat(buf); - buf->st_mode = S_IFCHR | 0666; - - return 0; -} -int GUSISIOUXSocket::isatty() -{ - return 1; -} -static bool input_pending() -{ - return false; -} - -bool GUSISIOUXSocket::select(bool * canRead, bool * canWrite, bool *) -{ - if ( !initialized ) Initialize(); - bool cond = false; - if (canRead) - if (*canRead = input_pending()) - cond = true; - if (canWrite) - cond = *canWrite = true; - - return cond; -} -GUSISIOUXDevice * GUSISIOUXDevice::sInstance; -GUSISIOUXDevice * GUSISIOUXDevice::Instance() -{ - if (!sInstance) - sInstance = new GUSISIOUXDevice(); - return sInstance; -} -bool GUSISIOUXDevice::Want(GUSIFileToken & file) -{ - switch (file.WhichRequest()) { - case GUSIFileToken::kWillOpen: - return file.IsDevice() && (file.StrStdStream(file.Path()) > -1); - default: - return false; - } -} -GUSISocket * GUSISIOUXDevice::open(GUSIFileToken &, int) -{ - return GUSISIOUXSocket::Instance(1); -} -void GUSISetupConsoleDescriptors() -{ - GUSIDescriptorTable * table = GUSIDescriptorTable::Instance(); - - table->InstallSocket(GUSISIOUXSocket::Instance(0)); - table->InstallSocket(GUSISIOUXSocket::Instance(1)); - table->InstallSocket(GUSISIOUXSocket::Instance(2)); -} - -void PyMac_SetConsoleHandler(PyReadHandler stdinH, PyWriteHandler stdoutH, PyWriteHandler stderrH) -{ - if(stdinH && stdoutH && stderrH) - { - sInConsole = stdinH; - sOutConsole = stdoutH; - sErrConsole = stderrH; - } -} - -long PyMac_DummyReadHandler(char *buffer, long n) -{ - return 0; -} - -long PyMac_DummyWriteHandler(char *buffer, long n) -{ - return 0; -} diff --git a/Mac/ReadMe b/Mac/ReadMe deleted file mode 100644 index a7dcf37..0000000 --- a/Mac/ReadMe +++ /dev/null @@ -1,228 +0,0 @@ -How to install MacPython-OS9 2.3a2 on your Macintosh ----------------------------------------------------- - -This is a MacPython that can run on Mac OS 8.6 with CarbonLib -installed, Mac OS 9 and Mac OS X. It is the direct successor of MacPython 2.2. - -For Mac OS X users: you are probably better off with the normal unix distribution -of Python. That version also runs from the commandline, and if you do a framework -build it will contain all the functionality of this version too. A prebuilt -version will be available starting with the beta distributions. - -If you are upgrading from a previous MacPython you should read :Misc:NEWS, -which lists the new features of this Python release. As of this release -the Mac-specific release notes have been moved to the "Mac" section of -the general NEWS file. - -Two changes since 2.2 deserve special mention: -- Most Mac-specific modules have moved to :Lib:plat-mac. :Mac:Lib now contains - only modules that are not shared with MacPython-OSX 2.3. -- macfs is now a pure Python wrapper module around various modules in the - Carbon package. For 2.3a2 only this wrapping is incomplete: fsspec.SetDates() - does not work yet. If you encounter any other problems please report them. - ------- - -If this is your first encounter with Python: you definitely need the -common user documentation (common to all platforms). You can find this -(in various forms) on www.pythonlabs.com, www.python.org and -ftp.python.org. Through there, or via -http://www.cwi.nl/~jack/macpython.html you can also find the most recent -MacPython distribution. - -Mac-specific documentation is included in this distribution in folder -Mac:Demo. The documentation is sparse, but it will have to serve for -now. The documentation is in HTML format, start with index.html. - -If you want a MacPython that runs on systems without Carbon support (8.1 -up to 8.6 without CarbonLib) you should get MacPython 2.2.2. - -If you want 68k support you will have get MacPython 1.5.2. - -What to install ---------------- - -The optional parts in this distribution are -- PIL: the Python image manipulation package (allows you to read, write - and display images and do lots of operations on them). Tkinter is no - longer supported, a working Carbon version is Tk is not available. -- img: another imaging package. Has more file format support and is faster - than imaging, but has only limited operations on images. There is a bridge - between the packages. -- Numeric: the LLNL Numeric Python extension. All sorts of nifty operations - on matrices and such. This is version 22. -- Developers kit: all header files and some tools and sample projects - to get you started on writing Python extensions if you have CodeWarrior. -All these except the DevKit are installed with Easy Install. - -After the installer finishes it automatically launches the -ConfigurePython applet, to finish configuration of your Python. - -Moving your Python installation after installing is generally not a -good idea. If you have to do this anyway you should remove your -preference file, run ConfigurePython and remove all .pyc -files. (there's a script zappyc.py that does the latter). - -If you don't have enough memory: the sizes choosen are somewhat -arbitrary, and they are as high as they are so that test.autotest runs -with fewer problems. An average Python program can make do with much -less memory. Try lowering the application sizes in the finder "get -info" window, and seeing whether the resulting python is still usable. - -After installing ----------------- - -It is probably a good idea to run the automatic tests. Start -Python and "import test.regrtest ; test.regrtest.main()". - -On MacOS 8.6 a number of tests will fail because FSRefs are not -supported. - -test_socket and test_logging fail, this problem is being investigated. - -test_tarfile fails, this problem is being investigated. - -Three tests will fail on MacOS9 with MemoryErrors: -test_longexp, test_sha and test_zlib (on MacOSX these should pass). - -If you increase the PythonInterpreter memory partition size they will -pass (but for longexp you have to increase it by an incredible amount, -400MB is rumoured). It will, however, print some messages about -optional features not supported. You should not worry about these, -they are modules that are supported by Python on other -platforms. Also, if you didn't run compileall before autotesting you -may run out of memory the first time you run the tests. test_socket -may also fail if you have no internet connection. Please also read the -Relnotes file for other minor problems with this distribution. - -Using Python is most easily done from the IDE, which has a builtin -editor, debugger and other goodies. The alternative is to use -PythonInterpreter, which is the lowlevel interpreter with a -console-window only (similar to Unix Python). - -If your program uses Tkinter you MUST run it under PythonInterpreter, -Tkinter and IDE are incompatible and your program will fail in strange -ways. - -OSX Multiple users note ------------------------ - -Interaction with Mac OS X multiple users has been tested only very lightly. -If you install as a privileged user everything installs fine. - -If you install as a non-privileged user everything should install in your local -per-user folders. But: as there is no global PythonCore you can only run applets -if they reside in your toplevel Python folder. - -If you install as a privileged user and then try to run -Python as another (non-privileged) user you may encounter a problem with -not having a preference file: the symptom is failing to import all sorts -of standard modules. If you remove your per-user Python preference files -(in ~/Library/Preferences) and then run PythonInterpreter once everything should -be fine. - -Uninstalling ------------- - -Up to three items are installed in the MacOS 8 or 9 system folder: the interpreter -shared library PythonCore lives in the Extensions -folder and the "Python 2.3a2 Preferences" file in the Python subfolder -in the Preferences folder. All the rest of Python lives in the folder -you installed in. - -On OSX the library is installed in /Library/CFMSupport. The ConfigurePython -applets will complain if you have no right to create the libraries there -(you need Admin privileges). This has one consequence: you will not be able to -run applets unless they reside in the MacPython folder (such as the IDE or -EditPythonPrefs). If you try to run an applet stored elsewhere you will -get a "Cannot locate PythonCore" error message. - -Things to see -------------- - -Start off at Mac:Demo:index.html. Read at least the first few sections. - -There is also a first stab at documentation (plus examples) in the -Mac:Demo folder. The toplevel Demo folder has machine-independent demos. - -The ":Mac:scripts" folder has some sample scripts. Some are useful, -some are just interesting to look at to see how various things -work. The MkDistr, mkapplet and fullbuild scripts (plus the ones -mentioned above) may help you to understand how to use AppleEvents and -various other toolboxes from python. - -Other mac-specific goodies can be found in :Mac:Tools, of which the -IDE sources and a CGI framework deserve special mention. - -The 'img' group of modules, which handles I/O of many different image -formats is included, but without documentation. You can find docs at -ftp://ftp.cwi.nl/pub/jack/python/img (or somewhere around there). - -Finally there is a Mac:Contrib folder which contains some contributed -software. - -Upgrading from older Python releases ------------------------------------- - -Python releases are independent of each other, with separate -Preferences files, shared library names, etc. The good news is that -this means you can keep your older version around if you are unsure -whether to upgrade. The bad news is that your old preference settings -are lost and you have to set them again. - -After you are satisfied that 2.3a2 works as expected you can trash -anything in the system folder that has "python" in the name and not -"2.3a2". - -The ConfigurePython applet will try to detect incompatible -preferences files and offer to remove them. This means that re-running -ConfigurePython after a second install of the same MacPython version -(or after moving the Python folder) should fix things up correctly. - -The installer -------------- - -The installer for this product was created using Installer VISE -from MindVision Software. For more information on Installer VISE, -contact: -MindVision Software -7201 North 7th Street -Lincoln, NE 68521-8913 -Voice: 402-477-3269 -Fax: 402-477-1395 -Internet: mindvision@mindvision.com -http://www.mindvision.com - -Just van Rossum <just@letterror.com> created the initial version of the -installer (with Installer Vise Lite), and Jack worked from there. - -Thanks! -------- - -As of Python 2.3 the MacPython thanks list has been merged into the -general acknowledgements, see :Misc:ACKS. - -MacPython includes waste, a TextEdit replacement which is (c) 1998 -Marco Piovanelli. - -A special mention is deserved by Matthias Neeracher, who has written -the brilliant unix-compatible GUSI I/O library, without which -MacPython would not have sockets or select, and to Alexandre -Parenteau, who has ported this library to Carbon. - -Feedback --------- - -Send bug reports, suggestions, contributions and fanmail to -<jack@cwi.nl>. However, a better way to discuss MacPython is to join the -<pythonmac-sig@python.org> mailing list, which is explicitly meant for -this purpose. - - -Jack Jansen -CWI -Kruislaan 413 -1098 SJ Amsterdam -the Netherlands - -<jack@cwi.nl>, http://www.cwi.nl/~jack diff --git a/Mac/ReadMe-dev b/Mac/ReadMe-dev deleted file mode 100644 index 7e75da5..0000000 --- a/Mac/ReadMe-dev +++ /dev/null @@ -1,11 +0,0 @@ -This is the ReadMe for the plugin development option of the MacPython 2.0 -distribution. - -One example project is included, PlugIns:xx.prj - -More information can be found in the following files: - -Mac:ReadMe ReadMe file for the normal (binary) distribution -Relnotes Release notes, listing changes from previous releases -Readmefiles Readme files as supplied by Guido (platform independent changes) -Mac:Demo:building.html Instructions for building Python, folder structure, etc. diff --git a/Mac/ReadMe-src b/Mac/ReadMe-src deleted file mode 100644 index b07a4e9..0000000 --- a/Mac/ReadMe-src +++ /dev/null @@ -1,13 +0,0 @@ -This is the Python 1.5.2b1 source distribution. More information can be found -in the following files: - -Mac:ReadMe ReadMe file for the normal (binary) distribution -Relnotes Release notes, listing changes from previous releases -Readmefiles Readme files as supplied by Guido (platform independent changes) -Mac:Demo:building.html Instructions for building Python, folder structure, etc. - -This distribution usually lives somewhere under http://www.cwi.nl/~jack/macpython.html -or ftp://ftp.cwi.nl/pub/jack/python/mac. - - - Jack Jansen, <jack@cwi.nl>, 21-Jan-99 diff --git a/Mac/Resources/Carbon.r b/Mac/Resources/Carbon.r deleted file mode 100644 index 99bec4f..0000000 --- a/Mac/Resources/Carbon.r +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Permit this Carbon application to launch on OS X - * - * by Josef W. Wankerl - * 04/11/00 - */ -#define USE_CARB_RESOURCE -#ifdef USE_CARB_RESOURCE -/*----------------------------carb € Carbon on OS X launch information --------------------------*/ -type 'carb' { -}; - - -resource 'carb'(0) { -}; -#else - -#include "macbuildno.h" - -#include "patchlevel.h" - -type 'plst' -{ - string; -}; - -resource 'plst' (0) -{ - "CFBundleName = \"MacPython\";\n" /* short name for Mac OS X */ - "CFBundleShortVersionString = \""PY_VERSION"\";\n" - "CFBundleGetInfoString = \"MacPython "PY_VERSION".\";\n" -}; -#endif diff --git a/Mac/Resources/balloons.bh b/Mac/Resources/balloons.bh deleted file mode 100644 index 71df629..0000000 --- a/Mac/Resources/balloons.bh +++ /dev/null @@ -1,36 +0,0 @@ -DIALOG 231 Options -1.1 Start the interpreter. -2.1 Return to the finder. -3.1 Turn this item on to get the standard >>> prompt after a script terminates. -3.3 Turn this item off to have the interpreter terminate when a script terminates. -4.1 Turn this option on to get feedback on where modules are found and what their type is. -4.3 Turn this option off to stop import feedback. -5.1 Turn this option on to strip LINO instructions from Python bytecode. Gives a slight speedup. -5.3 Turn this option off to include LINO instructions in the bytecode. This enables line numbers in traceback printouts. -6.1 Turn this on to show output byte-by-byte as it is produced. Slows things down. -6.3 Turn this off to show output on a line-by-line basis, or when input is requested. -7.1 Print gibberish only Guido understands. -7.3 Stop printing gibberish. -8.1 Select this to always keep the console window open after script termination. -8.3 The console window is always kept open after script termination. -9.1 Select this to keep the console window open if there is output that you may not have had a chance to look at. -9.3 The console window stays open if there is output that you may not have had a chance to look at. -10.1 Select this to keep the console window open when a script aborts. -10.3 The console window stays open when a script aborts. -11.1 Select this to always close the console window on script termination. -11.3 The console window is always closed on script termination. -12.1 This shows another dialog where you can type unix-style command line arguments. WARNING: do not redirect stdin and stdout, it does not work. -13.1 Select to warn about mixing tabs and spaces in your source. -13.3 Deselect to treat tabs as 4 spaces without warning. -14.1 Selecting this disables the site-python feature. -14.3 Deselecting this enables the site-python feature. -15.1 Turn off balloon help. -16.1 Select this to keep the old behaviour for macfs Standard File calls -16.3 Deselect this to auto-import macfsn which replaces macfs Standard File calls with Navigation Services wrappers -END-DIALOG -DIALOG 234 -1.1 Deleting the incorrect preference will not always work, but Python will run with standard options. -2.1 Python will continue to run, but with standard options. -3.1 Don't run, return to the finder. -END-DIALOG -END diff --git a/Mac/Resources/bundle.rsrc b/Mac/Resources/bundle.rsrc Binary files differdeleted file mode 100644 index 6ee26a4..0000000 --- a/Mac/Resources/bundle.rsrc +++ /dev/null diff --git a/Mac/Resources/dialogs.rsrc b/Mac/Resources/dialogs.rsrc Binary files differdeleted file mode 100644 index d07e413..0000000 --- a/Mac/Resources/dialogs.rsrc +++ /dev/null diff --git a/Mac/Resources/gusiprefs.rsrc b/Mac/Resources/gusiprefs.rsrc Binary files differdeleted file mode 100644 index cc3be18..0000000 --- a/Mac/Resources/gusiprefs.rsrc +++ /dev/null diff --git a/Mac/Resources/pythonpath.r b/Mac/Resources/pythonpath.r deleted file mode 100644 index 1d7479c..0000000 --- a/Mac/Resources/pythonpath.r +++ /dev/null @@ -1,108 +0,0 @@ -/* -** Resources for the sys.path initialization, the Python options -** and the preference filename -*/ -#include "Types.r" -#include "patchlevel.h" -#include "pythonresources.h" - -/* A few resource type declarations */ - -type 'Popt' { - literal byte version = POPT_VERSION_CURRENT; - byte noInspect = 0, inspect = 1; - byte noVerbose = 0, verbose = 1; - byte noOptimize = 0, optimize = 1; - byte noUnbuffered = 0, unbuffered = 1; - byte noDebugParser = 0, debugParser = 1; - byte unused_0 = 0, unused_1 = 1; - byte closeAlways = POPT_KEEPCONSOLE_NEVER, - noCloseOutput = POPT_KEEPCONSOLE_OUTPUT, - noCloseError = POPT_KEEPCONSOLE_ERROR, - closeNever = POPT_KEEPCONSOLE_ALWAYS; - byte interactiveOptions = 0, noInteractiveOptions = 1; - byte argcArgv = 0, noArgcArgv = 1; - byte newStandardExceptions = 0, oldStandardExceptions = 1; - byte sitePython = 0, noSitePython = 1; - byte navService = 0, noNavService = 1; - byte noDelayConsole = 0, delayConsole = 1; - byte noDivisionWarning = 0, divisionWarning = 1; - byte noUnixNewlines = 0, unixNewlines = 1; -}; - -type 'TMPL' { - wide array { - pstring; - literal longint; - }; -}; - -/* The resources themselves */ - -/* Popt template, for editing them in ResEdit */ - -resource 'TMPL' (PYTHONOPTIONS_ID, "Popt") { - { - "preference version", 'DBYT', - "Interactive after script", 'DBYT', - "Verbose import", 'DBYT', - "Optimize", 'DBYT', - "Unbuffered stdio", 'DBYT', - "Debug parser", 'DBYT', - "Keep window on normal exit", 'DBYT', - "Keep window on error exit", 'DBYT', - "No interactive option dialog", 'DBYT', - "No argc/argv emulation", 'DBYT', - "Old standard exceptions", 'DBYT', - "No site-python support", 'DBYT', - "No NavServices in macfs", 'DBYT', - "Delay console window", 'DBYT', - "Warnings for old-style division", 'DBYT', - "Allow unix newlines on textfile input",'DBYT', - } -}; - -/* The default-default Python options */ - -resource 'Popt' (PYTHONOPTIONS_ID, "Options") { - POPT_VERSION_CURRENT, - noInspect, - noVerbose, - noOptimize, - noUnbuffered, - noDebugParser, - unused_0, - noCloseOutput, - interactiveOptions, - argcArgv, - newStandardExceptions, - sitePython, - navService, - noDelayConsole, - noDivisionWarning, - unixNewlines, -}; - -/* The sys.path initializer */ - -resource 'STR#' (PYTHONPATH_ID, "sys.path initialization") { - { - "$(PYTHON)", - "$(PYTHON):Lib", - "$(PYTHON):Lib:lib-dynload", - "$(PYTHON):Lib:plat-mac", - "$(PYTHON):Lib:plat-mac:lib-scriptpackages", - "$(PYTHON):Mac:Lib", - "$(PYTHON):Extensions:img:Mac", - "$(PYTHON):Extensions:img:Lib", - "$(PYTHON):Extensions:Imaging", - "$(PYTHON):Lib:lib-tk", - "$(PYTHON):Lib:site-packages", - } -}; - -/* The preferences filename */ - -resource 'STR ' (PREFFILENAME_ID, PREFFILENAME_PASCAL_NAME) { - $$Format("Python %s Preferences", PY_VERSION) -}; diff --git a/Mac/Resources/tkpython.rsrc b/Mac/Resources/tkpython.rsrc Binary files differdeleted file mode 100644 index a1a3306..0000000 --- a/Mac/Resources/tkpython.rsrc +++ /dev/null diff --git a/Mac/Resources/version.r b/Mac/Resources/version.r deleted file mode 100644 index 85d7466..0000000 --- a/Mac/Resources/version.r +++ /dev/null @@ -1,30 +0,0 @@ -/* -** Create the 'vers' version resource from information in the -** Python include files. -*/ - -#include "Types.r" - -#include "patchlevel.h" - -/* Invent the Mac version from the Python version */ -#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA -#define V_RELEASE alpha -#endif -#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA -#define V_RELEASE beta -#endif -#ifndef V_RELEASE -#define V_RELEASE final -#endif - -resource 'vers' (1) { - PY_MAJOR_VERSION, - (PY_MINOR_VERSION<<4) | (PY_MICRO_VERSION), - V_RELEASE, - PY_RELEASE_SERIAL, - 0, - PY_VERSION, - $$Format("%s, © Python Software Foundation %s", - PY_VERSION, $$Date) -}; diff --git a/Mac/Tools/CGI/BuildCGIApplet.py b/Mac/Tools/CGI/BuildCGIApplet.py deleted file mode 100644 index 0ee2ce0..0000000 --- a/Mac/Tools/CGI/BuildCGIApplet.py +++ /dev/null @@ -1,76 +0,0 @@ -"""BuildCGIApplet.py -- Create a CGI applet from a Python script. - -Specilized version of BuildApplet, enabling Python CGI scripts to be -used under Mac web servers like WebStar. The __main__ program is -PythonCGISlave.py, which provides a compatibility layer, emulating -Unix-style CGI scripts. See CGI_README.txt for details. -""" - -import sys -import os -import macfs -import MacOS -from Carbon import Res -import EasyDialogs -import buildtools -import py_resource - - -def main(): - try: - buildcgiapplet() - except buildtools.BuildError, detail: - EasyDialogs.Message(detail) - - -def buildcgiapplet(): - buildtools.DEBUG=1 - - # Find the template - # (there's no point in proceeding if we can't find it) - - template = buildtools.findtemplate() - wrapper = "PythonCGISlave.py" - if not os.path.exists("PythonCGISlave.py"): - wrapper = os.path.join(sys.exec_prefix, ":Mac:Tools:CGI", wrapper) - - # Ask for source text if not specified in sys.argv[1:] - if not sys.argv[1:]: - srcfss, ok = macfs.PromptGetFile('Select a CGI script:', 'TEXT', 'APPL') - if not ok: - return - filename = srcfss.as_pathname() - dstfilename = mkcgifilename(filename) - dstfss, ok = macfs.StandardPutFile('Save application as:', - os.path.basename(dstfilename)) - if not ok: - return - dstfilename = dstfss.as_pathname() - buildone(template, wrapper, filename, dstfilename) - else: - # Loop over all files to be processed - for filename in sys.argv[1:]: - dstfilename = mkcgifilename(filename) - buildone(template, wrapper, filename, dstfilename) - - -def mkcgifilename(filename): - if filename[-3:] == '.py': - filename = filename[:-3] - filename = filename + ".cgi" - return filename - - -def buildone(template, wrapper, src, dst): - buildtools.process(template, wrapper, dst, 1) - # write source as a PYC resource into dst - ref = Res.FSpOpenResFile(dst, 2) - try: - Res.UseResFile(ref) - py_resource.frompyfile(src, "CGI_MAIN", preload=1) - finally: - Res.CloseResFile(ref) - - -if __name__ == '__main__': - main() diff --git a/Mac/Tools/CGI/BuildCGIApplet.rsrc b/Mac/Tools/CGI/BuildCGIApplet.rsrc Binary files differdeleted file mode 100644 index cc11108..0000000 --- a/Mac/Tools/CGI/BuildCGIApplet.rsrc +++ /dev/null diff --git a/Mac/Tools/CGI/CGI_README.txt b/Mac/Tools/CGI/CGI_README.txt deleted file mode 100644 index 89f559f..0000000 --- a/Mac/Tools/CGI/CGI_README.txt +++ /dev/null @@ -1,66 +0,0 @@ -Python CGI under MacOS - -This folder contains two tools that enable Python CGI scripts under -Mac based web servers, like WebStar, Quid Quo Pro, NetPresentz or -Apple's Personal Webserver. - -Both tools emulate Unix style CGI's, allowing for cross platform -CGI scripts. In short, this happens by converting an AppleEvent sent -by the web server into os.environ dictionary entries. See below for more -details. - -Both tools serve slightly different purposes: -- PythonCGISlave enables execution of Python scripts as plain *.py - text files. The web server must be configured to handle .py requests - over to PythonCGISlave. Not all web servers support that. Eg. WebStar - does, but NetPresentz does not. -- BuildCGIApplet wraps a Python CGI script in a compatibility layer, and - creates a CGI Applet which can be executed by any web server. - -The pros and cons of using PythonCGISlave are (+ is good, - is bad): - + support plain .py files, no need to wrap each script - - not supported b all servers, requires more complicated configuration -The pros and cons of using BuildCGIApplet are: - + supported by more servers - + less configuration troubles - - must wrap each script - - -Using BuildCGIApplet - -Drop your CGI script onto BuildCGIApplet. An applet called <script name>.cgi -will be created. Move it to the appropriate location in the HTTP document tree. -Make sure your web server is configured to handle .cgi applet files. Usually -it is configured correctly by default, since .cgi is a standard extension. -If your CGI applet starts up for the first time, a file <applet name>.errors -is created. If your CGI script causes an exception, debug info will be written -to that file. - - -Using PythonCGISlave - -Place the PythonCGISlave applet somewhere in the HTTP document tree. Configure -your web server so it'll pass requests for .py files to PythonCGISlave. For -Webstar, this goes roughly like this: -- in the WebStar Admin app, create a new "action", call it PYTHON, click the - "Choose" button and select our applet. Save the settings. -- go to Suffix Mappings, create a new suffix .PY, type TEXT, creator *, and - choose PYTHON in the actions popup. Save the settings. - - -How it works - -For each Python CGI request, the web server will send an AppleEvent to the -CGI applet. Most relevant CGI parameters are taken from the AppleEvent and -get stuffed into the os.environ dictionary. Then the script gets executed. -This emulates Unix-style CGI as much as possible, so CGI scripts that are -written portably should now also work under a Mac web server. - -Since the applet does not quit after each request by default, there is hardly -any startup overhead except the first time it starts up. If an exception occurs -in the CGI script, the applet will write a traceback to a file called -<applet name>.errors, and then quit. The latter seems a good idea, just in case -we leak memory. The applet will be restarted upon the next request. - - -Please direct feedback to <just@letterror.com> and/or <pythonmac-sig@python.org>. diff --git a/Mac/Tools/CGI/PythonCGISlave.py b/Mac/Tools/CGI/PythonCGISlave.py deleted file mode 100644 index f14a582..0000000 --- a/Mac/Tools/CGI/PythonCGISlave.py +++ /dev/null @@ -1,244 +0,0 @@ -"""PythonCGISlave.py - -This program can be used in two ways: -- As a Python CGI script server for web servers supporting "Actions", like WebStar. -- As a wrapper for a single Python CGI script, for any "compliant" Mac web server. - -See CGI_README.txt for more details. -""" - -# -# Written by Just van Rossum, but partly stolen from example code by Jack. -# - - -LONG_RUNNING = 1 # If true, don't quit after each request. - - -import MacOS -MacOS.SchedParams(0, 0) -from MiniAEFrame import AEServer, MiniApplication - -import os -import string -import cStringIO -import sys -import traceback -import mimetools - -__version__ = '3.2' - - -slave_dir = os.getcwd() - - -# log file for errors -sys.stderr = open(sys.argv[0] + ".errors", "a+") - -def convertFSSpec(fss): - return fss.as_pathname() - - -# AE -> os.environ mappings -ae2environ = { - 'kfor': 'QUERY_STRING', - 'Kcip': 'REMOTE_ADDR', - 'svnm': 'SERVER_NAME', - 'svpt': 'SERVER_PORT', - 'addr': 'REMOTE_HOST', - 'scnm': 'SCRIPT_NAME', - 'meth': 'REQUEST_METHOD', - 'ctyp': 'CONTENT_TYPE', -} - - -ERROR_MESSAGE = """\ -Content-type: text/html - -<html> -<head> -<title>Error response</title> -</head> -<body> -<h1>Error response</h1> -<p>Error code %d. -<p>Message: %s. -</body> -</html> -""" - - -def get_cgi_code(): - # If we're a CGI wrapper, the CGI code resides in a PYC resource. - from Carbon import Res - import marshal - try: - code = Res.GetNamedResource('PYC ', "CGI_MAIN") - except Res.Error: - return None - else: - return marshal.loads(code.data[8:]) - - - -class PythonCGISlave(AEServer, MiniApplication): - - def __init__(self): - self.crumblezone = 100000 * "\0" - MiniApplication.__init__(self) - AEServer.__init__(self) - self.installaehandler('aevt', 'oapp', self.open_app) - self.installaehandler('aevt', 'quit', self.quit) - self.installaehandler('WWW\275', 'sdoc', self.cgihandler) - - self.code = get_cgi_code() - self.long_running = LONG_RUNNING - - if self.code is None: - print "%s version %s, ready to serve." % (self.__class__.__name__, __version__) - else: - print "%s, ready to serve." % os.path.basename(sys.argv[0]) - - try: - self.mainloop() - except: - self.crumblezone = None - sys.stderr.write("- " * 30 + '\n') - self.message("Unexpected exception") - self.dump_environ() - sys.stderr.write("%s: %s\n" % sys.exc_info()[:2]) - - def getabouttext(self): - if self.code is None: - return "PythonCGISlave %s, written by Just van Rossum." % __version__ - else: - return "Python CGI script, wrapped by BuildCGIApplet and " \ - "PythonCGISlave, version %s." % __version__ - - def getaboutmenutext(self): - return "About %s\311" % os.path.basename(sys.argv[0]) - - def message(self, msg): - import time - sys.stderr.write("%s (%s)\n" % (msg, time.asctime(time.localtime(time.time())))) - - def dump_environ(self): - sys.stderr.write("os.environ = {\n") - keys = os.environ.keys() - keys.sort() - for key in keys: - sys.stderr.write(" %s: %s,\n" % (repr(key), repr(os.environ[key]))) - sys.stderr.write("}\n") - - def quit(self, **args): - self.quitting = 1 - - def open_app(self, **args): - pass - - def cgihandler(self, pathargs, **args): - # We emulate the unix way of doing CGI: fill os.environ with stuff. - environ = os.environ - - # First, find the document root. If we don't get a DIRE parameter, - # we take the directory of this program, which may be wrong if - # it doesn't live the actual http document root folder. - if args.has_key('DIRE'): - http_root = args['DIRE'].as_pathname() - del args['DIRE'] - else: - http_root = slave_dir - environ['DOCUMENT_ROOT'] = http_root - - if self.code is None: - # create a Mac pathname to the Python CGI script or applet - script = string.replace(args['scnm'], '/', ':') - script_path = os.path.join(http_root, script) - else: - script_path = sys.argv[0] - - if not os.path.exists(script_path): - rv = "HTTP/1.0 404 Not found\n" - rv = rv + ERROR_MESSAGE % (404, "Not found") - return rv - - # Kfrq is the complete http request. - infile = cStringIO.StringIO(args['Kfrq']) - firstline = infile.readline() - - msg = mimetools.Message(infile, 0) - - uri, protocol = string.split(firstline)[1:3] - environ['REQUEST_URI'] = uri - environ['SERVER_PROTOCOL'] = protocol - - # Make all http headers available as HTTP_* fields. - for key in msg.keys(): - environ['HTTP_' + string.upper(string.replace(key, "-", "_"))] = msg[key] - - # Translate the AE parameters we know of to the appropriate os.environ - # entries. Make the ones we don't know available as AE_* fields. - items = args.items() - items.sort() - for key, value in items: - if key[0] == "_": - continue - if ae2environ.has_key(key): - envkey = ae2environ[key] - environ[envkey] = value - else: - environ['AE_' + string.upper(key)] = str(value) - - # Redirect stdout and stdin. - saveout = sys.stdout - savein = sys.stdin - out = sys.stdout = cStringIO.StringIO() - postdata = args.get('post', "") - if postdata: - environ['CONTENT_LENGTH'] = str(len(postdata)) - sys.stdin = cStringIO.StringIO(postdata) - - # Set up the Python environment - script_dir = os.path.dirname(script_path) - os.chdir(script_dir) - sys.path.insert(0, script_dir) - sys.argv[:] = [script_path] - namespace = {"__name__": "__main__"} - rv = "HTTP/1.0 200 OK\n" - - try: - if self.code is None: - # we're a Python script server - execfile(script_path, namespace) - else: - # we're a CGI wrapper, self.code is the CGI code - exec self.code in namespace - except SystemExit: - # We're not exiting dammit! ;-) - pass - except: - self.crumblezone = None - sys.stderr.write("- " * 30 + '\n') - self.message("CGI exception") - self.dump_environ() - traceback.print_exc() - sys.stderr.flush() - self.quitting = 1 - # XXX we should return an error AE, but I don't know how to :-( - rv = "HTTP/1.0 500 Internal error\n" - - # clean up - namespace.clear() - environ.clear() - sys.path.remove(script_dir) - sys.stdout = saveout - sys.stdin = savein - - if not self.long_running: - # quit after each request - self.quitting = 1 - - return rv + out.getvalue() - - -PythonCGISlave() diff --git a/Mac/Tools/CGI/PythonCGISlave.rsrc b/Mac/Tools/CGI/PythonCGISlave.rsrc Binary files differdeleted file mode 100644 index caf8e76..0000000 --- a/Mac/Tools/CGI/PythonCGISlave.rsrc +++ /dev/null diff --git a/Mac/Tools/CGI/cgi.html b/Mac/Tools/CGI/cgi.html deleted file mode 100644 index 3dc5dc0..0000000 --- a/Mac/Tools/CGI/cgi.html +++ /dev/null @@ -1,53 +0,0 @@ -<HTML> -<HEAD> - <META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0 Mac"> - <TITLE>Creating CGI scripts with MacPython</TITLE> -</HEAD> -<BODY> - -<H3>Creating CGI scripts with MacPython</H3> -<BLOCKQUOTE> -Note: this document is work-in-progress, and not tested. -</BLOCKQUOTE> - -<P>MacPython allows you to use Python as a CGI scripting language -for your webserver. Moreover, there are some helper applications -that allow you to write your CGI scripts in the same way as for -Unix and Windows, i.e. obtaining their arguments from <TT>os.environ</TT> -and sending their results to <TT>stdout</TT>. MacPython also has -all the facilities to program CGI scripts in the Macintosh way, -through AppleEvents, but that falls outside the scope of this -document (reading the source code for the helper scripts will -give you an idea about how to do this).</P> - -<P>For the purpose of this document we will assume you are using -Apple's Personal Webserver 1.5, which comes standard with your -machine as of MacOS 9.</P> - -<P>The first step is to start the webserver, you will find it -in your control panels. Give it a folder to serve documents from, -and check that it is working by pointing your browser at it.</P> - -<P>The next step is to tell the webserver that documents with -a ".<TT>py</TT>" extension should be served through -the <TT>PythonCGISlave</TT> helper application. Open the webserver, -choose Preferences, tab Action, Add, Start on Extension, extension -".py", select application <TT>PythonCGISlave</TT> (which -lives in <TT>Python:Mac:Tools:CGI</TT>).</P> - -<P>The last step is to try it. Put the following script in <TT>Macintosh -HD:Webpages:hello.py </TT>(assuming your webserver has the default -settings for its document folder):</P> - -<BLOCKQUOTE> - <P><CODE>print "Content-type: text/plain"<BR> - print<BR> - print "Hello world!"<BR> - import time<BR> - print "Local time is", time.ctime(time.time())</CODE></P></BLOCKQUOTE> - -<P>Point your webbrowser at <A HREF="http://localhost/hello.py">http://localhost/hello.py</A><CODE> -</CODE>and check whether it works. - -</BODY> -</HTML> diff --git a/Mac/Unsupported/unshar.py b/Mac/Unsupported/unshar.py deleted file mode 100644 index ec14f2e..0000000 --- a/Mac/Unsupported/unshar.py +++ /dev/null @@ -1,97 +0,0 @@ -# Extract files from a SHAR archive. -# Run this on the Mac. -# Usage: -# >>> import unshar -# >>> f = open('SHAR') -# >>> unshar.unshar(f) - -import string -import EasyDialogs - -def unshar(fp, verbose=0, overwrite=0): - ofp = None - file = None - while 1: - line = fp.readline() - if verbose > 3: print 'Got:', `line` - if line[:1] == 'X': - # Most common case first - if ofp: ofp.write(line[1:]) - continue - if not line: - if verbose: print 'EOF' - if ofp: - print 'Unterminated file -- closing' - ofp.close() - ofp = None - break - if line[0] == '#': - if verbose: print line, - continue - if line[:14] == 'sed "s/^X//" >': - if verbose: print "!!!", `line` - i = string.find(line, "'") - j = string.find(line, "'", i+1) - if i >= 0 and j > i: - file = line[i+1:j] - if '/' in file: - words = string.splitfields(file, '/') - for funny in '', '.': - while funny in words: words.remove(funny) - for i in range(len(words)): - if words[i] == '..': words[i] = '' - words.insert(0, '') - file = string.joinfields(words, ':') - try: - ofp = open(file, 'r') - ofp.close() - ofp = None - over = 1 - except IOError: - over = 0 - if over and not overwrite: - print 'Skipping', file, '(already exists) ...' - continue - ofp = open(file, 'w') - if over: - print 'Overwriting', file, '...' - else: - print 'Writing', file, '...' - continue - if line == 'END_OF_FILE\n': - if not file: - print 'Unexpected END_OF_FILE marker' - if ofp: - print 'done' - ofp.close() - ofp = None - else: - print 'done skipping' - file = None - continue - if verbose: print "...", `line` - -def main(): - import sys - import os - if len(sys.argv) > 1: - for fname in sys.argv[1:]: - fp = open(fname, 'r') - dir, fn = os.path.split(fname) - if dir: - os.chdir(dir) - unshar(fp) - else: - import macfs - fname = EasyDialogs.AskFileForOpen() - if not fname: - sys.exit(0) - fp = open(fname, 'r') - dirname = EasyDialogs.AskFolder(message='Folder to save files in:') - if not dirname: - sys.exit(0) - os.chdir(dirname) - unshar(fp) - -if __name__ == '__main__': - main() diff --git a/Mac/_checkversion.py b/Mac/_checkversion.py deleted file mode 100644 index 91b3954..0000000 --- a/Mac/_checkversion.py +++ /dev/null @@ -1,16 +0,0 @@ -"""This file (which is sourced, not imported) checks the version of the -"versioncheck" package. It is also an example of how to format your own -_checkversion.py file""" - -import pyversioncheck - -_PACKAGE="MacPython" -_VERSION="2.3a2" -_URL="http://www.cwi.nl/~jack/macpythonversion.txt" - -try: - _myverbose=VERBOSE -except NameError: - _myverbose=1 - -pyversioncheck.versioncheck(_PACKAGE, _URL, _VERSION, verbose=_myverbose) diff --git a/Mac/mwerks/errno_unix.h b/Mac/mwerks/errno_unix.h deleted file mode 100644 index 4127f3c..0000000 --- a/Mac/mwerks/errno_unix.h +++ /dev/null @@ -1,63 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* -** There are various sources of unix-like error numbers: GUSI headers, -** MSL headers and Carbon-specific MSL headers. The later are triggered, -** apparently, by the _POSIX define. -*/ -#ifndef USE_GUSI2 -#define ENOTDIR (-120) -#ifndef __MSL__ -#define EACCES (-54) -#endif -#ifndef _POSIX -#define EEXIST (-48) -#define ENOENT (-43) -#define ENFILE (-42) -#define ENOSPC (-34) -#define EIO (-36) -#endif -#define EBUSY (-47) -#define EROFS (-44) -#endif - -#ifndef USE_GUSI2 -#define ESRCH 3 -#define EINTR 4 -#define ENODEV 19 -#endif -#ifndef _POSIX -#define EBADF 9 -#define EINVAL 22 -#define EMFILE 24 -#endif - diff --git a/Mac/mwerks/macuseshlstart.c b/Mac/mwerks/macuseshlstart.c deleted file mode 100644 index edbb246..0000000 --- a/Mac/mwerks/macuseshlstart.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -** mac __start for python-with-shared-library. -** -** Partially stolen from MW Startup.c, which is -** Copyright © 1993 metrowerks inc. All Rights Reserved. -*/ - -#include <setjmp.h> - -/* - * clear_stackframe_backlink - set 0(SP) to 0 - * - */ - -static asm void clear_stackframe_backlink(void) -{ - li r3,0 - stw r3,0(SP) - blr -} - -void __start(void) -{ - char *argv = 0; - - clear_stackframe_backlink(); - main(0, &argv); - exit(0); -} diff --git a/Mac/mwerks/malloc/README b/Mac/mwerks/malloc/README deleted file mode 100644 index 56547e7..0000000 --- a/Mac/mwerks/malloc/README +++ /dev/null @@ -1,84 +0,0 @@ - - What is this? - ------------- -This package is a memory allocator for the Macintosh. It was initially -implemented for use with the MetroWerks CodeWarrior compiler on the -PowerPC Mac, but may also be useful (in a more limited way) for use -with MW 68K or Think compilers. - -This is distribution 1.1, dated May 28, 1997. - - How does it work? - ----------------- -Actually, 99% of the code comes straight from the old old BSD-unix -"fast malloc", only the interface to the low-level memory allocator -and the handling of large blocks is different. The allocator follows -one of two strategies, based upon block size: -- for small blocks (anything up to 8K, as distributed), the size is - rounded up to the next power of two, and that much is - allocated. Realloc, etc. understand about this. Small blocks are - packed into 8K segments. -- Larger blocks are allocated directly using NewPtr(). - - Why should I want it? - --------------------- -The reason for writing this is that I've had serious problems with MW -malloc, especially in one piece of software, the Python -interpreter. Python is a very-high level interpreted language, and -spends very large amounts of time in malloc. Moreover, it reallocs() -like there's no tomorrow, and allocates and frees tiny and huge blocks -intermixedly. After some time running, this caused two things (using -the original MW malloc): memory useage grew exponentially and so did -runtime. MetroWerks have tried to be helpful, but I have been unable -to provide them with simple sample-programs that showed the problem: -it seems to be something to do with fragmentation and only happens -under very heavy use. - -The 68K MW malloc has the same problems, and the Think C malloc -has a similar one: it shows the same growth problem but not the -increase in runtime. - -Two additional reasons for using it: -- It is blindingly fast. -- It has pretty good range checking and such (enabled with a #define), - so it'll help you catch various programming errors like referencing - outside the bounds of the malloced block. - -One reason for not using it: -- It is rather wasteful of memory. Small blocks, on average, occupy - 25% more memory than they need, and the allocation in 8K chunks - wastes another 50K (on average). Also, memory is never returned from - malloc()s pool to the Memory Manager. - - How do I use it? - ---------------- -You may want to look at the source: most debugging options are off by -default, and so is returning cache-aligned blocks. Near the top of -malloc.c you will see a couple of defines you can turn on. - -For MW PPC: simply add the sources to your project. Due to the way the -linker works all mallocs will use the new malloc, even the malloc -calls that come from the libraries. - -For MW 68K: ditto, only supposedly the library malloc calls will still -use the original malloc. The two packages don't bite each other, -however, so there shouldn't be any problems. - -For Think: more work, but you can rebuild the ANSI library with this -malloc, since the Think distribution contains everything you need for -this. - - Is that all? - ------------ - -Yes. Let me finish off by asking that you send bug reports, fixes, -enhancement, etc to me at the address below. - - Jack Jansen - Centrum voor Wiskunde en Informatica - Kruislaan 413 - 1098 SJ Amsterdam - the Netherlands - - <Jack.Jansen@cwi.nl> - diff --git a/Mac/mwerks/malloc/calloc.c b/Mac/mwerks/malloc/calloc.c deleted file mode 100644 index 41d69ea..0000000 --- a/Mac/mwerks/malloc/calloc.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)calloc.c 5.6 (Berkeley) 2/23/91";*/ -static char *rcsid = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -#include <stdlib.h> -#include <string.h> - -void * -calloc(num, size) - size_t num; - register size_t size; -{ - register void *p; - - size *= num; - if (p = malloc(size)) - memset(p, '\0', size); - return(p); -} diff --git a/Mac/mwerks/malloc/malloc.c b/Mac/mwerks/malloc/malloc.c deleted file mode 100644 index 38bd32a..0000000 --- a/Mac/mwerks/malloc/malloc.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Attempt at a memory allocator for the Mac, Jack Jansen, CWI, 1995-1997. - * - * Code adapted from BSD malloc, which is: - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";*/ -static char *rcsid = "$Id$"; -#endif /* LIBC_SCCS and not lint */ - -/* - * malloc.c (Caltech) 2/21/82 - * Chris Kingsley, kingsley@cit-20. Modified by Jack Jansen, CWI. - * - * This is a very fast storage allocator. It allocates blocks of a small - * number of different sizes, and keeps free lists of each size. Blocks that - * don't exactly fit are passed up to the next larger size. - * - * Blocks over a certain size are directly allocated by calling NewPtr. - * - */ - -#ifdef USE_MALLOC_DEBUG -/* You may also selectively enable some of these (but some are interdependent) */ -#define DEBUG -#define DEBUG2 -#define MSTATS -#define RCHECK -#define VCHECK -#endif /* USE_MALLOC_DEBUG */ - -/* - * Set the next define if you want to return memory that is aligned to 32-byte - * boundaries. This allows 604 (and, to a lesser extent, any PPC) programs to - * make better use of the L1 cache. - */ -/* #define USE_CACHE_ALIGNED 8 /* The alignment (in 4-byte words) */ - -typedef unsigned char u_char; -typedef unsigned long u_long; -typedef unsigned int u_int; -typedef unsigned short u_short; -typedef u_long caddr_t; - -#include <Memory.h> -#include <stdlib.h> -#include <string.h> - -#ifndef NULL -#define NULL 0 -#endif - -static void morecore(); - -/* - * The overhead on a block is at least 4 bytes. When free, this space - * contains a pointer to the next free block, and the bottom two bits must - * be zero. When in use, the first byte is set to MAGIC, and the second - * byte is the size index. The remaining bytes are for alignment. - * If range checking is enabled then a second word holds the size of the - * requested block, less 1, rounded up to a multiple of sizeof(RMAGIC). - * The order of elements is critical: ov_magic must overlay the low order - * bits of ov_next, and ov_magic can not be a valid ov_next bit pattern. - */ -union overhead { - union overhead *ov_next; /* when free */ - struct { - u_char ovu_magic0; /* magic number */ - u_char ovu_index; /* bucket # */ - u_char ovu_unused; /* unused */ - u_char ovu_magic1; /* other magic number */ -#ifdef RCHECK - u_short ovu_rmagic; /* range magic number */ - u_long ovu_size; /* actual block size */ -#endif - } ovu; -#define ov_magic0 ovu.ovu_magic0 -#define ov_magic1 ovu.ovu_magic1 -#define ov_index ovu.ovu_index -#define ov_rmagic ovu.ovu_rmagic -#define ov_size ovu.ovu_size -#ifdef USE_CACHE_ALIGNED - struct cachealigner { - u_long ovalign[USE_CACHE_ALIGNED]; - } ovu_aligner; -#endif /* USE_CACHE_ALIGN */ -}; - -#define MAGIC 0xef /* magic # on accounting info */ -#define RMAGIC 0x5555 /* magic # on range info */ - -#ifdef RCHECK -#define RSLOP sizeof (u_short) -#else -#define RSLOP 0 -#endif - -#define OVERHEAD (sizeof(union overhead) + RSLOP) - -/* - * nextf[i] is the pointer to the next free block of size 2^(i+3). The - * smallest allocatable block is 8 bytes. The overhead information - * precedes the data area returned to the user. - */ -#define NBUCKETS 11 -#define MAXMALLOC (1<<(NBUCKETS+2)) -static union overhead *nextf[NBUCKETS]; - -#ifdef MSTATS -/* - * nmalloc[i] is the difference between the number of mallocs and frees - * for a given block size. - */ -static u_int nmalloc[NBUCKETS+1]; -#include <stdio.h> -#endif - -#if defined(DEBUG) || defined(RCHECK) || defined(DEBUG2) -#define ASSERT(p) if (!(p)) botch(# p) -#include <stdio.h> -static -botch(s) - char *s; -{ - fprintf(stderr, "\r\nmalloc assertion botched: %s\r\n", s); - (void) fflush(stderr); /* just in case user buffered it */ - abort(); -} -#else -#define ASSERT(p) -#endif - -void * -malloc(nbytes) - size_t nbytes; -{ - register union overhead *op; - register long bucket; - register unsigned amt; - - /* - ** First the simple case: we simple allocate big blocks directly - */ - if ( nbytes + OVERHEAD >= MAXMALLOC ) { - op = (union overhead *)NewPtr(nbytes+OVERHEAD); - if ( op == NULL ) - return NULL; - op->ov_magic0 = op->ov_magic1 = MAGIC; - op->ov_index = 0xff; -#ifdef MSTATS - nmalloc[NBUCKETS]++; -#endif -#ifdef RCHECK - /* - * Record allocated size of block and - * bound space with magic numbers. - */ - op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); - op->ov_rmagic = RMAGIC; - *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; -#endif - return (void *)(op+1); - } - /* - * Convert amount of memory requested into closest block size - * stored in hash buckets which satisfies request. - * Account for space used per block for accounting. - */ -#ifndef RCHECK - amt = 8; /* size of first bucket */ - bucket = 0; -#else - amt = 16; /* size of first bucket */ - bucket = 1; -#endif - while (nbytes + OVERHEAD > amt) { - amt <<= 1; - if (amt == 0) - return (NULL); - bucket++; - } -#ifdef DEBUG2 - ASSERT( bucket < NBUCKETS ); -#endif - /* - * If nothing in hash bucket right now, - * request more memory from the system. - */ - if ((op = nextf[bucket]) == NULL) { - morecore(bucket); - if ((op = nextf[bucket]) == NULL) - return (NULL); - } - /* remove from linked list */ - nextf[bucket] = op->ov_next; - op->ov_magic0 = op->ov_magic1 = MAGIC; - op->ov_index = bucket; -#ifdef MSTATS - nmalloc[bucket]++; -#endif -#ifdef RCHECK - /* - * Record allocated size of block and - * bound space with magic numbers. - */ - op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); - op->ov_rmagic = RMAGIC; - *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; -#endif -#ifdef VCHECK - memset((char *)(op+1), 0x41, nbytes); -#endif - return ((char *)(op + 1)); -} - -/* - * Allocate more memory to the indicated bucket. - */ -static void -morecore(bucket) - int bucket; -{ - register union overhead *op; - register long sz; /* size of desired block */ - long amt; /* amount to allocate */ - int nblks; /* how many blocks we get */ - - /* - * sbrk_size <= 0 only for big, FLUFFY, requests (about - * 2^30 bytes on a VAX, I think) or for a negative arg. - */ - sz = 1 << (bucket + 3); -#ifdef DEBUG2 - ASSERT(sz > 0); -#endif - amt = MAXMALLOC; - nblks = amt / sz; -#ifdef DEBUG2 - ASSERT(nblks*sz == amt); -#endif -#ifdef USE_CACHE_ALIGNED - op = (union overhead *)NewPtr(amt+4*USE_CACHE_ALIGNED); -#else - op = (union overhead *)NewPtr(amt); -#endif - /* no more room! */ - if (op == NULL) - return; -#ifdef USE_CACHE_ALIGNED -#define ALIGN_MASK (4*USE_CACHE_ALIGNED-1) - while ((long)op & ALIGN_MASK ) - op = (union overhead *)((long)op+1); -#endif /* USE_CACHE_ALIGNED */ - /* - * Add new memory allocated to that on - * free list for this hash bucket. - */ - nextf[bucket] = op; - while (--nblks > 0) { - op->ov_next = (union overhead *)((caddr_t)op + sz); - op = (union overhead *)((caddr_t)op + sz); - } - op->ov_next = (union overhead *)NULL; -} - -void -free(cp) - void *cp; -{ - register long size; - register union overhead *op; - - if (cp == NULL) - return; - op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); -#ifdef DEBUG - ASSERT(op->ov_magic0 == MAGIC); /* make sure it was in use */ - ASSERT(op->ov_magic1 == MAGIC); -#else - if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) - return; /* sanity */ -#endif -#ifdef RCHECK - ASSERT(op->ov_rmagic == RMAGIC); - ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC); -#endif -#ifdef VCHECK - memset(cp, 43, op->ov_size); -#endif - size = op->ov_index; - if ( size == 0xff ) { -#ifdef MSTATS - nmalloc[NBUCKETS]--; -#endif - DisposePtr((Ptr)op); - return; - } - ASSERT(size < NBUCKETS); - op->ov_next = nextf[size]; /* also clobbers ov_magic */ - nextf[size] = op; -#ifdef MSTATS - nmalloc[size]--; -#endif -} - -void * -realloc(cp, nbytes) - void *cp; - size_t nbytes; -{ - int i; - union overhead *op; - int expensive; - u_long maxsize; - - if (cp == NULL) - return (malloc(nbytes)); - op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); -#ifdef DEBUG - ASSERT(op->ov_magic0 == MAGIC); /* make sure it was in use */ - ASSERT(op->ov_magic1 == MAGIC); -#else - if (op->ov_magic0 != MAGIC || op->ov_magic1 != MAGIC) - return NULL; /* sanity */ -#endif -#ifdef RCHECK - ASSERT(op->ov_rmagic == RMAGIC); - ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC); -#endif - i = op->ov_index; - /* - ** First the malloc/copy cases - */ - expensive = 0; - if ( i == 0xff ) { - /* Big block. See if it has to stay big */ - if (nbytes+OVERHEAD > MAXMALLOC) { - /* Yup, try to resize it first */ - SetPtrSize((Ptr)op, nbytes+OVERHEAD); - if ( MemError() == 0 ) { -#ifdef RCHECK - op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); - *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; -#endif - return cp; - } - /* Nope, failed. Take the long way */ - } - maxsize = GetPtrSize((Ptr)op); - expensive = 1; - } else { - maxsize = 1 << (i+3); - if ( nbytes + OVERHEAD > maxsize ) - expensive = 1; - else if ( i > 0 && nbytes + OVERHEAD < (maxsize/2) ) - expensive = 1; - } - if ( expensive ) { - void *newp; - - newp = malloc(nbytes); - if ( newp == NULL ) { - return NULL; - } - maxsize -= OVERHEAD; - if ( maxsize < nbytes ) - nbytes = maxsize; - memcpy(newp, cp, nbytes); - free(cp); - return newp; - } - /* - ** Ok, we don't have to copy, it fits as-is - */ -#ifdef RCHECK - op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); - *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; -#endif - return(cp); -} - - -#ifdef MSTATS -/* - * mstats - print out statistics about malloc - * - * Prints two lines of numbers, one showing the length of the free list - * for each size category, the second showing the number of mallocs - - * frees for each size category. - */ -mstats(s) - char *s; -{ - register int i, j; - register union overhead *p; - int totfree = 0, - totused = 0; - - fprintf(stderr, "Memory allocation statistics %s\nfree:\t", s); - for (i = 0; i < NBUCKETS; i++) { - for (j = 0, p = nextf[i]; p; p = p->ov_next, j++) - ; - fprintf(stderr, " %d", j); - totfree += j * (1 << (i + 3)); - } - fprintf(stderr, "\nused:\t"); - for (i = 0; i < NBUCKETS; i++) { - fprintf(stderr, " %d", nmalloc[i]); - totused += nmalloc[i] * (1 << (i + 3)); - } - fprintf(stderr, "\n\tTotal small in use: %d, total free: %d\n", - totused, totfree); - fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %d\n", MAXMALLOC, nmalloc[NBUCKETS]); -} -#endif diff --git a/Mac/mwerks/mwerks_nscarbon.pch b/Mac/mwerks/mwerks_nscarbon.pch deleted file mode 100644 index 7482755..0000000 --- a/Mac/mwerks/mwerks_nscarbon.pch +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once on - -#pragma precompile_target "mwerks_nscarbon_pch" - -#include "mwerks_nscarbon_config.h" -#include <Carbon.h> -#include "Python.h" diff --git a/Mac/mwerks/mwerks_nscarbon_config.h b/Mac/mwerks/mwerks_nscarbon_config.h deleted file mode 100644 index 675f56a..0000000 --- a/Mac/mwerks/mwerks_nscarbon_config.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -** Configuration file for standalone Carbon Python. -** -** Note: enabling the switches below is not enough to enable the -** specific features, you may also need different sets of sources. -*/ -#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 -#define OPAQUE_TOOLBOX_STRUCTS 1 -#define TARGET_API_MAC_CARBON 1 - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -#define USE_GUSI -#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ -#define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ -#define USE_TOOLBOX /* Include toolbox modules in core Python */ -#define USE_QT /* Include quicktime modules in core Python */ -#define USE_WASTE /* Include waste module in core Python */ -/* #define USE_IMG /* Include img modules in core Python */ -/* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ -/* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ -/* #define HAVE_DYNAMIC_LOADING /* Enable dynamically loaded modules */ -#define USE_GDBM /* Include the gdbm module */ -#define USE_ZLIB /* Include the zlib module */ -#define USE_IC /* Include Internet Config module */ -#define USE_PYEXPAT /* Include Pyexpat module */ -#define XML_NS 1 -#define XML_DTD 1 -#define BYTEORDER 4321 -#define XML_CONTEXT_BYTES 1024 -#define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ -#ifndef USE_MSL_MALLOC -/* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ -#endif -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ - -#ifdef USE_MSL -#define MSL_USE_PRECOMPILED_HEADERS 0 /* Don't use precomp headers: we include our own */ -#include <ansi_prefix.mac.h> -#endif -/* Missing declarations. Should these go to pyport.h? */ -#ifdef USE_GUSI2 -#include <stdio.h> -extern int fileno(FILE *); -#endif -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwerks_pyexpat_config.h b/Mac/mwerks/mwerks_pyexpat_config.h deleted file mode 100644 index 4ca4b07c..0000000 --- a/Mac/mwerks/mwerks_pyexpat_config.h +++ /dev/null @@ -1,9 +0,0 @@ -/* -** Configuration file for dynamically loaded Carbon pyexpat module. -*/ -#include "mwerks_shcarbon_config.h" - -#define XML_NS 1 -#define XML_DTD 1 -#define BYTEORDER 4321 -#define XML_CONTEXT_BYTES 1024 diff --git a/Mac/mwerks/mwerks_shcarbon.pch b/Mac/mwerks/mwerks_shcarbon.pch deleted file mode 100644 index 8f2352b..0000000 --- a/Mac/mwerks/mwerks_shcarbon.pch +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once on - -#pragma precompile_target "mwerks_shcarbon_pch" - -#include "mwerks_shcarbon_config.h" -#include <Carbon.h> -#include "Python.h" diff --git a/Mac/mwerks/mwerks_shcarbon_config.h b/Mac/mwerks/mwerks_shcarbon_config.h deleted file mode 100644 index d155b3b..0000000 --- a/Mac/mwerks/mwerks_shcarbon_config.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -** Configuration file for dynamically loaded Carbon PythonCore, -** interpreter and extension modules. -** -** Note: enabling the switches below is not enough to enable the -** specific features, you may also need different sets of sources. -*/ -#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 -#define OPAQUE_TOOLBOX_STRUCTS 1 -#define TARGET_API_MAC_CARBON 1 - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ -#define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ -/* #define USE_CORE_TOOLBOX /* Include core toolbox modules (Dlg,Ctl,Menu,Win,Res,Qd) */ -/* #define USE_TOOLBOX /* Include all toolbox modules in core Python */ -/* #define USE_QT /* Include quicktime modules in core Python */ -/* #define USE_WASTE /* Include waste module in core Python */ -/* #define USE_MACSPEECH /* Include macspeech module in core Python */ -/* #define USE_IMG /* Include img modules in core Python */ -/* #define USE_MACCTB /* Include ctb module in core Python */ -/* #define USE_STDWIN /* Include stdwin module in core Python */ -/* #define USE_MACTCP /* Include mactcp (*not* socket) modules in core */ -/* #define USE_TK /* Include _tkinter module in core Python */ -/* #define MAC_TCL /* This *must* be on if USE_TK is on */ -#define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ -#define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ -#define HAVE_DYNAMIC_LOADING /* Enable dynamically loaded modules */ -/* #define USE_GDBM /* Include the gdbm module */ -/* #define USE_ZLIB /* Include the zlib module */ -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ -#define USE_TOOLBOX_OBJECT_GLUE /* Call toolbox object converters indirectly */ - -#define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ -#ifndef USE_MSL_MALLOC -/* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ -#endif - -#ifdef USE_MSL -#define MSL_USE_PRECOMPILED_HEADERS 0 /* Don't use precomp headers: we include our own */ -#include <ansi_prefix.mac.h> -#endif -/* Missing declarations. Should these go to pyport.h? */ -#ifdef USE_GUSI2 -#include <stdio.h> -extern int fileno(FILE *); -#endif -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwerks_smcarbon.pch b/Mac/mwerks/mwerks_smcarbon.pch deleted file mode 100644 index 9025cee..0000000 --- a/Mac/mwerks/mwerks_smcarbon.pch +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once on - -#pragma precompile_target "mwerks_smcarbon_pch" - -#include "mwerks_smcarbon_config.h" -#include <Carbon.h> -#include "Python.h" diff --git a/Mac/mwerks/mwerks_smcarbon_config.h b/Mac/mwerks/mwerks_smcarbon_config.h deleted file mode 100644 index 6b134bd..0000000 --- a/Mac/mwerks/mwerks_smcarbon_config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** Configuration file for small standalone Carbon Python. -** -** Note: enabling the switches below is not enough to enable the -** specific features, you may also need different sets of sources. -*/ -#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 -#define OPAQUE_TOOLBOX_STRUCTS 1 -#define TARGET_API_MAC_CARBON 1 - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -#define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ -#define USE_TOOLBOX /* Include toolbox modules in core Python */ -/* #define USE_CORE_TOOLBOX /* Include minimal set of toolbox modules in core Python */ -#define USE_QT /* Include quicktime modules in core Python */ -/* #define USE_WASTE /* Include waste module in core Python */ -/* #define USE_MACSPEECH /* Include macspeech module in core Python */ -/* #define USE_IMG /* Include img modules in core Python */ -/* #define USE_MACCTB /* Include ctb module in core Python */ -/* #define USE_STDWIN /* Include stdwin module in core Python */ -/* #define USE_MACTCP /* Include mactcp (*not* socket) modules in core */ -/* #define USE_TK /* Include _tkinter module in core Python */ -/* #define MAC_TCL /* This *must* be on if USE_TK is on */ -/* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ -/* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ -/* #define HAVE_DYNAMIC_LOADING /* Enable dynamically loaded modules */ -/* #define USE_GDBM /* Include the gdbm module */ -/* #define USE_ZLIB /* Include the zlib module */ -#define WITH_HOTSHOT /* Enable hotshot profiler */ - -#define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ -#ifndef USE_MSL_MALLOC -/* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ -#endif -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ - -#ifdef USE_MSL -#define MSL_USE_PRECOMPILED_HEADERS 0 /* Don't use precomp headers: we include our own */ -#include <ansi_prefix.mac.h> -#endif -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwerks_thrcarbonsm_config.h b/Mac/mwerks/mwerks_thrcarbonsm_config.h deleted file mode 100644 index 958f1c6..0000000 --- a/Mac/mwerks/mwerks_thrcarbonsm_config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** Configuration file for small standalone 68k/ppc Python. -** -** Note: enabling the switches below is not enough to enable the -** specific features, you may also need different sets of sources. -*/ -#define ACCESSOR_CALLS_ARE_FUNCTIONS 1 -#define OPAQUE_TOOLBOX_STRUCTS 1 -#define TARGET_API_MAC_CARBON 1 - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ -#define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ -#define USE_TOOLBOX /* Include toolbox modules in core Python */ -/* #define USE_CORE_TOOLBOX /* Include minimal set of toolbox modules in core Python */ -#define USE_QT /* Include quicktime modules in core Python */ -/* #define USE_WASTE /* Include waste module in core Python */ -/* #define USE_MACSPEECH /* Include macspeech module in core Python */ -/* #define USE_IMG /* Include img modules in core Python */ -/* #define USE_MACCTB /* Include ctb module in core Python */ -/* #define USE_STDWIN /* Include stdwin module in core Python */ -/* #define USE_MACTCP /* Include mactcp (*not* socket) modules in core */ -/* #define USE_TK /* Include _tkinter module in core Python */ -/* #define MAC_TCL /* This *must* be on if USE_TK is on */ -/* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ -/* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ -/* #define HAVE_DYNAMIC_LOADING /* Enable dynamically loaded modules */ -/* #define USE_GDBM /* Include the gdbm module */ -/* #define USE_ZLIB /* Include the zlib module */ -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ - -#define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ -#ifndef USE_MSL_MALLOC -/* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ -#endif - -#ifdef USE_MSL -#define MSL_USE_PRECOMPILED_HEADERS 0 /* Don't use precomp headers: we include our own */ -#include <ansi_prefix.mac.h> -#endif -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwerks_threadsmall_config.h b/Mac/mwerks/mwerks_threadsmall_config.h deleted file mode 100644 index 302a36a..0000000 --- a/Mac/mwerks/mwerks_threadsmall_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** Configuration file for small standalone 68k/ppc Python. -** -** Note: enabling the switches below is not enough to enable the -** specific features, you may also need different sets of sources. -*/ - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -#define WITH_THREAD /* Use thread support */ -#define USE_MSL /* Use Mw Standard Library (as opposed to Plaugher C libraries) */ -#define USE_TOOLBOX /* Include toolbox modules in core Python */ -#define USE_QT /* Include quicktime modules in core Python */ -/* #define USE_WASTE /* Include waste module in core Python */ -#define USE_MACSPEECH /* Include macspeech module in core Python */ -/* #define USE_IMG /* Include img modules in core Python */ -#define USE_MACCTB /* Include ctb module in core Python */ -/* #define USE_STDWIN /* Include stdwin module in core Python */ -/* #define USE_MACTCP /* Include mactcp (*not* socket) modules in core */ -/* #define USE_TK /* Include _tkinter module in core Python */ -/* #define MAC_TCL /* This *must* be on if USE_TK is on */ -/* #define USE_MAC_SHARED_LIBRARY /* Enable code to add shared-library resources */ -/* #define USE_MAC_APPLET_SUPPORT /* Enable code to run a PYC resource */ -/* #define HAVE_DYNAMIC_LOADING /* Enable dynamically loaded modules */ -/* #define USE_GDBM /* Include the gdbm module */ -/* #define USE_ZLIB /* Include the zlib module */ -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ - -#define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ -#ifndef USE_MSL_MALLOC -/* #define USE_MALLOC_DEBUG /* Enable range checking and other malloc debugging */ -#endif - -#ifdef USE_MSL -#define MSL_USE_PRECOMPILED_HEADERS 0 /* Don't use precomp headers: we include our own */ -#include <ansi_prefix.mac.h> -#endif -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwerks_tkplugin_config.h b/Mac/mwerks/mwerks_tkplugin_config.h deleted file mode 100644 index f3b4e09..0000000 --- a/Mac/mwerks/mwerks_tkplugin_config.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -** Special config-file for _tkinter plugin. -*/ - -#define USE_GUSI2 /* Stdio implemented with GUSI 2 */ -/* #define USE_GUSI1 /* Stdio implemented with GUSI 1.X */ -#if defined(USE_GUSI2) -#define USE_GUSI -#endif -#define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ -#define USE_TK /* Include _tkinter module in core Python */ -#define MAC_TCL /* This *must* be on if USE_TK is on */ -#define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ -#ifndef Py_DEBUG -#define NDEBUG -#endif diff --git a/Mac/mwerks/mwfopenrf.c b/Mac/mwerks/mwfopenrf.c deleted file mode 100644 index 31eca1b..0000000 --- a/Mac/mwerks/mwfopenrf.c +++ /dev/null @@ -1,79 +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 or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI 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. - -******************************************************************/ - -/* -** mwfopenrf - Open resource fork as stdio file for CodeWarrior. -*/ - -#if defined(__MWERKS__) && !defined(USE_GUSI) -#include <stdio.h> -#include <unix.h> -#include <errno.h> -#include "errno_unix.h" - -FILE * -fopenRF(name, mode) - char *name; - char *mode; -{ - int fd; - int modebits = -1; - int extramodebits = 0; - char *modep; - - for(modep=mode; *modep; modep++) { - switch(*modep) { - case 'r': modebits = O_RDONLY; break; - case 'w': modebits = O_WRONLY; extramodebits |= O_CREAT|O_TRUNC; break; - case 'a': modebits = O_RDONLY; - extramodebits |= O_CREAT|O_APPEND; - extramodebits &= ~O_TRUNC; - break; - case '+': modebits = O_RDWR; - extramodebits &= ~O_TRUNC; - break; - case 'b': extramodebits |= O_BINARY; - break; - default: - errno = EINVAL; - return NULL; - } - } - if ( modebits == -1 ) { - errno = EINVAL; - return NULL; - } - fd = open(name, modebits|extramodebits|O_RSRC); - if ( fd < 0 ) - return NULL; - return fdopen(fd, mode); -} -#endif /* __MWERKS__ */ diff --git a/Mac/scripts/BuildApplication.py b/Mac/scripts/BuildApplication.py deleted file mode 100644 index c919b3f..0000000 --- a/Mac/scripts/BuildApplication.py +++ /dev/null @@ -1,140 +0,0 @@ -"""Create a standalone application from a Python script. - -This puts up a dialog asking for a Python source file ('TEXT'). -The output is a file with the same name but its ".py" suffix dropped. -It is created by copying an applet template, all used shared libs and -then adding 'PYC ' resources containing compiled versions of all used -modules written in Python and the main script itself, as __main__. -""" - - -import sys - -import string -import os -import MacOS -from Carbon import Res -from Carbon import Dlg -import EasyDialogs -import buildtools -import macresource - -# Hmmm... -MACFREEZEPATH = os.path.join(sys.prefix, ":Mac:Tools:macfreeze") -if MACFREEZEPATH not in sys.path: - sys.path.append(MACFREEZEPATH) - -import macgen_bin - -# dialog, items -DLG_ID = 400 -OK_BUTTON = 1 -CANCEL_BUTTON = 2 -GENFAT_BUTTON = 4 -GENPPC_BUTTON = 5 -GEN68K_BUTTON = 6 - -# Define this if we cannot generate 68/fat binaries (Python 1.6) -PPC_ONLY=1 - - -macresource.need('DITL', DLG_ID, "BuildApplication.rsrc") - -def main(): - try: - buildapplication() - except buildtools.BuildError, detail: - EasyDialogs.Message(detail) - - -def buildapplication(debug = 0): - buildtools.DEBUG = debug - - # Ask for source text if not specified in sys.argv[1:] - - if not sys.argv[1:]: - filename = EasyDialogs.AskFileForOpen(message='Select Python source:', - fileTypes=('TEXT',)) - if not filename: - return - else: - if sys.argv[2:]: - raise buildtools.BuildError, "please select one file at a time" - filename = sys.argv[1] - tp, tf = os.path.split(filename) - - # interact with user - architecture, ok = interact(tf) - if not ok: - return - if tf[-3:] == '.py': - tf = tf[:-3] - else: - tf = tf + '.app' - - dstfilename = EasyDialogs.AskFileForSate(message='Save application as:', - savedFileName=tf) - if not ok: - return - - macgen_bin.generate(filename, dstfilename, None, architecture, 1) - - -class radio: - - def __init__(self, dlg, *items): - self.items = {} - for item in items: - ctl = dlg.GetDialogItemAsControl(item) - self.items[item] = ctl - - def set(self, setitem): - for item, ctl in self.items.items(): - if item == setitem: - ctl.SetControlValue(1) - else: - ctl.SetControlValue(0) - - def get(self): - for item, ctl in self.items.items(): - if ctl.GetControlValue(): - return item - - def hasitem(self, item): - return self.items.has_key(item) - - -def interact(scriptname): - if PPC_ONLY: - return 'pwpc', 1 - d = Dlg.GetNewDialog(DLG_ID, -1) - if not d: - raise "Can't get DLOG resource with id =", DLG_ID - d.SetDialogDefaultItem(OK_BUTTON) - d.SetDialogCancelItem(CANCEL_BUTTON) - Dlg.ParamText(scriptname, "", "", "") - - radiogroup = radio(d, GENFAT_BUTTON, GENPPC_BUTTON, GEN68K_BUTTON) - radiogroup.set(GENFAT_BUTTON) - - gentype = 'fat' - while 1: - n = Dlg.ModalDialog(None) - if n == OK_BUTTON or n == CANCEL_BUTTON: - break - elif radiogroup.hasitem(n): - radiogroup.set(n) - genitem = radiogroup.get() - del radiogroup - del d - if genitem == GENFAT_BUTTON: - gentype = 'fat' - elif genitem == GENPPC_BUTTON: - gentype = 'pwpc' - elif genitem == GEN68K_BUTTON: - gentype = 'm68k' - return gentype, n == OK_BUTTON - - -if __name__ == '__main__': - main() diff --git a/Mac/scripts/BuildApplication.rsrc b/Mac/scripts/BuildApplication.rsrc Binary files differdeleted file mode 100644 index 0617418..0000000 --- a/Mac/scripts/BuildApplication.rsrc +++ /dev/null diff --git a/Mac/scripts/ConfigurePython.py b/Mac/scripts/ConfigurePython.py deleted file mode 100644 index 4223101..0000000 --- a/Mac/scripts/ConfigurePython.py +++ /dev/null @@ -1,179 +0,0 @@ -# This python script creates Finder aliases for all the -# dynamically-loaded modules that "live in" in a single -# shared library. -# -# This is sort-of a merger between Jack's MkPluginAliases -# and Guido's mkaliases. -# -# Jack Jansen, CWI, August 1996 - -import sys -import os -import warnings -warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) -import macfs -import MacOS -import gestalt -import string -from Carbon import Res - -SPLASH_COPYCORE=512 -SPLASH_COPYCARBON=513 -SPLASH_COPYCLASSIC=514 -SPLASH_BUILDAPPLETS=515 - -ALERT_NOCORE=516 -ALERT_NONBOOT=517 -ALERT_NONBOOT_COPY=1 -ALERT_NONBOOT_ALIAS=2 - -ALERT_NOTPYTHONFOLDER=518 -ALERT_NOTPYTHONFOLDER_REMOVE_QUIT=1 -ALERT_NOTPYTHONFOLDER_QUIT=2 -ALERT_NOTPYTHONFOLDER_CONTINUE=3 - -APPLET_LIST=[ - (":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None), - (":Mac:scripts:BuildApplet.py", "BuildApplet", None), - (":Mac:scripts:BuildApplication.py", "BuildApplication", None), -## (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), -## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"), -## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"), - (":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None), - (":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None), - (":Mac:Tools:CGI:BuildCGIApplet.py", ":Mac:Tools:CGI:BuildCGIApplet", None), -] - -def getextensiondirfile(fname): - import macfs - import MACFS - try: - vrefnum, dirid = macfs.FindFolder(MACFS.kLocalDomain, MACFS.kSharedLibrariesFolderType, 1) - except macfs.error: - try: - vrefnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kSharedLibrariesFolderType, 1) - except macfs.error: - return None - fss = macfs.FSSpec((vrefnum, dirid, fname)) - return fss.as_pathname() - -def mkcorealias(src, altsrc): - import string - import macostools - version = string.split(sys.version)[0] - dst = getextensiondirfile(src+ ' ' + version) - if not dst: - return 0 - if not os.path.exists(os.path.join(sys.exec_prefix, src)): - if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): - return 0 - src = altsrc - try: - os.unlink(dst) - except os.error: - pass - do_copy = ask_copy() - try: - if do_copy: - macostools.copy(os.path.join(sys.exec_prefix, src), dst) - else: - macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) - except IOError: - return 0 - return 1 - -do_copy = None -def ask_copy(): - global do_copy - if do_copy != None: - return do_copy - # On OSX always copy - if gestalt.gestalt('sysv') > 0x9ff: - do_copy = 1 - return do_copy - do_copy = 0 - if macfs.FSSpec(sys.exec_prefix).as_tuple()[0] != -1: # XXXX - try: - from Carbon import Dlg - rv = Dlg.CautionAlert(ALERT_NONBOOT, None) - if rv == ALERT_NONBOOT_COPY: - do_copy = 1 - except ImportError: - pass - return do_copy - - -# Copied from fullbuild, should probably go to buildtools -def buildapplet(top, dummy, list): - """Create python applets""" - import buildtools - for src, dst, tmpl in list: - template = buildtools.findtemplate(tmpl) - if src[-3:] != '.py': - raise 'Should end in .py', src - base = os.path.basename(src) - src = os.path.join(top, src) - dst = os.path.join(top, dst) - try: - os.unlink(dst) - except os.error: - pass - try: - buildtools.process(template, src, dst, 1) - except buildtools.BuildError, arg: - print '**', dst, arg - -def buildcopy(top, dummy, list): - import macostools - for src, dst in list: - src = os.path.join(top, src) - dst = os.path.join(top, dst) - macostools.copy(src, dst, forcetype="APPL") - -def main(): - verbose = 0 - try: - h = Res.GetResource('DLOG', SPLASH_COPYCORE) - del h - except Res.Error: - verbose = 1 - print "Not running as applet: verbose on" - oldcwd = os.getcwd() - os.chdir(sys.prefix) - newcwd = os.getcwd() - if verbose: - print "Not running as applet: Skipping check for preference file correctness." - elif oldcwd != newcwd: - # Hack to make sure we get the new MACFS - sys.path.insert(0, os.path.join(oldcwd, ':Mac:Lib')) - from Carbon import Dlg - rv = Dlg.CautionAlert(ALERT_NOTPYTHONFOLDER, None) - if rv == ALERT_NOTPYTHONFOLDER_REMOVE_QUIT: - import pythonprefs, preferences - prefpathname = pythonprefs.pref_fss.as_pathname() - os.remove(prefpathname) - sys.exit(0) - elif rv == ALERT_NOTPYTHONFOLDER_QUIT: - sys.exit(0) - - sys.path.append('::Mac:Lib') - import macostools - - # Create the PythonCore alias(es) - MacOS.splash(SPLASH_COPYCORE) - if verbose: - print "Copying PythonCoreCarbon..." - n = 0 - n = n + mkcorealias('PythonCoreCarbon', 'PythonCoreCarbon') - if n == 0: - from Carbon import Dlg - Dlg.CautionAlert(ALERT_NOCORE, None) - if verbose: - print "Warning: PythonCore not copied to Extensions folder" - print " (Applets will not work unless run from the Python folder)" - MacOS.splash(SPLASH_BUILDAPPLETS) - buildapplet(sys.prefix, None, APPLET_LIST) - -if __name__ == '__main__': - main() - MacOS.splash() diff --git a/Mac/scripts/ConfigurePython.rsrc b/Mac/scripts/ConfigurePython.rsrc Binary files differdeleted file mode 100644 index f91ae61..0000000 --- a/Mac/scripts/ConfigurePython.rsrc +++ /dev/null diff --git a/Mac/scripts/EditPythonPrefs.py b/Mac/scripts/EditPythonPrefs.py deleted file mode 100644 index 64c5218..0000000 --- a/Mac/scripts/EditPythonPrefs.py +++ /dev/null @@ -1,213 +0,0 @@ -"""Edit the Python Preferences file.""" -# -# This program is getting more and more clunky. It should really -# be rewritten in a modeless way some time soon. - -from Carbon.Dlg import * -from Carbon.Events import * -from Carbon.Res import * -from Carbon import Controls -import string -import struct -import macfs -import MacOS -import os -import sys -from Carbon import Res # For Res.Error -import pythonprefs -import macresource -import EasyDialogs -try: - from Carbon import Help -except ImportError: - Help = None - -# resource IDs in our own resources (dialogs, etc) -MESSAGE_ID = 256 - -DIALOG_ID = 511 -TEXT_ITEM = 1 -OK_ITEM = 2 -CANCEL_ITEM = 3 -DIR_ITEM = 4 -TITLE_ITEM = 5 -OPTIONS_ITEM = 7 -HELP_ITEM = 9 - -# The options dialog. There is a correspondence between -# the dialog item numbers and the option. -OPT_DIALOG_ID = 510 - -# Map dialog item numbers to option names (and the reverse) -opt_dialog_map = [ - None, - None, - None, - "inspect", - "verbose", - "optimize", - "unbuffered", - "debugging", - "tabwarn", - "nosite", - "nonavservice", - "nointopt", - "noargs", - "delayconsole", - "divisionwarn", - "unixnewlines", - ] -opt_dialog_dict = {} -for i in range(len(opt_dialog_map)): - if opt_dialog_map[i]: - opt_dialog_dict[opt_dialog_map[i]] = i -# 1 thru 10 are the options -# The GUSI creator/type and delay-console -OD_CREATOR_ITEM = 20 -OD_TYPE_ITEM = 21 -OD_OK_ITEM = 1 -OD_CANCEL_ITEM = 2 -OD_HELP_ITEM = 22 -OD_KEEPALWAYS_ITEM = 16 -OD_KEEPOUTPUT_ITEM = 17 -OD_KEEPERROR_ITEM = 18 -OD_KEEPNEVER_ITEM = 19 - -def optinteract(options): - """Let the user interact with the options dialog""" - d = GetNewDialog(OPT_DIALOG_ID, -1) - htext = d.GetDialogItemAsControl(OD_CREATOR_ITEM) - SetDialogItemText(htext, options['creator']) - htext = d.GetDialogItemAsControl(OD_TYPE_ITEM) - SetDialogItemText(htext, options['type']) - d.SetDialogDefaultItem(OD_OK_ITEM) - d.SetDialogCancelItem(OD_CANCEL_ITEM) - if not Help: - d.HideDialogItem(OD_HELP_ITEM) - while 1: - for name in opt_dialog_dict.keys(): - num = opt_dialog_dict[name] - ctl = d.GetDialogItemAsControl(num) - ctl.SetControlValue(options[name]) - ctl = d.GetDialogItemAsControl(OD_KEEPALWAYS_ITEM) - ctl.SetControlValue(options['keep_console'] == 3) - ctl = d.GetDialogItemAsControl(OD_KEEPOUTPUT_ITEM) - ctl.SetControlValue(options['keep_console'] == 1) - ctl = d.GetDialogItemAsControl(OD_KEEPERROR_ITEM) - ctl.SetControlValue(options['keep_console'] == 2) - ctl = d.GetDialogItemAsControl(OD_KEEPNEVER_ITEM) - ctl.SetControlValue(options['keep_console'] == 0) - n = ModalDialog(None) - if n == OD_OK_ITEM: - htext = d.GetDialogItemAsControl(OD_CREATOR_ITEM) - ncreator = GetDialogItemText(htext) - htext = d.GetDialogItemAsControl(OD_TYPE_ITEM) - ntype = GetDialogItemText(htext) - if len(ncreator) == 4 and len(ntype) == 4: - options['creator'] = ncreator - options['type'] = ntype - return options - else: - MacOS.SysBeep() - elif n == OD_CANCEL_ITEM: - return - elif n in (OD_CREATOR_ITEM, OD_TYPE_ITEM): - pass - elif n == OD_KEEPALWAYS_ITEM: - options['keep_console'] = 3; - elif n == OD_KEEPOUTPUT_ITEM: - options['keep_console'] = 1; - elif n == OD_KEEPERROR_ITEM: - options['keep_console'] = 2; - elif n == OD_KEEPNEVER_ITEM: - options['keep_console'] = 0; - elif n == OD_HELP_ITEM and Help: - onoff = Help.HMGetBalloons() - Help.HMSetBalloons(not onoff) - elif 1 <= n <= len(opt_dialog_map): - options[opt_dialog_map[n]] = (not options[opt_dialog_map[n]]) - - -def interact(options, title): - """Let the user interact with the dialog""" - try: - # Try to go to the "correct" dir for GetDirectory - os.chdir(options['dir'].as_pathname()) - except os.error: - pass - d = GetNewDialog(DIALOG_ID, -1) - htext = d.GetDialogItemAsControl(TITLE_ITEM) - SetDialogItemText(htext, title) - path_ctl = d.GetDialogItemAsControl(TEXT_ITEM) - data = string.joinfields(options['path'], '\r') - path_ctl.SetControlData(Controls.kControlEditTextPart, Controls.kControlEditTextTextTag, data) - - d.SelectDialogItemText(TEXT_ITEM, 0, 32767) - d.SelectDialogItemText(TEXT_ITEM, 0, 0) -## d.SetDialogDefaultItem(OK_ITEM) - d.SetDialogCancelItem(CANCEL_ITEM) - if not Help: - d.HideDialogItem(HELP_ITEM) - d.GetDialogWindow().ShowWindow() - d.DrawDialog() - while 1: - n = ModalDialog(None) - if n == OK_ITEM: - break - if n == CANCEL_ITEM: - return None -## if n == REVERT_ITEM: -## return [], pythondir - if n == DIR_ITEM: - fss = EasyDialogs.AskFolder(message='Select python home folder:', - wanted=macfs.FSSpec) - if fss: - options['dir'] = fss - elif n == HELP_ITEM and Help: - onoff = Help.HMGetBalloons() - Help.HMSetBalloons(not onoff) - if n == OPTIONS_ITEM: - noptions = options - for k in options.keys(): - noptions[k] = options[k] - noptions = optinteract(noptions) - if noptions: - options = noptions - data = path_ctl.GetControlData(Controls.kControlEditTextPart, Controls.kControlEditTextTextTag) - tmp = string.splitfields(data, '\r') - newpath = [] - for i in tmp: - if i: - newpath.append(i) - options['path'] = newpath - return options - - -def edit_preferences(): - handler = pythonprefs.PythonOptions() - options = handler.load() - if options['noargs']: - EasyDialogs.Message('Warning: system-wide sys.argv processing is off.\nIf you dropped an applet I have not seen it.') - result = interact(options, 'System-wide preferences') - if result: - handler.save(result) - -def edit_applet(name): - handler = pythonprefs.AppletOptions(name) - result = interact(handler.load(), os.path.split(name)[1]) - if result: - handler.save(result) - -def main(): - macresource.need('DLOG', DIALOG_ID, 'EditPythonPrefs.rsrc') - - MacOS.SchedParams(1, 0) - if len(sys.argv) <= 1: - edit_preferences() - else: - for appl in sys.argv[1:]: - edit_applet(appl) - - -if __name__ == '__main__': - main() diff --git a/Mac/scripts/EditPythonPrefs.rsrc b/Mac/scripts/EditPythonPrefs.rsrc Binary files differdeleted file mode 100644 index 745cbec..0000000 --- a/Mac/scripts/EditPythonPrefs.rsrc +++ /dev/null diff --git a/Mac/scripts/EditPythonPrefsBH.bh b/Mac/scripts/EditPythonPrefsBH.bh deleted file mode 100644 index 9a5e1ac..0000000 --- a/Mac/scripts/EditPythonPrefsBH.bh +++ /dev/null @@ -1,47 +0,0 @@ -STR# 26733 -DIALOG 511 -1.1 Enter folders to include in sys.path. Use the arrow keys to navigate. -2.1 Press when done. -3.1 Press to leave settings as they are. -4.1 Select the folder that will replace $(PYTHON) in sys.path items. -7.1 Press to show a dialog that allows you to set options. -9.1 Press here to turn help balloons off again. -END-DIALOG -DIALOG 510 -1.1 Press here when satisfied with your new settings in this dialog. -2.1 Press here when you're not satisfied with your new settings. -3.1 Turn this item on to get the standard >>> prompt after a script terminates. -3.3 Turn this item off to have the interpreter terminate when a script terminates. -4.1 Turn this option on to get feedback on where modules are found and what their type is. -4.3 Turn this option off to stop import feedback. -5.1 Turn this option on to strip LINO instructions from Python bytecode. Gives a slight speedup. -5.3 Turn this option off to include LINO instructions in the bytecode. This enables line numbers in traceback printouts. -6.1 Turn this on to show output byte-by-byte as it is produced. Slows things down. -6.3 Turn this off to show output on a line-by-line basis, or when input is requested. -7.1 Print gibberish only Guido understands. -7.3 Stop printing gibberish. -8.1 Select to warn about mixing tabs and spaces in your source. -8.3 Deselect to treat tabs as 4 spaces without warning. -9.1 Selecting this disables the site-python feature. -9.3 Deselecting this enables the site-python feature. -10.1 Select this to keep the old behaviour for macfs Standard File calls -10.3 Deselect this to auto-import macfsn which replaces macfs Standard File calls with Navigation Services wrappers -11.1 Turn this on to stop the user from asking for the startup option dialog with the option key. Use this on applets only. -11.3 Turn this off to enable the user to set options by depressing <option> while Python is starting up. -12.1 If you enable this Python will not try to build a unix-style sys.argv, leaving all AppleEvents for your script. Use this for applets only. -12.3 If you disable this Python will create a sys.argv consisting of the files dropped on the interpreter or applet. -13.1 Turn this on to refrain from showing the console window and menu bar until something is printed. Use this for applets only. -13.3 Turn this off to show the console window and menu bar immedeately upon startup. -14.1 Select this to always keep the console window open after script termination. -14.3 The console window is always kept open after script termination. -15.1 Select this to keep the console window open if there is output that you may not have had a chance to look at. -15.3 The console window stays open if there is output that you may not have had a chance to look at. -16.1 Select this to keep the console window open when a script aborts. -16.3 The console window stays open when a script aborts. -17.1 Select this to always close the console window on script termination. -17.3 The console window is always closed on script termination. -18.1 The creator code Python will create files with. Select your favourite text editor. -19.1 The type code Python will create files with. TEXT is probably best. -20.1 Press here to turn help balloons off again. -END-DIALOG -END diff --git a/Mac/scripts/EditPythonPrefsBH.prj b/Mac/scripts/EditPythonPrefsBH.prj Binary files differdeleted file mode 100644 index 6ab97a5..0000000 --- a/Mac/scripts/EditPythonPrefsBH.prj +++ /dev/null diff --git a/Mac/scripts/EditPythonPrefsBH.rsrc b/Mac/scripts/EditPythonPrefsBH.rsrc Binary files differdeleted file mode 100644 index a63db5a..0000000 --- a/Mac/scripts/EditPythonPrefsBH.rsrc +++ /dev/null diff --git a/Mac/scripts/MkDistr.py b/Mac/scripts/MkDistr.py deleted file mode 100644 index 3e2ee27..0000000 --- a/Mac/scripts/MkDistr.py +++ /dev/null @@ -1,318 +0,0 @@ -# -# Interactively decide what to distribute -# -# -# The exclude file signals files to always exclude, -# The pattern file lines are of the form -# *.c -# This excludes all files ending in .c. -# -# The include file signals files and directories to include. -# Records are of the form -# ('Tools:bgen:AE:AppleEvents.py', 'Lib:MacToolbox:AppleEvents.py') -# This includes the specified file, putting it in the given place, or -# ('Tools:bgen:AE:AppleEvents.py', None) -# This excludes the specified file. -# -from MkDistr_ui import * -import fnmatch -import re -import os -import sys -import macfs -import macostools - -DEBUG=0 - -SyntaxError='Include/exclude file syntax error' - -class Matcher: - """Include/exclude database, common code""" - - def __init__(self, filename): - self.filename = filename - self.rawdata = [] - self.parse(filename) - self.rawdata.sort() - self.rebuild() - self.modified = 0 - - def parse(self, dbfile): - try: - fp = open(dbfile) - except IOError: - return - data = fp.readlines() - fp.close() - for d in data: - d = d[:-1] - if not d or d[0] == '#': continue - pat = self.parseline(d) - self.rawdata.append(pat) - - def save(self): - fp = open(self.filename, 'w') - self.savedata(fp, self.rawdata) - self.modified = 0 - - def add(self, value): - if len(value) == 1: - value = value + ('',) - self.rawdata.append(value) - self.rebuild1(value) - self.modified = 1 - - def delete(self, value): - key = value - for i in range(len(self.rawdata)): - if self.rawdata[i][0] == key: - del self.rawdata[i] - self.unrebuild1(i, key) - self.modified = 1 - return - print 'Not found!', key - - def getall(self): - return map(lambda x: x[0], self.rawdata) - - def get(self, value): - for src, dst in self.rawdata: - if src == value: - return src, dst - print 'Not found!', value - - def is_modified(self): - return self.modified - -class IncMatcher(Matcher): - """Include filename database and matching engine""" - - def rebuild(self): - self.idict = {} - self.edict = {} - for v in self.rawdata: - self.rebuild1(v) - - def parseline(self, line): - try: - data = eval(line) - except: - raise SyntaxError, line - if type(data) <> type(()) or len(data) not in (1,2): - raise SyntaxError, line - if len(data) == 1: - data = data + ('',) - return data - - def savedata(self, fp, data): - for d in self.rawdata: - fp.write(`d`+'\n') - - def rebuild1(self, (src, dst)): - if dst == '': - dst = src - if dst == None: - self.edict[src] = None - else: - self.idict[src] = dst - - def unrebuild1(self, num, src): - if self.idict.has_key(src): - del self.idict[src] - else: - del self.edict[src] - - def match(self, patharg): - removed = [] - # First check the include directory - path = patharg - while 1: - if self.idict.has_key(path): - # We know of this path (or initial piece of path) - dstpath = self.idict[path] - # We do want it distributed. Tack on the tail. - while removed: - dstpath = os.path.join(dstpath, removed[0]) - removed = removed[1:] - # Finally, if the resultant string ends in a separator - # tack on our input filename - if dstpath[-1] == os.sep: - dir, file = os.path.split(path) - dstpath = os.path.join(dstpath, file) - if DEBUG: - print 'include', patharg, dstpath - return dstpath -## path, lastcomp = os.path.split(path) -## if not path: -## break -## removed[0:0] = [lastcomp] -## # Next check the exclude directory -## path = patharg -## while 1: - if self.edict.has_key(path): - if DEBUG: - print 'exclude', patharg, path - return '' - path, lastcomp = os.path.split(path) - if not path: - break - removed[0:0] = [lastcomp] - if DEBUG: - print 'nomatch', patharg - return None - - def checksourcetree(self): - rv = [] - for name in self.idict.keys(): - if not os.path.exists(name): - rv.append(name) - return rv - -class ExcMatcher(Matcher): - """Exclude pattern database and matching engine""" - - def rebuild(self): - self.relist = [] - for v in self.rawdata: - self.rebuild1(v) - - def parseline(self, data): - return (data, None) - - def savedata(self, fp, data): - for d in self.rawdata: - fp.write(d[0]+'\n') - - def rebuild1(self, (src, dst)): - pat = fnmatch.translate(src) - if DEBUG: - print 'PATTERN', `src`, 'REGEX', `pat` - self.relist.append(re.compile(pat)) - - def unrebuild1(self, num, src): - del self.relist[num] - - def match(self, path): - comps = os.path.split(path) - file = comps[-1] - for pat in self.relist: - if pat and pat.match(file): - if DEBUG: - print 'excmatch', file, pat - return 1 - return 0 - - -class Main: - """The main program glueing it all together""" - - def __init__(self): - InitUI() - os.chdir(sys.prefix) - if not os.path.isdir(':Mac:Distributions'): - os.mkdir(':Mac:Distributions') - self.typedist = GetType() - self.inc = IncMatcher(':Mac:Distributions:%s.include'%self.typedist) - self.exc = ExcMatcher(':Mac:Distributions:%s.exclude'%self.typedist) - self.ui = MkDistrUI(self) - self.ui.mainloop() - - def check(self): - return self.checkdir(':', 1) - - def checkdir(self, path, istop): - if DEBUG: - print 'checkdir', path - files = os.listdir(path) - rv = [] - todo = [] - for f in files: - if DEBUG: - print 'checkfile', f - if self.exc.match(f): - if DEBUG: - print 'exclude match', f - continue - fullname = os.path.join(path, f) - if DEBUG: - print 'checkpath', fullname - matchvalue = self.inc.match(fullname) - if matchvalue == None: - if os.path.isdir(fullname): - if DEBUG: - print 'do dir', fullname - todo.append(fullname) - else: - if DEBUG: - print 'include', fullname - rv.append(fullname) - elif DEBUG: - print 'badmatch', matchvalue - for d in todo: - if len(rv) > 500: - if istop: - rv.append('... and more ...') - return rv - rv = rv + self.checkdir(d, 0) - return rv - - def run(self): - missing = self.inc.checksourcetree() - if missing: - print '==== Missing source files ====' - for i in missing: - print i - print '==== Fix and retry ====' - return - destprefix = os.path.join(sys.prefix, ':Mac:Distributions:(vise)') - destprefix = os.path.join(destprefix, '%s Distribution'%self.typedist) - if not self.rundir(':', destprefix, 0): - return - self.rundir(':', destprefix, 1) - - def rundir(self, path, destprefix, doit): - files = os.listdir(path) - todo = [] - rv = 1 - for f in files: - if self.exc.match(f): - continue - fullname = os.path.join(path, f) - if os.path.isdir(fullname): - todo.append(fullname) - else: - dest = self.inc.match(fullname) - if dest == None: - print 'Not yet resolved:', fullname - rv = 0 - if dest: - if doit: - print 'COPY ', fullname - print ' -> ', os.path.join(destprefix, dest) - try: - macostools.copy(fullname, os.path.join(destprefix, dest), 1) - except: #DBG - print '*** Copy failed mysteriously, try again' - print '*** cwd', os.getcwd() #DBG - print '*** fsspec', macfs.FSSpec(fullname) #DBG - # Get rid of open files - try: - i = 1 / 0 - except: - pass - macostools.copy(fullname, os.path.join(destprefix, dest), 1) - for d in todo: - if not self.rundir(d, destprefix, doit): - rv = 0 - return rv - - def save(self): - self.inc.save() - self.exc.save() - - def is_modified(self): - return self.inc.is_modified() or self.exc.is_modified() - -if __name__ == '__main__': - Main() - diff --git a/Mac/scripts/MkDistr.rsrc b/Mac/scripts/MkDistr.rsrc Binary files differdeleted file mode 100644 index 47416d9..0000000 --- a/Mac/scripts/MkDistr.rsrc +++ /dev/null diff --git a/Mac/scripts/MkDistr_ui.py b/Mac/scripts/MkDistr_ui.py deleted file mode 100644 index ee7ace0..0000000 --- a/Mac/scripts/MkDistr_ui.py +++ /dev/null @@ -1,356 +0,0 @@ -# -# MkDistr - User Interface. -# -# Jack Jansen, CWI, August 1995 -# -# XXXX To be done (requires mods of FrameWork and toolbox interfaces too): -# - Give dialogs titles (need dlg->win conversion) -# - Place dialogs better (???) -# - <return> as <ok> -# - big box around ok button -# - window-close crashes on reopen (why?) -# - Box around lists (???) -# - Change cursor while busy (need cursor support in Qd) -# -from Carbon import Res -from Carbon import Dlg -from Carbon import Ctl -from Carbon import List -from Carbon import Win -from Carbon import Qd -from FrameWork import * -import EasyDialogs -import os -import sys -import macresource - -# Resource IDs -ID_MAIN = 514 -MAIN_LIST=1 -MAIN_MKDISTR=2 -MAIN_CHECK=3 -MAIN_INCLUDE=4 -MAIN_EXCLUDE=5 - -ID_INCWINDOW=515 -ID_EXCWINDOW=517 -INCEXC_DELETE=2 -INCEXC_CHANGE=3 -INCEXC_ADD=4 - -ID_INCLUDE=512 -ID_EXCLUDE=513 -DLG_OK=1 # Include for include, exclude for exclude -DLG_CANCEL=2 -DLG_SRCPATH=3 -DLG_DSTPATH=4 # include dialog only -DLG_EXCLUDE=5 # Exclude, include dialog only - -ID_DTYPE=516 -DTYPE_EXIST=1 -DTYPE_NEW=2 -DTYPE_CANCEL=3 - -class EditDialogWindow(DialogWindow): - """Include/exclude editor (modeless dialog window)""" - - def open(self, id, (src, dst), callback, cancelrv): - self.id = id - self.callback = callback - self.cancelrv = cancelrv - DialogWindow.open(self, id) - tp, h, rect = self.dlg.GetDialogItem(DLG_SRCPATH) - Dlg.SetDialogItemText(h, src) - self.dlg.SetDialogDefaultItem(DLG_OK) - self.dlg.SetDialogCancelItem(DLG_CANCEL) - if id == ID_INCLUDE: - tp, h, rect = self.dlg.GetDialogItem(DLG_DSTPATH) - if dst == None: - dst = '' - Dlg.SetDialogItemText(h, dst) - self.dlg.DrawDialog() - - def do_itemhit(self, item, event): - if item in (DLG_OK, DLG_CANCEL, DLG_EXCLUDE): - self.done(item) - # else it is not interesting - - def done(self, item): - tp, h, rect = self.dlg.GetDialogItem(DLG_SRCPATH) - src = Dlg.GetDialogItemText(h) - if item == DLG_OK: - if self.id == ID_INCLUDE: - tp, h, rect = self.dlg.GetDialogItem(DLG_DSTPATH) - dst = Dlg.GetDialogItemText(h) - rv = (src, dst) - else: - rv = (src, None) - elif item == DLG_EXCLUDE: - rv = (src, None) - else: - rv = self.cancelrv - self.close() - self.callback((item in (DLG_OK, DLG_EXCLUDE)), rv) - -class ListWindow(DialogWindow): - """A dialog window containing a list as its main item""" - - def open(self, id, contents): - self.id = id - DialogWindow.open(self, id) - Qd.SetPort(self.wid) - tp, h, rect = self.dlg.GetDialogItem(MAIN_LIST) - self.listrect = rect - rect2 = rect[0]+1, rect[1]+1, rect[2]-16, rect[3]-16 # Scroll bar space - self.list = List.LNew(rect2, (0, 0, 1, len(contents)), (0,0), 0, self.wid, - 0, 1, 1, 1) - self.setlist(contents) - - def setlist(self, contents): - self.list.LDelRow(0, 0) - self.list.LSetDrawingMode(0) - if contents: - self.list.LAddRow(len(contents), 0) - for i in range(len(contents)): - self.list.LSetCell(contents[i], (0, i)) - self.list.LSetDrawingMode(1) - ##self.list.LUpdate(self.wid.GetWindowPort().visRgn) - self.wid.InvalWindowRect(self.listrect) - - def additem(self, item): - where = self.list.LAddRow(1, 0) - self.list.LSetCell(item, (0, where)) - - def delgetitem(self, item): - data = self.list.LGetCell(1000, (0, item)) - self.list.LDelRow(1, item) - return data - - def do_listhit(self, event): - (what, message, when, where, modifiers) = event - Qd.SetPort(self.wid) - where = Qd.GlobalToLocal(where) - if self.list.LClick(where, modifiers): - self.do_dclick(self.delgetselection()) - - def delgetselection(self): - items = [] - point = (0,0) - while 1: - ok, point = self.list.LGetSelect(1, point) - if not ok: - break - items.append(point[1]) - point = point[0], point[1]+1 - values = [] - items.reverse() - for i in items: - values.append(self.delgetitem(i)) - return values - - def do_rawupdate(self, window, event): - Qd.SetPort(window) - Qd.FrameRect(self.listrect) - self.list.LUpdate(self.wid.GetWindowPort().visRgn) - - def do_close(self): - self.close() - - def close(self): - del self.list - DialogWindow.close(self) - - def mycb_add(self, ok, item): - if item: - self.additem(item[0]) - self.cb_add(item) - -class MainListWindow(ListWindow): - """The main window""" - - def open(self, id, cb_check, cb_run, cb_add): - ListWindow.open(self, id, []) - self.dlg.SetDialogDefaultItem(MAIN_INCLUDE) - self.cb_run = cb_run - self.cb_check = cb_check - self.cb_add = cb_add - setwatchcursor() - list = self.cb_check() - self.setlist(list) - setarrowcursor() - - def do_itemhit(self, item, event): - if item == MAIN_LIST: - self.do_listhit(event) - if item == MAIN_MKDISTR: - setwatchcursor() - self.cb_run() - setarrowcursor() - if item == MAIN_CHECK: - setwatchcursor() - list = self.cb_check() - self.setlist(list) - setarrowcursor() - if item == MAIN_INCLUDE: - self.do_dclick(self.delgetselection()) - if item == MAIN_EXCLUDE: - for i in self.delgetselection(): - self.cb_add((i, None)) - - def do_dclick(self, list): - if not list: - list = [''] - for l in list: - w = EditDialogWindow(self.parent) - w.open(ID_INCLUDE, (l, None), self.mycb_add, None) - - def mycb_add(self, ok, item): - if item: - self.cb_add(item) - -class IncListWindow(ListWindow): - """An include/exclude window""" - def open(self, id, editid, contents, cb_add, cb_del, cb_get): - ListWindow.open(self, id, contents) - self.dlg.SetDialogDefaultItem(INCEXC_CHANGE) - self.editid = editid - self.cb_add = cb_add - self.cb_del = cb_del - self.cb_get = cb_get - - def do_itemhit(self, item, event): - if item == MAIN_LIST: - self.do_listhit(event) - if item == INCEXC_DELETE: - old = self.delgetselection() - for i in old: - self.cb_del(i) - if item == INCEXC_CHANGE: - self.do_dclick(self.delgetselection()) - if item == INCEXC_ADD: - w = EditDialogWindow(self.parent) - w.open(self.editid, ('', None), self.mycb_add, None) - - def do_dclick(self, list): - if not list: - list = [''] - for l in list: - old = self.cb_get(l) - self.cb_del(l) - w = EditDialogWindow(self.parent) - w.open(self.editid, old, self.mycb_add, old) - -class MkDistrUI(Application): - def __init__(self, main): - self.main = main - Application.__init__(self) - self.mwin = MainListWindow(self) - self.mwin.open(ID_MAIN, self.main.check, self.main.run, self.main.inc.add) - self.iwin = None - self.ewin = None - - def makeusermenus(self): - self.filemenu = m = Menu(self.menubar, "File") - self.includeitem = MenuItem(m, "Show Include window", "", self.showinc) - self.excludeitem = MenuItem(m, "Show Exclude window", "", self.showexc) - self.saveitem = MenuItem(m, "Save databases", "S", self.save) - self.quititem = MenuItem(m, "Quit", "Q", self.quit) - - def quit(self, *args): - if self.main.is_modified(): - rv = EasyDialogs.AskYesNoCancel('Database modified. Save?', -1) - if rv == -1: - return - if rv == 1: - self.main.save() - self._quit() - - def save(self, *args): - self.main.save() - - def showinc(self, *args): - if self.iwin: - if self._windows.has_key(self.iwin): - self.iwin.close() - del self.iwin - self.iwin = IncListWindow(self) - self.iwin.open(ID_INCWINDOW, ID_INCLUDE, self.main.inc.getall(), self.main.inc.add, - self.main.inc.delete, self.main.inc.get) - - def showexc(self, *args): - if self.ewin: - if self._windows.has_key(self.ewin): - self.ewin.close() - del self.ewin - self.ewin = IncListWindow(self) - self.ewin.open(ID_EXCWINDOW, ID_EXCLUDE, self.main.exc.getall(), self.main.exc.add, - self.main.exc.delete, self.main.exc.get) - - def do_about(self, id, item, window, event): - EasyDialogs.Message("Test the MkDistr user interface.") - -def GetType(): - """Ask user for distribution type""" - while 1: - d = Dlg.GetNewDialog(ID_DTYPE, -1) - d.SetDialogDefaultItem(DTYPE_EXIST) - d.SetDialogCancelItem(DTYPE_CANCEL) - while 1: - rv = ModalDialog(None) - if rv in (DTYPE_EXIST, DTYPE_NEW, DTYPE_CANCEL): - break - del d - if rv == DTYPE_CANCEL: - sys.exit(0) - if rv == DTYPE_EXIST: - path = EasyDialogs.AskFileForOpen() - if not path: - sys.exit(0) - basename = os.path.split(path)[-1] - if basename[-8:] <> '.include': - EasyDialogs.Message('That is not a distribution include file') - else: - return basename[:-8] - else: - name = EasyDialogs.AskString('Distribution name:') - if name: - return name - sys.exit(0) - -def InitUI(): - """Initialize stuff needed by UI (a resource file)""" - macresource.need('DLOG', ID_MAIN, 'MkDistr.rsrc', modname=__name__) - -class _testerhelp: - def __init__(self, which): - self.which = which - - def get(self): - return [self.which+'-one', self.which+'-two'] - - def add(self, value): - if value: - print 'ADD', self.which, value - - def delete(self, value): - print 'DEL', self.which, value - -class _test: - def __init__(self): - import sys - InitUI() - self.inc = _testerhelp('include') - self.exc = _testerhelp('exclude') - self.ui = MkDistrUI(self) - self.ui.mainloop() - sys.exit(1) - - def check(self): - print 'CHECK' - return ['rv1', 'rv2'] - - def run(self): - print 'RUN' - -if __name__ == '__main__': - _test() diff --git a/Mac/scripts/buildappbundle.py b/Mac/scripts/buildappbundle.py deleted file mode 100755 index 281c6fe..0000000 --- a/Mac/scripts/buildappbundle.py +++ /dev/null @@ -1,104 +0,0 @@ -#! /usr/bin/env python - -# XXX This will be replaced by a main program in Mac/Lib/bundlebuilder.py, -# but for now this is kept so Jack won't need to change his scripts... - - -"""\ -buildappbundle creates an application bundle -Usage: - buildappbundle [options] executable -Options: - --output o Output file; default executable with .app appended, short -o - --link Symlink the executable instead of copying it, short -l - --plist file Plist file (default: generate one), short -p - --nib file Main nib file or lproj folder for Cocoa program, short -n - --resource r Extra resource file to be copied to Resources, short -r - --creator c 4-char creator code (default: '????'), short -c - --verbose increase verbosity level (default: quiet), short -v - --help This message, short -? or -h -""" - - -import sys -import os -import getopt -from bundlebuilder import AppBuilder -from plistlib import Plist - - -def usage(): - print __doc__ - sys.exit(1) - - -def main(): - output = None - symlink = 0 - creator = "????" - plist = None - nib = None - resources = [] - verbosity = 0 - SHORTOPTS = "o:ln:r:p:c:v?h" - LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help", - "verbose") - try: - options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) - except getopt.error: - usage() - if len(args) != 1: - usage() - executable = args[0] - for opt, arg in options: - if opt in ('-o', '--output'): - output = arg - elif opt in ('-l', '--link'): - symlink = 1 - elif opt in ('-n', '--nib'): - nib = arg - elif opt in ('-r', '--resource'): - resources.append(arg) - elif opt in ('-c', '--creator'): - creator = arg - elif opt in ('-p', '--plist'): - plist = arg - elif opt in ('-v', '--verbose'): - verbosity += 1 - elif opt in ('-?', '-h', '--help'): - usage() - if output is not None: - builddir, bundlename = os.path.split(output) - else: - builddir = os.curdir - bundlename = None # will be derived from executable - if plist is not None: - plist = Plist.fromFile(plist) - - builder = AppBuilder(name=bundlename, executable=executable, - builddir=builddir, creator=creator, plist=plist, resources=resources, - symlink_exec=symlink, verbosity=verbosity) - - if nib is not None: - resources.append(nib) - nibname, ext = os.path.splitext(os.path.basename(nib)) - if ext == '.lproj': - # Special case: if the main nib is a .lproj we assum a directory - # and use the first nib from there. XXX Look: an arbitrary pick ;-) - files = os.listdir(nib) - for f in files: - if f[-4:] == '.nib': - nibname = os.path.split(f)[1][:-4] - break - else: - nibname = "" - if nibname: - builder.plist.NSMainNibFile = nibname - if not hasattr(builder.plist, "NSPrincipalClass"): - builder.plist.NSPrincipalClass = "NSApplication" - builder.setup() - builder.build() - - -if __name__ == '__main__': - main() diff --git a/Mac/scripts/crlf.py b/Mac/scripts/crlf.py deleted file mode 100755 index 6506cdc..0000000 --- a/Mac/scripts/crlf.py +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/local/bin/python - -# Replace \r by \n -- useful after transferring files from the Mac... -# Run this on UNIX. -# Usage: crlf.py file ... - -import sys -import os -import string - -def main(): - args = sys.argv[1:] - if not args: - print 'usage:', sys.argv[0], 'file ...' - sys.exit(2) - for file in args: - print file, '...' - data = open(file, 'r').read() - lines = string.splitfields(data, '\r') - newdata = string.joinfields(lines, '\n') - if newdata != data: - print 'rewriting...' - os.rename(file, file + '~') - open(file, 'w').write(newdata) - print 'done.' - else: - print 'no change.' - -main() diff --git a/Mac/scripts/findgremlins.py b/Mac/scripts/findgremlins.py deleted file mode 100644 index 3569c77..0000000 --- a/Mac/scripts/findgremlins.py +++ /dev/null @@ -1,57 +0,0 @@ -"""findgremlins - Search through a folder and subfolders for -text files that have characters with bit 8 set, and print -the filename and a bit of context. - -By Just, with a little glue by Jack""" - -import EasyDialogs -import MacOS -import re -import os -import string -import sys - -xpat = re.compile(r"[\200-\377]") - -def walk(top, recurse=1): - if os.path.isdir(top): - if recurse: - for name in os.listdir(top): - path = os.path.join(top, name) - walk(path) - else: - cr, tp = MacOS.GetCreatorAndType(top) - if tp in ('TEXT', '\0\0\0\0') and top[-4:] <> ".hqx": - data = open(top).read() - badcount = 0 - for ch in data[:256]: - if ord(ch) == 0 or ord(ch) >= 0200: - badcount = badcount + 1 - if badcount > 16: - print `top`, 'appears to be a binary file' - return - pos = 0 - gotone = 0 - while 1: - m = xpat.search(data, pos) - if m is None: - break - if not gotone: - print `top` - gotone = 1 - [(i, j)] = m.regs - print " ", string.replace(data[i-15:j+15], '\n', ' ') - pos = j - -def main(): - if sys.argv[1:]: - for pathname in sys.argv[1:]: - walk(pathname) - else: - pathname = EasyDialogs.AskFolder() - if pathname: - walk(pathname) - -if __name__ == '__main__': - main() - diff --git a/Mac/scripts/fixfiletypes.py b/Mac/scripts/fixfiletypes.py deleted file mode 100644 index bbbf807..0000000 --- a/Mac/scripts/fixfiletypes.py +++ /dev/null @@ -1,56 +0,0 @@ -# -# Fixfiletypes - Set mac filetypes to something sensible, -# recursively down a directory tree. -# -# It will only touch extensions it feels pretty sure about. -# This script is useful after copying files from unix. -# -# Jack Jansen, CWI, 1995. -# -import os -import EasyDialogs -import sys -import macostools -import MacOS - -list = [ - ('.py', 'Pyth', 'TEXT'), - ('.pyc', 'Pyth', 'PYC '), - ('.c', 'CWIE', 'TEXT'), - ('.h', 'CWIE', 'TEXT'), - ('.as', 'ToyS', 'TEXT'), - ('.hqx', 'BnHq', 'TEXT'), - ('.cmif', 'CMIF', 'TEXT'), - ('.cmc', 'CMIF', 'CMC '), - ('.aiff', 'SCPL', 'AIFF'), - ('.mpg', 'mMPG', 'MPEG'), -] - -def walktree(name, change): - if os.path.isfile(name): - for ext, cr, tp in list: - if name[-len(ext):] == ext: - curcrtp = MacOS.GetCreatorAndType(name) - if curcrtp <> (cr, tp): - if change: - MacOS.SetCreatorAndType(name, cr, tp) - macostools.touched(fs) - print 'Fixed ', name - else: - print 'Wrong', curcrtp, name - elif os.path.isdir(name): - print '->', name - files = os.listdir(name) - for f in files: - walktree(os.path.join(name, f), change) - -def run(change): - pathname = EasyDialogs.AskFolder(message='Folder to search:') - if not pathname: - sys.exit(0) - walktree(pathname, change) - -if __name__ == '__main__': - run(0) - - diff --git a/Mac/scripts/fullbuild.py b/Mac/scripts/fullbuild.py deleted file mode 100644 index 28ad59f..0000000 --- a/Mac/scripts/fullbuild.py +++ /dev/null @@ -1,434 +0,0 @@ -# -# fullbuild creates everything that needs to be created before a -# distribution can be made, and puts it all in the right place. -# -# It expects the projects to be in the places where Jack likes them: -# in directories named like 'build.mac'. That is fixable, -# however. -# -# NOTE: You should proably make a copy of python with which to execute this -# script, rebuilding running programs does not work... - -CARBON_ONLY = 1 - -MACBUILDNO=":Mac:Include:macbuildno.h" - -import os -import sys -import Carbon.File -import MacOS -import EasyDialogs -import re -import string -import genpluginprojects -import macresource - -import aetools -from Carbon import AppleEvents - -import CodeWarrior - -from Carbon import Res -from Carbon import Dlg - -import buildtools -import cfmfile - -# Dialog resource. Note that the item numbers should correspond -# to those in the DITL resource. Also note that the order is important: -# things are built in this order, so there should be no forward dependencies. -DIALOG_ID = 512 - -I_OK=1 -I_CANCEL=2 -# label 3 -I_PPC_EXTLIBS=4 -I_GEN_PROJECTS=5 -I_GEN_PROJECTS_FORCE=6 -I_GEN_IMGPROJECTS=7 -I_GEN_IMGPROJECTS_FORCE=8 -I_INC_BUILDNO=9 -# label 10 -I_PPC_CORE=11 -I_PPC_PLUGINS=12 -I_PPC_EXTENSIONS=13 -# label 14 -I_CARBON_CORE=15 -I_CARBON_PLUGINS=16 -I_CARBON_EXTENSIONS=17 -I_INTERPRETER=18 -# label 19 -I_PPC_FULL=20 -I_PPC_SMALL=21 -# label 22 -I_CARBON_FULL=23 -I_CARBON_SMALL=24 -# label 25 -I_APPLETS=26 - -N_BUTTONS=27 - -if CARBON_ONLY: - BUTTONS_DISABLE = [ - I_PPC_EXTLIBS, - I_PPC_CORE, - I_PPC_PLUGINS, - I_PPC_EXTENSIONS, - I_INTERPRETER, - I_PPC_FULL, - I_PPC_SMALL, - ] -else: - BUTTONS_DISABLE = [] - -RUNNING=[] - -def buildmwproject(top, creator, projects): - """Build projects with an MW compiler""" - mgr = CodeWarrior.CodeWarrior(creator, start=1) - mgr.send_timeout = AppleEvents.kNoTimeOut - - failed = [] - for file in projects: - if type(file) == type(()): - file, target = file - else: - target = '' - file = os.path.join(top, file) - try: - fss = Carbon.File.FSSpec(file) - except MacOS.Error: - print '** file not found:', file - continue - print 'Building', file, target - try: - mgr.open(fss) - except aetools.Error, detail: - print '**', detail, file - continue - if target: - try: - mgr.Set_Current_Target(target) - except aetools.Error, arg: - print '**', file, target, 'Cannot select:', arg - try: - mgr.Make_Project() - except aetools.Error, arg: - print '**', file, target, 'Failed:', arg - failed.append(fss) - mgr.Close_Project() - if failed: - print 'Open failed projects and exit?', - rv = sys.stdin.readline() - if rv[0] in ('y', 'Y'): - for fss in failed: - mgr.open(fss) - sys.exit(0) -## mgr.quit() - -def buildapplet(top, dummy, list): - """Create python applets""" - for src, dst, tmpl in list: - template = buildtools.findtemplate(tmpl) - if src[-3:] != '.py': - raise 'Should end in .py', src - base = os.path.basename(src) - src = os.path.join(top, src) - dst = os.path.join(top, dst) - try: - os.unlink(dst) - except os.error: - pass - print 'Building applet', dst - try: - buildtools.process(template, src, dst, 1) - except buildtools.BuildError, arg: - print '**', dst, arg - -def buildprojectfile(top, arg, list): - """Create CodeWarrior project files with a script""" - for folder, module, routine in list: - print "Generating project files with", module - sys.path.insert(0, os.path.join(top, folder)) - m = __import__(module) - r = getattr(m, routine) - r(arg) - del sys.path[0] - -def buildfat(top, dummy, list): - """Build fat binaries""" - for dst, src1, src2 in list: - dst = os.path.join(top, dst) - src1 = os.path.join(top, src1) - src2 = os.path.join(top, src2) - print 'Building fat binary', dst - cfmfile.mergecfmfiles((src1, src2), dst) - -def buildcopy(top, dummy, list): - import macostools - for src, dst in list: - src = os.path.join(top, src) - dst = os.path.join(top, dst) - macostools.copy(src, dst, forcetype="APPL") - -def buildsetup(top, dummy, list): - print 'Building extensions with setup.py ', ' '.join(list) - argv = ['setup.py'] + list[:] - save_argv = sys.argv - sys.argv = argv - sys.path.insert(0, top) - m = __import__('setup') - r = getattr(m, 'main') - r() - del sys.path[0] - sys.argv = save_argv - -def buildcarbonplugins(top, dummy1, dummy2): -## XXXX Need to convert pathnames, I guess, and adapt distutils Mac-specific -## code to not call GetArgv if not needed. -## buildsetup(top, None, [ -## '--dry_run', -## 'install', -## '--prefix=%s' % sys.prefix, -## '--install-scripts=%s' % os.path.join(sys.prefix, 'Scripts'), -## '--install-platlib=%s' % os.path.join(sys.prefix, 'Lib', 'lib-dynload') -## ]) - buildmwproject(top, "CWIE", [ - (":Mac:Build:_csv.carbon.mcp", "_csv.carbon"), - (":Mac:Build:_weakref.carbon.mcp", "_weakref.carbon"), - (":Mac:Build:_symtable.carbon.mcp", "_symtable.carbon"), - (":Mac:Build:_testcapi.carbon.mcp", "_testcapi.carbon"), - (":Mac:Build:_hotshot.carbon.mcp", "_hotshot.carbon"), - (":Mac:Build:xx.carbon.mcp", "xx.carbon"), - (":Mac:Build:xxsubtype.carbon.mcp", "xxsubtype.carbon"), - (":Mac:Build:pyexpat.carbon.mcp", "pyexpat.carbon"), - (":Mac:Build:calldll.carbon.mcp", "calldll.carbon"), - (":Mac:Build:datetime.carbon.mcp", "datetime.carbon"), - (":Mac:Build:gdbm.carbon.mcp", "gdbm.carbon"), - (":Mac:Build:icglue.carbon.mcp", "icglue.carbon"), - (":Mac:Build:waste.carbon.mcp", "waste.carbon"), - (":Mac:Build:zlib.carbon.mcp", "zlib.carbon"), - (":Mac:Build:hfsplus.carbon.mcp", "hfsplus.carbon"), - (":Mac:Build:ColorPicker.carbon.mcp", "ColorPicker.carbon"), - (":Mac:Build:_AE.carbon.mcp", "_AE.carbon"), - (":Mac:Build:_AH.carbon.mcp", "_AH.carbon"), - (":Mac:Build:_App.carbon.mcp", "_App.carbon"), - (":Mac:Build:_CF.carbon.mcp", "_CF.carbon"), - (":Mac:Build:_CG.carbon.mcp", "_CG.carbon"), - (":Mac:Build:_CarbonEvt.carbon.mcp", "_CarbonEvt.carbon"), - (":Mac:Build:_Cm.carbon.mcp", "_Cm.carbon"), - (":Mac:Build:_Ctl.carbon.mcp", "_Ctl.carbon"), - (":Mac:Build:_Dlg.carbon.mcp", "_Dlg.carbon"), - (":Mac:Build:_Drag.carbon.mcp", "_Drag.carbon"), - (":Mac:Build:_Evt.carbon.mcp", "_Evt.carbon"), - (":Mac:Build:_File.carbon.mcp", "_File.carbon"), - (":Mac:Build:_Fm.carbon.mcp", "_Fm.carbon"), - (":Mac:Build:_Folder.carbon.mcp", "_Folder.carbon"), - (":Mac:Build:_Help.carbon.mcp", "_Help.carbon"), - (":Mac:Build:_IBCarbon.carbon.mcp", "_IBCarbon.carbon"), - (":Mac:Build:_Icn.carbon.mcp", "_Icn.carbon"), - (":Mac:Build:_List.carbon.mcp", "_List.carbon"), - (":Mac:Build:_Menu.carbon.mcp", "_Menu.carbon"), - (":Mac:Build:_Mlte.carbon.mcp", "_Mlte.carbon"), - (":Mac:Build:_Qd.carbon.mcp", "_Qd.carbon"), - (":Mac:Build:_Qdoffs.carbon.mcp", "_Qdoffs.carbon"), - (":Mac:Build:_Qt.carbon.mcp", "_Qt.carbon"), - (":Mac:Build:_Res.carbon.mcp", "_Res.carbon"), - (":Mac:Build:_Scrap.carbon.mcp", "_Scrap.carbon"), - (":Mac:Build:_Snd.carbon.mcp", "_Snd.carbon"), - (":Mac:Build:_Sndihooks.carbon.mcp", "_Sndihooks.carbon"), - (":Mac:Build:_TE.carbon.mcp", "_TE.carbon"), - (":Mac:Build:_Win.carbon.mcp", "_Win.carbon"), - ]) - -def handle_dialog(filename): - """Handle selection dialog, return list of selected items""" - d = Dlg.GetNewDialog(DIALOG_ID, -1) - d.SetDialogDefaultItem(I_OK) - d.SetDialogCancelItem(I_CANCEL) - results = [0]*N_BUTTONS - for n in BUTTONS_DISABLE: - ctl = d.GetDialogItemAsControl(n) - ctl.HideControl() - while 1: - n = Dlg.ModalDialog(None) - if n == I_OK: - break - if n == I_CANCEL: - return [] - if n == I_INC_BUILDNO: - incbuildno(filename) - continue - if n < len(results): - results[n] = (not results[n]) - ctl = d.GetDialogItemAsControl(n) - ctl.SetControlValue(results[n]) - rv = [] - for i in range(len(results)): - if results[i]: - rv.append(i) - return rv - -# -# The build instructions. Entries are (routine, arg, list-of-files) -# XXXX We could also include the builds for stdwin and such here... -BUILD_DICT = { -I_GEN_PROJECTS : (buildprojectfile, 0, [ - (":Mac:scripts", "genpluginprojects", "genallprojects") - ]), - -I_GEN_PROJECTS_FORCE : (buildprojectfile, 1, [ - (":Mac:scripts", "genpluginprojects", "genallprojects") - ]), - -I_GEN_IMGPROJECTS : (buildprojectfile, 0, [ - (":Extensions:img:Mac", "genimgprojects", "genallprojects") - ]), - -I_GEN_IMGPROJECTS_FORCE : (buildprojectfile, 1, [ - (":Extensions:img:Mac", "genimgprojects", "genallprojects") - ]), - -I_INTERPRETER : (buildcopy, None, [ - ("PythonInterpreterCarbon", "PythonInterpreter"), - ]), - -I_PPC_CORE : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonCore.mcp", "PythonCore"), - (":Mac:Build:PythonInterpreter.mcp", "PythonInterpreterClassic"), - ]), - -I_CARBON_CORE : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonCore.mcp", "PythonCoreCarbon"), - (":Mac:Build:PythonInterpreter.mcp", "PythonInterpreterCarbon"), - ]), - -I_PPC_EXTLIBS : (buildmwproject, "CWIE", [ -## (":Mac:Build:buildlibs.mcp", "buildlibs ppc plus tcl/tk"), - (":Mac:Build:buildlibs.mcp", "buildlibs ppc"), - ]), - -I_PPC_PLUGINS : (buildmwproject, "CWIE", [ - (":Mac:Build:_weakref.mcp", "_weakref.ppc"), - (":Mac:Build:_symtable.mcp", "_symtable.ppc"), - (":Mac:Build:_testcapi.mcp", "_testcapi.ppc"), - (":Mac:Build:_hotshot.mcp", "_hotshot.ppc"), - (":Mac:Build:xx.mcp", "xx.ppc"), - (":Mac:Build:xxsubtype.mcp", "xxsubtype.ppc"), - (":Mac:Build:pyexpat.mcp", "pyexpat.ppc"), - (":Mac:Build:calldll.mcp", "calldll.ppc"), - (":Mac:Build:ctb.mcp", "ctb.ppc"), - (":Mac:Build:gdbm.mcp", "gdbm.ppc"), - (":Mac:Build:icglue.mcp", "icglue.ppc"), - (":Mac:Build:macspeech.mcp", "macspeech.ppc"), - (":Mac:Build:waste.mcp", "waste.ppc"), - (":Mac:Build:zlib.mcp", "zlib.ppc"), -## (":Mac:Build:_tkinter.mcp", "_tkinter.ppc"), - (":Extensions:Imaging:_tkinter.mcp", "_tkinter.ppc"), - (":Mac:Build:ColorPicker.mcp", "ColorPicker.ppc"), - (":Mac:Build:Printing.mcp", "Printing.ppc"), - (":Mac:Build:_AE.mcp", "_AE.ppc"), - (":Mac:Build:_App.mcp", "_App.ppc"), - (":Mac:Build:_Cm.mcp", "_Cm.ppc"), - (":Mac:Build:_Ctl.mcp", "_Ctl.ppc"), - (":Mac:Build:_Dlg.mcp", "_Dlg.ppc"), - (":Mac:Build:_Drag.mcp", "_Drag.ppc"), - (":Mac:Build:_Evt.mcp", "_Evt.ppc"), - (":Mac:Build:_Fm.mcp", "_Fm.ppc"), - (":Mac:Build:_Help.mcp", "_Help.ppc"), - (":Mac:Build:_Icn.mcp", "_Icn.ppc"), - (":Mac:Build:_List.mcp", "_List.ppc"), - (":Mac:Build:_Menu.mcp", "_Menu.ppc"), - (":Mac:Build:_Mlte.mcp", "_Mlte.ppc"), - (":Mac:Build:_Qd.mcp", "_Qd.ppc"), - (":Mac:Build:_Qdoffs.mcp", "_Qdoffs.ppc"), - (":Mac:Build:_Qt.mcp", "_Qt.ppc"), - (":Mac:Build:_Res.mcp", "_Res.ppc"), - (":Mac:Build:_Scrap.mcp", "_Scrap.ppc"), - (":Mac:Build:_Snd.mcp", "_Snd.ppc"), - (":Mac:Build:_Sndihooks.mcp", "_Sndihooks.ppc"), - (":Mac:Build:_TE.mcp", "_TE.ppc"), - (":Mac:Build:_Win.mcp", "_Win.ppc"), - ]), - -I_CARBON_PLUGINS : (buildcarbonplugins, None, []), - -I_PPC_FULL : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonStandalone.mcp", "PythonStandalone"), - ]), - -I_PPC_SMALL : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonStandSmall.mcp", "PythonStandSmall"), - ]), - -I_CARBON_FULL : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonStandalone.mcp", "PythonCarbonStandalone"), - ]), - -I_CARBON_SMALL : (buildmwproject, "CWIE", [ - (":Mac:Build:PythonStandSmall.mcp", "PythonStandSmallCarbon"), - ]), - -I_PPC_EXTENSIONS : (buildmwproject, "CWIE", [ - (":Extensions:Imaging:_imaging.mcp", "_imaging.ppc"), -## (":Extensions:Imaging:_tkinter.mcp", "_tkinter.ppc"), - (":Extensions:img:Mac:imgmodules.mcp", "imgmodules.ppc"), - ]), - -I_CARBON_EXTENSIONS : (buildmwproject, "CWIE", [ - (":Extensions:Imaging:_imaging.mcp", "_imaging.carbon"), -## (":Extensions:Imaging:_tkinter.mcp", "_tkinter.carbon"), - (":Extensions:img:Mac:imgmodules.mcp", "imgmodules.carbon"), - ]), - -I_APPLETS : (buildapplet, None, [ - (":Mac:scripts:EditPythonPrefs.py", "EditPythonPrefs", None), - (":Mac:scripts:BuildApplet.py", "BuildApplet", None), - (":Mac:scripts:BuildApplication.py", "BuildApplication", None), - (":Mac:scripts:ConfigurePython.py", "ConfigurePython", None), -## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonCarbon", "PythonInterpreterCarbon"), -## (":Mac:scripts:ConfigurePython.py", "ConfigurePythonClassic", "PythonInterpreterClassic"), - (":Mac:Tools:IDE:PythonIDE.py", "Python IDE", None), - (":Mac:Tools:CGI:PythonCGISlave.py", ":Mac:Tools:CGI:PythonCGISlave", None), - (":Mac:Tools:CGI:BuildCGIApplet.py", ":Mac:Tools:CGI:BuildCGIApplet", None), - ]), -} - -def incbuildno(filename): - fp = open(filename) - line = fp.readline() - fp.close() - - pat = re.compile('#define BUILD ([0-9]+)') - m = pat.search(line) - if not m or not m.group(1): - raise 'Incorrect macbuildno.h line', line - buildno = m.group(1) - new = string.atoi(buildno) + 1 - fp = open(filename, 'w') - fp.write('#define BUILD %d\n'%new) - fp.close() - -def main(): - macresource.need('DLOG', DIALOG_ID, 'fullbuild.rsrc') - dir = EasyDialogs.AskFolder(message='Python source folder:') - if not dir: - sys.exit(0) - # Set genpluginprojects to use this folder (slight hack) - genpluginprojects.PYTHONDIR = dir - - todo = handle_dialog(os.path.join(dir, MACBUILDNO)) - - instructions = [] - for i in todo: - instructions.append(BUILD_DICT[i]) - - for routine, arg, list in instructions: - routine(dir, arg, list) - - if todo: - print "All done!" - -if __name__ == '__main__': - main() - diff --git a/Mac/scripts/fullbuild.rsrc b/Mac/scripts/fullbuild.rsrc Binary files differdeleted file mode 100644 index 68d3175..0000000 --- a/Mac/scripts/fullbuild.rsrc +++ /dev/null diff --git a/Mac/scripts/genpluginprojects.py b/Mac/scripts/genpluginprojects.py deleted file mode 100644 index 929d2c4..0000000 --- a/Mac/scripts/genpluginprojects.py +++ /dev/null @@ -1,181 +0,0 @@ -import mkcwproject -import sys -import os -import string - -PYTHONDIR = sys.prefix -PROJECTDIR = os.path.join(PYTHONDIR, ":Mac:Build") -MODULEDIRS = [ # Relative to projectdirs - "::Modules:%s", - "::Modules", - ":::Modules", -] - -# Global variable to control forced rebuild (otherwise the project is only rebuilt -# when it is changed) -FORCEREBUILD=0 - -def relpath(base, path): - """Turn abs path into path relative to another. Only works for 2 abs paths - both pointing to folders""" - if not os.path.isabs(base) or not os.path.isabs(path): - raise 'Absolute paths only' - if base[-1] == ':': - base = base[:-1] - basefields = string.split(base, os.sep) - pathfields = string.split(path, os.sep) - commonfields = len(os.path.commonprefix((basefields, pathfields))) - basefields = basefields[commonfields:] - pathfields = pathfields[commonfields:] - pathfields = ['']*(len(basefields)+1) + pathfields - rv = string.join(pathfields, os.sep) - return rv - -def genpluginproject(architecture, module, - project=None, projectdir=None, - sources=[], sourcedirs=[], - libraries=[], extradirs=[], - extraexportsymbols=[], outputdir=":::Lib:lib-dynload", - libraryflags=None, stdlibraryflags=None, prefixname=None, - initialize=None): - if architecture != "carbon": - raise 'Unsupported architecture: %s'%architecture - templatename = "template-%s" % architecture - targetname = "%s.%s" % (module, architecture) - dllname = "%s.%s.slb" % (module, architecture) - if not project: - project = "%s.%s.mcp"%(module, architecture) - if not projectdir: - projectdir = PROJECTDIR - if not sources: - sources = [module + 'module.c'] - if not sourcedirs: - for moduledir in MODULEDIRS: - if '%' in moduledir: - # For historical reasons an initial _ in the modulename - # is not reflected in the folder name - if module[0] == '_': - modulewithout_ = module[1:] - else: - modulewithout_ = module - moduledir = moduledir % modulewithout_ - fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) - if os.path.exists(fn): - moduledir, sourcefile = os.path.split(fn) - sourcedirs = [relpath(projectdir, moduledir)] - sources[0] = sourcefile - break - else: - print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) - sourcedirs = [] - if prefixname: - pass - elif architecture == "carbon": - prefixname = "mwerks_shcarbon_pch" - else: - prefixname = "mwerks_plugin_config.h" - dict = { - "sysprefix" : relpath(projectdir, sys.prefix), - "sources" : sources, - "extrasearchdirs" : sourcedirs + extradirs, - "libraries": libraries, - "mac_outputdir" : outputdir, - "extraexportsymbols" : extraexportsymbols, - "mac_targetname" : targetname, - "mac_dllname" : dllname, - "prefixname" : prefixname, - } - if libraryflags: - dict['libraryflags'] = libraryflags - if stdlibraryflags: - dict['stdlibraryflags'] = stdlibraryflags - if initialize: - dict['initialize'] = initialize - mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, - force=FORCEREBUILD, templatename=templatename) - -def genallprojects(force=0): - global FORCEREBUILD - FORCEREBUILD = force - # Standard Python modules - genpluginproject("carbon", "pyexpat", - sources=["pyexpat.c", "xmlparse.c", "xmlrole.c", "xmltok.c"], - extradirs=[":::Modules:expat"], - prefixname="mwerks_pyexpat_config.h" - ) - genpluginproject("carbon", "zlib", - libraries=["zlib.ppc.Lib"], - extradirs=["::::imglibs:zlib:mac", "::::imglibs:zlib"]) - genpluginproject("carbon", "gdbm", - libraries=["gdbm.ppc.gusi.lib"], - extradirs=["::::gdbm:mac", "::::gdbm"]) - genpluginproject("carbon", "_csv", sources=["_csv.c"]) - genpluginproject("carbon", "_weakref", sources=["_weakref.c"]) - genpluginproject("carbon", "_symtable", sources=["symtablemodule.c"]) - # Example/test modules - genpluginproject("carbon", "_testcapi") - genpluginproject("carbon", "xx") - genpluginproject("carbon", "datetime") - genpluginproject("carbon", "xxsubtype", sources=["xxsubtype.c"]) - genpluginproject("carbon", "_hotshot", sources=["_hotshot.c"]) - - # bgen-generated Toolbox modules - genpluginproject("carbon", "_AE") - genpluginproject("carbon", "_AH") - genpluginproject("carbon", "_App") - genpluginproject("carbon", "_Cm") - genpluginproject("carbon", "_Ctl") - genpluginproject("carbon", "_Dlg") - genpluginproject("carbon", "_Drag") - genpluginproject("carbon", "_Evt", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_File", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Fm", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Folder", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Help") - genpluginproject("carbon", "_IBCarbon", sources=[":ibcarbon:_IBCarbon.c"]) - genpluginproject("carbon", "_Icn") - genpluginproject("carbon", "_List") - genpluginproject("carbon", "_Menu") - genpluginproject("carbon", "_Qd", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Qt", - libraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Qdoffs", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Res", - stdlibraryflags="Debug, WeakImport") - genpluginproject("carbon", "_Scrap") - genpluginproject("carbon", "_Snd") - genpluginproject("carbon", "_Sndihooks", sources=[":snd:_Sndihooks.c"]) - genpluginproject("carbon", "_TE") - genpluginproject("carbon", "_Mlte") - genpluginproject("carbon", "_Win") - genpluginproject("carbon", "_CF", sources=["_CFmodule.c", "pycfbridge.c"]) - genpluginproject("carbon", "_CarbonEvt") - genpluginproject("carbon", "hfsplus") - - # Other Mac modules - genpluginproject("carbon", "calldll", sources=["calldll.c"]) - genpluginproject("carbon", "ColorPicker") - genpluginproject("carbon", "waste", - sources=[ - "wastemodule.c", - "WEObjectHandlers.c", - "WETabs.c", "WETabHooks.c"], - libraries=["WASTE.Carbon.lib"], - extradirs=[ - '{Compiler}:MacOS Support:(Third Party Support):Waste 2.0 Distribution:C_C++ Headers', - '{Compiler}:MacOS Support:(Third Party Support):Waste 2.0 Distribution:Static Libraries', - '::wastemods', - ] - ) - genpluginproject("carbon", "icglue", sources=["icgluemodule.c"]) - -if __name__ == '__main__': - genallprojects() - - diff --git a/Mac/scripts/missingcarbonmethods.py b/Mac/scripts/missingcarbonmethods.py deleted file mode 100644 index 5db2674..0000000 --- a/Mac/scripts/missingcarbonmethods.py +++ /dev/null @@ -1,167 +0,0 @@ -# Methods that are missing in Carbon. -# This module is mainly for documentation purposes, but you could use -# it to automatically search for usage of methods that are missing. -# - -missing_icglue = [ - 'ICFindConfigFile', - 'ICFindUserConfigFile', - 'ICChooseConfig', - 'ICChooseNewConfig', -] - -missing_Help = [ - 'Help' -] - -missing_Scrap = [ - 'InfoScrap', - 'GetScrap', - 'ZeroScrap', - 'PutScrap', -] - -missing_Win = [ - 'GetAuxWin', - 'GetWindowDataHandle', - 'SaveOld', - 'DrawNew', - 'SetWinColor', - 'SetDeskCPat', - 'InitWindows', - 'InitFloatingWindows', - 'GetWMgrPort', - 'GetCWMgrPort', - 'ValidRgn', # Use versions with Window in their name - 'ValidRect', - 'InvalRgn', - 'InvalRect', - 'IsValidWindowPtr', # I think this is useless for Python, but not sure... - 'GetWindowZoomFlag', # Not available in Carbon - 'GetWindowTitleWidth', # Ditto - ] - -missing_Snd = [ - 'MACEVersion', - 'SPBRecordToFile', - 'Exp1to6', - 'Comp6to1', - 'Exp1to3', - 'Comp3to1', - 'SndControl', - 'SndStopFilePlay', - 'SndStartFilePlay', - 'SndPauseFilePlay', - ] - -missing_Res = [ - 'RGetResource', - 'OpenResFile', - 'CreateResFile', - 'RsrcZoneInit', - 'InitResources', - 'RsrcMapEntry', - ] - -missing_Qt = [ - 'SpriteMediaGetIndImageProperty', # XXXX Why isn't this in carbon? - 'CheckQuickTimeRegistration', - 'SetMovieAnchorDataRef', - 'GetMovieAnchorDataRef', - 'GetMovieLoadState', - 'OpenADataHandler', - 'MovieMediaGetCurrentMovieProperty', - 'MovieMediaGetCurrentTrackProperty', - 'MovieMediaGetChildMovieDataReference', - 'MovieMediaSetChildMovieDataReference', - 'MovieMediaLoadChildMovieFromDataReference', - 'Media3DGetViewObject', - ] - -missing_Qd = [ -## 'device', # Too many false positives - 'portBits', - 'portPixMap', - 'portVersion', - 'grafVars', - ] - -missing_Qdoffs = [ - ] - - -missing_Menu = [ - 'GetMenuItemRefCon2', - 'SetMenuItemRefCon2', - 'EnableItem', - 'DisableItem', - 'CheckItem', - 'CountMItems', - 'OpenDeskAcc', - 'SystemEdit', - 'SystemMenu', - 'SetMenuFlash', - 'InitMenus', - 'InitProcMenu', - ] - -missing_List = [ - ] - -missing_Icn = [ - 'IconServicesTerminate', - ] - -missing_Fm = [ - 'InitFonts', - 'SetFontLock', - 'FlushFonts', - ] - -missing_Evt = [ - 'SystemEvent', - 'SystemTask', - 'SystemClick', - 'GetOSEvent', - 'OSEventAvail', - ] - -missing_Dlg = [ - 'SetGrafPortOfDialog', - ] - -missing_Ctl = [ - 'GetAuxiliaryControlRecord', - 'SetControlColor', - ] - -missing_Cm = [ - 'SetComponentInstanceA5', - 'GetComponentInstanceA5', - ] - -missing_App = [ - 'GetThemeMetric', - ] - -missing_AE = [ - 'AEGetDescDataSize', - 'AEReplaceDescData', - ] - - -missing = [] -for name in dir(): - if name[:8] == 'missing_': - missing = missing + eval(name) -del name - -def _search(): - # Warning: this function only works on Unix - import string, os - re = string.join(missing, '|') - re = """[^a-zA-Z0-9_'"](%s)[^a-zA-Z0-9_'"]""" % re - os.system("find . -name '*.py' -print | xargs egrep '%s'"%re) - -if __name__ == '__main__': - _search() diff --git a/Mac/scripts/unweave.py b/Mac/scripts/unweave.py deleted file mode 100644 index f14287e..0000000 --- a/Mac/scripts/unweave.py +++ /dev/null @@ -1,259 +0,0 @@ -"""An attempt at an unweave script. -Jack Jansen, jack@oratrix.com, 13-Dec-00 -""" -import re -import sys -import macfs -import os -import macostools - -BEGINDEFINITION=re.compile("^<<(?P<name>.*)>>=\s*") -USEDEFINITION=re.compile("^(?P<pre>.*)<<(?P<name>.*)>>(?P<post>[^=].*)") -ENDDEFINITION=re.compile("^@") -GREMLINS=re.compile("[\xa0\xca]") - -DEFAULT_CONFIG=""" -filepatterns = [ - ("^.*\.cp$", ":unweave-src"), - ("^.*\.h$", ":unweave-include"), -] -genlinedirectives = 0 -gencomments = 1 -""" - -class Processor: - def __init__(self, filename, config={}): - self.items = {} - self.filename = filename - self.fp = open(filename) - self.lineno = 0 - self.resolving = {} - self.resolved = {} - self.pushback = None - # Options - if config.has_key("genlinedirectives"): - self.genlinedirectives = config["genlinedirectives"] - else: - self.genlinedirectives = 1 - if config.has_key("gencomments"): - self.gencomments = config["gencomments"] - else: - self.gencomments = 0 - if config.has_key("filepatterns"): - self.filepatterns = config["filepatterns"] - else: - self.filepatterns = [] - self.filepattern_relist = [] - for pat, dummy in self.filepatterns: - self.filepattern_relist.append(re.compile(pat)) - - def _readline(self): - """Read a line. Allow for pushback""" - if self.pushback: - rv = self.pushback - self.pushback = None - return rv - self.lineno = self.lineno + 1 - return self.lineno, self.fp.readline() - - def _linedirective(self, lineno): - """Return a #line cpp directive for this file position""" - return '#line %d "%s"\n'%(lineno-3, os.path.split(self.filename)[1]) - - def _readitem(self): - """Read the definition of an item. Insert #line where needed. """ - rv = [] - while 1: - lineno, line = self._readline() - if not line: - break - if ENDDEFINITION.search(line): - break - if BEGINDEFINITION.match(line): - self.pushback = lineno, line - break - mo = USEDEFINITION.match(line) - if mo: - pre = mo.group('pre') - if pre: -## rv.append((lineno, pre+'\n')) - rv.append((lineno, pre)) - rv.append((lineno, line)) - if mo: - post = mo.group('post') - if post and post != '\n': - rv.append((lineno, post)) - return rv - - def _define(self, name, value): - """Define an item, or append to an existing definition""" - if self.items.has_key(name): - self.items[name] = self.items[name] + value - else: - self.items[name] = value - - def read(self): - """Read the source file and store all definitions""" - savedcomment = [] - while 1: - lineno, line = self._readline() - if not line: break - mo = BEGINDEFINITION.search(line) - if mo: - name = mo.group('name') - value = self._readitem() - if self.gencomments: - defline = [(lineno, '// <%s>=\n'%name)] - if savedcomment: - savedcomment = savedcomment + [(lineno, '//\n')] + defline - else: - savedcomment = defline - savedcomment = self._processcomment(savedcomment) - value = savedcomment + value - savedcomment = [] - isfilepattern = 0 - for rexp in self.filepattern_relist: - if rexp.search(name): - isfilepattern = 1 - break - if 0 and not isfilepattern: - value = self._addspace(value) - self._define(name, value) - else: - if self.gencomments: - # It seems initial blank lines are ignored:-( - if savedcomment or line.strip(): - savedcomment.append((lineno, '// '+line)) - - def _processcomment(self, comment): - # This routine mimicks some artefact of Matthias' code. - rv = [] - for lineno, line in comment: - line = line[:-1] - line = GREMLINS.subn(' ', line)[0] - if len(line) < 75: - line = line + (75-len(line))*' ' - line = line + '\n' - rv.append((lineno, line)) - return rv - - def _addspace(self, value, howmany): - # Yet another routine to mimick yet another artefact - rv = value[0:1] - for lineno, line in value[1:]: - rv.append((lineno, (' '*howmany)+line)) - return rv - - def resolve(self): - """Resolve all references""" - for name in self.items.keys(): - self._resolve_one(name) - - def _resolve_one(self, name): - """Resolve references in one definition, recursively""" - # First check for unknown macros and recursive calls - if not self.items.has_key(name): - print "Undefined macro:", name - return ['<<%s>>'%name] - if self.resolving.has_key(name): - print "Recursive macro:", name - return ['<<%s>>'%name] - # Then check that we haven't handled this one before - if self.resolved.has_key(name): - return self.items[name] - # No rest for the wicked: we have work to do. - self.resolving[name] = 1 - result = [] - lastlineincomplete = 0 - for lineno, line in self.items[name]: - mo = USEDEFINITION.search(line) - if mo: - # We replace the complete line. Is this correct? - macro = mo.group('name') - replacement = self._resolve_one(macro) - if lastlineincomplete: - replacement = self._addspace(replacement, lastlineincomplete) - result = result + replacement - else: - result.append((lineno, line)) - if line[-1] == '\n': - lastlineincomplete = 0 - else: - lastlineincomplete = len(line) - self.items[name] = result - self.resolved[name] = 1 - del self.resolving[name] - return result - - def save(self, dir, pattern): - """Save macros that match pattern to folder dir""" - # Compile the pattern, if needed - if type(pattern) == type(''): - pattern = re.compile(pattern) - # If the directory is relative it is relative to the sourcefile - if not os.path.isabs(dir): - sourcedir = os.path.split(self.filename)[0] - dir = os.path.join(sourcedir, dir) - for name in self.items.keys(): - if pattern.search(name): - pathname = os.path.join(dir, name) - data = self._addlinedirectives(self.items[name]) - self._dosave(pathname, data) - - def _addlinedirectives(self, data): - curlineno = -100 - rv = [] - for lineno, line in data: - curlineno = curlineno + 1 - if self.genlinedirectives and line and line != '\n' and lineno != curlineno: - rv.append(self._linedirective(lineno)) - curlineno = lineno - rv.append(line) - return rv - - def _dosave(self, pathname, data): - """Save data to pathname, unless it is identical to what is there""" - if os.path.exists(pathname): - olddata = open(pathname).readlines() - if olddata == data: - return - macostools.mkdirs(os.path.split(pathname)[0]) - fp = open(pathname, "w").writelines(data) - -def process(file, config): - pr = Processor(file, config) - pr.read() - pr.resolve() - for pattern, folder in config['filepatterns']: - pr.save(folder, pattern) - -def readconfig(): - """Read a configuration file, if it doesn't exist create it.""" - configname = sys.argv[0] + '.config' - if not os.path.exists(configname): - confstr = DEFAULT_CONFIG - open(configname, "w").write(confstr) - print "Created config file", configname -## print "Please check and adapt (if needed)" -## sys.exit(0) - namespace = {} - execfile(configname, namespace) - return namespace - -def main(): - config = readconfig() - if len(sys.argv) > 1: - for file in sys.argv[1:]: - if file[-3:] == '.nw': - print "Processing", file - process(file, config) - else: - print "Skipping", file - else: - fss, ok = macfs.PromptGetFile("Select .nw source file", "TEXT") - if not ok: - sys.exit(0) - process(fss.as_pathname(), config) - -if __name__ == "__main__": - main() |