Check-in [dd1264525a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge with trunk
Timelines: family | ancestors | descendants | both | wtf-8-experiment
Files: files | file ages | folders
SHA1: dd1264525aa17dd58a7a5d3308133a2e06c7df7e
User & Date: chw 2020-01-04 21:00:49
Context
2020-01-05
20:01
merge with trunk check-in: f0053670cc user: chw tags: wtf-8-experiment
2020-01-04
21:00
merge with trunk check-in: dd1264525a user: chw tags: wtf-8-experiment
21:00
fixes in Rtcl package check-in: b5d9a94913 user: chw tags: trunk
13:51
merge with trunk check-in: fd397ed4aa user: chw tags: wtf-8-experiment
Changes

Changes to jni/tcl/library/encoding/tis-620.enc.

Changes to jni/tcl/tests/encoding.test.

661
662
663
664
665
666
667















668
669
670
671
672
673
674
675
676
677
678
679
    encoding dirs ? ?
} -result {wrong # args: should be "encoding dirs ?dirList?"}
test encoding-27.2 {encoding dirs basic behavior} -returnCodes error -body {
    encoding dirs "\{not a list"
} -result "expected directory list but got \"\{not a list\""

}















runtests

}

# cleanup
namespace delete ::tcl::test::encoding
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
    encoding dirs ? ?
} -result {wrong # args: should be "encoding dirs ?dirList?"}
test encoding-27.2 {encoding dirs basic behavior} -returnCodes error -body {
    encoding dirs "\{not a list"
} -result "expected directory list but got \"\{not a list\""

}


test encoding-28.0 {all encodings load} -body {
    set string hello
    foreach name [encoding names] {
	incr count
	encoding convertto $name $string

	# discard the cached internal representation of Tcl_Encoding
	# Unfortunately, without this, encoding 2-1 fails.  
	llength $name
    }
    return $count
} -result 81

runtests

}

# cleanup
namespace delete ::tcl::test::encoding
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End:

Changes to undroid/Rtcl/generic/rtcl.c.

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466




467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499

500
501
502
503
504
505
506
...
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
...
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
    str = Tcl_GetStringFromObj(objv[i+offset], &l);
    str = Tcl_UtfToExternalDString(NULL, str, l, &ds);
    SET_STRING_ELT(text, i, Rf_mkChar(str));
    Tcl_DStringFree(&ds);
  }

  /* Parse it */
  Rf_protect(exp = R_ParseVector(text, -1, &status, R_NilValue));

  if (status != PARSE_OK) {
    Rf_unprotect(2);
    Tcl_SetResult(interp, "R parse error", TCL_STATIC);
    return TCL_ERROR;
  }

  /* Evaluate it */




  val = R_tryEval(VECTOR_ELT(exp, 0), R_GlobalEnv, &evalError);

  if (evalError) {
    Rf_unprotect(2);

    /* Retrieve error message from R */
    Rf_protect(geterr = Rf_lang1(Rf_install("geterrmessage")));
    err = R_tryEval(geterr, R_GlobalEnv, &evalError);
    Rf_unprotect(1);

    errmsg = (char *) CHAR(STRING_ELT(err, 0));
    errmsg = Tcl_ExternalToUtfDString(NULL, errmsg, -1, &ds);
    str = errmsg + Tcl_DStringLength(&ds);
    while (str > errmsg) {
      --str;
      if (*str == '\n') {
	*str = '\0';
      }
    }
    Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
    Tcl_DStringFree(&ds);

    return TCL_ERROR;
  } else {
    if (verbose) {
      Rf_PrintValue(val);
    }
  }

  l = Rf_length(exp);

  for (i = 0; i < l; i++) {
    *s = Rf_eval(VECTOR_ELT(exp, i), R_GlobalEnv);

  }

  Rf_unprotect(2);
  return TCL_OK;
}

