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
$109.41
Apple Inc.
+2.67
MSFT
$45.74
Microsoft Corpora
+0.58
GOOG
$504.89
Google Inc.
+9.50

MacTech Search:
Community Search:

Software Updates via MacUpdate

BBEdit 11.0.2 - Powerful text and HTML e...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more
ExpanDrive 4.2.1 - Access cloud storage...
ExpanDrive builds cloud storage in every application, acts just like a USB drive plugged into your Mac. With ExpanDrive, you can securely access any remote file server directly from the Finder or... Read more
Adobe After Effects CC 2014 13.2 - Creat...
After Effects CC 2014 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous After Effects customer). After Effects CS6 is still available... Read more
Command-C 1.1.7 - Clipboard sharing tool...
Command-C is a revolutionary app which makes easy to share your clipboard between iOS and OS X using your local WiFi network, even if the app is not currently opened. Copy anything (text, pictures,... Read more
Tidy Up 4.0.2 - Find duplicate files and...
Tidy Up is a complete duplicate finder and disk-tidiness utility. With Tidy Up you can search for duplicate files and packages by the owner application, content, type, creator, extension, time... Read more
Typinator 6.3 - 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
GraphicConverter 9.5 - Graphics editor w...
GraphicConverter is an all-purpose image-editing program that can import 200 different graphic-based formats, edit the image, and export it to any of 80 available file formats. The high-end editing... Read more
Toast Titanium 12.0.1 - The ultimate med...
Toast Titanium goes way beyond the very basic burning in the Mac OS and iLife software, and sets the standard for burning CDs, DVDs, and now Blu-ray discs on the Mac. Create superior sounding audio... Read more
QuickBooks 2015 16.0.2.1422 R3 - Financi...
Save 20% on QuickBooks Pro for Mac today through this special discount link QuickBooks Pro 2013 helps you manage your business easily and efficiently. Organize your finances all in one place, track... Read more
Remotix 3.0.6 - Access all your computer...
Remotix is a fast and powerful application to easily access multiple Macs (and PCs) from your own Mac. Features: Complete Apple Screen Sharing support - including Mac OS X login, clipboard... Read more

Latest Forum Discussions

See All

The Drive : Devil's Run (Games)
The Drive : Devil's Run 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: ON THE ROAD AGAIN! The Drive - Devil’s Run is classic point to point style racing game that pays homage to the classics... | Read more »
Procreate Pocket (Entertainment)
Procreate Pocket 1.01 Device: iOS iPhone Category: Entertainment Price: $2.99, Version: 1.01 (iTunes) Description: Create - anytime, anywhere. Made by the developers of the award-winning Procreate® for iPad®, Procreate Pocket™ allows... | Read more »
IRON FINGER - Mini Games Championship (...
IRON FINGER - Mini Games Championship 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Quick to play, easy to learn yet hard to master.. TAP, SWIPE & TILT your way through mini games that... | Read more »
Pentaction: Medieval (Games)
Pentaction: Medieval 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Pentaction: Medieval is a turn-based strategy board-game about chance and skill on the battlefield. Take control of your... | Read more »
Hipstify Review
Hipstify Review By Jennifer Allen on December 17th, 2014 Our Rating: :: COOL FILTERSUniversal App - Designed for iPhone and iPad Add filters, quotes, and fancy frames to your images, thanks to Hipstify.   | Read more »
Mighty Smighties Gets Evolve Cards and N...
Mighty Smighties Gets Evolve Cards and New Worlds Posted by Jessica Fisher on December 17th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Duckie Deck Card Wars Review
Duckie Deck Card Wars Review By Amy Solomon on December 17th, 2014 Our Rating: :: STYLISH GAME OF CARDSUniversal App - Designed for iPhone and iPad Duckie Deck Card Wars adapts the classic card game War for use on devices, complete... | Read more »
PDF Office Review
PDF Office Review By Jennifer Allen on December 17th, 2014 Our Rating: :: CONVENIENT PDF EDITINGiPad Only App - Designed for the iPad Want to create your own PDF files? Import them from elsewhere? Adapt a web page into a PDF? PDF... | Read more »
The Out There: Ω Edition Update will be...
The Out There: Ω Edition Update will be Releasing in 2015, Bringing Better Graphics and Additional Content Posted by Jessica Fisher on December 17th, 2014 [ permalink ] | Read more »
Pinball Planet Pro (Games)
Pinball Planet Pro 1.02 Device: iOS Universal Category: Games Price: $2.99, Version: 1.02 (iTunes) Description: - Our missionWe've always loved to play pinball games but we noticed most modern pinball games are simulators for the... | Read more »

Price Scanner via MacPrices.net

Holiday sales continue: MacBook Pros for up t...
 B&H Photo has new MacBook Pros on sale for up to $300 off MSRP as part of their Holiday pricing. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.2GHz Retina MacBook Pro: $1699... Read more
Google Search App For iOS Gets A Major Makeov...
Google has given iOS users an early Christmas present with a substantial update of it’s not-very-often-upgraded Google Search app. Google Search has been my go-to tool for Web searches since it was... Read more
ShopKeep Apple Pay And Chip Card Reader Avail...
ShopKeep, a cloud-based technology provider to more than 10,000 small business owners to manage retail shops and restaurants with iPads, has released its new Apple Pay and chip card reader. This... Read more
Holiday sale! 27-inch 5K iMac for $2299, save...
 B&H Photo has the 27″ 3.5GHz 5K iMac in stock today and on sale for $2299 including free shipping plus NY sales tax only. Their price is $200 off MSRP, and it’s the lowest price available for... Read more
Holiday Sale! 3.7GHz Quad Core Mac Pro availa...
 B&H Photo has the 3.7GHz Quad Core Mac Pro on sale for $2599 including free shipping plus NY sales tax only. Their price is $400 off MSRP, and it’s the lowest price for this model from any... Read more
iPhone 6 Number 3 Canadian Google Search Of 2...
CTVNews.ca reports that Apple’s iPhone 6 was the third highest-trending Google Canada search topic of 2014, exceeded only by Robin Williams largely after his death by suicide in August, and the FIFA... Read more
New iPad mini 3 Counter-Top & Wall Mount...
newMacgadgets has announced new secure all-acrylic displays for the iPad mini 3 (also works fine with the mini 2, last year’s iPad mini With Retina Display, and the original iPad mini). The new iPad... Read more
Holiday sales continue, MacBook Airs for up t...
B&H Photo has 2014 MacBook Airs on sale for up to $120 off MSRP, for a limited time, for the Thanksgiving/Christmas Holiday shopping season. Shipping is free, and B&H charges NY sales tax... Read more
B&H lowers price on 27-inch 3.2GHz iMac t...
B&H Photo has lowered their price on the 27″ 3.2GHz iMac, now on sale for $1629 including free shipping plus NY sales tax only. Their price is $170 off MSRP, and it’s the lowest price for this... Read more
15-inch 2.0GHz Retina MacBook Pro available f...
B&H Photo has lowered their price on leftover 2013 15″ 2.0GHz Retina MacBook Pros to $1499 including free shipping plus NY sales tax only. Their price is $500 off original MSRP. Read more

Jobs Board

*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the 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
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.