Initial revision
[ssr] / StraySrc / Libraries / Sapphire / csapph / h / cmdLine
CommitLineData
2ee739cc 1/*
2 * cmdLine.h
3 *
4 * [Generated from cmdLine, 25 September 1996]
5 */
6
7#if !defined(__CC_NORCROFT) || !defined(__arm)
8 #error You must use the Norcroft ARM Compiler for Sapphire programs
9#endif
10
11#pragma include_only_once
12#pragma force_top_level
13
14#ifndef __cmdLine_h
15#define __cmdLine_h
16
17#ifndef __sapphire_h
18 #include "sapphire.h"
19#endif
20
21/*----- Overview ----------------------------------------------------------*
22 *
23 * Functions provided:
24 *
25 * cl_next
26 */
27
28/* --- cl_next --- *
29 *
30 * On entry: R0 == pointer to a command line string (ctrl terminated)
31 * R1 == pointer to a buffer (may be equal to R0)
32 *
33 * On exit: CS if another word found, and
34 * R0 == updated past next word
35 * R1 preserved, buffer filled with null terminated string
36 * R2 == pointer to terminating null character
37 * else CC and
38 * R0 == pointer to terminating character
39 * R1 preserved, buffer preserved
40 * R2 corrupted
41 *
42 * Use: Extracts the next word from a command line string. If the
43 * string is in a writable buffer, you can set R1 == R0 to
44 * start with. You can build up a C-like argv array like this:
45 *
46 * ; R0 == pointer to command line in writable buffer
47 *
48 * MOV R1,R0
49 * ADR R3,argv
50 * MOV R4,#0
51 * loop BL cl_next
52 * MOVCC R1,#0
53 * STR R1,[R3],#4
54 * ADDCS R4,#0
55 * BCS loop
56 *
57 * ; R0-R3 corrupted
58 * ; R4 == argc
59 *
60 * This routine will handle quoted strings, considering them
61 * to be single arguments. Either type of quote will do,
62 * quote doubling is required to insert quotes in quoted
63 * strings.
64 */
65
66extern routine cl_next;
67
68/*----- That's all, folks -------------------------------------------------*/
69
70#endif