Mostly Completed Step 5.
+- configops.c/h +- metadataops.c/h
This commit is contained in:
parent
dc4eca7285
commit
e19542c060
4 changed files with 879 additions and 12 deletions
|
|
@ -2,6 +2,35 @@
|
|||
#define CONFIGOPS
|
||||
|
||||
#include "StandardConstants.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
typedef enum {CFG_FILE_ACCESS_ERR,
|
||||
CFG_CORRUPT_DESCRIPTOR_ERR,
|
||||
CFG_DATA_OUT_OF_RANGE_ERR,
|
||||
CFG_CORRUPT_PROMPT_ERR,
|
||||
CFG_VERSION_CODE,
|
||||
CFG_MD_FILE_NAME_CODE,
|
||||
CFG_CPU_SCHED_CODE,
|
||||
CFG_QUANT_CYCLES_CODE,
|
||||
CFG_MEM_DISPLAY_CODE,
|
||||
CFG_MEM_AVAILABLE_CODE,
|
||||
CFG_PROC_CYCLES_CODE,
|
||||
CFG_IO_CYCLES_CODE,
|
||||
CFG_LOG_TO_CODE,
|
||||
CFG_LOG_FILE_NAME_CODE
|
||||
} ConfigCodeMessages;
|
||||
|
||||
typedef enum {CPU_SCHED_SJF_N_CODE,
|
||||
CPU_SCHED_SRTF_P_CODE,
|
||||
CPU_SCHED_FCFS_P_CODE,
|
||||
CPU_SCHED_RR_P_CODE,
|
||||
CPU_SCHED_FCFS_N_CODE,
|
||||
LOGTO_MONITOR_CODE,
|
||||
LOGTO_FILE_CODE,
|
||||
LOGTO_BOTH_CODE,
|
||||
NON_PREEMPTIVE_CODE,
|
||||
PREEMPTIVE_CODE
|
||||
} ConfigDataCodes;
|
||||
|
||||
typedef struct ConfigDataTypeStruct
|
||||
{
|
||||
|
|
@ -21,6 +50,18 @@ Dependencies: ???
|
|||
*/
|
||||
ConfigDataType *clearConfigData(ConfigDataType *configData);
|
||||
|
||||
/*
|
||||
Name: configCodeToString
|
||||
Process: utility fct converts configuration code numbers to string they represent
|
||||
Function Input/Parameters: configuration code (int)
|
||||
Function Output/Parameters: resulting output string (char *)
|
||||
Function Output/Returned: none
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: copyString
|
||||
*/
|
||||
void configCodeToString(int code, char *outString);
|
||||
|
||||
/*
|
||||
Name: displayConfigData
|
||||
Process: screen dump/display of all config data
|
||||
|
|
@ -42,9 +83,64 @@ Function Output/Parameters: pointer to config data pointer (ConfigDataType **)
|
|||
Function Output/Returned: Boolean result of data access operation (bool)
|
||||
Device Input/File: config data uploaded
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
Dependencies: copyString, fopen, getStringToDelimiter, compareString, fclose,
|
||||
malloc, free, stripTrailingSpaces, getDataLineCode, fscanf,
|
||||
setStrToLowerCase, valueInRange, getCpuSchedCode, getLogToCode
|
||||
*/
|
||||
bool getConfigData(const char *fileName,
|
||||
ConfigDataType **configData, char *endStateMsg);
|
||||
ConfigDataType **configData, char *endStateMsg);
|
||||
|
||||
/*
|
||||
Name: getDataLineCode
|
||||
Process: converts leader line string to configuration code value
|
||||
(processes all config file leader lines)
|
||||
Function Input/Parameters: config leader line string (const char *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: configuration code value (ConfigCodeMessages)
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: compareString
|
||||
*/
|
||||
ConfigCodeMessages getDataLineCode(const char *dataBuffer);
|
||||
|
||||
/*
|
||||
Name: getLogToCode
|
||||
Process: ???
|
||||
Function Input/Parameters: none
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
*/
|
||||
ConfigDataCodes getLogToCode(const char *lowerCaseLogToStr);
|
||||
|
||||
/*
|
||||
Name: stripTrailingSpaces
|
||||
Process: removes trailing spaces from input config leader lines
|
||||
Function Input/Parameters: config leader line string (char *)
|
||||
Function Output/Parameters: updates config leader line string (char *)
|
||||
Function Output/Returned: none
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: getStringLength
|
||||
*/
|
||||
void stripTrailingSpaces(char *str);
|
||||
|
||||
/*
|
||||
Name: valueInRange
|
||||
Process: checks for config data values in range, including str values
|
||||
Function Input/Parameters: line code number for specific config value (int),
|
||||
integer value, as needed (int),
|
||||
double value, as needed (double),
|
||||
string value, as needed (const char *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: Boolean result of the range test (bool)
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: compareString
|
||||
*/
|
||||
bool valueInRange(int lineCode, int intVal, double doubleVal,
|
||||
const char *lowerCaseStringVal);
|
||||
|
||||
#endif // CONFIGOPS
|
||||
Loading…
Add table
Add a link
Reference in a new issue