Changeset 725 for trunk/src/tcl/src/RpEncodeTclInterface.cc
- Timestamp:
- May 10, 2007, 8:00:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tcl/src/RpEncodeTclInterface.cc
r684 r725 78 78 79 79 int 80 RpTclEncodingIs ( ClientData cdata, 81 Tcl_Interp *interp, 82 int objc, 83 Tcl_Obj *const objv[] ) 80 RpTclEncodingIs (ClientData cdata, Tcl_Interp *interp, 81 int objc, Tcl_Obj *const objv[]) 84 82 { 85 const char* type = NULL; // type of data being checked86 const char* buf = NULL; // buffer to be checked87 const char* cmdName = NULL;88 89 int typeLen = 0;90 int bufLen = 0; // length of user provided buffer91 int nextarg = 0; // next argument92 93 83 Tcl_ResetResult(interp); 94 95 cmdName = Tcl_GetString(objv[nextarg++]);96 84 97 85 // parse through command line options … … 99 87 Tcl_AppendResult(interp, 100 88 "wrong # args: should be \"", 101 cmdName," binary <string>\"",89 Tcl_GetString(objv[0])," binary <string>\"", 102 90 (char*)NULL); 103 91 return TCL_ERROR; 104 92 } 105 93 106 type = Tcl_GetStringFromObj(objv[nextarg++],&typeLen); 107 buf = Tcl_GetStringFromObj(objv[nextarg++],&bufLen); 108 109 if (strncmp(type,"binary",typeLen) == 0) { 94 const char *type = Tcl_GetString(objv[1]); 95 96 int bufLen; 97 const char *buf = (const char*) Tcl_GetByteArrayFromObj(objv[2],&bufLen); 98 99 if (strcmp(type,"binary") == 0) { 110 100 if (Rappture::encoding::isbinary(buf,bufLen) != 0) { 111 101 // non-ascii character found, return yes 112 Tcl_AppendResult(interp, "yes",(char*)NULL); 113 return TCL_OK; 102 Tcl_AppendResult(interp, "yes", (char*)NULL); 103 } else { 104 Tcl_AppendResult(interp, "no",(char*)NULL); 114 105 } 115 } 116 else { 117 Tcl_AppendResult(interp, "bad option \"", type, 118 "\": should be binary", 119 (char*)NULL); 120 return TCL_ERROR; 121 122 } 123 124 // default return 125 // no binary characters found, return no 126 Tcl_AppendResult(interp, "no",(char*)NULL); 127 return TCL_OK; 106 return TCL_OK; 107 } 108 Tcl_AppendResult(interp, "bad option \"", type, 109 "\": should be binary", 110 (char*)NULL); 111 return TCL_ERROR; 128 112 } 129 113
Note: See TracChangeset
for help on using the changeset viewer.