1 #ifndef CLIB_DOS_PROTOS_H
    2 #define CLIB_DOS_PROTOS_H
    3 
    4 /*
    5 	dos.library C prototypes (V50)
    6 
    7 	Copyright © 2002-2020 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #if defined(__ixemul__) && !defined(__IXEMUL_EXEC_MIXING_ALLOWED)
   11 # error "Mixing ixemul and native library calls is not supported. Native application should be built with -noixemul"
   12 #endif
   13 
   14 #ifndef DOS_DOS_H
   15 # include <dos/dos.h>
   16 #endif
   17 
   18 #ifndef DOS_DOSEXTENS_H
   19 # include <dos/dosextens.h>
   20 #endif
   21 
   22 #ifndef DOS_RECORD_H
   23 # include <dos/record.h>
   24 #endif
   25 
   26 #ifndef DOS_RDARGS_H
   27 # include <dos/rdargs.h>
   28 #endif
   29 
   30 #ifndef DOS_DOSASL_H
   31 # include <dos/dosasl.h>
   32 #endif
   33 
   34 #ifndef DOS_VAR_H
   35 # include <dos/var.h>
   36 #endif
   37 
   38 #ifndef DOS_NOTIFY_H
   39 # include <dos/notify.h>
   40 #endif
   41 
   42 #ifndef DOS_DATETIME_H
   43 # include <dos/datetime.h>
   44 #endif
   45 
   46 #ifndef DOS_EXALL_H
   47 # include <dos/exall.h>
   48 #endif
   49 
   50 #ifndef UTILITY_TAGITEM_H
   51 # include <utility/tagitem.h>
   52 #endif
   53 
   54 
   55 #ifdef __cplusplus
   56 extern "C" {
   57 #endif /* __cplusplus */
   58 
   59 BPTR Open( CONST_STRPTR name, LONG accessMode );
   60 LONG Close( BPTR file );
   61 LONG Read( BPTR file, APTR buffer, LONG length );
   62 LONG Write( BPTR file, CONST APTR buffer, LONG length );
   63 BPTR Input( VOID );
   64 BPTR Output( VOID );
   65 LONG Seek( BPTR file, LONG position, LONG offset );
   66 LONG DeleteFile( CONST_STRPTR name );
   67 LONG Rename( CONST_STRPTR oldName, CONST_STRPTR newName );
   68 BPTR Lock( CONST_STRPTR name, LONG type );
   69 VOID UnLock( BPTR lock );
   70 BPTR DupLock( BPTR lock );
   71 LONG Examine( BPTR lock, struct FileInfoBlock *fileInfoBlock );
   72 LONG ExNext( BPTR lock, struct FileInfoBlock *fileInfoBlock );
   73 LONG Info( BPTR lock, struct InfoData *parameterBlock );
   74 BPTR CreateDir( CONST_STRPTR name );
   75 BPTR CurrentDir( BPTR lock );
   76 LONG IoErr( VOID );
   77 struct MsgPort *CreateProc( CONST_STRPTR name, LONG pri, BPTR segList, LONG stackSize );
   78 VOID Exit( LONG returnCode );
   79 BPTR LoadSeg( CONST_STRPTR name );
   80 VOID UnLoadSeg( BPTR seglist );
   81 struct MsgPort *DeviceProc( CONST_STRPTR name );
   82 LONG SetComment( CONST_STRPTR name, CONST_STRPTR comment );
   83 LONG SetProtection( CONST_STRPTR name, LONG protect );
   84 struct DateStamp *DateStamp( struct DateStamp *date );
   85 VOID Delay( LONG timeout );
   86 LONG WaitForChar( BPTR file, LONG timeout );
   87 BPTR ParentDir( BPTR lock );
   88 LONG IsInteractive( BPTR file );
   89 LONG Execute( CONST_STRPTR string, BPTR file, BPTR file2 );
   90 
   91 APTR AllocDosObject( ULONG type, CONST struct TagItem *tags );
   92 APTR AllocDosObjectTagList( ULONG type, CONST struct TagItem *tags );
   93 #if !defined(USE_INLINE_STDARG)
   94 APTR AllocDosObjectTags( ULONG type, ULONG tag1type, ... );
   95 #endif
   96 VOID FreeDosObject( ULONG type, APTR ptr );
   97 
   98 LONG DoPkt( struct MsgPort *port, LONG action, LONG arg1, LONG arg2, LONG arg3, LONG arg4, LONG arg5 );
   99 LONG DoPkt0( struct MsgPort *port, LONG action );
  100 LONG DoPkt1( struct MsgPort *port, LONG action, LONG arg1 );
  101 LONG DoPkt2( struct MsgPort *port, LONG action, LONG arg1, LONG arg2 );
  102 LONG DoPkt3( struct MsgPort *port, LONG action, LONG arg1, LONG arg2, LONG arg3 );
  103 LONG DoPkt4( struct MsgPort *port, LONG action, LONG arg1, LONG arg2, LONG arg3, LONG arg4 );
  104 VOID SendPkt( struct DosPacket *dp, struct MsgPort *port, struct MsgPort *replyport );
  105 struct DosPacket *WaitPkt( VOID );
  106 VOID ReplyPkt( struct DosPacket *dp, LONG res1, LONG res2 );
  107 VOID AbortPkt( struct MsgPort *port, struct DosPacket *pkt );
  108 
  109 BOOL LockRecord( BPTR fh, ULONG offset, ULONG length, ULONG mode, ULONG timeout );
  110 BOOL LockRecords( struct RecordLock *recArray, ULONG timeout );
  111 BOOL UnLockRecord( BPTR fh, ULONG offset, ULONG length );
  112 BOOL UnLockRecords( struct RecordLock *recArray );
  113 
  114 BPTR SelectInput( BPTR fh );
  115 BPTR SelectOutput( BPTR fh );
  116 LONG FGetC( BPTR fh );
  117 LONG FPutC( BPTR fh, LONG ch );
  118 LONG UnGetC( BPTR fh, LONG character );
  119 LONG FRead( BPTR fh, APTR block, ULONG blocklen, ULONG number );
  120 LONG FWrite( BPTR fh, CONST APTR block, ULONG blocklen, ULONG number );
  121 STRPTR FGets( BPTR fh, STRPTR buf, ULONG buflen );
  122 LONG FPuts( BPTR fh, CONST_STRPTR str );
  123 VOID VFWritef( BPTR fh, CONST_STRPTR format, CONST LONG *argarray );
  124 #if !defined(USE_INLINE_STDARG)
  125 VOID FWritef( BPTR fh, CONST_STRPTR format, ... );
  126 #endif
  127 LONG VFPrintf( BPTR fh, CONST_STRPTR format, CONST APTR argarray );
  128 #if !defined(USE_INLINE_STDARG)
  129 LONG FPrintf( BPTR fh, CONST_STRPTR format, ... );
  130 #endif
  131 LONG Flush( BPTR fh );
  132 LONG SetVBuf( BPTR fh, STRPTR buff, LONG type, LONG size );
  133 
  134 BPTR DupLockFromFH( BPTR fh );
  135 BPTR OpenFromLock( BPTR lock );
  136 BPTR ParentOfFH( BPTR fh );
  137 BOOL ExamineFH( BPTR fh, struct FileInfoBlock *fib );
  138 LONG SetFileDate( CONST_STRPTR name, CONST struct DateStamp *date );
  139 LONG NameFromLock( BPTR lock, STRPTR buffer, LONG len );
  140 LONG NameFromFH( BPTR fh, STRPTR buffer, LONG len );
  141 WORD SplitName( CONST_STRPTR name, ULONG separator, STRPTR buf, LONG oldpos, LONG size );
  142 LONG SameLock( BPTR lock1, BPTR lock2 );
  143 LONG SetMode( BPTR fh, LONG mode );
  144 LONG ExAll( BPTR lock, struct ExAllData *buffer, LONG size, LONG data, struct ExAllControl *control );
  145 LONG ReadLink( struct MsgPort *port, BPTR lock, CONST_STRPTR path, STRPTR buffer, ULONG size );
  146 LONG MakeLink( CONST_STRPTR name, LONG dest, LONG soft );
  147 LONG ChangeMode( LONG type, BPTR fh, LONG newmode );
  148 LONG SetFileSize( BPTR fh, LONG pos, LONG mode );
  149 
  150 LONG SetIoErr( LONG result );
  151 BOOL Fault( LONG code, STRPTR header, STRPTR buffer, LONG len );
  152 BOOL PrintFault( LONG code, CONST_STRPTR header );
  153 LONG ErrorReport( LONG code, LONG type, ULONG arg1, struct MsgPort *device );
  154 
  155 struct CommandLineInterface *Cli( VOID );
  156 struct Process *CreateNewProc( CONST struct TagItem *tags );
  157 struct Process *CreateNewProcTagList( CONST struct TagItem *tags );
  158 #if !defined(USE_INLINE_STDARG)
  159 struct Process *CreateNewProcTags( ULONG tag1type, ... );
  160 #endif
  161 LONG RunCommand( BPTR seg, LONG stack, CONST_STRPTR paramptr, LONG paramlen );
  162 struct MsgPort *GetConsoleTask( VOID );
  163 struct MsgPort *SetConsoleTask( CONST struct MsgPort *task );
  164 struct MsgPort *GetFileSysTask( VOID );
  165 struct MsgPort *SetFileSysTask( CONST struct MsgPort *task );
  166 STRPTR GetArgStr( VOID );
  167 BOOL SetArgStr( CONST_STRPTR string );
  168 struct Process *FindCliProc( ULONG num );
  169 ULONG MaxCli( VOID );
  170 BOOL SetCurrentDirName( CONST_STRPTR name );
  171 BOOL GetCurrentDirName( STRPTR buf, LONG len );
  172 BOOL SetProgramName( CONST_STRPTR name );
  173 BOOL GetProgramName( STRPTR buf, LONG len );
  174 BOOL SetPrompt( CONST_STRPTR name );
  175 BOOL GetPrompt( STRPTR buf, LONG len );
  176 BPTR SetProgramDir( BPTR lock );
  177 BPTR GetProgramDir( VOID );
  178 
  179 LONG SystemTagList( CONST_STRPTR command, CONST struct TagItem *tags );
  180 LONG System( CONST_STRPTR command, CONST struct TagItem *tags );
  181 #if !defined(USE_INLINE_STDARG)
  182 LONG SystemTags( CONST_STRPTR command, ULONG tag1type, ... );
  183 #endif
  184 LONG AssignLock( CONST_STRPTR name, BPTR lock );
  185 BOOL AssignLate( CONST_STRPTR name, CONST_STRPTR path );
  186 BOOL AssignPath( CONST_STRPTR name, CONST_STRPTR path );
  187 BOOL AssignAdd( CONST_STRPTR name, BPTR lock );
  188 LONG RemAssignList( CONST_STRPTR name, BPTR lock );
  189 struct DevProc *GetDeviceProc( CONST_STRPTR name, struct DevProc *dp );
  190 VOID FreeDeviceProc( struct DevProc *dp );
  191 struct DosList *LockDosList( ULONG flags );
  192 VOID UnLockDosList( ULONG flags );
  193 struct DosList *AttemptLockDosList( ULONG flags );
  194 BOOL RemDosEntry( struct DosList *dlist );
  195 LONG AddDosEntry( struct DosList *dlist );
  196 struct DosList *FindDosEntry( CONST struct DosList *dlist, CONST_STRPTR name, ULONG flags );
  197 struct DosList *NextDosEntry( CONST struct DosList *dlist, ULONG flags );
  198 struct DosList *MakeDosEntry( CONST_STRPTR name, LONG type );
  199 VOID FreeDosEntry( struct DosList *dlist );
  200 BOOL IsFileSystem( CONST_STRPTR name );
  201 
  202 BOOL Format( CONST_STRPTR filesystem, CONST_STRPTR volumename, ULONG dostype );
  203 LONG Relabel( CONST_STRPTR drive, CONST_STRPTR newname );
  204 LONG Inhibit( CONST_STRPTR name, LONG onoff );
  205 LONG AddBuffers( CONST_STRPTR name, LONG number );
  206 
  207 LONG CompareDates( CONST struct DateStamp *date1, CONST struct DateStamp *date2 );
  208 LONG DateToStr( struct DateTime *datetime );
  209 LONG StrToDate( struct DateTime *datetime );
  210 
  211 BPTR InternalLoadSeg( BPTR fh, BPTR table, CONST LONG *funcarray, LONG *stack );
  212 BOOL InternalUnLoadSeg( BPTR seglist, VOID (*CONST freefunc) __CLIB_PROTOTYPE((STRPTR,ULONG)) );
  213 BPTR NewLoadSeg( CONST_STRPTR file, CONST struct TagItem *tags );
  214 BPTR NewLoadSegTagList( CONST_STRPTR file, CONST struct TagItem *tags );
  215 #if !defined(USE_INLINE_STDARG)
  216 BPTR NewLoadSegTags( CONST_STRPTR file, ULONG tag1type, ... );
  217 #endif
  218 LONG AddSegment( CONST_STRPTR name, BPTR seg, LONG system );
  219 struct Segment *FindSegment( CONST_STRPTR name, CONST struct Segment *seg, LONG system );
  220 LONG RemSegment( struct Segment *seg );
  221 
  222 LONG CheckSignal( LONG mask );
  223 struct RDArgs *ReadArgs( CONST_STRPTR arg_template, LONG *array, struct RDArgs *args );
  224 LONG FindArg( CONST_STRPTR keyword, CONST_STRPTR arg_template );
  225 LONG ReadItem( CONST_STRPTR name, LONG maxchars, struct CSource *cSource );
  226 LONG StrToLong( CONST_STRPTR string, LONG *value );
  227 LONG MatchFirst( CONST_STRPTR pat, struct AnchorPath *anchor );
  228 LONG MatchNext( struct AnchorPath *anchor );
  229 VOID MatchEnd( struct AnchorPath *anchor );
  230 LONG ParsePattern( CONST_STRPTR pat, STRPTR buf, LONG buflen );
  231 BOOL MatchPattern( CONST_STRPTR pat, STRPTR str );
  232 VOID FreeArgs( struct RDArgs *args );
  233 STRPTR FilePart( CONST_STRPTR path );
  234 STRPTR PathPart( CONST_STRPTR path );
  235 BOOL AddPart( STRPTR dirname, CONST_STRPTR filename, ULONG size );
  236 
  237 BOOL StartNotify( struct NotifyRequest *notify );
  238 VOID EndNotify( struct NotifyRequest *notify );
  239 
  240 BOOL SetVar( CONST_STRPTR name, CONST_STRPTR buffer, LONG size, LONG flags );
  241 LONG GetVar( CONST_STRPTR name, STRPTR buffer, LONG size, LONG flags );
  242 LONG DeleteVar( CONST_STRPTR name, ULONG flags );
  243 struct LocalVar *FindVar( CONST_STRPTR name, ULONG type );
  244 LONG CliInitNewcli( struct DosPacket *dp );
  245 LONG CliInitRun( struct DosPacket *dp );
  246 LONG WriteChars( CONST_STRPTR buf, ULONG buflen );
  247 LONG PutStr( CONST_STRPTR str );
  248 LONG VPrintf( CONST_STRPTR format, CONST APTR argarray );
  249 #if !defined(USE_INLINE_STDARG)
  250 LONG Printf( CONST_STRPTR format, ... );
  251 #endif
  252 
  253 LONG ParsePatternNoCase( CONST_STRPTR pat, UBYTE *buf, LONG buflen );
  254 BOOL MatchPatternNoCase( CONST_STRPTR pat, STRPTR str );
  255 
  256 BOOL SameDevice( BPTR lock1, BPTR lock2 );
  257 
  258 VOID ExAllEnd( BPTR lock, struct ExAllData *buffer, LONG size, LONG data, struct ExAllControl *control );
  259 BOOL SetOwner( CONST_STRPTR name, LONG owner_info );
  260 
  261 /*** V50 ***/
  262 
  263 LONG AddSegmentTagList(struct TagItem *);
  264 LONG AddSegmentTags(ULONG tag1, ...);
  265 struct Segment *FindSegmentTagList(struct TagItem *);
  266 struct Segment *FindSegmentTags(ULONG tag1, ...);
  267 
  268 /*** V51 ***/
  269 
  270 QUAD Seek64( BPTR file, QUAD pos, LONG mode );
  271 QUAD SetFileSize64( BPTR fh, QUAD pos, LONG mode );
  272 LONG LockRecord64( BPTR fh, UQUAD offset, UQUAD length, ULONG mode, ULONG timeout );
  273 LONG LockRecords64( struct RecordLock64 *recArray, ULONG timeout );
  274 LONG UnLockRecord64( BPTR fh, UQUAD offset, UQUAD length );
  275 LONG UnLockRecords64( struct RecordLock64 *recArray );
  276 LONG Examine64( BPTR lock, struct FileInfoBlock *fib, struct TagItem *tags );
  277 LONG Examine64TagList( BPTR lock, struct FileInfoBlock *fib, struct TagItem *tags );
  278 #if !defined(USE_INLINE_STDARG)
  279 LONG Examine64Tags( BPTR lock, struct FileInfoBlock *fib, ... );
  280 #endif
  281 LONG ExNext64( BPTR lock, struct FileInfoBlock *fib, struct TagItem *tags );
  282 LONG ExNext64TagList( BPTR lock, struct FileInfoBlock *fib, struct TagItem *tags );
  283 #if !defined(USE_INLINE_STDARG)
  284 LONG ExNext64Tags( BPTR lock, struct FileInfoBlock *fib, ... );
  285 #endif
  286 LONG ExamineFH64( BPTR file, struct FileInfoBlock *fib, struct TagItem *tags );
  287 LONG ExamineFH64TagList( BPTR file, struct FileInfoBlock *fib, struct TagItem *tags );
  288 #if !defined(USE_INLINE_STDARG)
  289 LONG ExamineFH64Tags( BPTR file, struct FileInfoBlock *fib, ... );
  290 #endif
  291 LONG NewReadLink( struct MsgPort *port, BPTR lock, CONST_STRPTR path, UBYTE *buffer, LONG buffer_size );
  292 LONG GetFileSysAttr( CONST_STRPTR devicename, LONG attr, APTR storage, LONG storage_size );
  293 LONG GetSegListAttr( BPTR seglist, LONG attr, APTR storage, LONG storage_size );
  294 LONG SetDosObjectAttr( ULONG type, APTR ptr, struct TagItem *tags );
  295 LONG SetDosObjectAttrTagList( ULONG type, APTR ptr, struct TagItem *tags );
  296 #if !defined(USE_INLINE_STDARG)
  297 LONG SetDosObjectAttrTags( ULONG type, APTR ptr, ... );
  298 #endif
  299 LONG GetDosObjectAttr( ULONG type, APTR ptr, struct TagItem *tags );
  300 LONG GetDosObjectAttrTagList( ULONG type, APTR ptr, struct TagItem *tags );
  301 #if !defined(USE_INLINE_STDARG)
  302 LONG GetDosObjectAttrTags( ULONG type, APTR ptr, ... );
  303 #endif
  304 
  305 /*** V51.51 ***/
  306 void ReleaseCLINumber( LONG clinum );
  307 struct CLIData *QueryCLIDataTagList( struct TagItem *tags );
  308 #if !defined(USE_INLINE_STDARG)
  309 struct CLIData *QueryCLIDataTags( ULONG tag1, ... );
  310 #endif
  311 void FreeCLIData( struct CLIData *data );
  312 /*** V51.52 ***/
  313 LONG GetSegListAttrTagList( BPTR seglist, LONG attr, APTR storage, LONG storage_size, struct TagItem *tags );
  314 #if !defined(USE_INLINE_STDARG)
  315 LONG GetSegListAttrTags( BPTR seglist, LONG attr, APTR storage, LONG storage_size, ULONG tag1, ... );
  316 #endif
  317 /*** V51.66 ***/
  318 LONG SetFilePosixDate( CONST_STRPTR name, CONST struct PosixDateStamp *date, struct TagItem *tags );
  319 LONG SetFilePosixDateTagList( CONST_STRPTR name, CONST struct PosixDateStamp *date, struct TagItem *tags );
  320 #if !defined(USE_INLINE_STDARG)
  321 LONG SetFilePosixDateTags( CONST_STRPTR name, CONST struct PosixDateStamp *date, ULONG tag1, ... );
  322 #endif
  323 /*** V51.71 ***/
  324 struct PosixDateStamp *PosixDateStamp(struct PosixDateStamp *pds);
  325 LONG PosixDateStampToDateStamp(CONST struct PosixDateStamp *pds, struct DateStamp *ds);
  326 LONG DateStampToPosixDateStamp(CONST struct DateStamp *ds, struct PosixDateStamp *pds);
  327 
  328 #ifdef __cplusplus
  329 }
  330 #endif /* __cplusplus */
  331 
  332 #endif /* CLIB_DOS_PROTOS_H */