Previous

Next

Bottom

Contents

Glossary

Index

 

CF1 User's Manual

PicoDOS Query/Reply Functions

May 1999

Revision 1.01

 Persistor Instruments Inc.
© 1998 All rights reserved.

 

Quick Reference Table

QRchar

QRconfirm

QRdate

QRdatetime

QRdouble

QRfloat

QRlong

QRshort

QRstring

QRtime

QRulong

QRushort

Introduction

The query/reply functions provide a variety of useful functions for interacting with an operator using console I/O.

QRconfirm -- Query/Reply for Y/N confirmation

 

Prototype:

bool QRconfirm(char *prompt, bool defyes, bool crok);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
defyes is set true to make 'Y' the default reply.
crok is set true to accept the default reply with just a carriage-return (enter key)

Returns:

Returns true Yes replies.

Notes:

Timing:

TBD

QRchar -- Query/Reply for character using: %c

 

Prototype:

bool QRchar(char *prompt, char *fmt, bool crok, char *reply, char *instr, bool uc);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
reply is a pointer to a character variable to hold the reply
instr if non-zero must contain a set of characters that the reply must match to be valid
uc is set true to force all replies to upper case.

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRstring -- Query/Reply for string using: %s

 

Prototype:

bool QRstring(char *prompt, char *fmt, bool crok, char *strbuf, short len);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
strbuf is a pointer to a character buffer to hold the reply
len
is the maximum number of character to place in the reply buffer

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRshort -- Query/Reply for short using: %i %hi %d %hd %u %hu %o %ho

 

Prototype:

bool QRshort(char *prompt, char *fmt, bool crok, short *value, short min, short max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a short variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRushort -- Query/Reply for ushort using: %i %hi %d %hd %u %hu %o %ho

 

Prototype:

bool QRushort(char *prompt, char *fmt, bool crok, ushort *value, ushort min, ushort max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a ushort variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRlong -- Query/Reply for long using: %li %ld %lu %lo

 

Prototype:

bool QRlong(char *prompt, char *fmt, bool crok, long *value, long min, long max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a long variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRulong -- Query/Reply for ulong using: %li %ld %lu %lo

 

Prototype:

bool QRulong(char *prompt, char *fmt, bool crok, ulong *value, ulong min, ulong max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a ulong variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRfloat -- Query/Reply for float using: %f %e %E %g %G

 

Prototype:

bool QRfloat(char *prompt, char *fmt, bool crok, float *value, float min, float max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a float variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRdouble -- Query/Reply for double using: %lf %le %lE %lg %lG

 

Prototype:

bool QRdouble(char *prompt, char *fmt, bool crok, double *value, double min, double max);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
fmt is a standard C libary printf/scanf format string
crok is set true to accept the default reply with just a carriage-return (enter key)
value is a pointer to a double variable that will hold the reply
min
if not equal to max, min is the minimum valid value to accept for a reply
max
if not equal to min, max is the maximum valid value to accept for a reply

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Timing:

TBD

QRtime -- Query/Reply for time

 

Prototype:

bool QRtime(char *prompt, bool crok, struct tm *tm);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
crok is set true to accept the default reply with just a carriage-return (enter key)
tm is a standard C library tm structure pointer from <time.h> with fields tm_hour, tm_min, and tm_secs filled in from the scan.

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Replies are accepted in the form: HOURS<delim>MINUTES<delim>SECONDS
<delim> may be any single comma, space, dash, period, or slash.

Timing:

TBD

QRdate -- Query/Reply for date

typedef enum {  YYMMDD    // ISO
              , MMDDYY    // US
              , DDMMYY    // European
             } DateFieldOrder;

 

Prototype:

bool QRdate(char *prompt, DateFieldOrder dfo, bool crok, struct tm *tm);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
crok is set true to accept the default reply with just a carriage-return (enter key)
tm is a standard C library tm structure pointer from <time.h> with fields tm_year, tm_mon, and tm_mday filled in from the scan.

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Replies are accepted with:

YEAR<delim>MONTH<delim>DAY (specifying enum YYMMDD)
MONTH<delim>DAY<delim>YEAR (specifying enum MMYYDD)
DAY<delim>MONTH<delim>YEAR (specifying enum DDMMYY)

<delim> may be any single comma, space, dash, period, or slash.
YEAR may a full 4 digits or 2 digits assumed between 1970 and 2069
MONTH may be 1-12, full text (January, February, ..., December) or three character abbreviations.

Timing:

TBD

QRdatetime -- Query/Reply for date and time

typedef enum {  YYMMDD    // ISO
              , MMDDYY    // US
              , DDMMYY    // European
             } DateFieldOrder;

 

Prototype:

bool QRdatetime(char *prompt, DateFieldOrder dfo, bool crok, struct tm *tm);

Definition:

#include <cf1pico.h>

Inputs:

prompt is a zero terminated C string to display as a prompt for the user.
crok is set true to accept the default reply with just a carriage-return (enter key)
tm is a standard C library tm structure pointer from <time.h> with fields tm_year, tm_mon, tm_mday, m_hour, tm_min, and tm_secs filled in from the scan.

Returns:

Returns true for all but query cancelled (CTRL-C typed).

Notes:

Replies are accepted with:

YEAR<delim>MONTH<delim>DAY (specifying enum YYMMDD)
MONTH<delim>DAY<delim>YEAR (specifying enum MMYYDD)
DAY<delim>MONTH<delim>YEAR (specifying enum DDMMYY)

<delim> may be any single comma, space, dash, period, or slash.
YEAR may a full 4 digits or 2 digits assumed between 1970 and 2069
MONTH may be 1-12, full text (January, February, ..., December) or three character abbreviations.

Timing:

TBD

Previous

Next

Top

Contents

Glossary

Index

Tel: 508-759-6434

Fax: 508-759-6436

Copyright (C) 1998 Persistor Instruments Inc. - All Rights Reserved