1) Add time command to time specific functions.

2) improve the help system.
3) bug fixes for arrays.


git-svn-id: svn://10.0.0.236/trunk@256742 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
relyea%netscape.com
2009-03-29 19:04:26 +00:00
parent 3cb4ba3b98
commit 3ddb282360
2 changed files with 47 additions and 0 deletions

View File

@@ -1311,6 +1311,11 @@ const Commands _commands[] = {
"reads filename as script of commands to execute\n",
{ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
{"Time", F_Time,
"Time pkcs11 command\n\n"
"Execute a pkcs #11 command and time the results\n",
{ArgVar|ArgFull, ArgNone, ArgNone, ArgNone, ArgNone,
ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
{"System", F_System,
"Fix Me... ",
{ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
@@ -1329,4 +1334,38 @@ const Commands _commands[] = {
const Commands *commands= &_commands[0];
const int commandCount = sizeof(_commands) / sizeof(_commands[0]);
const Topics _topics[] = {
{ "variables",
"Variables are random strings of characters. These should begin with alpha\n"
" characters, and should not contain any spaces, nor should they match any\n"
" built-in constants. There is some checking in the code for these things,\n"
" but it's not 100% and using invalid variable names can cause problems.\n"
" Variables are created by any 'OUT' parameter. If the variable does not\n"
" exist, it will be created. For in parameters variables must already exist.\n"
},
{ "constants",
"pk11util recognizes *lots* of constants. All CKA_, CKF_, CKO_, CKU_, CKS_,\n"
" CKC_, CKK_, CKH_, CKM_, CKT_ values from the PKCS #11 spec are recognized.\n"
" Constants can be specified with their fully qualified CK?_ value, or the\n"
" prefix can be dropped. Constants are matched case insensitve.\n"
},
{ "arrays",
"Arrays are special variables which represent 'C' arrays. Each array \n"
" variable can be referenced as a group (using just the name), or as \n"
" individual elements (with the [int] operator). Example:\n"
" print myArray # prints the full array.\n"
" print myArray[3] # prints the 3rd elemement of the array \n"
},
{ "sizes",
"Size operaters returns the size in bytes of a variable, or the number of\n"
" elements in an array.\n"
" size(var) and sizeof(var) return the size of var in bytes.\n"
" sizea(var) and sizeofarray(var) return the number of elements in var.\n"
" If var is not an array, sizea(var) returns 1.\n"
},
};
const Topics *topics=&_topics[0];
const int topicCount = sizeof(_topics)/sizeof(_topics[0]);

View File

@@ -29,6 +29,7 @@ typedef enum {
F_Load,
F_Unload,
F_System,
F_Time,
F_Help,
F_Quit,
} FunctionType;
@@ -59,6 +60,7 @@ typedef enum {
ArgFile = 0x800,
ArgStatic = 0x1000,
ArgOpt = 0x2000,
ArgFull = 0x4000,
} ArgType;
typedef enum _constType
@@ -135,6 +137,10 @@ typedef struct _module {
CK_FUNCTION_LIST *functionList;
} Module;
typedef struct _topics {
char *name;
char *helpString;
} Topics;
/*
* the command array itself. Make name to function and it's arguments
@@ -148,4 +154,6 @@ extern const Constant *consts;
extern const int constCount;
extern const Commands *commands;
extern const int commandCount;
extern const Topics *topics;
extern const int topicCount;