Previous

Next

Bottom

Contents

Glossary

Index

 

CF1 User's Manual

PicoDOS Utility Functions

May 1999

Revision 1.01

 Persistor Instruments Inc.
© 1998 All rights reserved.

 

Quick Reference Table

execstr

flogf

Initflog

pdcfinfo

picodosver

sscandate

sscantime

Introduction

This section contains various useful or legacy routines that don't quite fit anywhere else.

Initflog -- Setup for future flogf operations

Setup for printf-like runtime logging to a file and/or the console.

Prototype:

void Initflog(char *fname, bool echoToConsole);

Definition:

#include <cf1pico.h>

Inputs:

fname is a zero terminated C string contiaining the file or full path name to log/append future flogf messages to.
echoToConsole is true if flogf messages are to be echoed to the stdout console.

Returns:

Returns nothing.

Notes:

Pass zero for fname and true for echoToConsole to just show messages on the console.

Timing:

TBD

flogf -- printf to console and log file (after Initflogf())

This function works like printf, except that it sends the formatted data to either, neither, or both an append file and the stdout console. When working to the console, the flogf takes care of checking the current state of the EIA driver and if it's off, turns it on while sending then turns it back off when complete. Console writes also blocks until all characters have been sent. Similarly, when writing to a file, flogf checks the current CF enable state and if it's off, turns it on while writing, then back off. Each flogf targeting a file opens the file for append mode on entry and closes and flushes the file on exit.

Prototype:

short flogf(char *format, ...);

Definition:

#include <cf1pico.h>

Inputs:

format is identical to standard printf formats and variable arguments.

Returns:

Returns the number of characters written.

Notes:

Notes.

Timing:

TBD

sscandate -- scan date string into year, mon, and mday fields of struct tm

This is a general purpose date string parser that accomodates a variety of date specification styles.

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

Prototype:

short sscandate(const char *str, struct tm *ptm, DateFieldOrder dfo );

Definition:

#include <cf1pico.h>

Inputs:

str is a zero terminated C string containing date in the form:

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.

ptm is a standard C library tm structure from <time.h> with fields tm_year, tm_mon, and tm_mday filled in from the scan.

Returns:

Returns the lenght of the scanned string or zero if the string is invalid.

Notes:

This routine is used by the PicoDOS QRdate and QRdatetime query/reply functions.

Timing:

TBD

sscantime -- scan time string into hour, min, and sec fields of struct tm

This is a general purpose time string parser.

Prototype:

short sscantime(const char *str, struct tm *ptm);

Definition:

#include <cf1pico.h>

Inputs:

str is a zero terminated C string containing time in the form: HOURS<delim>MINUTES<delim>SECONDS and optional AM or PM for 12 hour time.
<delim> may be any single comma, space, dash, period, or slash.

ptm is a standard C library tm structure from <time.h> with fields tm_hour, tm_min, and tm_secs filled in from the scan.

Returns:

Returns the lenght of the scanned string or zero if the string is invalid.

Notes:

This routine is used by the PicoDOS QRtime and QRdatetime query/reply functions.

Timing:

TBD

execstr -- Pass command string from running application to PicoDOS command shell

Pass a command to the PicoDOS command shell.

Prototype:

short execstr(char *cmdstr);

Definition:

#include <cf1pico.h>

Inputs:

cmdstr is a zero terminated C string containing the command and parameters just as would be typed at the PicoDOS command prompt.

Returns:

Returns enum { execstrNoCmdMatch = -1, execstrNoError = 0, execstrGeneralFailure = 1 };

Notes:

Notes.

Timing:

TBD

picodosver -- Return a string containing PicoDOS version information (legacy support code)

Return PicoDOS version information with a CF8/AT8 compatable function call.

Prototype:

char * picodosver(void);

Definition:

#include <cf1pico.h>

Inputs:

Nothing

Returns:

Returns a C string in the form "nnnnn-v.rs" where nnnnn is the serial number, v is the current version of PicoDOS, r is the release level, and s is the sub-release level.

Notes:

New programs should use the BIOS global variables for this information:

  • BIOSGVT.CF1SerNum
  • BIOSGVT.BIOSVersion
  • BIOSGVT.BIOSRelease
  • BIOSGVT.PICOVersion
  • BIOSGVT.PICORelease

Timing:

TBD

pdcfinfo -- Return PicoDOS file system size information (legacy support code)

Return PicoDOS file system information with a CF8/AT8 compatable function call.

Prototype:

short pdcfinfo(char *drive, long *size, long *free)PICO_CALL(pdcfinfo);

Definition:

#include <cf1pico.h>

Inputs:

drive is a string pointer in the form of "A:", "B:", etc.
size is a pointer to a long variable to hold the size of the media in bytes
free is a pointer to a long variable to hold the available free space in bytes

Returns:

Returns zero on success, or -1 if the named drive is not available.

Notes:

New programs should use the PicoDOS DIR functions DIRFreeSpace and DIRTotalSpace.

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