Loading...
Searching...
No Matches
LibThread::Command Class Reference

## Public Member Functions

| Command (const char *n, leftv r, leftv a)
| ~Command ()
void | check_argc (int n)
void | check_argc (int lo, int hi)
void | check_argc_min (int n)
void | check_arg (int i, int type, const char *err)
void | check_init (int i, const char *err)
void | check_arg (int i, int type, int type2, const char *err)
int | argtype (int i)
int | nargs ()
void * | arg (int i)
template<typename T>
T * | shared_arg (int i)
long | int_arg (int i)
void | report (const char *err)
int | test_arg (int i, int type)
void | set_result (long n)
void | set_result (const char *s)
void | set_result (int type, void *p)
void | set_result (int type, long n)
void | no_result ()
bool | ok ()
BOOLEAN | status ()
BOOLEAN | abort (const char *err)

## Private Attributes

const char * | name
const char * | error
leftv | result
leftv * | args
int | argc

## Detailed Description

Definition at line 36 of file shared.cc.

## Constructor & Destructor Documentation

## Command()

LibThread::Command::Command | ( | const char * | n,
|  | leftv | r,
|  | leftv | a )

inline

Definition at line 44 of file shared.cc.

{
name = n;
result = r;
error = NULL;
argc = 0;
for (leftv t = a; t != NULL; t = t->next) {
argc++;
}
args = (leftv *) omAlloc0(sizeof(leftv) * argc);
int i = 0;
for (leftv t = a; t != NULL; t = t->next) {
args[i++] = t;
}
result->rtyp = NONE;
result->data = NULL;
}
i
int i
Definition cfEzgcd.cc:132
LibThread::Command::argc
int argc
Definition shared.cc:42
LibThread::Command::args
leftv * args
Definition shared.cc:41
LibThread::Command::error
const char * error
Definition shared.cc:39
LibThread::Command::result
leftv result
Definition shared.cc:40
LibThread::Command::name
const char * name
Definition shared.cc:38
sleftv::next
leftv next
Definition subexpr.h:86
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
leftv
sleftv * leftv
Definition structs.h:53
NONE
#define NONE
Definition tok.h:223

## ~Command()

LibThread::Command::~Command | ( |  | ) |

inline

Definition at line 61 of file shared.cc.

{
omFree(args);
}
omFree
#define omFree(addr)
Definition omAllocDecl.h:261

## Member Function Documentation

## abort()

BOOLEAN LibThread::Command::abort | ( | const char * | err | ) |

inline

Definition at line 143 of file shared.cc.

{
report(err);
return status();
}
LibThread::Command::report
void report(const char *err)
Definition shared.cc:106
LibThread::Command::status
BOOLEAN status()
Definition shared.cc:137

## arg()

void * LibThread::Command::arg | ( | int | i | ) |

inline

Definition at line 96 of file shared.cc.

{
return args[i]->Data();
}

## argtype()

int LibThread::Command::argtype | ( | int | i | ) |

inline

Definition at line 90 of file shared.cc.

{
return args[i]->Typ();
}

## check_arg() [1/2]

void LibThread::Command::check_arg | ( | int | i,
|  | int | type,
|  | const char * | err )

inline

Definition at line 76 of file shared.cc.

{
if (error) return;
if (args[i]->Typ() != type) error = err;
}

## check_arg() [2/2]

void LibThread::Command::check_arg | ( | int | i,
|  | int | type,
|  | int | type2,
|  | const char * | err )

inline

Definition at line 86 of file shared.cc.

{
if (error) return;
if (args[i]->Typ() != type && args[i]->Typ() != type2) error = err;
}

## check_argc() [1/2]

void LibThread::Command::check_argc | ( | int | lo,
|  | int | hi )

inline

Definition at line 68 of file shared.cc.

{
if (error) return;
if (argc < lo || argc > hi) error = "wrong number of arguments";
}

## check_argc() [2/2]

