/* Copyright 1998 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
*  Lan Manager client
*
*  Xlate.H --  DOS to RISCOS name & attrib mapping header
*
*  Versions
*  08-03-94 INH Original
*
*/

/* Some general functions */
extern int stricmp ( const char *s1, const char *s2 );
extern void strcpyn ( char *d, const char *s, int n );
extern void strcpyn_upper ( char *d, const char *s, int n );
extern void strcpyn_lower ( char *d, const char *s, int n );

extern void Xlt_Jumble ( char *str );
extern void Xlt_Unjumble ( char *str );

#define CNV_DEFAULT_TYPE        FileType_Text
#define CNV_DATETIME            1
#define CNV_ATTRIBS             2

extern void Xlt_CnvDOStoRO ( DOS_ATTRIBS *pInAttr,
                             RISCOS_ATTRIBS *pOutAttr, int flags );

extern void Xlt_CnvROtoDOS ( RISCOS_ATTRIBS *pInAttr,
                             DOS_ATTRIBS *pOutAttr, int flags );


extern char *Xlt_GetRISCOSLeafName ( char *name );
extern void Xlt_NameDOStoRO ( char *riscos_dst, char *dos_src );

/* Name mode */
#define NM_PRESERVED 0
#define NM_LOWERCASE 1
#define NM_FIRSTCAPS 2
#define NM_INTERNAL  4 /* Can't be selected at the CLI */


/* Mime mappings */
#define MimeMap_Translate       0x50B00
#define MMM_TYPE_RISCOS         0
#define MMM_TYPE_RISCOS_STRING  1
#define MMM_TYPE_MIME           2
#define MMM_TYPE_DOT_EXTN       3

extern err_t Xlt_ExpandSearchEntry ( BYTE *entry,
            char *DOS_pathname,
            char *name_out,
            DOS_ATTRIBS *pOutDA,
            RISCOS_ATTRIBS *pOutRA );
extern err_t Xlt_ExpandSearchEntryX2 ( BYTE *entry,
            char *DOS_pathname,
            char *name_out,
            DOS_ATTRIBS *pOutDA,
            RISCOS_ATTRIBS *pOutRA );


extern err_t Xlt_SetDefaultDrv ( char *path );
extern err_t Xlt_ConvertPath ( char *RO_name_in,
                               char *DOS_name_out );

/* Translate from our error code to RISCOS error block */
extern _kernel_oserror *Xlt_Error ( err_t err );

/* Translate from RISCOS error block to our error code */
extern err_t Xlt_SetOSError ( _kernel_oserror *err );

#ifdef LONGNAMES
/* Looks at the specified path/leaf name and determines if it has
 * a ,xxx type specifier on the end of it.  If it does, it returns
 * the address of the comma in the terminator parameter, and updates
 * the RISCOS_ATTRIBS.loadaddr field to contain the type of the file.
 * The source string is not modified (but cannot be const without
 * requiring a cast to store the address of the terminator)
 */
extern err_t Xlt_SplitLeafnameX2 ( char *leafname, RISCOS_ATTRIBS *pRA,
  char **terminator);

/* Looks at the source filename for a rename operation and updates the
 * target filename to preserve any filetyping information
 */
extern err_t Xlt_CnvRenameX2 ( char *src, char *dst );

/* Alters the filename specified so that it co-incides with the
 * type encoded in the given "load addr" parameter,
 * Returns 1 if it changed the filetype, 0 otherwise
 */
extern int Xlt_AddROType ( char *leafname, uint loadaddr );
#endif