From af6ee422a8dc5280a3aa7916c1742ecfdc9a57d7 Mon Sep 17 00:00:00 2001
From: sola.lu <sola.lu@greentest.com.cn>
Date: 周三, 23 4月 2025 18:01:08 +0800
Subject: [PATCH] 1. 添加一些注释

---
 README.md |  137 ++++++++++++++-------------------------------
 1 files changed, 44 insertions(+), 93 deletions(-)

diff --git a/README.md b/README.md
index 47263f3..6ebdca3 100644
--- a/README.md
+++ b/README.md
@@ -1,110 +1,61 @@
 SCPI parser library v2
 ===========
 
-[SCPI](http://en.wikipedia.org/wiki/Standard_Commands_for_Programmable_Instruments) Parser library aims to provide parsing ability of SCPI commands on **instrument side**. All commands are defined by its patterns eg: "STATus:QUEStionable:EVENt?".
+![Build status](https://github.com/j123b567/scpi-parser/actions/workflows/main.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/j123b567/scpi-parser/badge.svg?branch=master&service=github)](https://coveralls.io/github/j123b567/scpi-parser?branch=master)
 
-Source codes are published with open source Simplified BSD license.
+Documentation
+--------
+Documentation is available at [http://j123b567.github.io/scpi-parser](http://j123b567.github.io/scpi-parser).
 
-SCPI parser library is based on these standards
- - [SCPI-99](http://www.ivifoundation.org/docs/scpi-99.pdf)
- - [IEEE 488.2-2004](http://dx.doi.org/10.1109/IEEESTD.2004.95390)
+Examples
+--------
+Library contains several [examples](https://github.com/j123b567/scpi-parser/tree/master/examples) of usage but please note, that this code is just for educational purpose and not production ready.
+Examples are from several contributors and they are not tested and it is also not known, if they really work or can compile at all.
 
+The core library itself is well tested and has more then 93% of the code covered by unit tests and integration tests and tries to be SCPI-99 compliant as much as possible.
 
-[Documentation](http://j123b567.github.io/scpi-parser)
+About
 --------
 
-Usage
----------------
-Download source package or clone repository
- - v2.1 - https://github.com/j123b567/scpi-parser/archive/v2.1.zip
- - v2.0 - https://github.com/j123b567/scpi-parser/archive/v2.0.zip
- - v1.2 - https://github.com/j123b567/scpi-parser/archive/v1.2.zip
- - latest - https://github.com/j123b567/scpi-parser/archive/master.zip
- - git clone https://github.com/j123b567/scpi-parser.git
+[SCPI](http://en.wikipedia.org/wiki/Standard_Commands_for_Programmable_Instruments) Parser library aims to provide parsing ability of SCPI commands on **instrument side**. All commands are defined by its patterns eg: `"STATus:QUEStionable:EVENt?"`.
 
-Library is in folder `libscpi` and you can use it directly in your embedded project.
+Source codes are published with open source BSD 2-Clause License.
 
-You can try to make examples so just run `make`.
+SCPI parser library is based on these standards
 
-In folder `examples` there are several examples using console or TCP connection to emulate SCPI instrument.
+* [SCPI-99](https://www.ivifoundation.org/downloads/SCPI/scpi-99.pdf)
+* [IEEE 488.2-2004](http://dx.doi.org/10.1109/IEEESTD.2004.95390)
 
 
-Version history
-----------------
-Version v2.0 2015-01-18
- - better AVR support
- - implementation of traversal of header tree - it is possible to write `CONF:VOLT:DC 1; AC 2` instead of `CONF:VOLT:DC 1; CONF:VOLT:AC 2`
- - resolve issue with multiple commands with result separated by `;`
- - add support for Multiple Identical Capabilities - e.g. `OUT:FREQ`, `OUT2:FREQ` by pattern `OUTput#:FREQuency`
-
-Version v2.0_beta1 2015-01-18
- - parsing more compliant with SCPI-1999
- - support all parameter types defined in the spec - separate them and identifie them
- - support for Arbitrary program data
- - support for tagging command patterns (useful for common handler)
- - support for extending any parameter type using SCPI_Parameter
- - general support for number or text value (e.g. 1, 6, DEF, INF) not limited to one array of special numbers
- - support for optional command headers (Richard.hmm)
+**SCPI version compliance**
+<table>
+<tr><td>SCPI version<td>v1999.0</tr>
+</table>
 
 
-Version v1.0 released 2013-06-24
- - support basic command pattern matching (no optional keywoards)
- - support basic data types (no expressions, no nondecimal numbers, no arbitrary program data, ...)
- - last version before refactoring of the parser and before extending parameter handling
+**Supported command patterns**
+<table>
+<tr><th>Feature<th>Pattern example</tr>
+<tr><td>Short and long form<td><code>MEASure</code> means <code>MEAS</code> or <code>MEASURE</code> command</tr>
+<tr><td>Common command<td><code>*CLS</code></td>
+<tr><td>Compound command<td><code>CONFigure:VOLTage</code><tr>
+<tr><td>Query command<td><code>MEASure:VOLTage?</code>, <code>*IDN?</code></tr>
+<tr><td>Optional keywords<td><code>MEASure:VOLTage[:DC]?</code></tr>
+<tr><td>Numeric keyword suffix<br>Multiple identical capabilities<td><code>OUTput#:FREQuency</code></tr>
+</table>
 
-
-Command pattern definition
------------
-Command pattern is defined by well known representation from SCPI instruments. Pattern is case insensitive but uses lower and upper case letters to show short and long form of the command.
-
-    Pattern "SYSTem" matches strings "SYST", "syst", "SyStEm", "system", ...
-
-Command pattern is devided by colon ":" to show command hierarchy
-
-    Pattern "SYSTem:VERsion?" mathes strings "SYST:version?", "system:ver?", "SYST:VER?", ...
-
-SCPI standard also uses brackets "[]" to define unnecesery parts of command.
-
-    Pattern "SYSTem:ERRor[:NEXT]?" matches strings  "SYST:ERR?", "system:err?" and also "system:error:next?", ...
-
-
-Command callback
------------
-Command callbac is defined as function with context parameter, e.g.:
-
-```c
-    int DMM_MeasureVoltageDcQ(scpi_context_t * context)
-```
-
-The "Q" at the end of the function name indicates, that this function is Query function (command with "?").
-
-The command callback can use predefined function to parse input parameters and to write output.
-
-Reading input parameter is done by functions `SCPI_ParamInt`, `SCPI_ParamDouble`, `SCPI_ParamString`, `SCPI_ParamNumber`, `SCPI_ParamArbitraryBlock`, `SCPI_ParamCopyText`, `SCPI_ParamBool` and `SCPI_ParamChoice`
-
-Writing output is done by functions `SCPI_ResultInt`, `SCPI_ResultDouble`, `SCPI_ResultString`, `SCPI_ResultText`. You can write multiple output variables. They are automaticcaly separated by coma ",".
-
-Source code organisation
-------------
-
-Source codes are devided into few files to provide better portability to other systems.
-
-- *libscpi/src/parser.c* - provides the core parser library
-- *libscpi/src/lexer.c* - provides identification of keywoards and data types
-- *libscpi/src/error.c* - provides basic error handling (error queue of the instrument)
-- *libscpi/src/ieee488.c* - provides basic implementation of IEEE488.2 mandatory commands
-- *libscpi/src/minimal.c* - provides basic implementation of SCPI mandatory commands
-- *libscpi/src/utils.c* - provides string handling routines and conversion routines
-- *libscpi/src/units.c* - provides handling of special numners (DEF, MIN, MAX, ...) and units
-- *libscpi/src/fifo.c* - provides basic implementation of error queue FIFO
-- *libscpi/src/debug.c* - provides debug functions
-
-- *libscpi/test/* - Unit test for the library
-
-- *examples/test-parser* - is the basic non-interactive demo of the parser
-- *examples/test-interactive* - is the basic interactive demo of the parser
-- *examples/test-tcp* - is the basic interactive tcp server (port 5025)
-- *examples/common* - common examples commands
-
-
-[![travis build](https://travis-ci.org/j123b567/scpi-parser.svg?branch=master)](https://travis-ci.org/j123b567/scpi-parser)
+**Supported parameter types**
+<table>
+<tr><th>Type<th>Example</tr>
+<tr><td>Decimal<td><code>10</code>, <code>10.5</code></tr>
+<tr><td>Decimal with suffix<td><code>-5.5 V</code>, <code>1.5 KOHM</code></tr>
+<tr><td>Hexadecimal<td><code>#HFF</code></tr>
+<tr><td>Octal<td><code>#Q77</code></tr>
+<tr><td>Binary<td><code>#B11</code></tr>
+<tr><td>String<td><code>"text"</code>, <code>'text'</code></tr>
+<tr><td>Arbitrary block<td><code>#12AB</code></tr>
+<tr><td>Program expression<td><code>(1)</code></tr>
+<tr><td>Numeric list<td><code>(1,2:50,80)</code></tr>
+<tr><td>Channel list<td><code>(@1!2:3!4,5!6)</code></tr>
+<tr><td>Character data<td><code>MINimum</code>, <code>DEFault</code>, <code>INFinity</code></tr>
+</table>

--
Gitblit v1.9.1