TweetFollow Us on Twitter

Editor Extender
Volume Number:5
Issue Number:7
Column Tag:C Workshop

Related Info: Scrap Manager Desk Manager

Extend Your Favorite Editor

By Joel McNamara, Bellevue, WA

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

Extending Your Editor: Edit Extender DA

If you’ve programmed for awhile, you’re bound to to encounter one or two text editors you really feel comfortable with. Be it EMACS on a mainframe or QUED on a Mac, a good editor has a way of growing on you. You savor the power, the flexibility, and all of those little features that really make it stand out. Then comes the day, for some reason or another, when you’re forced to use another editor. You click on the menu bar and your favorite feature isn’t there. A keyboard command just puts a non-ASCII character on the screen. You grit your teeth and code away, wishing your preferred editor was around.

I was rudely awakened to this predicament when I started to use MPW and Lightspeed C. QUED had long been my editor of choice on the Mac, and I suddenly found a few of my favorite features weren’t around anymore. Granted, I could continue to use QUED or even be more ambitious and write my own editor with a little help from Symantec’s CAPPS, but I really like the notion of an integrated programming environment. To me, it’s a hassle to transfer from your editor into your main development environment all of the time.

Ah, but that’s the joy of being a programmer. You’re not forever an end user, hoping and praying the software gods will deliver you from want. You can rise above the masses with an idea and a compiler. The problem of creating an extendible editor can easily be solved by simply writing a desk accessory.

The theory goes like this. You have a chunk of text you want to manipulate within your editor. You just select the text, copy it into the clipboard, capitalize/count/do whatever to it, and then paste the altered text back in, replacing the previous selection. You let the text editor do all of the work, while you sit on top, adding your own features through the DA. No sweat, DA spell checkers like Thunder! do it all the time. Just combine the concepts of the sample “Windows” desk accessory included with Lightspeed C with some clipboard related code, and viola, a few quick hours of programming gives you the features of your favorite editor in a least favored one. Specifically, in the following example, capitalization, changing case, word counting, time and date insertion, and saving a selected region to a text file.

The Clipboard, Fake Keydowns, and Timing

The obvious storage location for storing text to be manipulated is the clipboard, alias the desk scrap. Once the text is there, it can be twiddled with to your heart’s content. So, the first thing to do is get the selected text into it. Now being somewhat lazy in not wanting to menu select Copy or Paste or type their keyboard equivalents all of the time, I decided there must be a better way, more in tune with the Mac interface. Something along the lines of having the text selected, pulling down the DA’s menu, and having the command executed.

The solution is to post a Command “C” (the non-case sensitive, universal Mac key command for “Copy”), and fake the editor into thinking the user had just done a copy into the clipboard. It’s a pretty easy task to post a keydown event with the PostEvent trap, but unfortunately you don’t have any control over the modifiers. If you pass in an ASCII “c” eventCode, and a “keyDwnEvt” eventMsg, all you’ll get is a lower case “c” on the screen. There are no provisions for specifying that the command/option/shift/caps lock keys may also be pressed. There are two choices in dealing with this problem: (1) Post some mousedown events with the locations of the “Edit” menu and “Copy” position, essentially faking a menu selection with the mouse. A risky proposition since you rely on the editor following Apple’s interface guidelines of where things should be. (2) Fake the Mac into thinking a command modifier key has been pressed.

The quick and dirty way is to pick door number 2 and modify the event queue. Using TMON, the location of the key modifiers are readily apparent. (Snoop around at $174 and start pressing keys.) Just change a byte here and there, and presto, the keydown “c” event is turned into a Command “C” copy event. The same technique can be used when replacing text, by posting a Command “V” for paste. You just select a menu item, Edit Extender posts a Command “C,” and the text is sitting in the clipboard ready for manipulation.

