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
$528.49
Apple Inc.
+3.55
MSFT
$40.07
Microsoft Corpora
+0.06
GOOG
$529.11
Google Inc.
-6.99

MacTech Search:
Community Search:

Software Updates via MacUpdate

Lens Blur 1.3.0 - True out-of-focus boke...
Let Lens Blur transform your existing photo into true SLR-quality out-of-focus bokeh effect! Everyone needs a gorgeous personalized background for a social profile, blog, Web/UI design, presentation... Read more
VMware Fusion 6.0.3 - Run Windows apps a...
VMware Fusion allows you to create a Virtual Machine on your Mac and run Windows (including Windows 8.1) and Windows software on your Mac. Run your favorite Windows applications alongside Mac... Read more
Tweetbot 1.5.1 - Popular iOS twitter cli...
Tweetbot is a full-featured OS X Twitter client with a lot of personality. Whether it's the meticulously-crafted interface, sounds and animation, or features like multiple timelines and column views... Read more
Mac DVDRipper Pro 4.1.7 - Copy, backup,...
Mac DVDRipper Pro is the DVD backup solution that lets you protect your DVDs from scratches, save your batteries by reading your movies from your hard disk, manage your collection with just a few... Read more
PDFpenPro 6.2 - Advanced PDF toolkit for...
PDFpenPro allows users to edit PDF's easily. Add text, images and signatures. Fill out PDF forms. Merge or split PDF documents. Reorder and delete pages. Even correct text and edit graphics! Create... Read more
PDFpen 6.2 - Edit and annotate PDFs with...
PDFpen allows users to easily edit PDF's. Add text, images and signatures. Fill out PDF forms. Merge or split PDF documents. Reorder and delete pages. Even correct text and edit graphics! Features... Read more
Monolingual 1.5.9 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
Maya 2015 - Professional 3D modeling and...
Maya is an award-winning software and powerful, integrated 3D modeling, animation, visual effects, and rendering solution. Because Maya is based on an open architecture, all your work can be scripted... Read more
Starcraft II: Wings of Liberty 1.1.1.180...
Download the patch by launching the Starcraft II game and downloading it through the Battle.net connection within the app. Starcraft II: Wings of Liberty is a strategy game played in real-time. You... Read more
Sibelius 7.5.0 - Music notation solution...
Sibelius is the world's best-selling music notation software for Mac. It is as intuitive to use as a pen, yet so powerful that it does most things in less than the blink of an eye. The demo includes... Read more

Latest Forum Discussions

See All

Bike Assault Review
Bike Assault Review By Nadia Oxford on April 21st, 2014 Our Rating: :: RIDE FASTUniversal App - Designed for iPhone and iPad Bike Assault is as basic as an arcade-style game gets, though it’s not devoid of charm and challenge.   | Read more »
Hearthstone: Heroes of Warcraft Review
Hearthstone: Heroes of Warcraft Review By Rob Thomas on April 21st, 2014 Our Rating: :: PERFECTLY (WAR)CRAFTEDiPad Only App - Designed for the iPad This World of Warcraft CCG spin-off is easy to pick up, almost impossible to put... | Read more »
Hearthstone: Tips and Tricks for Becomin...
Hearthstone: Heroes of Warcraft is a deceptive game because it can be so easy to get into, but doing well winds up being a bit of a challenge. Well, for those just jumping into the game with its iPad release, here are a few general tips on how to... | Read more »
Puzzle Breaker Review
Puzzle Breaker Review By Jordan Minor on April 21st, 2014 Our Rating: :: PUZZLES AND DRAGONSUniversal App - Designed for iPhone and iPad Puzzle Breaker combines simple match-3 gameplay with a surprisingly strong RPG feel.   | Read more »
Createrria Gets an Update that Adds Lead...
Createrria Gets an Update that Adds Leaderboards, Parental Controls, and More Posted by Tre Lawrence on April 21st, 2014 [ permalink ] | Read more »
The Amazing Spider-Man 2 Review
The Amazing Spider-Man 2 Review By Lee Hamlet on April 21st, 2014 Our Rating: :: SPIDER-SENSE TINGLING. IN A GOOD WAYUniversal App - Designed for iPhone and iPad With great power comes… Ah who cares? I just want to swing!   | Read more »
This Week at 148Apps: April 14-18, 2014
Spring Into Our App Reviews   | Read more »
Have a Special Dead Trigger 2 Easter Bas...
Have a Special Dead Trigger 2 Easter Basket Full of Goodies, Courtesy of Madfinger Games Posted by Rob Rich on April 18th, 2014 [ permalink ] Dead Trigger 2 | Read more »
Almost All of Playdek’s Library is on Sa...
Almost All of Playdek’s Library is on Sale Right Now, and You Should Check it Out Posted by Rob Rich on April 18th, 2014 [ permalink ] Playdek has released quite a few great iOS ports of board and card games over the years, and now most of them... | Read more »
Zynga Launches Brand New Farmville Exper...
Zynga Launches Brand New Farmville Experience with Farmville 2: Country Escape Posted by Tre Lawrence on April 18th, 2014 [ permalink ] | Read more »

