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

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »

Price Scanner via MacPrices.net

B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for up to $150 off Apple’s new MSRP, starting at only $849. Free 1-2 day delivery is available to most US... Read more
M2 Mac minis on sale for $100-$200 off MSRP,...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100-$200 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $... Read more
Mac Studios with M2 Max and M2 Ultra CPUs on...
B&H Photo has standard-configuration Mac Studios with Apple’s M2 Max & Ultra CPUs in stock today and on Easter sale for $200 off MSRP. Their prices are the lowest available for these models... Read more
Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple 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
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.