At this point, things begin to get a bit murky. If you were to implement the above method in a desk accessory, you’d see the menu bar flash, signalling the Command “C” had been posted, but no text would be copied into the clipboard. What’s going on here? The solution is a matter of timing. The DA has to tell the operating system that it’s finished, have the application take control again to do the copy, and then signal it wants to take control again. This can be accomplished with the desk accessory’s csCode parameter. Just pass in an integer in the accRun message and branch as required. With the timing problem solved, Edit Extender worked great. I now had some of my favorite features up and running. Then I was in for a rude surprise. Out of curiosity, I decided to try running it with MacWrite and Microsoft Word. It didn’t work at all. Something strange was going on. The DA worked fine with MPW, Lightspeed C, miniEdit, and QUED, but fell flat on its face when it came to “real” word processors.

Private Scraps

Despite having the same purpose, when it comes to using the clipboard and copying and pasting, text editors and word processors are two different critters. Most word processors that do any kind of text formatting (bolding, underlining, italicizing, etc.) keep the text they are dealing with in what “Inside Macintosh” refers to as a “private scrap.” This is simply a private clipboard where the application stores text and formatting information for internal use. For the sake of speed and efficiency, when the user selects some text and copies or cuts it, more than likely it’s going to end up someplace other than the desk scrap. On the other hand, virtually every text editor that deals strictly with text, will use the desk scrap for storage. This is why you can access copied text through the clipboard from the Lightspeed or MPW editor, but not from MacWrite or Word.

The Scrap Manager section of “Inside Macintosh” enlightens you to the fact that it is good and required programming etiquette for an application to transfer its private scrap to the common access desk scrap whenever a user quits the program or when a desk accessory becomes active. In doing so, formatted data should be converted into a form readable by either another application or the desk accessory. That means text turns it into a type ‘TEXT’ resource (simply a series of ASCII characters), graphics become a ‘PICT’ type, and optionally, any formatted information can be kept with its own unique resource type.

I fought off the temptation to cop-out and use Edit Extender exclusively with text editors. After all, it might be nice to have it work with word processors or even desktop publishing applications. So, what determines if a desk accessory is activated or not? Simple, if a window that is owned by the DA is brought to the front and becomes the active window, the desk accessory becomes activated. If another non-DA window comes to the front, the DA is deactivated. Not wanting to splash an ugly window on the screen, I decided to make my window appear offscreen at the upper left corner. Now when Edit Extender got a command, it brought the offscreen window to the front, the application received a message that a DA had become active and converted its private scrap into the desk scrap. The DA goes away, and presto, text now awaits us in the desk scrap.

With the window code working, Edit Extender was in business with MacWrite. With the exception of one small detail. If you had some formatted text (say italicized Geneva 10) selected, and used Edit Extender to capitalize it, when it was pasted back in, it came back as Geneva 12 plain. Clearly a case of WYDWISYG (What you don’t want is what you get!). Remember that when the private scrap is converted, it can also place formatted data in the desk scrap. That’s exactly what MacWrite is doing. In addition to the ‘TEXT’ resource, MacWrite is placing a ‘MWRT’ resource in the desk scrap that contains the text with formatting information. When MacWrite pastes back in, it will first look in the scrap for a ‘MWRT’ resource, and if it’s there, paste it in with all formatting intact. If there’s none to be found, ‘TEXT’ will be pasted in at Geneva 12. The solution to this problem is to get the clipboard format of the ‘MWRT’ text. In this case, look at Tech Note #13, MacWrite Clipboard Format. Although this version of Edit Extender doesn’t support formatted text, to do so would be fairly trivial. After you’ve posted the copy event, just scan the desk scrap for a resource with the type ‘MWRT.’ If you find it, then based on the data structure, go in and find the text and manipulate it.

Microsoft machinations

