Reference Section
_access_f {
char buffer[13];
if (_access_f (buffer))
{
/* Does not have read/write permission */
} else
{
/* Has read/write permission */
}
}
#include <inline.h>
{
char buffer[13] = "file.dat";
...
lea si,buffer
access_f ();
je access_f_010/* if read/write permission */
ja access_f_020/* if read-only permission */
... /* if an error occurred */
jmp short access_f_100
access_f_010: /* read/write permission */
...
jmp short access_f_100
access_f_020: /* read-only permission */
...
access_f_100: /* done... */
...
}
Source file _FDACCES.ASM ASM equiv ACCESS_F
{
if (_ch_dir(".") == -1)
{
/* Handle the error */
}
...
}
#include <inline.h>
{
char *dir= "D:\\TEMP";
mov si,dir
ch_dir ();
jncch_dir_010/* If successful */
... /* if an error occurred */
ch_dir_010:
...
}
Source file _FDCHDIR.ASM ASM equiv CH_DIR
{
int cond = FA_NORM;
char filename[13];
...
if (!_exist_f (filename, &cond) || cond)
{
/* Handle the error */
}
...
}
#include <inline.h>
{
char filename[13] = "file.dat";
...
lea si,filename
mov ax,FA_NORM/* AX=file attrs to look for */
exist_f ();
ja exist_f_010/* if attributes didn't match */
jb exist_f_020/* an error occurred */
... /* if attributes match */
jmp short exist_f_030
exist_f_010:
... /* Attributes don't match */
jmp short exist_f_030
exist_f_020:
... /* file doesn't exist or error */
exist_f_030:
...
}
Source file _FDEXIST.ASM ASM equiv EXIST_F
{
char buffer[50];
...
switch (_expand_path (buffer))
{
case 1:
/* Pathname is a valid path plus filename */
break;
case 0:
/* Pathname is a valid path */
break;
case -1:
/* Pathname is not a valid path or filename */
break;
}
...
}
#include <inline.h>
{
char buffer[50] = "file.dat";
...
lea si,buffer
expand_path ();
ja expand_p_010/* path + filename */
jb expand_p_020/* error or file doesn't exist */
... /* filename was a path */
jmp short expand_p_030
expand_p_010:
... /* filename = path + filename */
jmp short expand_p_030
expand_p_020:
... /* file doesn't exist or error */
expand_p_030:
...
}
Source file _FDEXPND.ASM ASM equiv EXPAND_PATH
{
fbuf filebuf;
int code;
code = _find_first ("*.c", &filebuf, FA_NORM);
if (code == -1)
{
/* Handle the error */
} else if (code == 1)
{
/* handle no matching files */
} else
{
do {
...
} while (!_find_next (&filebuf));
...
}
}
#include <inline.h>
{
fbuf filebuf;
char *filespec = "*.c";
...
mov si,filespec
pushss
pop es /* ES = SS */
lea di,filebuf
mov ax,FA_NORM/* AX = attributes to look for */
find_first ();
ja find_first_060/* if no matching files found */
jb find_first_040/* if an error occurred */
find_first_020:
... /* process the matching files here... */
find_next ();
je find_first_020/* if a matching file was found */
ja find_first_060/* if no matching files found */
find_first_040:
... /* DOS error ... */
jmp find_first_080
find_first_060:
... /* no more matching files */
find_first_080:
...
}
Source file _FDFINDF.ASM ASM equiv FIND_FIRST
{
fbuf filebuf;
int code;
code = _find_first ("*.c", &filebuf, FA_NORM);
if (code == -1)
{
/* Handle the error */
} else if (code == 1)
{
/* handle no matching files */
} else
{
do {
...
} while (!_find_next (&filebuf));
...
}
}
#include <inline.h>
{
fbuf filebuf;
char *filespec = "*.c";
mov si,filespec
pushss
pop es /* ES = SS */
lea di,filebuf
mov ax,FA_NORM/* AX = attributes to look for */
find_first ();
ja find_first_060/* if no matching files found */
jb find_first_040/* if an error occurred */
find_first_020:
... /* process matching files ... */
find_next ();
je find_first_020/* if matching file was found */
ja find_first_060/* if no matching files found */
find_first_040:
... /* handle the error... */
jmp find_first_080
find_first_060:
... /* no more matching files */
find_first_080:
...
}
Source file _FDFINDN.ASM ASM equiv FIND_NEXT
{
char filename[13];
...
_fix_filename (filename);
}
#include <inline.h>
{
char filename[40] = "longfilename.longext";
...
lea si,filename
fix_filename ();
jncfix_fname_010/* if successful */
... /* filename could not be forced to the form
of a valid filename */
fix_fname_010:
...
}
Source file _FDFIXFN.ASM ASM equiv FIX_FILENAME
{
char filename[13];
...
_fix_path (filename);
}
#include <inline.h>
{
char path[50] = "c:\\util\\";
...
lea si,path
fix_path ();
jnefix_path_010/* path already in DOS format */
... /* if path was changed */
fix_path_010:
...
}
Source file _FDFIXP.ASM ASM equiv FIX_PATH
{
char buffer[68];
if (_get_curdir (buffer, 'C'))
{
/* Handle an error */
}
...
}
#include <inline.h>
{
char buffer[68];
...
lea si,buffer
mov al,'C' /* use C drive */
get_curdir ();
jncget_curdir_010/* if successful */
... /* if an error occurred */
get_curdir_010:
...
}
Source file _FDCURDR.ASM ASM equiv GET_CURDIR
{
char buffer[68];
if (!_get_cwd (buffer))
{
/* Handle the error */
}
...
}
#include <inline.h>
{
char buffer[68];
...
lea si,buffer
get_cwd ();
jncget_cwd_010/* if successful */
... /* if an error occurred */
get_cwd_010:
...
}
Source file _FDCWD.ASM ASM equiv GET_CWD
{
char drive;
drive = _get_drive(); /* drive = drive letter */
...
}
#include <inline.h>
...
get_drive(); /* AL = drive letter */
...
Source file FDGDRIVE.ASM ASM equiv GET_DRIVE
{
if (_getmode_f ("$fd.c") != FA_NORM)
{
/* Handle file mode not matching FA_NORM */
} else
{
...
}
}
#include <inline.h>
{
char filename[13] = "file.dat";
...
lea si,filename
getmode_f (); /* AX=file attributes */
jncgetmode_f_010/* if successful */
... /* if an error occurred */
getmode_f_010:
...
}
Source file _FDGETMD.ASM ASM equiv GETMODE_F
{
char buffer[68];
...
_merge_drive (buffer, "c:");
...
}
#include <inline.h>
{
char buffer[68] = "a:\\data\\file.dat", *drive = "c";
...
mov si,drive
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_drive ();/* buffer = "C:\DATA\FILE.DAT" */
...
}
Source file _FDMERGD.ASM ASM equiv MERGE_DRIVE
{
char buffer[68];
...
_merge_drvpath (buffer, "c:\\util\\");
...
}
#include <inline.h>
{
char buffer[68] ="a:\\data\\file.dat", *string = "c:\\util\\";
...
mov si,string
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_drvpath ();/* buffer = "C:\UTIL\FILE.DAT" */
...
}
Source file _FDMERGV.ASM ASM equiv MERGE_DRVPATH
{
char buffer[68];
...
_merge_ext (buffer, ".bak");
...
}
#include <inline.h>
{
char buffer[68] = "a:\\data\\file.dat", *string = ".bak";
...
mov si,string
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_ext ();/* buffer = "A:\DATA\FILE.BAK" */
...
}
Source file _FDMERGE.ASM ASM equiv MERGE_EXT
{
char buffer[68];
...
_merge_fname (buffer, "tempfile");
...
}
#include <inline.h>
{
char buffer[68] = "a:\\data\\file.dat", *string = "tempfile";
...
mov si,string
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_fname ();/* buffer = "A:\DATA\TEMPFILE.DAT" */
...
}
Source file _FDMERGN.ASM ASM equiv MERGE_FNAME
{
char buffer[68];
...
_merge_fnamext (buffer, "tempfile.tmp");
...
}
#include <inline.h>
{
char buffer[68] ="a:\\data\\file.dat", *string = "tfile.tmp";
...
mov si,string
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_fnamext ();/* buffer = "A:\DATA\TFILE.TMP" */
...
}
Source file _FDMERGX.ASM ASM equiv MERGE_FNAMEXT
{
char buffer[68];
...
_merge_path (buffer, "\\util\\");
...
}
#include <inline.h>
{
char buffer[68] = "a:\\data\\file.dat", *string = "\\util\\";
...
mov si,string
pushss
pop es /* ES=seg buffer */
lea di,buffer
merge_path (); /* buffer = "A:\UTIL\FILE.DAT" */
...
}
Source file _FDMERGP.ASM ASM equiv MERGE_PATH
{
char pathname[50] = "temp????";
...
if (_mk_temp (pathname) || _mk_dir (pathname))
{
/* Handle the error */
} else
{
if (_rm_dir (pathname))
{
/* Handle the error */
} else
{
...
}
}
}
#include <inline.h>
{
char pathname[50] = "mydir";
...
lea si,pathname
mk_dir (); /* make "MYDIR" subdirectory */
jc mk_dir_010/* if an error occurred */
... /* if successful */
rm_dir (); /* remove "MYDIR" subdirectory */
jc mk_dir_010/* if an error occurred */
... /* if successful */
jmp short mk_dir_020
mk_dir_010:
... /* handle the error */
mk_dir_020:
...
}
Source file _FDMKDIR.ASM ASM equiv MK_DIR
{
char pathname[50] = "temp????";
...
if (_mk_temp (pathname) || _mk_dir (pathname))
{
/* Handle the error */
} else
{
if (_rm_dir (pathname))
{
/* Handle the error */
} else
{
...
}
}
}
#include <inline.h>
{
char buffer[13] = "temp????";
...
lea si,buffer
mk_temp (); /* generate a temp filename */
jc mk_temp_010/* if an error occurred */
mov ax,FA_NORM/* setup to create as "normal" */
create_h (); /* create tempfile, BX = handle */
jc mk_temp_010/* if an error occurred */
... /* if successful */
close_h (); /* close file w/handle in BX */
jc mk_temp_010/* if an error occurred */
remove_h (); /* remove temp file */
jc mk_temp_010/* if an error occurred */
... /* more stuff... */
mk_temp_010:
... /* handle the error */
}
Source file _FDMKTMP.ASM ASM equiv MK_TEMP
{
char pathname[50];
...
if (_remove_f (pathname))
{
/* Handle the error */
} else
{
...
}
}
#include <inline.h>
{
char pathname[50] = "file.dat";
...
lea si,pathname
remove_f ();
jc remove_f_010/* if an error occurred */
... /* if successful */
jmp short remove_f_020
remove_f_010:
... /* handle the error */
remove_f_020:
...
}
Source file _FDREMOV.ASM ASM equiv REMOVE_F
{
char pathname1[50], pathname2[50];
...
if (_rename_f (pathname1, pathname2))
{
/* Handle the error */
} else
{
...
}
}
#include <inline.h>
{
char pathname1[50] = "file.dat", pathname2[50] = "temp.fil";
...
lea si,pathname1
pushss
pop es /* ES=SS */
lea di,pathname2
rename_f ();
jc rename_f_010/* if an error occurred */
... /* if successful */
jmp short rename_f_020
rename_f_010:
... /* handle the error */
rename_f_020:
...
}
Source file _FDRENAM.ASM ASM equiv RENAME_F
{
char pathname[50] = "temp????";
int cond;
...
if (_mk_temp (pathname, &cond) || _mk_dir (pathname))
{
/* Handle the error */
} else
{
if (_rm_dir (pathname))
{
/* Handle the error */
} else
{
...
}
}
}
#include <inline.h>
{
char pathname[50] = "mydir";
...
lea si,pathname
mk_dir (); /* make "MYDIR" subdirectory */
jc mk_dir_010/* if an error occurred */
... /* if successful */
rm_dir (); /* remove "MYDIR" subdirectory */
jc mk_dir_010/* if an error occurred */
... /* if successful */
jmp short mk_dir_020
mk_dir_010:
... /* handle the error */
mk_dir_020:
...
}
Source file _FDRMDIR.ASM ASM equiv RM_DIR_
{
char buffer[80];
...
if (_search_path (buffer, "c:\\;c:\\work\\stub;") == NULL)
{
/* Handle the error */
} else
{
...
}
}
#include <inline.h>
{
char buffer[50] = "file.dat", *path="c:\\;c:\\util;c:\\bin;";
...
pushss
pop es /* ES=DS (path pntr on stack) */
mov di,path /* DI = offset of buffer */
lea si,buffer/* SI = offset of buffer */
search_path (); /* specified pathname found? */
je srch_path_010/* y: process pathname */
ja srch_path_020/* n: path not found */
... /* if an error occurred */
jmp short srch_path_030
srch_path_010:
... /* process pathname */
jmp short srch_path_030
srch_path_020:
... /* path not found */
srch_path_030:
...
}
Source file _FDSRCHP.ASM ASM equiv SEARCH_PATH
if (_set_drive ('D'))
{
/* Handle the error */
} else
{
...
}
#include <inline.h>
...
mov al,'C' /* AL=drive letter to use */
set_drive ();
jncset_drive_010/* if successful */
... /* if an error occurred */
set_drive_010:
...
Source file _FDSDRIV.ASM ASM equiv SET_DRIVE
{
char filename[13];
...
if (_setmode_f (filename, FA_NORM))
{
/* Handle the error */
} else
{
...
}
}
#include <inline.h>
{
char filename[13] = "file.dat";
...
lea si,filename
mov ax,FA_NORM/* AX=file mode attributes */
setmode_f ();
jncsetmode_f_010/* if successful */
... /* if an error occurred */
setmode_f_010:
...
}
Source file _FDSETMD.ASM ASM equiv SETMODE_F
{
char buffer1[50], buffer2[50];
...
_split_drive (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS (pntr on stack) */
lea di,buffer1/* DI = offset buffer1 */
split_drive (); /* buffer1 = "C:" */
...
}
Source file _FDSPLTD.ASM ASM equiv SPLIT_DRIVE
{
char buffer1[50], buffer2[50];
...
_split_drvpath (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS */
lea di,buffer1
split_drvpath ();/* buffer1 = "C:\DATA\" */
...
}
Source file _FDSPLTV.ASM ASM equiv SPLIT_DRVPATH
{
char buffer1[50], buffer2[50];
...
_split_ext (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS */
lea di,buffer1
split_ext (); /* buffer1 = ".DAT" */
...
}
Source file _FDSPLTE.ASM ASM equiv SPLIT_EXT
{
char buffer1[50], buffer2[50];
...
_split_fname (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS */
lea di,buffer1
split_fname (); /* buffer1 = "FILE" */
...
}
Source file _FDSPLTN.ASM ASM equiv SPLIT_FNAME
{
char buffer1[50], buffer2[50];
...
_split_fnamext (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS */
lea di,buffer1
split_fnamext ();/* buffer1 = "FILE.DAT" */
...
}
Source file _FDSPLTX.ASM ASM equiv SPLIT_FNAMEXT
{
char buffer1[50], buffer2[50];
...
_split_path (buffer1, buffer2);
...
}
#include <inline.h>
{
char buffer1[50], buffer2[50] = "a:\\data\\file.dat";
...
lea si,buffer2
pushss
pop es /* ES=SS */
lea di,buffer1
split_path (); /* buffer1 = "\DATA\" */
...
}
Source file _FDSPLTP.ASM ASM equiv SPLIT_PATH
{
char pathname[50];
...
_term_path (pathname);
}
#include <inline.h>
{
char pathname[50] = "\\util";
...
lea si,pathname
term_path ();/* pathname = "\UTIL\" */
...
}
Source file _FDTERMP.ASM ASM equiv TERM_PATH