home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
GWINDOWS
/
lfmaker.lzh
/
aif.c
< prev
next >
Wrap
Text File
|
1996-04-13
|
2KB
|
85 lines
/*********************************************************************
aif.c - recognizer to give G-Windows some of the functions that
AIF files gave to Multi-View
File structure:
line 1 AIF
line 2 command line to pass to G-Windows
line 3 File type to pass to gwindows
line 4 icon
compile with:
cc -i -td=/r0 -s=0 -t=10 -eas -v=/dd/GWINDOWS/DEFS -tp=68kc aif.c
link:
l68 /dd/GWINDOWS/LIB/substart.r aif.r -l=/dd/MWOS/OS9/68000/LIB/clib.l
-l=/dd/MWOS/OS9/68000/LIB/os_lib.l -o=/dd/GWINDOWS/CMDS/aif_recognizer
set attributes:
attr /dd/GWINDOWS/CMDS/aif_recognizer -eperprw
*********************************************************************/
#include <desktop.h> /* MATCHTEST */
#include <types.h> /* special data types */
#include <string.h> /* strcpy() */
/* change this when new icons added - this must be one less that the number
of icons defined in aif_icons */
#define LASTICON 12
/* nothing from here down should need to be changed. */
#define COMPVALUE 0x4149460D
unsigned short black_icon();
extern char *GetLine(char**);
int dt_hook(MATCHTEST *mt)
{
unsigned long hashvalue;
unsigned short value;
char *data;
data = mt->data;
hashvalue = (data[0] << 24) | (data[1] << 16) | (data[2] <<8) | (data[3]);
if(hashvalue != COMPVALUE)
return 0;
data+=4;
strcpy(mt->command,GetLine(&data));
strcpy(mt->filetype,GetLine(&data));
value = 0;
while(*data >= '0' && *data <='9')
{
value *= 10;
value += *(data++) - '0';
}
if(value > LASTICON)
value = 0;
value <<= 7;
mt->icon = (unsigned short*)black_icon;
mt->icon += value;
mt->matchflag = LASTICON; /* desktop only checks for non zero */
return 1;
}
char *GetLine(char **data)
{
char *s = *data;
char *rtn = *data; /* save original pointer */
while(*s != 0x0d) /* find carriage return */
s++;
*s++ = 0; /* null terminate */
*data = s; /* update data pointer */
return rtn;
}
#include "aif_icons"