Hmmm. Now it was working with MacWrite, but wasn’t with Word. Ack! The simple DA was turning into a frustrating programming exercise. Oh well, when in doubt, get your debugger out. TMON revealed an interesting characteristic in Word. In addition to requiring the desk accessory to be activated, it also needed a Copy (Command “C”) or Paste (Command “V”) event before it would convert its private scrap to the desk scrap. Picky, picky, picky. After sliding in the appropriate code, and seeing no problems with using it for other applications, Edit Extender now seemed to work just fine. (Be advised though, that unlike MacWrite, the current version 3.0_whatever doesn’t place any formatted text into the clipboard. Rumor has it that future versions will place RTF into the desk scrap along with unformatted text.)

MultiFinder considerations

With any desk accessory that interacts directly with an application, you need to keep in mind MultiFinder and its buddy the DA Handler. Since Mr. DA Handler treats a desk accessory like an individual program, I was expecting some major complications. I know, Apple says to write small applications instead of DAs, but I still like interactive desk accessories. Fortunately in their infinite wisdom, the creators of MultiFinder left a nice loophole for DAs like Edit Extender. The solution is to hold down the Option key when initially selecting and launching the desk accessory. That means click on the apple menu, hold down the Option key, and select the DA. (If you hold down the option key before you select the apple menu, MultiFinder won’t display any DAs.) This little known technique bypasses the DA Handler, and installs Edit Extender (or any other DA for that matter) directly into the application’s heap.

(MultiFinder Caveats: In using the Option key method be aware of two things. (1) If you get out of memory errors, quit the program and increase the application’s memory size. (2) This technique allows you to run the desk accessory within only one application at a time. If you wanted to run Edit Extender in (i.e) MacWrite and PageMaker at the same time, just create a duplicate of Edit Extender and use ResEdit to give it a different DRVR resource name. Font DA/Mover will give it a unique resource I.D. when you install it, and you’ll be set.)

Conclusion

Edit Extender was built so I could have some features available no matter which Mac editor I had to use. It demonstrates some neat tricks like posting copy and paste events and converting text for DA use. But for the most part, it’s pretty much of a base to work off of. I included my pet features, and with a bit of coding, so can you. Some other options that could easily be incorporated include: sorting, search and replace, paragraph numbering, selected text printing, or indexing. Happy editor constructing!

Figure 1. Project


Listing EditExtender.c

/*  
 Edit Extender Desk Accessory
 for MacTutor Magazine
 June 1, 1988
 by Joel McNamara, Satori Software  
*/
/* the required stuff... */
#include “EventMgr.h”
#include “MenuMgr.h”
#include “MemoryMgr.h”
#include “FontMgr.h”
#include “FileMgr.h”
#include “DeviceMgr.h”
#include “DialogMgr.h”
#include “IntlPkg.h”
#include “StdFilePkg.h”

/* the globals... */
int     ALREADY_OPEN = 0;
intCONDITION = 0;
intRUNCODE = 0;
DCtlPtr DCE;
GrafPtr SAVEPORT;
MenuHandleTHE_MENUHANDLE;

/* the constants... */
/* routine returns correct resource number for the driver */
#define RsrcID(id) (0xC000 + (~DCE->dCtlRefNum << 5) + id)
/* the dialogs */
#define AboutDLOG0
#define CountsDLOG 1
#define MessageDLOG2
/* counts DITL items */
#define CharItem 2
#define WordsItem3
#define SentenceItem 4
#define ParagraphItem5
/* the fake window */
#define FakeWIND 0
/* run code commands */
#define UpperCaseCOND1
#define LowerCaseCOND2
#define ReverseCaseCOND 3
#define CapitalizeCOND  4
#define CountsCOND 5
#define TextCOND 6
#define DateCOND 7
#define TimeCOND 8
/* STR# error messages */
#define ListSTR  0
#define MemoryMSG1
#define GenericMSG 2
#define CreateMSG3
#define OpenMSG  4
#define WriteMSG 5
#define SelectMSG6
/* menu items */
#define AboutITEM1
#define UpperITEM3
#define LowerITEM4
#define ReverseITEM5
#define CapitalITEM6
#define DateITEM 8
#define TimeITEM 9
#define CountsITEM  11
#define TextITEM    13
#define QuitITEM    15
 /* DA messages */
