|
2023-03-02
| ||
| 06:56 | • Closed ticket [e778e3f804]: Parsing of "profile" for TIP #656 plus... artifact: a6ba5598e2 user: apnadkarni | |
| 06:41 | Bug [e778e3f804]. Fix error message for invalid profile name. check-in: f9e3e55bb8 user: apnadkarni tags: tip-656 | |
| 06:29 | Bug [e778e3f804]. Fix error message for invalid profile name. check-in: 80abdf9c7d user: apnadkarni tags: tip-656-tcl9 | |
|
2023-02-28
| ||
| 16:57 | • Ticket [e778e3f804] Parsing of "profile" for TIP #656 status still... artifact: e0f953f179 user: apnadkarni | |
| 16:14 | • Ticket [e778e3f804]: 3 changes artifact: 649791577d user: jan.nijtmans | |
| 16:11 | • Ticket [e778e3f804]: 3 changes artifact: dea4ef226d user: jan.nijtmans | |
| 16:08 | Proposed fix for [e778e3f804]: Parsing of "profile" for TIP #656 leaf check-in: 82377ce539 user: jan.nijtmans tags: bug-e778e3f804 | |
| 16:06 | • New ticket [e778e3f804] Parsing of "profile" for TIP #656. artifact: 7e739b04f1 user: jan.nijtmans | |
Parsing of "profile" for TIP #656
Closed / Fixede778e3f804cacd70deefcdf5ed5d1f8921f32ab1Created 4 years agoUpdated 4 years ago
Descriptionwiki2023-02-28 16:06:40
Some examples:
% fconfigure stdin -encodingprofile xx
bad profile "xx". Must be "tcl8" or "strict".
% fconfigure stdin -translation xx
bad value for -translation: must be one of auto, binary, cr, lf, crlf, or platform
Looking at consistancy, I would expect "bad value for -encodingprofile: must be one of replace, strict, or tcl8". "replace" was missing, and options should be alphabetical.
Same for "encoding convertfrom/convertto"
% encoding convertfrom -profile xx ascii é
bad profile "xx". Must be "tcl8" or "strict".
Looking at the implementation, there's a special function `TclEncodingProfileNameToId()` which does the parsing. Suggestion, use the standard Tcl function `Tcl_GetIndexFromObjStruct()` in stead, wherever possible. This function handles all those minor details.
Referenced by3
f9e3e55bb8Bug [e778e3f804]. Fix error message for invalid profile name. check-in2023-03-02 06:41:3980abdf9c7dBug [e778e3f804]. Fix error message for invalid profile name. check-in2023-03-02 06:29:1082377ce539Proposed fix for [e778e3f804]: Parsing of "profile" for TIP #656 check-in2023-02-28 16:08:13
jan.nijtmanswiki2023-02-28 16:11:20
Another advantage of using `Tcl_GetIndexFromObjStruct()`: The Tcl_Obj is converted to an "index" objType, which cashes the internal id.
Proposed fix: [here]
jan.nijtmans Ticket [e778e3f804]: 3 changes
[History diff]2023-02-28 16:14:59
apnadkarniplain2023-02-28 16:57:09
I'll fix the missing "replace" and alphabetical order. I didn't use Tcl_GetIndexFromObjStruct specifically because it cannot be used from the configure which only has a string and not a Tcl_Obj. Allocating a Tcl_Obj just to call Tcl_GetIndexFromObjStruct did not seem like a good trade-off. I was not in favour of using Tcl_GetIndexFromObjStruct in one place and then using an inline loop (much less readable imo) in the configure code as you have done for essentially the same function. I much prefer code for a specific purpose to be encapsulated into a single function. Thanks for the feedback. /Ashok
apnadkarniplain2023-03-02 06:56:26
Fixed in [f9e3e55bb8] and [80abdf9c7d] respectively for tip-656 and tip-656-tcl9
Log in (anonymous is fine) to add a comment.