file.h

Go to the documentation of this file.
00001 
00002 /*  $Id: file.h 1329 2006-04-24 21:40:07Z creecode $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #ifndef fileinclude
00029 #define fileinclude
00030 
00031 
00032 #ifndef shelltypesinclude
00033 
00034     #include "shelltypes.h"
00035 
00036 #endif
00037 
00038 
00039 //universal error codes
00040 #ifdef MACVERSION
00041 #define errorVolume                 nsvErr
00042 #define errorParam                  paramErr
00043 #define errorFileNotFound           fnfErr
00044 #define errorDirNotFound            dirNFErr
00045 #define errorNone                   noErr
00046 #ifndef __NAVIGATION__
00047 #include <Navigation.h>
00048 #endif
00049 #endif
00050 
00051 #ifdef WIN95VERSION
00052 #define errorVolume                 ERROR_PATH_NOT_FOUND
00053 #define errorParam                  ERROR_INVALID_PARAMETER
00054 #define errorFileNotFound           ERROR_FILE_NOT_FOUND
00055 #define errorDirNotFound            ERROR_PATH_NOT_FOUND
00056 #define errorNone                   NO_ERROR
00057 #endif
00058 
00059 
00060 
00061 #ifdef MACVERSION
00062     #define chpathseparator ':'
00063 #endif
00064 
00065 #ifdef WIN95VERSION
00066     #define chpathseparator '\\'
00067 #endif
00068 
00069     
00070 /*selectors for sfdialog*/
00071 
00072 typedef enum {
00073     
00074     sfputfileverb = 1,
00075     
00076     sfgetfileverb = 2,
00077     
00078     sfgetfolderverb = 3,
00079     
00080     sfgetdiskverb = 4
00081     } tysfverb;
00082 
00083 
00084 #define maxsftypelist 20 /*up to ten file types for sf getfile*/
00085 
00086 
00087 typedef struct tysftypelist { /*our version of sftypelist, includes type count*/
00088     
00089     short cttypes;
00090     
00091     OSType types [maxsftypelist];
00092     } tysftypelist, *ptrsftypelist;
00093 
00094 
00095 typedef enum tyfolderview { 
00096     
00097     viewbysmallicon = 0,
00098     
00099     viewbyicon = 1,
00100     
00101     viewbyname = 2, 
00102     
00103     viewbydate = 3, 
00104     
00105     viewbysize = 4,
00106     
00107     viewbykind = 5, 
00108     
00109     viewbycomment = 6,
00110     
00111     viewbycolor = 7,
00112     
00113     viewbyversion = 8
00114     } tyfolderview;
00115 
00116 
00117 typedef struct tyfileinfo { /*flattens interface for getting file information*/
00118 
00119     OSErr errcode; /*if there was an error retrieving info about the file, this is the error number*/
00120     
00121     short vnum; /*the volume that the file is on*/
00122     
00123     long dirid; /*the folder that contains the file*/
00124     
00125     boolean flfolder; /*true if it's a folder not a file*/
00126     
00127     boolean fllocked; /*true if the file is locked*/
00128     
00129     boolean flbundle; /*true if the file has a BNDL resource*/
00130     
00131     boolean flbusy; /*true if the file is open in an application*/
00132     
00133     boolean flalias; /*true if the file is an alias*/
00134     
00135     boolean flinvisible;    /*true if the file is invisible*/
00136     
00137     boolean flvolume; /*true if it's a disk volume*/
00138     
00139     boolean flejectable; /*true if it's an ejectable volume*/
00140     
00141     boolean flstationery; /*true if the file is a stationery pad*/
00142     
00143     boolean flshared; /*true if the file can the file be shared*/
00144     
00145     boolean flnamelocked; /*true if the file's name is locked*/
00146     
00147     boolean flcustomicon; /*true if the file has a custom icon*/
00148     
00149     boolean flhardwarelock; /*for volumes, if true, the device is readonly*/
00150     
00151     boolean flremotevolume; /*for volumes, if true, it's a remote volume, accessed over the network*/
00152     
00153     boolean flsystem; /*Windows "system" file attribute*/
00154     
00155     boolean flarchive; /*Windows "srchive" file attribute*/
00156     
00157     boolean flcompressed; /*Windows "compressed" file attribute*/
00158     
00159     boolean fltemp; /*Windows "temp" file attribute*/
00160     
00161     OSType filecreator, filetype; /*the creator ID and file type*/
00162     
00163     long timecreated, timemodified, timeaccessed; /*the creation and modification date for the file*/
00164     
00165     long sizedataforkhigh, sizedatafork, sizeresourcefork; /*the size of the file's two forks*/
00166     
00167     short ixlabel; /*the file's label, as displayed in the Finder*/
00168     
00169     Point iconposition; /*the position of the file's icon, when viewing by icon in Finder*/
00170     
00171     unsigned short ctfiles; /*for folders, the number of files in the folder*/
00172     
00173     unsigned short ctfolders; /*for volumes, the number of folders on the disk*/
00174     
00175     tyfolderview folderview; /*for folders, view by name, by date, etc.*/
00176     
00177     unsigned long ctfreebytes; /*for volumes*/
00178     
00179     unsigned long cttotalbytes; /*for volumes*/
00180     
00181     unsigned long blocksize;
00182     } tyfileinfo;
00183 
00184 
00185 extern boolean flsupportslargevolumes; /*6.1b15 AR: fileverbs.c*/
00186 
00187 
00188 /*prototypes*/
00189 #ifdef WIN95VERSION
00190     typedef int (WINAPI * tyGetDiskFreeSpaceEx) (unsigned short *, ULARGE_INTEGER *, ULARGE_INTEGER *, ULARGE_INTEGER *);
00191 
00192     extern tyGetDiskFreeSpaceEx adrGetDiskFreeSpaceEx;
00193 
00194     extern void winsetfileinfo (WIN32_FIND_DATA * fileinfo, tyfileinfo *info);
00195 
00196     extern boolean winfileerror (const tyfilespec *);
00197 #endif
00198 
00199 extern void setfserrorparam (const tyfilespec *);
00200 
00201 extern boolean endswithpathsep (bigstring bs);
00202 
00203 extern boolean cleanendoffilename (bigstring bs);
00204 
00205 extern boolean getmachinename (bigstring bsname);
00206 
00207 extern boolean equalfilespecs (const tyfilespec *, const tyfilespec *);
00208 
00209 extern boolean filegetinfo (const tyfilespec *fs, tyfileinfo *info); // 1/28/97 dmb for clay
00210 
00211 extern void filegetinfofrompb (CInfoPBRec *pb, tyfileinfo *info);
00212 
00213 extern boolean filegetvolumeinfo (short vnum, tyfileinfo *info);
00214 
00215 extern boolean filegetvolumename (short vnum, bigstring volname);
00216 
00217 extern boolean getmacfileinfo (const tyfilespec *fs, CInfoPBRec *pb);
00218 
00219 extern boolean filemakespec (short vnum, long dirid, bigstring fname, ptrfilespec pfs);
00220 
00221 extern boolean filegetfilename (const tyfilespec *pfs, bigstring name); // 1/28/97 dmb end for clay
00222 
00223 extern void filenotfounderror (bigstring);
00224 
00225 extern boolean surefile (const tyfilespec *);
00226 
00227 extern boolean filegeteof (hdlfilenum, long *);
00228 
00229 extern boolean fileseteof (hdlfilenum, long);
00230 
00231 extern boolean filesetposition (hdlfilenum, long);
00232 
00233 extern boolean filegetposition (hdlfilenum, long *);
00234 
00235 extern long filegetsize (hdlfilenum);
00236 
00237 extern boolean filetruncate (hdlfilenum);
00238 
00239 extern boolean filewrite (hdlfilenum, long, void *);
00240 
00241 extern boolean filereaddata (hdlfilenum, long, long *, void *);
00242 
00243 extern boolean fileread (hdlfilenum, long, void *);
00244 
00245 extern boolean filegetchar (hdlfilenum, char *);
00246 
00247 extern boolean fileputchar (hdlfilenum, char);
00248 
00249 extern boolean filewritehandle (hdlfilenum, Handle);
00250 
00251 extern boolean filereadhandle (hdlfilenum, Handle *);
00252 
00253 #ifdef NEWFILESPECTYPE
00254 extern boolean fileparsevolname (bigstring, long *, bigstring);
00255 #else
00256 extern boolean fileparsevolname (bigstring, short *, bigstring);
00257 #endif
00258 
00259 extern boolean fileresolvealias (tyfilespec *);
00260 
00261 extern boolean filefrompath (bigstring, bigstring);
00262 
00263 extern boolean folderfrompath (bigstring, bigstring);
00264 
00265 extern boolean getfileparentfolder (const tyfilespec *, tyfilespec *);
00266 
00267 extern boolean deletefile (const tyfilespec *);
00268 
00269 extern boolean renamefile (const tyfilespec *, bigstring);
00270 
00271 extern boolean movefile (const tyfilespec *, const tyfilespec *);
00272 
00273 extern boolean lockfile (const tyfilespec *);
00274 
00275 extern boolean unlockfile (const tyfilespec *);
00276 
00277 extern boolean newfolder (const tyfilespec *);
00278 
00279 extern boolean newfile (const tyfilespec *, OSType, OSType);
00280 
00281 extern void fileinit (void);
00282 
00283 extern void fileshutdown (void);
00284 
00285 extern boolean fileopenorcreate (const tyfilespec *, OSType, OSType, hdlfilenum *);
00286 
00287 extern boolean opennewfile (const tyfilespec *, OSType, OSType, hdlfilenum *);
00288 
00289 extern boolean openfile (const tyfilespec *, hdlfilenum *, boolean);
00290 
00291 extern boolean closefile (hdlfilenum);
00292 
00293 extern boolean flushvolumechanges (const tyfilespec * fsspec, hdlfilenum fnum);
00294 
00295 extern boolean getfullfilepath (bigstring);
00296 
00297 extern boolean foldertest (CInfoPBRec *);
00298 
00299 extern boolean getfiletype (const tyfilespec *, OSType *);
00300 
00301 extern boolean getfilecreator (const tyfilespec *, OSType *);
00302 
00303 extern boolean fileexists (const tyfilespec *, boolean *);
00304 
00305 extern boolean filesize (const tyfilespec *, long *);
00306 
00307 extern boolean fileisfolder (const tyfilespec *, boolean *);
00308 
00309 extern boolean fileisvolume (const tyfilespec *);
00310 
00311 extern boolean fileislocked (const tyfilespec *, boolean *);
00312 
00313 extern boolean fileisbusy (const tyfilespec *, boolean *);
00314 
00315 extern boolean filehasbundle (const tyfilespec *, boolean *);
00316 
00317 extern boolean filesetbundle (const tyfilespec *, boolean);
00318 
00319 extern boolean fileisalias (const tyfilespec *, boolean *);
00320 
00321 extern boolean fileisvisible (const tyfilespec *, boolean *);
00322 
00323 extern boolean filesetvisible (const tyfilespec *, boolean);
00324 
00325 extern boolean getfiledates (const tyfilespec *, unsigned long *, unsigned long *);
00326 
00327 extern boolean setfiledates (const tyfilespec *, unsigned long, unsigned long);
00328 
00329 extern boolean getfilepos (const tyfilespec *, Point *);
00330 
00331 extern boolean setfilepos (const tyfilespec *, Point);
00332 
00333 extern boolean setfilecreated (const tyfilespec *, long);
00334 
00335 extern boolean setfilemodified (const tyfilespec *, long);
00336 
00337 extern boolean setfiletype (const tyfilespec *, OSType);
00338 
00339 extern boolean setfilecreator (const tyfilespec *, OSType);
00340 
00341 extern boolean largefilebuffer (Handle *);
00342 
00343 extern boolean copyfile (const tyfilespec *, const tyfilespec *, boolean, boolean);
00344 
00345 extern short filegetapplicationvnum (void);
00346 
00347 extern short filegetapplicationrnum (void);
00348 
00349 extern short filegetsystemvnum (void);
00350 
00351 extern boolean getspecialfolderpath (bigstring, bigstring, boolean, tyfilespec *);
00352 
00353 extern boolean ejectvol (const tyfilespec *);
00354 
00355 extern boolean isejectable (const tyfilespec *, boolean *);
00356 
00357 extern boolean langgetextendedvolumeinfo (const tyfilespec *, double *, double *);
00358 
00359 extern boolean getfreespace (const tyfilespec *, long *);
00360 
00361 extern boolean getvolumesize (const tyfilespec *, long *);
00362 
00363 extern boolean getvolumeblocksize (const tyfilespec *, long *);
00364 
00365 extern boolean filesonvolume (const tyfilespec *, long *);
00366 
00367 extern boolean foldersonvolume (const tyfilespec *, long *);
00368 
00369 extern boolean isvolumelocked (const tyfilespec *, boolean *);
00370 
00371 extern boolean volumecreated (const tyfilespec *, unsigned long *);
00372 
00373 extern boolean lockvolume (const tyfilespec *, boolean);
00374 
00375 extern boolean unmountvolume (const tyfilespec *);
00376 
00377 extern boolean drivenumtovolname (short, bigstring);
00378 
00379 extern boolean findapplication (OSType, tyfilespec *);
00380 
00381 extern boolean getfilecomment (const tyfilespec *, bigstring);
00382 
00383 extern boolean setfilecomment (const tyfilespec *, bigstring);
00384 
00385 extern boolean getfilelabel (const tyfilespec *, bigstring);
00386 
00387 extern boolean setfilelabel (const tyfilespec *, bigstring);
00388 
00389 extern boolean mountvolume (bigstring, bigstring, bigstring);
00390 
00391 extern boolean initfile (void);
00392 
00393 
00394 extern boolean fiffindinfile (const tyfilespec *, bigstring, long *); /*findinfile.c*/
00395 
00396 extern boolean fifcomparefiles (const tyfilespec *, const tyfilespec *);
00397 
00398 extern boolean fifcharcounter (const tyfilespec *, char, long *);
00399 
00400 extern boolean fifclosefile (const tyfilespec *);
00401 
00402 extern boolean fifcloseallfiles (long);
00403 
00404 extern boolean fifopenfile (const tyfilespec *, long);
00405 
00406 extern boolean fifendoffile (const tyfilespec *);
00407 
00408 extern boolean fifreadline (const tyfilespec *, Handle *);
00409 
00410 extern boolean fifwriteline (const tyfilespec *, Handle);
00411 
00412 extern boolean fifreadhandle (const tyfilespec *, long, Handle *);
00413 
00414 extern boolean fifreadfile (const tyfilespec *fs, Handle *x);   /* 2006-04-11 aradke */
00415 
00416 extern boolean fifwritehandle (const tyfilespec *, Handle);
00417 
00418 extern boolean fifsetposition (const tyfilespec *, long);
00419 
00420 extern boolean fifgetposition (const tyfilespec *, long *);
00421 
00422 extern boolean fifsetendoffile (const tyfilespec *fs, long eof);
00423 
00424 extern boolean fifgetendoffile (const tyfilespec *fs, long *eof);
00425 
00426 
00427 #pragma mark === filepath.c ===
00428  
00429  extern boolean directorytopath (long, short, bigstring);
00430 
00431 extern boolean volumerefnumtopath (short, bigstring);
00432 
00433 extern boolean filesetdefaultpath (const tyfilespec *);
00434 
00435 extern boolean filegetdefaultpath (tyfilespec *);
00436 
00437 extern boolean filespectopath (const tyfilespec *, bigstring);
00438 
00439 extern boolean pathtofilespec (bigstring, tyfilespec *);
00440 
00441 extern boolean filegetpath (const tyfilespec *, bigstring);
00442 
00443 extern boolean setfsfile (tyfilespec *, bigstring);
00444 
00445 extern boolean getfsfile (const tyfilespec *, bigstring);
00446 
00447 extern boolean getfsvolume (const tyfilespec *, long *);
00448 
00449 extern void initfsdefault (void); /* 2005-07-18 creedon */
00450 
00451  
00452 #pragma mark === fileverbs.c ===
00453  
00454  //extern filecheckdefaultpath (bigstring);
00455 
00456 extern boolean filegetprogramversion (bigstring);
00457 
00458 extern boolean filestart (void); /*6.1b15 AR*/
00459 
00460 
00461 #pragma mark === filedialog.c ===
00462 
00463 extern boolean sfdialog (tysfverb, bigstring, ptrsftypelist, tyfilespec *, OSType); /* 2005-10-06 creedon - added OSType */
00464 
00465 extern boolean initfiledialog (void);
00466 
00467 #ifdef MACVERSION
00468     //Code change by Timothy Paustian Tuesday, June 20, 2000 2:22:02 PM
00469     //Nav services code for Frontier.
00470     extern OSErr    TimsPutFile(bigstring prompt, Str255 fileName, StandardFileReply * outReply);
00471 
00472     extern OSErr    TimsGetFolderOrVolume(bigstring prompt, SInt16 dialogType, StandardFileReply * outReply);
00473 
00474     extern pascal void      NavEventProc(NavEventCallbackMessage callBackSelector, 
00475                             NavCBRecPtr callBackParms, 
00476                             NavCallBackUserData callBackUD);
00477 
00478 
00479     extern OSErr getafile (bigstring prompt, ptrsftypelist filetypes, StandardFileReply * outReply, OSType); /* 2005-09-23 creedon */ 
00480 
00481 #endif
00482                         
00483 #endif
00484 
00485 #pragma mark === filemp3.c ===
00486 
00487 boolean getmp3info (const tyfilespec *, long *, long *, long *, long *, boolean *);
00488 
00489 
00490 #pragma mark === fileops.c ===
00491 
00492 extern short getfilelabelindex (const tyfilespec *, short *); /* 2006-04-23 creedon */
00493 
00494 extern boolean setfilelabelindex (const tyfilespec *, short, boolean); /* 2006-04-23 creedon */
00495 

Generated on Wed May 31 18:19:46 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6