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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.