/*
................................................................................
  if (pathObj == NULL) {
    return TCL_ERROR;
  }
  Tcl_IncrRefCount(pathObj);
  str = Tcl_GetStringFromObj(pathObj, &offset);
  str = Tcl_UtfToExternalDString(NULL, str, offset, &ds);
  Tcl_DecrRefCount(pathObj);
  Rf_protect(exp = Rf_lang2(Rf_install("source"), Rf_mkString(str)));
  Tcl_DStringFree(&ds);
  val = R_tryEval(exp, R_GlobalEnv, &evalError);

  if (evalError) {
    Rf_unprotect(1);

    /* Retrieve error message from R */
    Rf_protect(geterr = Rf_lang1(Rf_install("geterrmessage")));
    err = R_tryEval(geterr, R_GlobalEnv, &evalError);
    Rf_unprotect(1);

    errmsg = (char *) CHAR(STRING_ELT(err, 0));
    errmsg = Tcl_ExternalToUtfDString(NULL, errmsg, -1, &ds);
    str = errmsg + Tcl_DStringLength(&ds);
    while (str > errmsg) {
................................................................................
	*str = '\0';
      }
    }
    Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
    Tcl_DStringFree(&ds);

    return TCL_ERROR;
  } else {
    if (verbose) {
      Rf_PrintValue(val);
    }
  }

  Rf_unprotect(1);
  return TCL_OK;
}

/*







|








>
>
>
>
|

|
|

|
|
|
|

|
|
|
|
|
|
|
|
|
|
|

|
<
|


<
<
<
<
<
<
>







 







|







|







 







<
|
|
<







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493

494
495
496






497
498
499
500
501
502
503
504
...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
...
621
622
623
624
625
626
627

628
629

630
631
632
633
634
635
636
    str = Tcl_GetStringFromObj(objv[i+offset], &l);
    str = Tcl_UtfToExternalDString(NULL, str, l, &ds);
    SET_STRING_ELT(text, i, Rf_mkChar(str));
    Tcl_DStringFree(&ds);
  }

  /* Parse it */
  exp = Rf_protect(R_ParseVector(text, -1, &status, R_NilValue));

  if (status != PARSE_OK) {
    Rf_unprotect(2);
    Tcl_SetResult(interp, "R parse error", TCL_STATIC);
    return TCL_ERROR;
  }

  /* Evaluate it */
  l = Rf_length(exp);
  *s = R_NilValue;

  for (i = 0; i < l; i++) {
    val = R_tryEval(VECTOR_ELT(exp, 0), R_GlobalEnv, &evalError);

    if (evalError) {
      Rf_unprotect(2);

      /* Retrieve error message from R */
      geterr = Rf_protect(Rf_lang1(Rf_install("geterrmessage")));
      err = R_tryEval(geterr, R_GlobalEnv, &evalError);
      Rf_unprotect(1);

      errmsg = (char *) CHAR(STRING_ELT(err, 0));
      errmsg = Tcl_ExternalToUtfDString(NULL, errmsg, -1, &ds);
      str = errmsg + Tcl_DStringLength(&ds);
      while (str > errmsg) {
	--str;
	if (*str == '\n') {
	  *str = '\0';
	}
      }
      Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
      Tcl_DStringFree(&ds);

      return TCL_ERROR;

    } else if (verbose) {
      Rf_PrintValue(val);
    }






    *s = val;
  }

  Rf_unprotect(2);
  return TCL_OK;
}

/*
................................................................................
  if (pathObj == NULL) {
    return TCL_ERROR;
  }
  Tcl_IncrRefCount(pathObj);
  str = Tcl_GetStringFromObj(pathObj, &offset);
  str = Tcl_UtfToExternalDString(NULL, str, offset, &ds);
  Tcl_DecrRefCount(pathObj);
  exp = Rf_protect(Rf_lang2(Rf_install("source"), Rf_mkString(str)));
  Tcl_DStringFree(&ds);
  val = R_tryEval(exp, R_GlobalEnv, &evalError);

  if (evalError) {
    Rf_unprotect(1);

    /* Retrieve error message from R */
    geterr = Rf_protect(Rf_lang1(Rf_install("geterrmessage")));
    err = R_tryEval(geterr, R_GlobalEnv, &evalError);
    Rf_unprotect(1);

    errmsg = (char *) CHAR(STRING_ELT(err, 0));
    errmsg = Tcl_ExternalToUtfDString(NULL, errmsg, -1, &ds);
    str = errmsg + Tcl_DStringLength(&ds);
    while (str > errmsg) {
................................................................................
	*str = '\0';
      }
    }
    Tcl_SetResult(interp, errmsg, TCL_VOLATILE);
    Tcl_DStringFree(&ds);

    return TCL_ERROR;

  } else if (verbose) {
    Rf_PrintValue(val);

  }

  Rf_unprotect(1);
  return TCL_OK;
}

/*