#define OpenMessage0
#define ControlMessage  2
#define CloseMessage 4

/* let’s start... */ 
main(controlParam, dControl, message)
cntrlParam *controlParam;
DCtlPtr dControl;
short message;
{
 EvQEl  tempQElement;
 
 if ((dControl->dCtlStorage) == 0) {
 SysBeep(5);
 if (message == OpenMessage) {
 SysBeep(5);
 Display(MemoryMSG);
 CloseDriver(dControl->dCtlRefNum);
 }
 return(0);
 }
 DCE = dControl;
 switch (message) {
 case OpenMessage:
 DoOpen();
 break;
 
 case ControlMessage:
 switch (controlParam->csCode) {
   /* who needs to be in control */
 case accRun:
 if ((RUNCODE != 0) && (OSEventAvail(keyDownMask,
 &tempQElement) == 0))
 DoRuncode(RUNCODE);
 break;
 
 case accMenu:
 DoMenu(controlParam->csParam[1]);
 break;
 
 case goodBye:
 DoGoodBye();
 break;
 }
 break;
 
 case CloseMessage:
 DoClose();
 break;
 } 
return(0);
}

/* open the DA */
DoOpen()
{
 DCE->dCtlFlags |= dNeedLock| dNeedGoodBye|dCtlEnable|dNeedTime;
 
 DCE->dCtlDelay = 15;
 DCE->dCtlMenu = RsrcID(0);
 if (ALREADY_OPEN)
 return;
 
 RUNCODE = 0;  
 ALREADY_OPEN = 1;
 THE_MENUHANDLE = GetMenu( DCE->dCtlMenu);
 (*THE_MENUHANDLE)->menuID = DCE->dCtlMenu;
 InsertMenu(THE_MENUHANDLE,0);
 DrawMenuBar();
}

/* handle any menu items */
DoMenu(theItem)
inttheItem;
{
 switch (theItem)
 {
 case AboutITEM:
 DoAbout();
 break;
 
 case UpperITEM:
 DoCopy();
 CONDITION = UpperCaseCOND;
 break;
 
 case LowerITEM:
 DoCopy();
 CONDITION = LowerCaseCOND;
 break;
 
 case ReverseITEM:
 DoCopy();
 CONDITION = ReverseCaseCOND;
 break;
 
 case CapitalITEM:
 DoCopy();
 CONDITION = CapitalizeCOND;
 break;
 
 case DateITEM:
 SetRuncode();
 CONDITION = DateCOND;
 break;
 
 case TimeITEM:
 SetRuncode();
 CONDITION = TimeCOND;
 break;
 
 case CountsITEM:
 DoCopy();
 CONDITION = CountsCOND;
 break;
 
 case TextITEM:
 DoCopy();
 CONDITION = TextCOND;
 break;
 
 case QuitITEM:  
 DoClose();
 break;
 
 default:
 break;
 }
 HiliteMenu(0);
}

/* about us */
DoAbout()
{
 DialogPtr theDialog;
 int dummy;
 
 theDialog = GetNewDialog(RsrcID(AboutDLOG),0,-1);
 ModalDialog(0, &dummy);
 DisposDialog(theDialog);
}

/* close everything up */
DoClose()
{
 DeleteMenu(DCE->dCtlMenu);
 DisposeMenu(THE_MENUHANDLE);
 ALREADY_OPEN = 0;
 DCE->dCtlMenu = 0;
 DCE->dCtlWindow = 0;
 DrawMenuBar();
}

/* good bye... */
DoGoodBye()
{
 DCE->dCtlMenu = 0;
 DCE->dCtlWindow = 0;
}

