TweetFollow Us on Twitter

Document Selector
Volume Number:2
Issue Number:9
Column Tag:C Workshop

Batch Document Selector in Mac C

By Frank Alviani, Contributing Editor

Everybody Needs a Front Man...

One of the more annoying "features" of the Finder is its habit of keeping all selections within a single folder; files selected in folder 'A' suddenly unselect when you click outside it. This is restrictive if you have a hard disk: typically there's one copy of an application, with files scattered all over the back 40. If you wanted to print a batch of them, from different folders, you were out of luck and had to babysit the Mac all the way thru. What we need is a utility that selects multiple files from a user dialog, then processes or sends the whole lot off to some other program or function. In otherwords, a front man to do a batch job for us! The Front Man is just such a general-purpose document-batching utility.

The Front Man was written to overcome this Finder limitation by providing a general purpose multi-file selector, and to show the use of the _Launch trap from 'C'. While obscurely documented in Inside Mac, there is a lot of potential in this trap! A number of other principals are also shown here, such as user configurability, HFS compatibility, and the use of the finder parameters. Following the guidelines here will teach you how to write HFS programs that work, and explain why some things are still tough to do with an HFS type file structure.

Front Man: List Selection of Files

Choose "Pick" to bring up a standard getfile dialog box. Each time you select a file, it is added to the list to be passed via the finder parameters to another application. Hit the cancel button to quit selecting. An exception is if a file name ends with '.FILE' - in this case, the file is assumed to contain a list of file names (1 per line) which are each added to the finder parms. It can (optionally) display ALL file types, not just TEXT files (so you can batch files to WORD, MacWrite, etc.). The only shortcoming is that when using a file of filenames, it doesn't look up the directory entry for each file named, and get the proper filetype; instead, the filetype of the batch file is applied to each named file (this limits the utility of batch files to TEXT files, but offers "an exercise for the student").

Choose "Launch". If you are in "interactive" mode, a standard getfile dialog box will appear displaying applications. If you are in "hardwired" mode, the application whose name is in a STR resource is launched automatically, with the list of files sent on in your behalf!

Front Man can (optionally) cause the launched application to either print or just open the selected files.

Uses of the Launch and Chain traps

