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
 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

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

Price Scanner via MacPrices.net

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

Jobs Board

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