/* do a control c */
DoCopy()
{
 struct keys{
 long charCode;
 long modifiers;
 } *keysPtr;
 long len;
 
 GetPort(&SAVEPORT);
 len = ZeroScrap();
 keysPtr = (struct keys*)0x174;    
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00008000;
 PostEvent(3,67);
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00000000;
 RUNCODE = 1;
}

/* get the DA’s attention */
SetRuncode()
{
 RUNCODE = 1;
}

/* handle any run codes */
DoRuncode(myRunCode)
short myRunCode;
{
 switch (myRunCode)
 {
 case 1: /* bring up the dummy window */
 DCE->dCtlWindow = GetNewWindow(RsrcID(FakeWIND),0,-1);
 ((WindowPeek)(DCE->dCtlWindow))->windowKind = DCE->dCtlRefNum;
 SetPort(DCE->dCtlWindow);
 RUNCODE = 2;
 break;
 
 case 2: /* do a paste event */
 PostPaste();
 RUNCODE = 3;
 break;
 
 case 3: /* now deal with our commands */
 DoText();
 break;
 
 default:
 break;
 }
}

/* here’s where we do our edit commands */
DoText()
{
 long   len;
 long   myOffset;
 long   loop;
 long   temp;
 long   theSecs;
 Handle myHandle;
 Handle newHandle;
 Handle theHandle;
 Rect   itemRect;
 int    sentences;
 int    paragraphs;
 int    words;
 int    chars;
 int    itemType;
 int    tempInt;
 char   myChar;
 char   prevChar;
 DialogPtrtheDialog;
 Ptr    myPtr;
 Str255 numStr;
 Str255 timeStr;
 
 RUNCODE = 0;    
 myHandle = NewHandle(0);
 
 len = GetScrap(myHandle,’TEXT’,&myOffset);
 if ((len <= 0) && (CONDITION <= CapitalizeCOND))
 /* nothing’s in the scrap */
 {
 SysBeep(5);
 Display(SelectMSG);
 DisposeWindow(DCE->dCtlWindow);
 DCE->dCtlWindow = 0;
 SetPort(SAVEPORT);
 }
 else
 { 
 if (CONDITION < CountsCOND)
 /* do we need a handle for manipulation? */
 newHandle = NewHandle(GetHandleSize(myHandle));
 
 switch (CONDITION)
 {
 /* the upper routine */
 case UpperCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) 
 *(((char *)(*newHandle)) + loop) = toupper(*((char *)((long)(*myHandle) 
+ loop)));
 break;
 
 /* the lower case routine */
 case LowerCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) 
 *((char *)((long)(*newHandle) + loop)) = tolower(*((char *)((long)(*myHandle) 
+ loop)));
 break;
 
 /* the reverse case routine */
 case ReverseCaseCOND:
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++) {
 if (isupper(*((char *)((long)(*myHandle) + loop))))  
 *((char *)((long)(*newHandle) + loop)) = tolower(*((char *)((long)(*myHandle) 
+ loop)));
 else
 if (islower(*((char *)((long)(*myHandle) + (long)loop))))  
 *((char *)((long)(*newHandle) + loop)) = toupper(*((char *)((long)(*myHandle) 
+ loop)));
 else
 *((char *)((long)(*newHandle) + loop)) = 
 *((char *)((long) (*myHandle) + loop));     
 }
 break;
 
 /* the capitalization routine */  
 case CapitalizeCOND:
 prevChar = (char)’x’;
 for (loop = 0; loop <= (GetHandleSize(myHandle)); loop++)
 { 
 if (loop == 0)
 {
 *((char *)((long)(*newHandle) + loop)) = 
 toupper(*((char *)((long)(*myHandle) + loop)));
 prevChar = *((char *)((long)(*newHandle) + loop));
 }
 else
 {
 if ((prevChar == ‘ ‘) || (prevChar == ‘\r’) ||
 (prevChar == ‘\t’)) 
 *((char *)((long)(*newHandle) + loop)) = 
 toupper(*((char *)((long)(*myHandle) + loop)));
 else
 *((char *)((long)(*newHandle) + loop)) = 
 *((char *)((long)(*myHandle) + loop));
 prevChar = *((char *)((long)(*newHandle) + loop));
 }
 } 
 break;
 
 /* a simplistic wc */
 case CountsCOND:
 chars = sentences = paragraphs = words = 0;
 
 myPtr = *myHandle;
 for (temp = 0; temp <= len; temp++)
 {
 myChar = *((char *)((long)myPtr + temp));
 chars++;

 if (myChar == ‘\r’)
 paragraphs++;
 
 if (myChar == ‘.’ || myChar == ‘!’ || myChar == ‘?’)
 sentences++;
 
 if (myChar == ‘ ‘ || myChar == ‘\t’ || myChar == ‘\r’)
 words++;
 } 
 
 InitCursor();   
 theDialog = GetNewDialog(RsrcID(CountsDLOG),0,-1);
 SetPort(theDialog);

 NumToString(chars - paragraphs,numStr);