One of the most common arrangements in traditional data processing systems was chained programs. Program 'A' ran to sort or preprocess a bunch of data, then chained to program 'B' which did the reports or other interesting work on the data. This was done to be able to work with large data sets on smallish machines (by today's standards), and also allowed very long processing runs to be broken up into smaller pieces. Programmers also found it more convenient in many respects - the smaller programs were easier to debug and write: all the classical virtues of modularity.

The difference between chaining and launching is small: when you chain to a program on a Mac, the application heap is preserved essentially intact. When you launch another program, the heap is reset except for the desk scrap. ExitToShell, for example, simply launches the program whose name is found in low memory at $2E0. Chaining is thus useful when the different programs want to pass blocks of data in memory, as might be the case in an "integrated" processing package; launching is more useful in more general-purpose "front ends" such as this.

"Front Ends" have a small but useful niche to fill. For example, a "program tuner" might batch a number of 'C' files together, have them all compiled to assembler, optimize at this level, then assemble the tuned files. Also, a set of options (ala conventional 'C' command-line parameters) could be gathered and placed in a block in system memory before launching another application which would know where to look...

Basics of the Finder Parameters

The finder parameters are what make "front ending" an application possible. They consist of 3 pieces of information:

(1) A "message" to the application about what to do with the files. The operation requested is applied to ALL the files named.

(2) A count of how many files to process.

(3) A list of the files to process, with complete location information (volume reference number as well as file name).

Currently, the only messages in use are "print" and "open". Since "message" is a 16-bit field, this leaves 65,766 operations available! There is no reason why "private" message types can't be developed, such as "sort each of these in ascending order", "sort each in descending order", "merge these all together ", etc. as long as the application getting the message is equipped to deal with the additional messages! In an even more flexible system, the first file in the list could contain parameters that dictate what processing is done to each of the following files in the list - that is, another type of command line type facility!! (Hmm, that's not a bad idea - maybe I'll write a general command line front end next....)

I used a set of routines written by Andy Shebanow to access the finder parameters. A couple of minor corrections are noted.

One minor fact to note if you intend to start building your own finder parameters: the finder-info relocatable block is locked on entry to your program and must be unlocked before you can start manipulating it!

Configurability

It is usually desirable to allow a program to be configured by its user. If the usage will change frequently, menu choices are probably the best route; if usage will be stable once settled on, it's less obtrusive to configure the program by using ResEd to set values in STR or STR# resources. Here, we've gone the ResEd route, using STR resources to determine the programs behavior in a simple fashion.

STR #259 determines if only 'TEXT' files are to be displayed (if it contains the string TEXT) or if all types are to be shown (if not ).

STR #258 determines if the launched application should print the files (if it contains the string PRINT) or just open them (if not).

STR #257 determines if the program is in "interactive" mode (if it contains the string ASK) or in "hardwired" mode (if not).

STR #256 contains the name of the application to launch in "hardwired" mode; this should be a complete path name.

Yer gonna love the Munger

This is one of the most useful - and overlooked - little routines in the entire Toolbox! The documentation is hidden in the Toolbox Utilities chapter at the end of volume I of Inside Macintosh. It allows searching for substrings, string insertion, string replacement, and string deletion: all with a single chunk of code! The table if fig. 3 summarizes how the munger is used; see IM for the details...

Here, we use it to check STR resources for specific substrings to decide how the program is going to behave. Just checking to see if a STR contains a given substring is more tolerant than requiring an exact match. The STR is "folded" to uppercase (lowercase would work equally well) before the match so the test is case insensitive. The only minor point to remember in 'C' is that any non-negative result is a success - a common shortcut is to simple check for non-zero for success.

The tiny routine CheckStr reads in a STR resource, folds it to uppercase, and tries to locate a given substring; the output from the Munger is returned as the result.

HFS Compatibility

This really isn't terribly difficult if you follow the rules. The failure of most development system publishers to be HFS compatible is totally unreasonable!

As has been documented countless times by now, the new file system is a fairly conventional tree-structured directory system. Each directory can be considered to be very much like an entire volume, with a link to the directory above it in the tree. Since each directory is almost independent, you must have the problem of potentially identical file names, and therefore you must specify a volume or directory as part of the file name. To avoid this would require unique names for all files in the system, which is ludicrous (try keeping unique names on ALL YOUR FLOPPIES, which is logically equivalent!).

This has been known for decades, since the first disks came into use. The concept of a "working directory" is part and parcel of Unix: either you are referencing your working directory, or you have to give a complete path to find a file, starting at the device level.

As a shortcut, "search paths" were developed, such as the new Consulair path manager - for a given type of file, the system is given a set of partial path names, which are prefixed to the plain file name to come up with a complete path name (which is still needed). Each partial path name is prefixed to the plain file name in turn until the system either finds the file or quits in disgust.

The basics are simple: either give a complete path name or make sure the system knows which volume/directory you are referring to. For appl- ications, this means using SetVol to set the default volume; with files, the volume reference number field must be filled in correctly.

In The Front Man, both the application to launch and the files to process can be located anywhere. The SetVol parameters for the application are taken from the SFGetFile record in interactive mode, or a full pathname must be provided in the STR resource (a full pathname for anything has highest priority in searching). A similar approach is used in setting the volume reference number for the finder parameters.

Unfortunately for developers, there is no fundamental mechanism built into the HFS type of system that allows you to automatically know where certain files "ought" to be located. In the Unix-type world, there is usually none either, except that applications conventionally all reside in a directory called "cmds" or something similar (a solution which is unusually awkward with the Mac interface for obvious reasons). Applications can make use of a path manager-type system if they wish, but that's still not part of the system. The closest we could come would be to build a path-manager facility into the ROMs and have individual applications provide "search path" resources customized to their needs. Total consistency would not be achieved, since different search paths would and could be created, but it might be a small step forward. And remember, with search paths, if you frequently restructure your folders, you'd have to restructure all your search paths at the same time!

Now that we've explained once again how easy HFS compatibility is for the average application, the development system vendors look even worse! Minor glitches aren't terribly surprising, but for the authors of Xenix (one of the best-selling Unix clones on the market), for example, to have an HFS-incompatible Fortran system on the market 6 months after the Mac+ was released and far longer after they knew what was required (since they probably had a hand in setting the specs) can only be explained by a corporate disregard for the Macintosh world (Microsoft didn't write Fortran themselves). Their conventional applications don't have quite as many problems, but still can't be called 100% compatible. Bah! Humbug!

/*  The Front Man, Ver. 1.0
 *  Frank Alviani
 *  This version does NOT support desk accessories
 */
#Options +Z
#include "stdio.h"
#include "macdefs.h"
#include "macCdefs.h"
#include "dialog.h"
#include "events.h"
#include "menu.h"
#include "memory.h"
#include "OsIO.h"
#include "packages.h"
/* constants */
#define NULL 0
#define EVENTMASK -1
#define PBSetVol(pb, a)   
 pbCall(pb, a, 0xA015)

/* menu constants */
#define APPLE 1
#define  ABOUT 1
#define FILE  2
#define  PICK 1
#define  LAUNCH 2
#define  QUIT 3

#define APPPARMHANDLE   0x0aec
/* finder application parameter info */
typedef struct {
        short           vRefNum;
        unsigned long   fType;
        short           versNum;
        Str255          fName;
} AppFile;

typedef struct {
    Ptr     pgmPtr;
    long    dummy;    /* normal setting = 0 */
} launchStuff; 

extern short AddAppFile(), MacCVRefNum;
extern void SetAppMessage(), ZeroAppFiles();

/* Globals */
MenuHandle      AppleMH, FileMH;
EventRecord     theEvent;
launchStuff     launchParms;

main()
{
short       mouse_part, alert_item;
long        menu_selection;
WindowPtr   tWindow;        /* dummy to use FindWindow */
    InitAll();      /* initialize various managers */
    while (1)    /* Usual Main Loop */
      { if (GetNextEvent(EVENTMASK, &theEvent))
          switch(theEvent.what)
          { case mouseDown:
                mouse_part = FindWindow(&theEvent.where, &tWindow);
                switch ( mouse_part )
                  { case inMenuBar:
                        menu_selection = MenuSelect(&theEvent.where);
                        DoCommand(menu_selection);
                        break;
                    default: break;
                  }
                break;
            case keyDown:   /* only for keyboard shortcuts */
                if (theEvent.modifiers & cmdKey)
                  { menu_selection = MenuKey(theEvent.message & 0xFF);
                    DoCommand(menu_selection);
                  }
                break;
            case autoKey:       /* no valid use for AutoKey events */
            case updateEvt:     /* no windows, so.... */
            case activateEvt:
                break;
          }
      }
}
InitAll()
{
    InitMenus();
    TEInit();
    InitDialogs(NULL);      /* no recovery */
    FlushEvents(0x0000FFFF); /* kill 'em all*/
    InitCursor();
    ZeroAppFiles();
    AppleMH = NewMenu(APPLE,"\p\024");
    FileMH  = GetMenu(FILE);
    AppendMenu(AppleMH, "\pAbout The Front Man;(-;");
    InsertMenu(AppleMH, 0);
    InsertMenu(FileMH, 0);
    DrawMenuBar();  /* make it visible */
}
AboutBox()
{
DialogRecord    about;
DialogPtr       about_ptr;
short           item_hit;
    about_ptr = GetNewDialog(256, &about, -1);
    ModalDialog(NULL, &item_hit);
    CloseDialog(about_ptr);
}
/* Standard Menu tree   */
DoCommand(menu_choice)
long    menu_choice;
{
short   menu, item;
    menu = HiWord(menu_choice);
    item = LoWord(menu_choice);
    switch (menu)
      { case APPLE:
          AboutBox();
          break;
        case FILE:
          switch (item)
            { case PICK:
                getFiles(); break;
              case LAUNCH:
                LaunchIt(); break;
              case QUIT:
                ExitToShell();
            }
          break;
      }
    HiliteMenu(0);  /* turn off highlighting */
}
/* Use SFGetFile to get file names. STR #259 determines if */
/* only TEXT or all file types will be displayed, so */
 /* Word,MacWrite, etc. files can be batched. */
/* Use the Munger to check the file name. If it ends */
/* in '.FILE', it holds a  LIST of file names. Read each */
/* in turn and add to the finder parameters. */
/* Hit the cancel button in the SF dialog to quit.   */

void getFiles()
{
Point       where;
SFTypeList  tType;
SFReply      aReply;
AppFile      fParm;
Handle       fNameH;
short        fNameLen, off, f_no, numTypes, CheckStr();
Ptr          wanted, wantedT;
char         file_name[64];
    where.h = 75; where.v = 100;
    wanted = ".FILE"; wantedT = 'TEXT';
    /* determine file types to display */
    if (CheckStr(259, wantedT) >= 0)
      { numTypes = 1;     /* just TEXT files */
        tType.ftype[0] = 'TEXT';
      }
    else
      { numTypes = -1;    /* any kind of file */
        tType.ftype[0] = NULL;
      }
    /* get file names repeatedly */
    while (1)
      { SFGetFile(&where, NULL, NULL, numTypes, &tType, NULL, &aReply);
        if (!aReply.good) break;    /* hit cancel to stop batching */
        /* see if name end in '.FILES' - if so, it's a "batch" file */
        fNameLen = aReply.Namelength;
        fNameH = NewHandle(fNameLen+1);
        BlockMove(&aReply.Namelength, *fNameH, fNameLen+1);
        PToCStr(*fNameH);
        setuppercase(*fNameH);
        off = Munger(fNameH, 0, wanted, 5, 0, 0);   /* check type */
        /* process selected file name */
        if (off>0)  /* batch file */
          { HLock(fNameH);
            MacCVRefNum = aReply.vRefNum;
            f_no = TKOpen(diskdevice, *fNameH, 1);  /*  read */
            while (!eof(f_no))    /* read a name, add to batch */
              { readline(f_no, file_name, 64);
                CtoPStr(file_name);     /* set up for Mac */
                fParm.vRefNum = MacCVRefNum;
                fParm.fType = aReply.ftype;
                fParm.versNum = 0;
                fParm.fName.count = file_name[0];
                BlockMove(&file_name[1], &fParm.fName.s[0], file_name[0]);
                AddAppFile(&fParm);     /* add to list */
              }
            TKClose(f_no);          /* clean up */
            HUnlock(fNameH);
          }
        else    /* normal name */
          { fParm.vRefNum = aReply.vRefNum;
            fParm.fType = aReply.ftype;
            fParm.versNum = 0;
            fParm.fName.count = aReply.Namelength;  /* copy */
            BlockMove(&aReply.Name[0], &fParm.fName.s[0], aReply.Namelength);
            AddAppFile(&fParm);     /* add to list */
          }
        DisposHandle(fNameH);
      }
}
/* Decide whether the application should print or just open */
/* the picked files.  Decide whether to use the "hardwired" */
/*  application name or use SFGetFile  to select the  */
/* name and set the default volume.   Launch application!!  */

void LaunchIt()
{
Point       where;
SFTypeList  tType;
SFReply      aReply;
Str255       target;
Handle       nameH,configH, msgH;
Ptr         wantedA, wantedMsg;
short       off, CheckStr();
VolumeParam volPB;
    where.h = 75; where.v = 100;
    tType.ftype[0] = 'APPL';
    wantedA = "ASK"; wantedMsg = "PRINT";
    /* determine whether to print or open batched files */
    if (CheckStr(258, wantedMsg) >= 0)
      SetAppMessage(1);     /* 'print' */
    else
      SetAppMessage(0);     /* 'open' */
    /* determine application to launch */
    if (CheckStr(257, wantedA) >= 0)   /* use SFGetFile */
      { SFGetFile(&where, NULL, NULL, 1, &tType, NULL, &aReply);
        if (!aReply.good) return;    /* hit cancel to avoid launch */
        /* SET VOL HERE!! */
        volPB.ioCompletion = NULL;
        volPB.ioNamePtr = NULL;
        volPB.ioVRefNum = aReply.vRefNum;
        PBSetVol(&volPB, 0);
        target.count = aReply.Namelength;
        BlockMove(&aReply.Name[0], &target.s[0], target.count);
      }
    else  /* use "hardwired" application name */
      { nameH = (Handle) GetResource('STR ', 256);
        DetachResource(nameH);  /* keep resource mgr happy */
        target.count = **nameH;
        BlockMove(*nameH+1, &target.s[0], target.count);
      }
    /* set up params and launch application */
    launchParms.pgmPtr = &target.count;
    launchParms.dummy = 0;          /* normal configuration */
    LaunchPgm(&launchParms.pgmPtr);
}
/* --- Check a STR resource for a given string (CASE INSENSITIVE) --- 
*/
/*  returns negative # if NOT found, non-neg if FOUND */
short CheckStr(StrNum, wanted)
short   StrNum;     /* STR # to check */
Ptr     wanted;     /* ptr to string to check for */
{
Handle  resH;
short   strLen;
    resH = (Handle) GetResource('STR ', StrNum);
    strLen = length(wanted);
    PToCStr(*resH);      /* RMaker builds Pstrings - need C  */
    setuppercase(*resH); /* folds all chars to upper case */
    return Munger(resH, 0, wanted, strLen, 0, 0);
}
/* --- Launch Glue --- */
void LaunchPgm(parms)
char *parms;    /* fake out compiler */
{
#asm
    MOVE.L  D0,A0
    DC.W    $A9F2       ;_Launch
#endasm
}
/* --- SFGetFile glue --- */
SFGetFile(where, prompt, fileFilter, numTypes, typeList, dlgHook, reply)
Point *where;    // (D0)
struct PStr *prompt; //(D1)
int (*fileFilter)(); //(D2)
short numTypes;  //(D3)
SFTypeList *typeList;//(D4)
int (*dlgHook)();//(D5)
SFReply *reply;  //(D6)
{
#asm
 Include MacTraps.D
 MOVE.L D0,A0
 MOVE.L (A0),-(SP) ; WHERE
 MOVE.L D1,-(SP) ; PROMPT
 MOVE.L D2,-(SP) ; FILTER PROC
 MOVE.W D3,-(SP) ; numTypes
 MOVE.L D4,-(SP) ; typeList
 MOVE.L D5,-(SP) ; dlgHook
 MOVE.L D6,-(SP) ; reply
 MOVE #2,-(SP)   ; routine selector
 _Pack3         ;DC.W $A9EA     ; _Pack3
 RTS
#endasm
}



/*
 * FinderParms.c        Andrew G. Shebanow      8/31/85
 *
 * Routines to emulate the Pascal calls which return
 * finder information (e.g., file arguments, open or print, etc).
 * Written to MacC. Copyright 1985  HyperSoft
 * This edition granted to MacTutor for publication.
 */
#include "memory.h"
/* finder message open files or print files */
#define appOpen           0
#define appPrint          1
/* finder application parameter info */
typedef struct {
        short             vRefNum;
        unsigned long     fType;
        short             versNum;
        Str255          fName;
} AppFile;
#define APPPARMHANDLE   0x0aec
#define FinderName 0x2E0
typedef struct {
        short message;
        short count;
        AppFile files[4];       /* actually open ended */
} AppParms;
short AddAppFile(appFile)
      AppFile *appFile;
      {
        Handle appParmH;
        AppParms *appParmPtr;
        AppFile *newAppFile;
        unsigned long appHsize, appFsize;
        unsigned long newSize;

        appParmH = (Handle) APPPARMHANDLE;
        appParmH = (Handle) *appParmH;
        appHsize = GetHandleSize(appParmH);
        appFsize = (unsigned long) appFile->fName.count;
        appFsize++;
        if ((appFsize & 0x01) != 0)
          appFsize++;
        appFsize += 8;
        newSize = appFsize + appHsize;
        if (SetHandleSize(appParmH,newSize) != 0)
          return(1);
        appParmPtr = (AppParms *) *appParmH;
        /* newAppFile = &(appParmPtr->files[appParmPtr->count]); */
        newAppFile = (AppFile *) ((char *) appParmPtr + appHsize);
        BlockMove(appFile,newAppFile,appFsize);
        appParmPtr->count += 1;
        return(0);
      }

static asmprocs()
{
#asm
        INCLUDE MACTRAPS.D
        INCLUDE SYSEQU.txt
        INCLUDE TOOLEQU.txt
; Routines declared here:
        XDEF CountAppFiles
        XDEF GetAppFiles
        XDEF ClrAppFiles
        XDEF ZeroAppFiles
        XDEF SetAppMessage
        XDEF GetAppName
        XDEF GetFndrName
        XDEF SetFndrName
; void CountAppFiles(message,count)
; short *message;        (D0)
; short *count;           (D1)
CountAppFiles:
        MOVEM.L A0-A2,-(SP)     ; save regs
        MOVE.L  APPPARMHANDLE,A0
        MOVE.L  (A0),A0          ; A0 points to AppParms
        MOVE.L  D0,A1            ; A1 points to message
        MOVE.L  D1,A2            ; A2 points to count
        MOVE    (A0),(A1)           ; save into message
        MOVE    2(A0),(A2)       ; save into count
        MOVEM.L (SP)+,A0-A2     ; restore regs
        RTS
; void GetAppFiles(index,appFile)
; short index;          (D0)
; AppFile *appFile;     (D1)
GetAppFiles:
        MOVEM.L A0-A2/D0-D1,-(SP)       ; save regs
        MOVE.L  APPPARMHANDLE,A0
        MOVE.L  (A0),A0                 ; A0 points to AppParms
        MOVE.L  D1,A2                   ; A2 points to appFile
        JSR     FindIndex               ; find index
        CMP.L   #0,A1
        BEQ     @1                      ; if couldn't find, handle error
        ; copy AppFile data from A1 to appFile
        MOVE.L  A1,A0                   ; source ptr
        MOVE.L  A2,A1                   ; dest ptr
        MOVE.L  8(A0),D0                ; put str len in D0
        AND.L   #$0FF,D0                ; mask hight bytes
        ADDQ.L  #1,D0
        BTST    #0,D0
        BEQ     @2                      ; if odd number of bytes...
        ADDQ.L  #1,D0                   ; pad with additional byte
@2      ADD.L   #8,D0                   ; add space for other data
        _BlockMove
@1      MOVEM.L (SP)+,A0-A2/D0-D1       ; restore regs
        RTS
; void ClrAppFiles(index)
; short index;          (D0)

ClrAppFiles:
        MOVEM.L A0-A1,-(SP)             ; save regs
        MOVE.L  APPPARMHANDLE,A0
        MOVE.L  (A0),A0                 ; A0 points to AppParms
        JSR     FindIndex               ; find index
        CMP.L   #0,A1
        BEQ     @1
        MOVE.L  #0,2(A1)                ; clear out fType field
@1      MOVEM.L (SP)+,A0-A1             ; restore regs
        RTS

; void ZeroAppFiles()
ZeroAppFiles
        MOVEM.L A0-A1,-(SP)             ; save regs
        MOVE.L  APPPARMHANDLE,A0
        _HUnlock                        ; make sure it's movable (FEA)
        MOVE.L  (A0),A1                 ; A1 points to AppParms
        CLR.L   (A1)                    ; set message & count to 0
        MOVEQ.L #4,D0                   ; set handle size to 4
        _SetHandleSize
        MOVEM.L (SP)+,A0-A1             ; restore regs
        RTS

; void SetAppMessage(message)
; short message;        (D0)
SetAppMessage
        MOVE.L  A0,-(SP)                ; save regs
        MOVE.L  APPPARMHANDLE,A0
        MOVE.L  (A0),A1          ; A1 points to AppParms
        MOVE.W  D0,(A1)        ; move message to app parm area
        MOVE.L  (SP)+,A0       ; restore regs
        RTS

; void GetAppName(appName)
; StringPtr appName;            (D0)
;
;       return name of current finder.
GetAppName
        MOVEM.L A0-A1/D0,-(SP)
        TST.L   D0
        BEQ     @1              ; if string pointer is null, return
        LEA     CurApName,A0    ; src <- CurApName global
        MOVE.L  D0,A1           ; dst <- appName
        MOVE.B  (A0),D0         ; get string size
        AND.L   #$0FF,D0
        ADDQ.L  #1,D0           ; add 1 for size byte
        _BlockMove              ; copy the string
@1      MOVEM.L (SP)+,A0-A1/D0
        RTS

; GetFndrName(fndrName)
; StringPtr fndrName;           (D0)
;
;       return name of current finder.
;
GetFndrName
        MOVEM.L A0-A1/D0,-(SP)
        TST.L   D0
        BEQ     @1              ; if string pointer is null, return

        LEA     FinderName,A0   ; src <- FinderName
        MOVE.L  D0,A1           ; dst <- fndrName
        MOVE.B  (A0),D0         ; get string size
        AND.L   #$0FF,D0
        ADDQ.L  #1,D0           ; add 1 for size byte
        _BlockMove              ; copy the string
@1      MOVEM.L (SP)+,A0-A1/D0
        RTS

; SetFndrName(fndrName)
; StringPtr fndrName;           (D0)
;
;       set current finder.
;
SetFndrName
        MOVEM.L A0-A1/D0,-(SP)
        TST.L   D0
        BEQ     @1              ; if string pointer is null, return
        MOVE.L  D0,A0           ; src <- fndrName
        LEA     FinderName,A1   ; dst <- FinderName global
        MOVE.B  (A0),D0         ; get string size
        CMP.B   #15,D0
        BGT     @1              ; if string to big, do nothing
        AND.L   #$0FF,D0
        ADDQ.L  #1,D0           ; add 1 for size byte
        _BlockMove              ; copy the string
@1      MOVEM.L (SP)+,A0-A1/D0
        RTS

; FindIndex
;
;       finds the nth AppFile record.
;
; INPUT:
;       A0.L    pointer to AppParms
;       D0.W    index (1..count)
; OUTPUT:
;       A1.L    pointer to AppFile data or 0 if not found
FindIndex
        MOVEM.L A2-A4/D1-D2,-(SP)       ; save regs
        MOVE.L  0,A1                    ; set result to 0
        TST     D0                      ; test for legal index
        BLE     FindXit
        CMP     2(A0),D0
        BGT     FindXit
        LEA     4(A0),A2                ; start of first AppFile
        MOVE    D0,D1                   ; D1 is loop counter
@1      SUBQ    #1,D1                   ; index from 0
        BEQ     @2                      ; if 0 we are done
        ADD.L   #8,A2                   ; start of filename string
        MOVE.B  (A2),D2                 ; D2 gets filename size
        AND.L   #$0FF,D2                ; mask off high bits
        ADDQ.L  #1,D2                   ; plus one more for size byte
        BTST    #0,D2                   ; test for pad byte
        BEQ     @3                      ; if odd count, we must pad
        ADDQ.L  #1,D2                   ; add one for pad byte
@3      ADD.L   D2,A2                   ; add string size to address
        BRA     @1
@2      MOVE.L  A2,A1                   ; store in result

FindXit MOVEM.L (SP)+,A2-A4/D1-D2       ; restore regs
        RTS
#endasm
}
/******** end of FinderParms.asm ***********/;

; Link file for The Front Man
; Frank Alviani
; 4:07:32 PM  6/4/86
/NoAnimate
/Output The Front Man
/Type 'APPL' 'FEA1'
/Bundle
/Start AltStart
Standard Library.rel
Front Man.rel
FinderParms.rel
/Resources
Front Man Sig.rel
/include Front Man.rsrc
/end



*   Resources for The Front Man
*   Frank Alviani
*   8:56:46 AM  6/6/86

RomRef DA:Rels:Front Man.rsrc

TYPE MENU
 ,2
File
Pick/P
Launch/L
Quit/Q

* --Configuration Strings--
* #256: names the application to be launched
* #257: if it contains 'ASK' use SFGetFile for APPL name 
* #258: if it contains 'PRINT' set message parameter to 1, else 0 ('open')
* #259: if it contains 'TEXT' only those display, else all files.
TYPE STR 
,256
Medit
,257
ASK
,258
print
,259
ALL

* "About Box"
type DLOG
,256
X
100 100 250 400 
Visible NoGoAway
1
0
256

type DITL
,256
7
BtnItem Enabled
124 208 144 289 
GOTCHA!

StatText Disabled
7 91 23 209 
The Front Man...

StatText Disabled
36 10 52 294 
You can select any number of files using

StatText Disabled
52 10 68 294 
the standard file dialog. All of these files

StatText Disabled
68 10 84 294 
will be passed at once to the application

StatText Disabled
84 10 100 294 
to be printed when you select "Launch"

StatText Disabled
100 10 116 294 
from the file Menu.



; Icon Signature for The Front Man
; Frank Alviani
; 9:33:17 AM  6/6/86

  .ALIGN 2
  RESOURCE 'ICN#' 128 'AN ICON'

;   Icon definition
    DC.L    $007FFFF0,$00400010,$01FFFFD0,$01000050
    DC.L    $07FFFF50,$04000150,$05000550,$04000150
    DC.L    $0516C550,$04000150,$051B4550,$04000150
    DC.L    $051DC550,$04000150,$051F4550,$04000150
    DC.L    $051DC550,$04000150,$05000550,$04000150
    DC.L    $FFFFFFFF,$90000049,$FFFFFFF9,$90000049
    DC.L    $9FFFFFC9,$80000009,$FFFFFFF9,$8000000F
    DC.L    $80000008,$90000008,$80000008,$FFFFFFF8
;   Mask definition
    DC.L    $007FFFF0,$007FFFF0,$01FFFFF0,$01FFFFF0
    DC.L    $07FFFFF0,$07FFFFF0,$07FFFFF0,$07FFFFF0
    DC.L    $07FFFFF0,$07FFFFF0,$07FFFFF0,$07FFFFF0
    DC.L    $07FFFFF0,$07FFFFF0,$07FFFFF0,$07FFFFF0
    DC.L    $07FFFFF0,$07FFFFF0,$07FFFFF0,$07FFFFF0
    DC.L    $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF
    DC.L    $FFFFFFFF,$FFFFFFFF,$FFFFFFFF,$FFFFFFFF
    DC.L    $FFFFFFF8,$FFFFFFF8,$FFFFFFF8,$FFFFFFF8
    
  .ALIGN 2
  RESOURCE 'BNDL' 128 'BUNDLE'
  
    DC.L 'FEA1'  ; NAME OF THE "SIGNATURE"
    DC.W 0,1; JUST SOME DATA -- DOESN'T CHANGE
    DC.L 'ICN#'  ; ICON MAPPINGS
      DC.W 0; NUMBER OF MAPPINGS -1
      DC.W 0,128 ; MAP 0 TO ICON 128
      
    DC.L 'FREF'  ; FREF MAPPINGS
      DC.W 0; NUMBER OF MAPPINGS -1
      DC.W 0,128 ; MAP 0 TO FREF 128
    
  RESOURCE 'FEA1' 0 'IDENTIFICATION'
  
    DC.B 34,'The Front Man - F. Alviani  6/5/86'
    
  RESOURCE 'FREF' 128 'FREF 1'
    DC.B 'APPL',0,0,0
 
AAPL
$102.64
Apple Inc.
+1.58
MSFT
$46.56
Microsoft Corpora
-0.50
GOOG
$581.13
Google Inc.
-6.24

MacTech Search:
Community Search:

Software Updates via MacUpdate

GarageSale 6.8 - Create outstanding eBay...
GarageSale is a slick, full-featured client application for the eBay online auction system. Create and manage your auctions with ease. With GarageSale, you can create, edit, track, and manage... Read more
ScreenFlow 4.5.3 - Create screen recordi...
Save 5% with the MacUpdate coupon code: 68031AE15F -- Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your entire... Read more
NeoOffice 2014.3 - Mac-tailored, OpenOff...
NeoOffice is a complete office suite for OS X. With NeoOffice, users can view, edit, and save OpenOffice documents, PDF files, and most Microsoft Word, Excel, and PowerPoint documents. NeoOffice 3.x... Read more
Typinator 6.2 - Speedy and reliable text...
Typinator turbo-charges your typing productivity. Type a little. Typinator does the rest. We've all faced projects that require repetitive typing tasks. With Typinator, you can store commonly used... Read more
PopChar X 6.7 - Floating window shows av...
PopChar X helps you get the most out of your font collection. With its crystal-clear interface, PopChar X provides a frustration-free way to access any font's special characters. Expanded... Read more
Evernote 5.6.0 - Create searchable notes...
Evernote allows you to easily capture information in any environment using whatever device or platform you find most convenient, and makes this information accessible and searchable at anytime, from... Read more
Monosnap 2.2.2 - Versatile screenshot ut...
Monosnap allows you to save screenshots easily, conveniently, and quickly, sharing them with friends and colleagues at once. It's the ideal choice for anyone who is looking for a smart and fast... Read more
Tunnelblick 3.4beta36 - GUI for OpenVPN...
Tunnelblick is a free, open source graphic user interface for OpenVPN on OS X. It provides easy control of OpenVPN client and/or server connections. It comes as a ready-to-use application with all... Read more
SoftRAID 5.0.4 - High-quality RAID manag...
SoftRAID allows you to create and manage disk arrays to increase performance and reliability. SoftRAID's intuitive interface and powerful feature set makes this utility a must have for any Mac OS X... Read more
Audio Hijack Pro 2.11.3 - Record and enh...
Audio Hijack Pro drastically changes the way you use audio on your computer, giving you the freedom to listen to audio when you want and how you want. Record and enhance any audio with Audio Hijack... Read more

Latest Forum Discussions

See All

Why I Don’t Want to Upgrade to the iPhon...
I’ve been living with my iPhone 4S for the past two years or so, and if I was living in a world where I wasn’t bombarded with new phone announcements and people of the general public caring enough to upgrade constantly, I wouldn’t think my phone... | Read more »
Tictail Review
Tictail Review By Jennifer Allen on September 23rd, 2014 Our Rating: :: CLASSY SHOPPINGiPhone App - Designed for the iPhone, compatible with the iPad Tictail is an attractive and stylish way of looking for some great new clothes... | Read more »
Super Glyph Quest is Bringing More Match...
Super Glyph Quest is Bringing More Match-3 Magics to the App Store Soon Posted by Jessica Fisher on September 23rd, 2014 [ permalink ] Fans of Glyph Quest, by Alex Trowers and Leanne Bayley, | Read more »
Sword King Review
Sword King Review By Jennifer Allen on September 23rd, 2014 Our Rating: :: WEAK, SO WEAKUniversal App - Designed for iPhone and iPad Ever wanted to tap on a screen and assume you’ve killed a monster or two? Probably not, but just... | Read more »
Pangea Software Unveil Bundles and iOS 8...
Pangea Software Unveil Bundles and iOS 8 Updates Posted by Ellis Spice on September 23rd, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Race Team Manager Review
Race Team Manager Review By Jennifer Allen on September 23rd, 2014 Our Rating: :: LIGHT RACINGUniversal App - Designed for iPhone and iPad Want to be in charge of a racing team but not be overwhelmed by tactics and options? Race... | Read more »
Kobojo Works with Creative Minds from Fi...
Kobojo has announced details for their newest game, Zodiac – a 2D persistent online RPG. Kobojo has put together a crack team of developers including composer Hitoshi Sakimoto and scenario writer Kazushige Nojima, whose work includes many of the... | Read more »
PlayHaus Review
PlayHaus Review By Amy Solomon on September 23rd, 2014 Our Rating: iPad Only App - Designed for the iPad PlayHaus is a interesting, stylish app for young children, full of cause-and-effect interactions.   | Read more »
Astropolo Review
Astropolo Review By Amy Solomon on September 23rd, 2014 Our Rating: Universal App - Designed for iPhone and iPad Astropolo is a space-themed children’s app with a great sense of style.   | Read more »
New E*TRADE Update Includes Touch ID and...
New E*TRADE Update Includes Touch ID and Home Screen Widget for iOS 8 Posted by Jessica Fisher on September 23rd, 2014 [ permalink ] | Read more »

Price Scanner via MacPrices.net

Razer DeathAdder Chroma Gaming Mouse Upgraded...
Razer has announced the launch of their new Razer DeathAdder Chroma gaming mouse. Even if you’re not a gamer, the DeathAdder bears considering. I’m a fan of the hard-wired tracking accuracy,... Read more
Check Apple prices on your device with iTracx
MacPrices is proud to offer readers a free iOS app (iPhones, iPads, & iPod touch) and Android app (Google Play and Amazon App Store) called iTracx, which allows you to glance at today’s lowest... Read more
Refurbished 2013 MacBook Pros available for u...
The Apple Store has Apple Certified Refurbished 13″ and 15″ MacBook Pros available starting at $929. Apple’s one-year warranty is standard, and shipping is free: - 13″ 2.5GHz MacBook Pros (4GB RAM/... Read more
New iPhones Score Big in SquareTrade Breakabi...
SquareTrade has announced the iPhone 6 and its larger sibling, iPhone 6 Plus, performed impressively in Breakability testing, and each carries the top Breakability Score in their respective category... Read more
10 Million + First Weekend Sales Set New iPho...
Apple has announced it sold over 10 million new iPhone 6 and iPhone 6 Plus models, a new record, just three days after the launch on September 19. iPhone 6 and iPhone 6 Plus are now available in the... Read more
Betty Crocker Launches New Cookbook for iOS
Betty Crocker, a General Mills brand, an established food industry leader, has announced its free digital cookbook app has been refreshed to make cooking with iPhone, iPad and iPod touch even easier... Read more
Apple restocks some refurbished 2014 MacBook...
The Apple Store has restocked some Apple Certified Refurbished 2014 MacBook Airs, with prices starting at $769. An Apple one-year warranty is included with each MacBook, and shipping is free. These... Read more
13-inch 128GB MacBook Air on sale for $949, s...
B&H Photo has the new 2014 13″ 1.4GHz/128GB MacBook Air on sale for $949.99 including free shipping plus NY tax only. Their price is $50 off MSRP. B&H will also include free copies of... Read more
Apple offering free $25 iTunes Gift Card with...
The Apple Store is offering a free $25 iTunes Gift Card with the purchase of a $99 Apple TV for a limited time. Shipping is free. Read more
Apple refurbished iPod touch available for up...
The Apple Store has Apple Certified Refurbished 5th generation iPod touches available starting at $149. Apple’s one-year warranty is included with each model, and shipping is free. Most colors are... Read more

Jobs Board

Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.