void LibThread::Command::check_argc | ( | int | n | ) |

inline

Definition at line 64 of file shared.cc.

{
if (error) return;
if (argc != n) error = "wrong number of arguments";
}

## check_argc_min()

void LibThread::Command::check_argc_min | ( | int | n | ) |

inline

Definition at line 72 of file shared.cc.

{
if (error) return;
if (argc < n) error = "wrong number of arguments";
}

## check_init()

void LibThread::Command::check_init | ( | int | i,
|  | const char * | err )

inline

Definition at line 80 of file shared.cc.

{
if (error) return;
leftv arg = args[i];
if (arg->Data() == NULL || *(void **)(arg->Data()) == NULL)
error = err;
}
LibThread::Command::arg
void * arg(int i)
Definition shared.cc:96

## int_arg()

long LibThread::Command::int_arg | ( | int | i | ) |

inline

Definition at line 103 of file shared.cc.

{
return (long)(args[i]->Data());
}

## nargs()

int LibThread::Command::nargs | ( |  | ) |

inline

Definition at line 93 of file shared.cc.

{
return argc;
}

## no_result()

void LibThread::Command::no_result | ( |  | ) |

inline

Definition at line 131 of file shared.cc.

{
result->rtyp = NONE;
}

## ok()

bool LibThread::Command::ok | ( |  | ) |

inline

Definition at line 134 of file shared.cc.

{
return error == NULL;
}

## report()

void LibThread::Command::report | ( | const char * | err | ) |

inline

Definition at line 106 of file shared.cc.

{
error = err;
}

## set_result() [1/4]

void LibThread::Command::set_result | ( | const char * | s | ) |

inline

Definition at line 119 of file shared.cc.

{
result->rtyp = STRING_CMD;
result->data = omStrDup(s);
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
STRING_CMD
@ STRING_CMD
Definition tok.h:187

## set_result() [2/4]

void LibThread::Command::set_result | ( | int | type,
|  | long | n )

inline

Definition at line 127 of file shared.cc.

{
result->rtyp = type;
result->data = (char *) n;
}

## set_result() [3/4]

void LibThread::Command::set_result | ( | int | type,
|  | void * | p )

inline

Definition at line 123 of file shared.cc.

{
result->rtyp = type;
result->data = (char *) p;
}
p
int p
Definition cfModGcd.cc:4086

## set_result() [4/4]

void LibThread::Command::set_result | ( | long | n | ) |

inline

Definition at line 115 of file shared.cc.

{
result->rtyp = INT_CMD;
result->data = (char *)n;
}
INT_CMD
@ INT_CMD
Definition tok.h:96

## shared_arg()

template<typename T>

T * LibThread::Command::shared_arg | ( | int | i | ) |

inline

Definition at line 100 of file shared.cc.

{
return *(T **)(arg(i));
}
T
STATIC_VAR jList * T
Definition janet.cc:30

## status()

BOOLEAN LibThread::Command::status | ( |  | ) |

inline

Definition at line 137 of file shared.cc.

{
if (error) {
Werror("%s: %s", name, error);
}
return error != NULL;
}
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189

## test_arg()

int LibThread::Command::test_arg | ( | int | i,
|  | int | type )

inline

Definition at line 111 of file shared.cc.

{
if (i >= argc) return 0;
return args[i]->Typ() == type;
}

## Field Documentation

## argc

int LibThread::Command::argc

private

Definition at line 42 of file shared.cc.

## args

leftv* LibThread::Command::args

private

Definition at line 41 of file shared.cc.

## error

const char* LibThread::Command::error

private

Definition at line 39 of file shared.cc.

## name

const char* LibThread::Command::name

private

Definition at line 38 of file shared.cc.

## result

leftv LibThread::Command::result

private

Definition at line 40 of file shared.cc.

The documentation for this class was generated from the following file:

- Singular/dyn_modules/systhreads/shared.cc