Rt-thread finsh Source Analysis: FINSH_ERROR.C

Source: Internet
Author: User

/* *  error number for finsh shell. * * copyright  (C)  2013, shanghai real-thread technology co., ltd * *  this  file is part of RT-Thread  (http://www.rt-thread.org)  *   Maintainer: bernard.xiong <bernard.xiong at gmail.com> * *  all  rights reserved. * *  This program is free software;  you can redistribute it and/or modify *  it under the  terms of the gnu general public license as published by *   the free software foundation; either version 2 of the  License, or *   (at your option)  any later version. *  *  this program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied  warranty of *  merchantability or fitness for a particular  purpose.  see the *  gnu general public license for  More details. * *  you should have received a copy of  the GNU General Public License along *  with this  Program; if not, write to the free software foundation, inc.,  *  51 franklin street, fifth floor, boston, ma 02110-1301  USA. * * Change Logs: * Date            author       notes * 2010-03-22     bernard       first version */#include   "Finsh_error.h" u_char global_errno;   //static global variable, error code//error type corresponding to the string static const char * finsh_error_string_table[] ={      "No error", "Invalid token", "Expect a type", "Unknown type", "Variable  exist "," Expect a operater "," Memory full "," Unknown operator "," Unknown node "," Expect a character "," Unexpect end "," Unknown token "," float not supported "," Unknown symbol "," Null node "};//error code initialization int finsh_error_init () {Global_errno = finsh_ error_ok;return 0;} Set error code Int finsh_error_set (u_char type) {global_errno = type;return 0;} Get error code U_char finsh_errno () {Return global_errno;} Error string returned by error code const char* finsh_error_string (u_char&nbsP;type) {Return finsh_error_string_table[type];} 


This article is from the "mountain Ask the Boy" blog, please be sure to keep this source http://linpeng.blog.51cto.com/9779987/1685378

Rt-thread finsh Source Analysis: FINSH_ERROR.C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.