GetDItem(theDialog,CharItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(words,numStr);
GetDItem(theDialog,WordsItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(sentences,numStr);
GetDItem(theDialog,SentenceItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 NumToString(paragraphs,numStr);
GetDItem(theDialog,ParagraphItem,&itemType,&theHandle,&itemRect); 
 SetIText(theHandle,numStr);
 
 ModalDialog(0,&tempInt);
 CloseDialog(theDialog);
 break;
 
 /* text to save condition */ 
 case TextCOND:
 Extract(myHandle);
 break;
 
 /* display date condition */ 
 case DateCOND:
 GetDateTime(&theSecs);
 IUDateString(theSecs,longDate,&timeStr);
 PtoCstr(timeStr);
 ZeroScrap();
 PutScrap(strlen(timeStr),’TEXT’,&timeStr);
 PostPaste();
 break;
 
 /* display time condition */
 case TimeCOND:
 GetDateTime(&theSecs);
 IUTimeString(theSecs,TRUE,&timeStr);
 PtoCstr(timeStr);
 ZeroScrap();
 PutScrap(strlen(timeStr),’TEXT’,&timeStr);
 PostPaste();
 break;
 
 default:
 break;
 }
 
 DisposeWindow(DCE->dCtlWindow);
 DCE->dCtlWindow = 0;
 SetPort(SAVEPORT);
 
 if (CONDITION < CountsCOND)
 /* then we need to paste in the new stuff */
 {
 ZeroScrap();
 PutScrap(GetHandleSize(myHandle),’TEXT’,*newHandle);
 DisposHandle(newHandle);
 PostPaste();  
 } 
 } 
 DisposHandle(myHandle);
 CONDITION = 0;
}

/* do a paste event */
PostPaste()
{
 struct keys{
 long charCode;
 long modifiers;
 } *keysPtr;
 
 keysPtr = (struct keys*)0x174;    
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00008000;
 PostEvent(3,86);
 keysPtr->charCode = 0x00000000;
 keysPtr->modifiers = 0x00000000;
}

/* error message display */
Display(theIndex)
int theIndex;
{
 DialogPtr theDialog;
 int    dummy;
 Str255 theMessage;
 
 GetIndString(&theMessage,RsrcID(ListSTR),theIndex);
 InitCursor();
 theDialog = GetNewDialog(RsrcID(MessageDLOG),0,-1);
 ParamText(theMessage,”\p”,”\p”,”\p”); 
 ModalDialog(0,&dummy);
 DisposDialog(theDialog);
}

/* save selected text to a file */
Extract(myHandle)
Handle myHandle;
{
 SFReply myReply;
 Point  myLoc;
 int    errCode, refNum;
 long   theCount;
 
 myLoc.v = 90;
 myLoc.h = 90;
 
 HLock(myHandle);
 SFPutFile(myLoc,”\pSave selected text to:”,”\pUntitled”,0L,&myReply);
 
 if (myReply.good)
 {
   errCode = Create(myReply.fName,myReply.vRefNum,’EDIT’,’TEXT’);
   if (errCode != noErr);
   {
 if (errCode == dupFNErr) {
 FSDelete(myReply.fName,myReply.vRefNum);
 errCode = Create(myReply.fName,myReply.vRefNum, ’EDIT’,’TEXT’);
           }
        else if (errCode != noErr) { 
 Display(CreateMSG);
 HUnlock(myHandle);
 return;
 }
 }
 
 if (FSOpen(myReply.fName,myReply.vRefNum,&refNum) != noErr) {
 Display(OpenMSG);
 FSClose(refNum);
 HUnlock(myHandle);
 return;
 }
 
 theCount = GetHandleSize(myHandle);
     if (FSWrite(refNum,&theCount,*myHandle) != noErr) {
 Display(WriteMSG);
 FSClose(refNum);
 HUnlock(myHandle);
 return;
        }
        
     FSClose(refNum);
 }
 HUnlock(myHandle);
}

/* just in case your compiler doesn’t already have these...
   otherwise, leave them out... */
strlen(s)
register char *s;
{
 char *s0 = s;
 
 while (*s++);
 return (s-s0-1);
}

inttoupper(c)
char  c;
{
 return((c>=’a’) && (c<=’z’) ? (c-32) : c);
}

inttolower(c)
char  c;
{
 return((c>=’A’) && (c<=’Z’) ? (c+32) : c);
}

intisupper(c)
char c;
{
 return((c>=’A’) && (c<=’Z’));
}

intislower(c)
char c;
{
return((c>=’a’) && (c<=’z’));
}
Listing:  EditExtender.r

* resource file for Edit Extender DA
* by Joel McNamara
* for MacTutor Magazine
* June 1, 1988

EditExtender.rsrc

TYPE DLOG
 ,-16000
blah blah
54 74 190 452
Visible NoGoAway
1
0
-16000

TYPE DLOG
 ,-15999
Counts
264 20 330 494
Visible NoGoAway
0
0
-15999

TYPE DLOG
 ,-15998
info
68 120 152 408
Visible NoGoAway
1
0
-15998

TYPE DITL
 ,-16000
4
staticText Disabled
4 10 22 330
Edit Extender version 1.0 - by Joel McNamara

button
109 274 129 353
OK

staticText Disabled
112 7 129 210
For MacTutor Magazine

staticText Disabled
30 21 96 364
Edit Extender is a series of helpful tools, not found in all text editors. 
 Use the Edit Extender DA to change, insert, and analyze selected text 
in your documents.

TYPE DITL
 ,-15999
10
button
32 367 51 443
OK

staticText Disabled
7 89 27 149
999999

staticText Disabled
32 88 52 149
999999

staticText Disabled
32 257 52 318
999999

staticText Disabled
7 257 27 318
999999

staticText Disabled
7 8 27 87
Characters:

staticText Disabled
32 8 52 56
Words:

staticText Disabled
32 171 52 246
Sentences:

staticText Disabled
7 171 27 255
Paragraphs:

staticText Disabled
6 346 25 463
Text Information

TYPE DITL
 ,-15998
3
button
60 195 79 263
OK

staticText Disabled
8 49 56 272
^0

iconItem Disabled
8 8 40 40
0

TYPE WIND
 ,-16000
Dummy
-40 -40 -20 -20
Visible NoGoAway
0
0

TYPE MENU
 ,-16000
§
About Edit Extender...
(-
Upper case
Lower case
Reverse case
Capitalize
(-
Current date
Current time
(-
Counts...
(-
Save selection as...
(-
Quit

TYPE STR#
 ,-16000)
6
Sorry, not enough memory for Edit Extender to run.
Generic error!
Sorry, couldn’t create the text file.
Sorry, couldn’t open the text file you just created.
Sorry, couldn’t write the selected text to a text file.
You must have text selected before performing a Edit Extender command.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.