Price Scanner via MacPrices.net

$100 off cellular iPad minis plus free $20 gi...
Best Buy is discounting cellular iPad minis with Retina Displays by $100 on their online store for a limited time. They’ll also throw in a free $20 Best Buy gift card. Choose free shipping or free... Read more
Updated Price Trackers
We’ve updated our Mac Price Trackers with the latest information on prices, bundles, and availability on systems from Apple’s authorized internet/catalog resellers: - 15″ MacBook Pros - 13″ MacBook... Read more
Apple refurbished MacBook Airs available for...
The Apple Store has Apple Certified Refurbished 2013 MacBook Airs available for up to $200 off the cost of new models. An Apple one-year warranty is included with each MacBook, and shipping is free... Read more
Android Leads in Operating System Share Andro...
Consumer Intelligence Research Partners, LLC (CIRP) has released its latest results of its research on mobile phone operating systems for the calendar quarter that ended March 31, 2014. This analysis... Read more
Pelican Products, Inc. Introduces New Lineup...
Pelican Products, Inc., the global leader in the design and manufacture of high-performance protective cases, today announced the launch of a new line of rugged phone cases for both the Apple iPhone... Read more
SaveDrives – Car Dashboard Video Camera &...
Drivers who want to help reduce potential damage to their health and finances in the event of an accident can download the innovative new no-cost app SaveDrives – Car Dashboard Video Camera &... Read more
Deal Alert! 13-inch MacBook Pro on sale for $...
Best Buy has the 13″ 2.5GHz MacBook Pro on sale for $999.99 on their online store. Choose free shipping or free instant local store pickup (if available). Their price is $200 off MSRP. Price is valid... Read more
Free HopTo 2.2 Helps Enhance Your Productivit...
The HopTo app helps you do more on your iPad by providing more and easier adaccess to files and documents. Version 2.2 adds Egnyte and HopTo’s Mac OSX File Connector. If you already have the hopTo... Read more
National Distracted Driving Awareness Month:...
As the country recognizes National Distracted Driving Awareness Month, Sprint is reminding wireless consumers to focus on driving while behind the wheel, to not text or email while driving, and to... Read more
13-inch 2.4GHz Retina MacBook Pro available f...
Abt has the 13″ 2.4GHz 128GB Retina MacBook Pro available for $1229 including free shipping. Their price is $70 off MSRP. Read more

Jobs Board

*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
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
*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
*Apple* Inc. Research Data Specialist - Appl...
…of Worldwide Market Research & Intelligence. The team is responsible for conducting Apple branded consumer market research. It is also responsible for analyzing data Read more
*Apple* Automotive Parts Department position...
Apple Automotive is one of the fastest growing dealer…and it shows. Consider making the switch to the Apple Automotive Group today! At Apple Automotive, we Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.