/* * cmdLine.h * * [Generated from cmdLine, 25 September 1996] */ #if !defined(__CC_NORCROFT) || !defined(__arm) #error You must use the Norcroft ARM Compiler for Sapphire programs #endif #pragma include_only_once #pragma force_top_level #ifndef __cmdLine_h #define __cmdLine_h #ifndef __sapphire_h #include "sapphire.h" #endif /*----- Overview ----------------------------------------------------------* * * Functions provided: * * cl_next */ /* --- cl_next --- * * * On entry: R0 == pointer to a command line string (ctrl terminated) * R1 == pointer to a buffer (may be equal to R0) * * On exit: CS if another word found, and * R0 == updated past next word * R1 preserved, buffer filled with null terminated string * R2 == pointer to terminating null character * else CC and * R0 == pointer to terminating character * R1 preserved, buffer preserved * R2 corrupted * * Use: Extracts the next word from a command line string. If the * string is in a writable buffer, you can set R1 == R0 to * start with. You can build up a C-like argv array like this: * * ; R0 == pointer to command line in writable buffer * * MOV R1,R0 * ADR R3,argv * MOV R4,#0 * loop BL cl_next * MOVCC R1,#0 * STR R1,[R3],#4 * ADDCS R4,#0 * BCS loop * * ; R0-R3 corrupted * ; R4 == argc * * This routine will handle quoted strings, considering them * to be single arguments. Either type of quote will do, * quote doubling is required to insert quotes in quoted * strings. */ extern routine cl_next; /*----- That's all, folks -------------------------------------------------*/ #endif