⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expreval.html

📁 数学表达式计算和解析 用c语言编写的,内含有例.速度较快
💻 HTML
📖 第 1 页 / 共 4 页
字号:
						<li>*name - Name of the function to get</li>
						<li>*min - Pointer to variable to get min data</li>
						<li>*max - Pointer to variable to get max data</li>
						<li>*refmin - Pointer to variable to get min ref data</li>
						<li>*refmax - Pointer to variable to get max ref data</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprFuncListFree(exprFuncList *f);<br>
					Comments:
					<ul>
						<li>Free the function list entirely</li>
					</ul>
					Parameters:
					<ul>
						<li>*f - Pointer to the function list to free</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprFuncListClear(exprFuncList *f);<br>
					Comments:
					<ul>
						<li>Clear the functions from the function list</li>
					</ul>
					Parameters:
					<ul>
						<li>*f - Pointer to the function list to clear</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprFuncListInit(exprFuncList *f);<br>
					Comments:
					<ul>
						<li>Initializes internal functions into the funtion list</li>
					</ul>
					Parameters:
					<ul>
						<li>*f - Function list to initialize</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li>
			</ul>
		</p>
		<p><b>Value list functions:</b>
			<ul>
				<li>int exprValListCreate(exprValList **v);<br>
					Comments:
					<ul>
						<li>Creates a value list for variables or constants</li>
					</ul>
					Parameters:
					<ul>
						<li>**v - Pointer to a pointer to the value list.</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function.  On success, the pointer will
							be updated to point to the value list</li>
					</ul>
				</li><br>
				<li>int exprValListAdd(exprValList *v, char *name, EXPRTYPE val);<br>
					Comments:
					<ul>
						<li>Add or update a value in a value list</li>
					</ul>
					Parameters:
					<ul>
						<li>*v - Value list to add a value to</li>
						<li>*name - Name of the value to add</li>
						<li>val - Value of the value to add</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprValListGet(exprValList *v, char *name, EXPRTYPE *val)<br>
					Comment:
					<ul>
						<li>Get the value of a variable or constant in a value list</li>
					</ul>
					Parameters:
					<ul>
						<li>*v - Value list to use</li>
						<li>*name - Name of the value to get</li>
						<li>*val - Pointer to variable to get the value</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprValListGetAddress(exprValList *v, char *name, EXPRTYPE **addr)<br>
					Comment:
					<ul>
						<li>Get the memory address of a variable in a value list</li>
					</ul>
					Parameters:
					<ul>
						<li>*v - Value list to use</li>
						<li>*name - Name of the value to get</li>
						<li>** - Pointer to a pointer to store the address of the value
							This will be NULL if the name is not in the list.</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprValListFree(exprValList *v);<br>
					Comments:
					<ul>
						<li>Completely free the value list</li>
					</ul>
					Parameters:
					<ul>
						<li>*v - Value list to free</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprValListClear(exprValList *v);<br>
					Comments:
					<ul>
						<li>Set the values in the list to 0.0</li>
					</ul>
					Parameters:
					<ul>
						<li>*v - Value list to reset</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprValListInit(exprValList *v);<br>
					Comments:
					<ul>
						<li>Initialize internal constants into a value list</li>
					</ul>
					Paramters:
					<ul>
						<li>*v - Value list to initialize</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li>
			</ul>
		</p>
		<p><b>Expression functions:</b>
			<ul>
				<li>int exprCreate(exprObj **o, exprFuncList *f, exprValList *v, exprValList *c, exprMsgFuncType msg, exprBreakFuncType breaker, void *userdata);<br>
					Comments:
					<ul>
						<li>Create an expression object to use</li>
					</ul>
					Parameters:
					<ul>
						<li>**o - Pointer to a pointer to an expression object</li>
						<li>*f - Function list to associate with the expression</li>
						<li>*v - Variable value list to associate with the expression</li>
						<li>*c - Constant value list to associate with the expression</li>
						<li>msg - Message function callback to associate with the expression</li>
						<li>breaker - Breaker function callback to associate with the expression.
						    Used by functions that may be infinite loops (such as the for function)</li>
						<li>userdata - User data to associate with the expression</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprFree(exprObj *o);<br>
					Comments:
					<ul>
						<li>Completely free the expression object</li>
					</ul>
					Paramters:
					<ul>
						<li>*o - Expression object to free</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprClear(exprObj *o);<br>
					Comments:
					<ul>
						<li>Clear an expression, but keep list and callback associations.
							You can then parse another expression without calling create</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - Expression object to clear</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprParse(exprObj *o, char *expr);<br>
					Comments:
					<ul>
						<li>Parse an expression string into an expression object</li>
					</ul>
					Paramters:
					<ul>
						<li>*o - Expression object to use</li>
						<li>*expr - Expression string to parse</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprEval(exprObj *o, EXPRTYPE *val);<br>
					Comments:
					<ul>
						<li>Evaluate a parsed expression</li>
					</ul>
					Paramters:
					<ul>
						<li>*o - Expression object to evaluate</li>
						<li>*val = Pointer to variable to get result of evaluation</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>int exprEvalNode(exprObj *o, exprNode *n, EXPRTYPE *val);<br>
					Comments:
					<ul>
						<li>Evaluate a node of an expression.
							Used by custom functions</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - Expression object being used</li>
						<li>*n - Pointer to node to evaluate</li>
						<li>*val - Pointer to variable to get evaluation result</li>
					</ul>
					Returns:
					<ul>
						<li>Error code of the function</li>
					</ul>
				</li><br>
				<li>exprFuncList *exprGetFuncList(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the function list associated with an expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Pointer fo an exprFuncList object or NULL</li>
					</ul>
				</li><br>
				<li>exprValList *exprGetVarList(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the variable list associated with an expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Pointer to an exprValList object or NULL</li>
					</ul>
				</li><br>
				<li>exprValList *exprGetConstList(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the constant list associated with an expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Pointer to an exprValList object or NULL</li>
					</ul>
				</li><br>
				<li>exprMsgFuncType exprGetMsgFunc(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the message callback of the expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Pointer to the callback function or NULL</li>
					</ul>
				</li><br>
				<li>exprBreakFuncType exprGetBreakFunc(exprObj *o);<br>
				    Comments:
					<ul>
					    <li>Gets the breaker callback of the expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Pointer to the callback function or NULL</li>
					</ul>
				</li><br>
				<li>int exprGetBreakResult(exprObj *o);<br>
					Comments:
					<ul>
						<li>Get the result of the breaker function</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>zero to continue, nonzero to break</li>
					</ul>
				</li><br>
				<li>void* exprGetUserData(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the user data associated with an expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>User data</li>
					</ul>
				</li><br>
				<li>int exprGetSoftErrors(exprObj *o);<br>
					Comments:
					<ul>
						<li>Gets the soft error status.  0 means
							off, anything else means on</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expression object</li>
					</ul>
					Returns:
					<ul>
						<li>Soft error status of the expression</li>
					</ul>
				</li><br>
				<li>void exprSetUserData(exprObj *o, void *userdata);<br>
					Comments:
					<ul>
						<li>Sets the user data of an expression</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expresion object</li>
						<li>userdata - user data to set</li>
					</ul>
					Returns:
					<ul>
						<li>Nothing</li>
					</ul>
				</li><br>
				<li>void exprSetSoftErrors(exprObj *o, int softerr);<br>
					Comments:
					<ul>
						<li>Set soft error on or off. 0 means off, anything
							else means on</li>
					</ul>
					Parameters:
					<ul>
						<li>*o - expresion object</li>
						<li>softerr - value to set the soft errors to</li>
					</ul>
					Returns:
					<ul>
						<li>Nothing</li>
					</ul>
				</li>
			</ul>
		</p>
		<p><b>Some useful functions</b>
			<ul>
				<li>int exprValidIdent(char *name);<br>
					Comments:
					<ul>
						<li>Determine if an identifier is valid</li>
					</ul>
					Parameters:
					<ul>
						<li>*name - identifier to check</li>
					</ul>
					Returns:
					<ul>
						<li>0 on invalid. anything else on valid</li>
					</ul>
				</li><br>
				<li>int exprValidNumber(char *num);<br>
					Comments:
					<ul>
						<li>Determines if a number is valid.  A
							valid number may contain digits
							and a decimal point.  It must contain
							digits somewhere for it to be valid.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -