OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" | 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" |
8 | 8 |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } else { | 308 } else { |
309 FX_DOUBLE dValue = HValueToDouble(hThis, argOne); | 309 FX_DOUBLE dValue = HValueToDouble(hThis, argOne); |
310 if (dValue < 0) { | 310 if (dValue < 0) { |
311 dValue = -dValue; | 311 dValue = -dValue; |
312 } | 312 } |
313 FXJSE_Value_SetDouble(args.GetReturnValue(), dValue); | 313 FXJSE_Value_SetDouble(args.GetReturnValue(), dValue); |
314 } | 314 } |
315 FXJSE_Value_Release(argOne); | 315 FXJSE_Value_Release(argOne); |
316 } else { | 316 } else { |
317 CXFA_FM2JSContext* pContext = | 317 CXFA_FM2JSContext* pContext = |
318 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 318 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
319 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 319 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
320 L"Abs"); | 320 L"Abs"); |
321 } | 321 } |
322 } | 322 } |
323 void CXFA_FM2JSContext::Avg(FXJSE_HOBJECT hThis, | 323 void CXFA_FM2JSContext::Avg(FXJSE_HOBJECT hThis, |
324 const CFX_ByteStringC& szFuncName, | 324 const CFX_ByteStringC& szFuncName, |
325 CFXJSE_Arguments& args) { | 325 CFXJSE_Arguments& args) { |
326 CXFA_FM2JSContext* pContext = | 326 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
327 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
328 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 327 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
329 int32_t argc = args.GetLength(); | 328 int32_t argc = args.GetLength(); |
330 uint32_t uCount = 0; | 329 uint32_t uCount = 0; |
331 FX_DOUBLE dSum = 0.0; | 330 FX_DOUBLE dSum = 0.0; |
332 if (argc >= 1) { | 331 if (argc >= 1) { |
333 FXJSE_HVALUE argValue = 0; | 332 FXJSE_HVALUE argValue = 0; |
334 for (int32_t i = 0; i < argc; i++) { | 333 for (int32_t i = 0; i < argc; i++) { |
335 argValue = args.GetValue(i); | 334 argValue = args.GetValue(i); |
336 if (FXJSE_Value_IsNull(argValue)) { | 335 if (FXJSE_Value_IsNull(argValue)) { |
337 FXJSE_Value_Release(argValue); | 336 FXJSE_Value_Release(argValue); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } | 383 } |
385 if (0 == uCount) { | 384 if (0 == uCount) { |
386 FXJSE_Value_SetNull(args.GetReturnValue()); | 385 FXJSE_Value_SetNull(args.GetReturnValue()); |
387 } else { | 386 } else { |
388 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum / uCount); | 387 FXJSE_Value_SetDouble(args.GetReturnValue(), dSum / uCount); |
389 } | 388 } |
390 } | 389 } |
391 void CXFA_FM2JSContext::Ceil(FXJSE_HOBJECT hThis, | 390 void CXFA_FM2JSContext::Ceil(FXJSE_HOBJECT hThis, |
392 const CFX_ByteStringC& szFuncName, | 391 const CFX_ByteStringC& szFuncName, |
393 CFXJSE_Arguments& args) { | 392 CFXJSE_Arguments& args) { |
394 CXFA_FM2JSContext* pContext = | 393 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
395 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
396 if (args.GetLength() == 1) { | 394 if (args.GetLength() == 1) { |
397 FXJSE_HVALUE argValue = GetSimpleHValue(hThis, args, 0); | 395 FXJSE_HVALUE argValue = GetSimpleHValue(hThis, args, 0); |
398 if (HValueIsNull(hThis, argValue)) { | 396 if (HValueIsNull(hThis, argValue)) { |
399 FXJSE_Value_SetNull(args.GetReturnValue()); | 397 FXJSE_Value_SetNull(args.GetReturnValue()); |
400 } else { | 398 } else { |
401 FXJSE_Value_SetFloat(args.GetReturnValue(), | 399 FXJSE_Value_SetFloat(args.GetReturnValue(), |
402 FXSYS_ceil(HValueToFloat(hThis, argValue))); | 400 FXSYS_ceil(HValueToFloat(hThis, argValue))); |
403 } | 401 } |
404 FXJSE_Value_Release(argValue); | 402 FXJSE_Value_Release(argValue); |
405 } else { | 403 } else { |
406 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 404 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
407 L"Ceil"); | 405 L"Ceil"); |
408 } | 406 } |
409 } | 407 } |
410 void CXFA_FM2JSContext::Count(FXJSE_HOBJECT hThis, | 408 void CXFA_FM2JSContext::Count(FXJSE_HOBJECT hThis, |
411 const CFX_ByteStringC& szFuncName, | 409 const CFX_ByteStringC& szFuncName, |
412 CFXJSE_Arguments& args) { | 410 CFXJSE_Arguments& args) { |
413 CXFA_FM2JSContext* pContext = | 411 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
414 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
415 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 412 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
416 int32_t argc = args.GetLength(); | 413 int32_t argc = args.GetLength(); |
417 uint32_t uCount = 0; | 414 uint32_t uCount = 0; |
418 FXJSE_HVALUE argValue = 0; | 415 FXJSE_HVALUE argValue = 0; |
419 for (int32_t i = 0; i < argc; i++) { | 416 for (int32_t i = 0; i < argc; i++) { |
420 argValue = args.GetValue(i); | 417 argValue = args.GetValue(i); |
421 if (FXJSE_Value_IsNull(argValue)) { | 418 if (FXJSE_Value_IsNull(argValue)) { |
422 FXJSE_Value_Release(argValue); | 419 FXJSE_Value_Release(argValue); |
423 continue; | 420 continue; |
424 } else if (FXJSE_Value_IsArray(argValue)) { | 421 } else if (FXJSE_Value_IsArray(argValue)) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 uCount++; | 464 uCount++; |
468 } | 465 } |
469 FXJSE_Value_Release(argValue); | 466 FXJSE_Value_Release(argValue); |
470 } | 467 } |
471 argValue = 0; | 468 argValue = 0; |
472 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)uCount); | 469 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)uCount); |
473 } | 470 } |
474 void CXFA_FM2JSContext::Floor(FXJSE_HOBJECT hThis, | 471 void CXFA_FM2JSContext::Floor(FXJSE_HOBJECT hThis, |
475 const CFX_ByteStringC& szFuncName, | 472 const CFX_ByteStringC& szFuncName, |
476 CFXJSE_Arguments& args) { | 473 CFXJSE_Arguments& args) { |
477 CXFA_FM2JSContext* pContext = | 474 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
478 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
479 if (args.GetLength() == 1) { | 475 if (args.GetLength() == 1) { |
480 FXJSE_HVALUE argValue = GetSimpleHValue(hThis, args, 0); | 476 FXJSE_HVALUE argValue = GetSimpleHValue(hThis, args, 0); |
481 if (HValueIsNull(hThis, argValue)) { | 477 if (HValueIsNull(hThis, argValue)) { |
482 FXJSE_Value_SetNull(args.GetReturnValue()); | 478 FXJSE_Value_SetNull(args.GetReturnValue()); |
483 } else { | 479 } else { |
484 FXJSE_Value_SetFloat(args.GetReturnValue(), | 480 FXJSE_Value_SetFloat(args.GetReturnValue(), |
485 FXSYS_floor(HValueToFloat(hThis, argValue))); | 481 FXSYS_floor(HValueToFloat(hThis, argValue))); |
486 } | 482 } |
487 FXJSE_Value_Release(argValue); | 483 FXJSE_Value_Release(argValue); |
488 } else { | 484 } else { |
489 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 485 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
490 L"Floor"); | 486 L"Floor"); |
491 } | 487 } |
492 } | 488 } |
493 void CXFA_FM2JSContext::Max(FXJSE_HOBJECT hThis, | 489 void CXFA_FM2JSContext::Max(FXJSE_HOBJECT hThis, |
494 const CFX_ByteStringC& szFuncName, | 490 const CFX_ByteStringC& szFuncName, |
495 CFXJSE_Arguments& args) { | 491 CFXJSE_Arguments& args) { |
496 CXFA_FM2JSContext* pContext = | 492 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
497 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
498 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 493 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
499 int32_t argc = args.GetLength(); | 494 int32_t argc = args.GetLength(); |
500 uint32_t uCount = 0; | 495 uint32_t uCount = 0; |
501 FX_DOUBLE dMaxValue = 0.0; | 496 FX_DOUBLE dMaxValue = 0.0; |
502 FXJSE_HVALUE argValue = 0; | 497 FXJSE_HVALUE argValue = 0; |
503 for (int32_t i = 0; i < argc; i++) { | 498 for (int32_t i = 0; i < argc; i++) { |
504 argValue = args.GetValue(i); | 499 argValue = args.GetValue(i); |
505 if (FXJSE_Value_IsNull(argValue)) { | 500 if (FXJSE_Value_IsNull(argValue)) { |
506 FXJSE_Value_Release(argValue); | 501 FXJSE_Value_Release(argValue); |
507 continue; | 502 continue; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 argValue = 0; | 584 argValue = 0; |
590 if (uCount) { | 585 if (uCount) { |
591 FXJSE_Value_SetDouble(args.GetReturnValue(), dMaxValue); | 586 FXJSE_Value_SetDouble(args.GetReturnValue(), dMaxValue); |
592 } else { | 587 } else { |
593 FXJSE_Value_SetNull(args.GetReturnValue()); | 588 FXJSE_Value_SetNull(args.GetReturnValue()); |
594 } | 589 } |
595 } | 590 } |
596 void CXFA_FM2JSContext::Min(FXJSE_HOBJECT hThis, | 591 void CXFA_FM2JSContext::Min(FXJSE_HOBJECT hThis, |
597 const CFX_ByteStringC& szFuncName, | 592 const CFX_ByteStringC& szFuncName, |
598 CFXJSE_Arguments& args) { | 593 CFXJSE_Arguments& args) { |
599 CXFA_FM2JSContext* pContext = | 594 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
600 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
601 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 595 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
602 int32_t argc = args.GetLength(); | 596 int32_t argc = args.GetLength(); |
603 uint32_t uCount = 0; | 597 uint32_t uCount = 0; |
604 FX_DOUBLE dMinValue = 0.0; | 598 FX_DOUBLE dMinValue = 0.0; |
605 FXJSE_HVALUE argValue = 0; | 599 FXJSE_HVALUE argValue = 0; |
606 for (int32_t i = 0; i < argc; i++) { | 600 for (int32_t i = 0; i < argc; i++) { |
607 argValue = args.GetValue(i); | 601 argValue = args.GetValue(i); |
608 if (FXJSE_Value_IsNull(argValue)) { | 602 if (FXJSE_Value_IsNull(argValue)) { |
609 FXJSE_Value_Release(argValue); | 603 FXJSE_Value_Release(argValue); |
610 continue; | 604 continue; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 argValue = 0; | 686 argValue = 0; |
693 if (uCount) { | 687 if (uCount) { |
694 FXJSE_Value_SetDouble(args.GetReturnValue(), dMinValue); | 688 FXJSE_Value_SetDouble(args.GetReturnValue(), dMinValue); |
695 } else { | 689 } else { |
696 FXJSE_Value_SetNull(args.GetReturnValue()); | 690 FXJSE_Value_SetNull(args.GetReturnValue()); |
697 } | 691 } |
698 } | 692 } |
699 void CXFA_FM2JSContext::Mod(FXJSE_HOBJECT hThis, | 693 void CXFA_FM2JSContext::Mod(FXJSE_HOBJECT hThis, |
700 const CFX_ByteStringC& szFuncName, | 694 const CFX_ByteStringC& szFuncName, |
701 CFXJSE_Arguments& args) { | 695 CFXJSE_Arguments& args) { |
702 CXFA_FM2JSContext* pContext = | 696 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
703 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
704 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 697 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
705 if (args.GetLength() == 2) { | 698 if (args.GetLength() == 2) { |
706 FXJSE_HVALUE argOne = args.GetValue(0); | 699 FXJSE_HVALUE argOne = args.GetValue(0); |
707 FXJSE_HVALUE argTwo = args.GetValue(1); | 700 FXJSE_HVALUE argTwo = args.GetValue(1); |
708 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { | 701 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { |
709 FXJSE_Value_SetNull(args.GetReturnValue()); | 702 FXJSE_Value_SetNull(args.GetReturnValue()); |
710 } else { | 703 } else { |
711 FX_DOUBLE dDividend = 0.0; | 704 FX_DOUBLE dDividend = 0.0; |
712 FX_DOUBLE dDividor = 0.0; | 705 FX_DOUBLE dDividor = 0.0; |
713 if (FXJSE_Value_IsArray(argOne)) { | 706 if (FXJSE_Value_IsArray(argOne)) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 FXJSE_Value_Release(argOne); | 772 FXJSE_Value_Release(argOne); |
780 FXJSE_Value_Release(argTwo); | 773 FXJSE_Value_Release(argTwo); |
781 } else { | 774 } else { |
782 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 775 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
783 L"Mod"); | 776 L"Mod"); |
784 } | 777 } |
785 } | 778 } |
786 void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis, | 779 void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis, |
787 const CFX_ByteStringC& szFuncName, | 780 const CFX_ByteStringC& szFuncName, |
788 CFXJSE_Arguments& args) { | 781 CFXJSE_Arguments& args) { |
789 CXFA_FM2JSContext* pContext = | 782 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
790 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
791 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 783 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
792 int32_t argc = args.GetLength(); | 784 int32_t argc = args.GetLength(); |
793 uint8_t uPrecision = 0; | 785 uint8_t uPrecision = 0; |
794 if (argc == 1) { | 786 if (argc == 1) { |
795 FXJSE_HVALUE argOne = args.GetValue(0); | 787 FXJSE_HVALUE argOne = args.GetValue(0); |
796 if (FXJSE_Value_IsNull(argOne)) { | 788 if (FXJSE_Value_IsNull(argOne)) { |
797 FXJSE_Value_SetNull(args.GetReturnValue()); | 789 FXJSE_Value_SetNull(args.GetReturnValue()); |
798 } else { | 790 } else { |
799 FX_DOUBLE dValue = 0.0; | 791 FX_DOUBLE dValue = 0.0; |
800 if (FXJSE_Value_IsArray(argOne)) { | 792 if (FXJSE_Value_IsArray(argOne)) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 FXJSE_Value_Release(argOne); | 881 FXJSE_Value_Release(argOne); |
890 FXJSE_Value_Release(argTwo); | 882 FXJSE_Value_Release(argTwo); |
891 } else { | 883 } else { |
892 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 884 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
893 L"Round"); | 885 L"Round"); |
894 } | 886 } |
895 } | 887 } |
896 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, | 888 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, |
897 const CFX_ByteStringC& szFuncName, | 889 const CFX_ByteStringC& szFuncName, |
898 CFXJSE_Arguments& args) { | 890 CFXJSE_Arguments& args) { |
899 CXFA_FM2JSContext* pContext = | 891 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
900 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
901 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 892 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
902 int32_t argc = args.GetLength(); | 893 int32_t argc = args.GetLength(); |
903 uint32_t uCount = 0; | 894 uint32_t uCount = 0; |
904 FX_DOUBLE dSum = 0.0; | 895 FX_DOUBLE dSum = 0.0; |
905 if (argc) { | 896 if (argc) { |
906 FXJSE_HVALUE argValue = 0; | 897 FXJSE_HVALUE argValue = 0; |
907 for (int32_t i = 0; i < argc; i++) { | 898 for (int32_t i = 0; i < argc; i++) { |
908 argValue = args.GetValue(i); | 899 argValue = args.GetValue(i); |
909 if (FXJSE_Value_IsNull(argValue)) { | 900 if (FXJSE_Value_IsNull(argValue)) { |
910 FXJSE_Value_Release(argValue); | 901 FXJSE_Value_Release(argValue); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 CFX_ByteString bufferMon; | 972 CFX_ByteString bufferMon; |
982 CFX_ByteString bufferDay; | 973 CFX_ByteString bufferDay; |
983 bufferYear.Format("%d", pTmStruct->tm_year + 1900); | 974 bufferYear.Format("%d", pTmStruct->tm_year + 1900); |
984 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); | 975 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); |
985 bufferDay.Format("%02d", pTmStruct->tm_mday); | 976 bufferDay.Format("%02d", pTmStruct->tm_mday); |
986 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; | 977 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; |
987 int32_t dDays = DateString2Num(bufferCurrent.AsStringC()); | 978 int32_t dDays = DateString2Num(bufferCurrent.AsStringC()); |
988 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); | 979 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); |
989 } else { | 980 } else { |
990 CXFA_FM2JSContext* pContext = | 981 CXFA_FM2JSContext* pContext = |
991 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 982 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
992 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 983 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
993 L"Date"); | 984 L"Date"); |
994 } | 985 } |
995 } | 986 } |
996 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, | 987 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, |
997 const CFX_ByteStringC& szFuncName, | 988 const CFX_ByteStringC& szFuncName, |
998 CFXJSE_Arguments& args) { | 989 CFXJSE_Arguments& args) { |
999 int32_t argc = args.GetLength(); | 990 int32_t argc = args.GetLength(); |
1000 if ((argc > 0) && (argc < 4)) { | 991 if ((argc > 0) && (argc < 4)) { |
1001 FX_BOOL bFlags = FALSE; | 992 FX_BOOL bFlags = FALSE; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 } | 1033 } |
1043 FXJSE_Value_Release(dateValue); | 1034 FXJSE_Value_Release(dateValue); |
1044 if (argc > 1) { | 1035 if (argc > 1) { |
1045 FXJSE_Value_Release(formatValue); | 1036 FXJSE_Value_Release(formatValue); |
1046 if (argc == 3) { | 1037 if (argc == 3) { |
1047 FXJSE_Value_Release(localValue); | 1038 FXJSE_Value_Release(localValue); |
1048 } | 1039 } |
1049 } | 1040 } |
1050 } else { | 1041 } else { |
1051 CXFA_FM2JSContext* pContext = | 1042 CXFA_FM2JSContext* pContext = |
1052 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1043 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1053 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1044 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1054 L"Date2Num"); | 1045 L"Date2Num"); |
1055 } | 1046 } |
1056 } | 1047 } |
1057 void CXFA_FM2JSContext::DateFmt(FXJSE_HOBJECT hThis, | 1048 void CXFA_FM2JSContext::DateFmt(FXJSE_HOBJECT hThis, |
1058 const CFX_ByteStringC& szFuncName, | 1049 const CFX_ByteStringC& szFuncName, |
1059 CFXJSE_Arguments& args) { | 1050 CFXJSE_Arguments& args) { |
1060 int32_t argc = args.GetLength(); | 1051 int32_t argc = args.GetLength(); |
1061 if (argc < 3) { | 1052 if (argc < 3) { |
1062 FX_BOOL bFlags = FALSE; | 1053 FX_BOOL bFlags = FALSE; |
(...skipping 30 matching lines...) Expand all Loading... |
1093 FXJSE_Value_SetNull(args.GetReturnValue()); | 1084 FXJSE_Value_SetNull(args.GetReturnValue()); |
1094 } | 1085 } |
1095 if (argc > 0) { | 1086 if (argc > 0) { |
1096 FXJSE_Value_Release(argStyle); | 1087 FXJSE_Value_Release(argStyle); |
1097 if (argc == 2) { | 1088 if (argc == 2) { |
1098 FXJSE_Value_Release(argLocal); | 1089 FXJSE_Value_Release(argLocal); |
1099 } | 1090 } |
1100 } | 1091 } |
1101 } else { | 1092 } else { |
1102 CXFA_FM2JSContext* pContext = | 1093 CXFA_FM2JSContext* pContext = |
1103 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1094 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1104 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1095 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1105 L"Date2Num"); | 1096 L"Date2Num"); |
1106 } | 1097 } |
1107 } | 1098 } |
1108 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, | 1099 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, |
1109 const CFX_ByteStringC& szFuncName, | 1100 const CFX_ByteStringC& szFuncName, |
1110 CFXJSE_Arguments& args) { | 1101 CFXJSE_Arguments& args) { |
1111 if (args.GetLength() == 1) { | 1102 if (args.GetLength() == 1) { |
1112 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 1103 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
1113 if (FXJSE_Value_IsNull(argOne)) { | 1104 if (FXJSE_Value_IsNull(argOne)) { |
1114 FXJSE_Value_SetNull(args.GetReturnValue()); | 1105 FXJSE_Value_SetNull(args.GetReturnValue()); |
1115 } else { | 1106 } else { |
1116 CFX_ByteString szArgString; | 1107 CFX_ByteString szArgString; |
1117 HValueToUTF8String(argOne, szArgString); | 1108 HValueToUTF8String(argOne, szArgString); |
1118 int32_t dDays = DateString2Num(szArgString.AsStringC()); | 1109 int32_t dDays = DateString2Num(szArgString.AsStringC()); |
1119 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); | 1110 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); |
1120 } | 1111 } |
1121 FXJSE_Value_Release(argOne); | 1112 FXJSE_Value_Release(argOne); |
1122 } else { | 1113 } else { |
1123 CXFA_FM2JSContext* pContext = | 1114 CXFA_FM2JSContext* pContext = |
1124 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1115 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1125 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1116 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1126 L"IsoDate2Num"); | 1117 L"IsoDate2Num"); |
1127 } | 1118 } |
1128 } | 1119 } |
1129 void CXFA_FM2JSContext::IsoTime2Num(FXJSE_HOBJECT hThis, | 1120 void CXFA_FM2JSContext::IsoTime2Num(FXJSE_HOBJECT hThis, |
1130 const CFX_ByteStringC& szFuncName, | 1121 const CFX_ByteStringC& szFuncName, |
1131 CFXJSE_Arguments& args) { | 1122 CFXJSE_Arguments& args) { |
1132 CXFA_FM2JSContext* pContext = | 1123 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1133 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
1134 if (args.GetLength() == 1) { | 1124 if (args.GetLength() == 1) { |
1135 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 1125 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
1136 if (HValueIsNull(hThis, argOne)) { | 1126 if (HValueIsNull(hThis, argOne)) { |
1137 FXJSE_Value_SetNull(args.GetReturnValue()); | 1127 FXJSE_Value_SetNull(args.GetReturnValue()); |
1138 } else { | 1128 } else { |
1139 CXFA_Document* pDoc = pContext->GetDocument(); | 1129 CXFA_Document* pDoc = pContext->GetDocument(); |
1140 ASSERT(pDoc); | 1130 ASSERT(pDoc); |
1141 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1131 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
1142 CFX_ByteString szArgString; | 1132 CFX_ByteString szArgString; |
1143 HValueToUTF8String(argOne, szArgString); | 1133 HValueToUTF8String(argOne, szArgString); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 FXJSE_Value_SetNull(args.GetReturnValue()); | 1212 FXJSE_Value_SetNull(args.GetReturnValue()); |
1223 } | 1213 } |
1224 if (argc > 0) { | 1214 if (argc > 0) { |
1225 FXJSE_Value_Release(argStyle); | 1215 FXJSE_Value_Release(argStyle); |
1226 if (argc == 2) { | 1216 if (argc == 2) { |
1227 FXJSE_Value_Release(argLocal); | 1217 FXJSE_Value_Release(argLocal); |
1228 } | 1218 } |
1229 } | 1219 } |
1230 } else { | 1220 } else { |
1231 CXFA_FM2JSContext* pContext = | 1221 CXFA_FM2JSContext* pContext = |
1232 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1222 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1233 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1223 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1234 L"LocalDateFmt"); | 1224 L"LocalDateFmt"); |
1235 } | 1225 } |
1236 } | 1226 } |
1237 void CXFA_FM2JSContext::LocalTimeFmt(FXJSE_HOBJECT hThis, | 1227 void CXFA_FM2JSContext::LocalTimeFmt(FXJSE_HOBJECT hThis, |
1238 const CFX_ByteStringC& szFuncName, | 1228 const CFX_ByteStringC& szFuncName, |
1239 CFXJSE_Arguments& args) { | 1229 CFXJSE_Arguments& args) { |
1240 int32_t argc = args.GetLength(); | 1230 int32_t argc = args.GetLength(); |
1241 if (argc < 3) { | 1231 if (argc < 3) { |
1242 FX_BOOL bFlags = FALSE; | 1232 FX_BOOL bFlags = FALSE; |
(...skipping 30 matching lines...) Expand all Loading... |
1273 FXJSE_Value_SetNull(args.GetReturnValue()); | 1263 FXJSE_Value_SetNull(args.GetReturnValue()); |
1274 } | 1264 } |
1275 if (argc > 0) { | 1265 if (argc > 0) { |
1276 FXJSE_Value_Release(argStyle); | 1266 FXJSE_Value_Release(argStyle); |
1277 if (argc == 2) { | 1267 if (argc == 2) { |
1278 FXJSE_Value_Release(argLocal); | 1268 FXJSE_Value_Release(argLocal); |
1279 } | 1269 } |
1280 } | 1270 } |
1281 } else { | 1271 } else { |
1282 CXFA_FM2JSContext* pContext = | 1272 CXFA_FM2JSContext* pContext = |
1283 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1273 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1284 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1274 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1285 L"LocalTimeFmt"); | 1275 L"LocalTimeFmt"); |
1286 } | 1276 } |
1287 } | 1277 } |
1288 void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis, | 1278 void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis, |
1289 const CFX_ByteStringC& szFuncName, | 1279 const CFX_ByteStringC& szFuncName, |
1290 CFXJSE_Arguments& args) { | 1280 CFXJSE_Arguments& args) { |
1291 int32_t argc = args.GetLength(); | 1281 int32_t argc = args.GetLength(); |
1292 if ((argc > 0) && (argc < 4)) { | 1282 if ((argc > 0) && (argc < 4)) { |
1293 FX_BOOL bFlags = FALSE; | 1283 FX_BOOL bFlags = FALSE; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 } | 1418 } |
1429 FXJSE_Value_Release(dateValue); | 1419 FXJSE_Value_Release(dateValue); |
1430 if (argc > 1) { | 1420 if (argc > 1) { |
1431 FXJSE_Value_Release(formatValue); | 1421 FXJSE_Value_Release(formatValue); |
1432 if (argc == 3) { | 1422 if (argc == 3) { |
1433 FXJSE_Value_Release(localValue); | 1423 FXJSE_Value_Release(localValue); |
1434 } | 1424 } |
1435 } | 1425 } |
1436 } else { | 1426 } else { |
1437 CXFA_FM2JSContext* pContext = | 1427 CXFA_FM2JSContext* pContext = |
1438 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1428 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1439 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1429 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1440 L"Num2Date"); | 1430 L"Num2Date"); |
1441 } | 1431 } |
1442 } | 1432 } |
1443 void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis, | 1433 void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis, |
1444 const CFX_ByteStringC& szFuncName, | 1434 const CFX_ByteStringC& szFuncName, |
1445 CFXJSE_Arguments& args) { | 1435 CFXJSE_Arguments& args) { |
1446 int32_t argc = args.GetLength(); | 1436 int32_t argc = args.GetLength(); |
1447 if ((argc > 0) && (argc < 4)) { | 1437 if ((argc > 0) && (argc < 4)) { |
1448 FX_BOOL bFlags = FALSE; | 1438 FX_BOOL bFlags = FALSE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 } | 1480 } |
1491 FXJSE_Value_Release(timeValue); | 1481 FXJSE_Value_Release(timeValue); |
1492 if (argc > 1) { | 1482 if (argc > 1) { |
1493 FXJSE_Value_Release(formatValue); | 1483 FXJSE_Value_Release(formatValue); |
1494 if (argc == 3) { | 1484 if (argc == 3) { |
1495 FXJSE_Value_Release(localValue); | 1485 FXJSE_Value_Release(localValue); |
1496 } | 1486 } |
1497 } | 1487 } |
1498 } else { | 1488 } else { |
1499 CXFA_FM2JSContext* pContext = | 1489 CXFA_FM2JSContext* pContext = |
1500 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1490 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1501 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1491 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1502 L"Num2GMTime"); | 1492 L"Num2GMTime"); |
1503 } | 1493 } |
1504 } | 1494 } |
1505 void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis, | 1495 void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis, |
1506 const CFX_ByteStringC& szFuncName, | 1496 const CFX_ByteStringC& szFuncName, |
1507 CFXJSE_Arguments& args) { | 1497 CFXJSE_Arguments& args) { |
1508 int32_t argc = args.GetLength(); | 1498 int32_t argc = args.GetLength(); |
1509 if ((argc > 0) && (argc < 4)) { | 1499 if ((argc > 0) && (argc < 4)) { |
1510 FX_BOOL bFlags = FALSE; | 1500 FX_BOOL bFlags = FALSE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 } | 1542 } |
1553 FXJSE_Value_Release(timeValue); | 1543 FXJSE_Value_Release(timeValue); |
1554 if (argc > 1) { | 1544 if (argc > 1) { |
1555 FXJSE_Value_Release(formatValue); | 1545 FXJSE_Value_Release(formatValue); |
1556 if (argc == 3) { | 1546 if (argc == 3) { |
1557 FXJSE_Value_Release(localValue); | 1547 FXJSE_Value_Release(localValue); |
1558 } | 1548 } |
1559 } | 1549 } |
1560 } else { | 1550 } else { |
1561 CXFA_FM2JSContext* pContext = | 1551 CXFA_FM2JSContext* pContext = |
1562 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1552 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1563 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1553 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1564 L"Num2Time"); | 1554 L"Num2Time"); |
1565 } | 1555 } |
1566 } | 1556 } |
1567 void CXFA_FM2JSContext::Time(FXJSE_HOBJECT hThis, | 1557 void CXFA_FM2JSContext::Time(FXJSE_HOBJECT hThis, |
1568 const CFX_ByteStringC& szFuncName, | 1558 const CFX_ByteStringC& szFuncName, |
1569 CFXJSE_Arguments& args) { | 1559 CFXJSE_Arguments& args) { |
1570 if (args.GetLength() == 0) { | 1560 if (args.GetLength() == 0) { |
1571 time_t now; | 1561 time_t now; |
1572 time(&now); | 1562 time(&now); |
1573 struct tm* pGmt = gmtime(&now); | 1563 struct tm* pGmt = gmtime(&now); |
1574 int32_t iGMHour = pGmt->tm_hour; | 1564 int32_t iGMHour = pGmt->tm_hour; |
1575 int32_t iGMMin = pGmt->tm_min; | 1565 int32_t iGMMin = pGmt->tm_min; |
1576 int32_t iGMSec = pGmt->tm_sec; | 1566 int32_t iGMSec = pGmt->tm_sec; |
1577 FXJSE_Value_SetInteger(args.GetReturnValue(), | 1567 FXJSE_Value_SetInteger(args.GetReturnValue(), |
1578 ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); | 1568 ((iGMHour * 3600 + iGMMin * 60 + iGMSec) * 1000)); |
1579 } else { | 1569 } else { |
1580 CXFA_FM2JSContext* pContext = | 1570 CXFA_FM2JSContext* pContext = |
1581 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1571 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1582 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1572 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1583 L"Time"); | 1573 L"Time"); |
1584 } | 1574 } |
1585 } | 1575 } |
1586 void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, | 1576 void CXFA_FM2JSContext::Time2Num(FXJSE_HOBJECT hThis, |
1587 const CFX_ByteStringC& szFuncName, | 1577 const CFX_ByteStringC& szFuncName, |
1588 CFXJSE_Arguments& args) { | 1578 CFXJSE_Arguments& args) { |
1589 int32_t argc = args.GetLength(); | 1579 int32_t argc = args.GetLength(); |
1590 if ((argc > 0) && (argc < 4)) { | 1580 if ((argc > 0) && (argc < 4)) { |
1591 FX_BOOL bFlags = FALSE; | 1581 FX_BOOL bFlags = FALSE; |
(...skipping 19 matching lines...) Expand all Loading... |
1611 if (argc == 3) { | 1601 if (argc == 3) { |
1612 localValue = GetSimpleHValue(hThis, args, 2); | 1602 localValue = GetSimpleHValue(hThis, args, 2); |
1613 if (HValueIsNull(hThis, localValue)) { | 1603 if (HValueIsNull(hThis, localValue)) { |
1614 bFlags = TRUE; | 1604 bFlags = TRUE; |
1615 } else { | 1605 } else { |
1616 HValueToUTF8String(localValue, localString); | 1606 HValueToUTF8String(localValue, localString); |
1617 } | 1607 } |
1618 } | 1608 } |
1619 if (!bFlags) { | 1609 if (!bFlags) { |
1620 CXFA_FM2JSContext* pContext = | 1610 CXFA_FM2JSContext* pContext = |
1621 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1611 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1622 CXFA_Document* pDoc = pContext->GetDocument(); | 1612 CXFA_Document* pDoc = pContext->GetDocument(); |
1623 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1613 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
1624 IFX_Locale* pLocale = NULL; | 1614 IFX_Locale* pLocale = NULL; |
1625 if (localString.IsEmpty()) { | 1615 if (localString.IsEmpty()) { |
1626 CXFA_Node* pThisNode = | 1616 CXFA_Node* pThisNode = |
1627 ToNode(pDoc->GetScriptContext()->GetThisObject()); | 1617 ToNode(pDoc->GetScriptContext()->GetThisObject()); |
1628 ASSERT(pThisNode); | 1618 ASSERT(pThisNode); |
1629 CXFA_WidgetData widgetData(pThisNode); | 1619 CXFA_WidgetData widgetData(pThisNode); |
1630 pLocale = widgetData.GetLocal(); | 1620 pLocale = widgetData.GetLocal(); |
1631 } else { | 1621 } else { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 } | 1665 } |
1676 FXJSE_Value_Release(timeValue); | 1666 FXJSE_Value_Release(timeValue); |
1677 if (argc > 1) { | 1667 if (argc > 1) { |
1678 FXJSE_Value_Release(formatValue); | 1668 FXJSE_Value_Release(formatValue); |
1679 if (argc == 3) { | 1669 if (argc == 3) { |
1680 FXJSE_Value_Release(localValue); | 1670 FXJSE_Value_Release(localValue); |
1681 } | 1671 } |
1682 } | 1672 } |
1683 } else { | 1673 } else { |
1684 CXFA_FM2JSContext* pContext = | 1674 CXFA_FM2JSContext* pContext = |
1685 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1675 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1686 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1676 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1687 L"Time2Num"); | 1677 L"Time2Num"); |
1688 } | 1678 } |
1689 } | 1679 } |
1690 void CXFA_FM2JSContext::TimeFmt(FXJSE_HOBJECT hThis, | 1680 void CXFA_FM2JSContext::TimeFmt(FXJSE_HOBJECT hThis, |
1691 const CFX_ByteStringC& szFuncName, | 1681 const CFX_ByteStringC& szFuncName, |
1692 CFXJSE_Arguments& args) { | 1682 CFXJSE_Arguments& args) { |
1693 int32_t argc = args.GetLength(); | 1683 int32_t argc = args.GetLength(); |
1694 if (argc < 3) { | 1684 if (argc < 3) { |
1695 FX_BOOL bFlags = FALSE; | 1685 FX_BOOL bFlags = FALSE; |
(...skipping 30 matching lines...) Expand all Loading... |
1726 FXJSE_Value_SetNull(args.GetReturnValue()); | 1716 FXJSE_Value_SetNull(args.GetReturnValue()); |
1727 } | 1717 } |
1728 if (argc > 0) { | 1718 if (argc > 0) { |
1729 FXJSE_Value_Release(argStyle); | 1719 FXJSE_Value_Release(argStyle); |
1730 if (argc == 2) { | 1720 if (argc == 2) { |
1731 FXJSE_Value_Release(argLocal); | 1721 FXJSE_Value_Release(argLocal); |
1732 } | 1722 } |
1733 } | 1723 } |
1734 } else { | 1724 } else { |
1735 CXFA_FM2JSContext* pContext = | 1725 CXFA_FM2JSContext* pContext = |
1736 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1726 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
1737 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1727 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
1738 L"TimeFmt"); | 1728 L"TimeFmt"); |
1739 } | 1729 } |
1740 } | 1730 } |
1741 FX_BOOL CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, | 1731 FX_BOOL CXFA_FM2JSContext::IsIsoDateFormat(const FX_CHAR* pData, |
1742 int32_t iLength, | 1732 int32_t iLength, |
1743 int32_t& iStyle, | 1733 int32_t& iStyle, |
1744 int32_t& iYear, | 1734 int32_t& iYear, |
1745 int32_t& iMonth, | 1735 int32_t& iMonth, |
1746 int32_t& iDay) { | 1736 int32_t& iDay) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 return iRet; | 2045 return iRet; |
2056 } | 2046 } |
2057 iRet = TRUE; | 2047 iRet = TRUE; |
2058 return iRet; | 2048 return iRet; |
2059 } | 2049 } |
2060 FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis, | 2050 FX_BOOL CXFA_FM2JSContext::Local2IsoDate(FXJSE_HOBJECT hThis, |
2061 const CFX_ByteStringC& szDate, | 2051 const CFX_ByteStringC& szDate, |
2062 const CFX_ByteStringC& szFormat, | 2052 const CFX_ByteStringC& szFormat, |
2063 const CFX_ByteStringC& szLocale, | 2053 const CFX_ByteStringC& szLocale, |
2064 CFX_ByteString& strIsoDate) { | 2054 CFX_ByteString& strIsoDate) { |
2065 CXFA_FM2JSContext* pContext = | 2055 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2066 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2067 CXFA_Document* pDoc = pContext->GetDocument(); | 2056 CXFA_Document* pDoc = pContext->GetDocument(); |
2068 if (!pDoc) { | 2057 if (!pDoc) { |
2069 return FALSE; | 2058 return FALSE; |
2070 } | 2059 } |
2071 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2060 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2072 IFX_Locale* pLocale = NULL; | 2061 IFX_Locale* pLocale = NULL; |
2073 if (szLocale.IsEmpty()) { | 2062 if (szLocale.IsEmpty()) { |
2074 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2063 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2075 ASSERT(pThisNode); | 2064 ASSERT(pThisNode); |
2076 CXFA_WidgetData widgetData(pThisNode); | 2065 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 14 matching lines...) Expand all Loading... |
2091 wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); | 2080 wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); |
2092 CFX_Unitime dt = widgetValue.GetDate(); | 2081 CFX_Unitime dt = widgetValue.GetDate(); |
2093 strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); | 2082 strIsoDate.Format("%4d-%02d-%02d", dt.GetYear(), dt.GetMonth(), dt.GetDay()); |
2094 return TRUE; | 2083 return TRUE; |
2095 } | 2084 } |
2096 FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis, | 2085 FX_BOOL CXFA_FM2JSContext::Local2IsoTime(FXJSE_HOBJECT hThis, |
2097 const CFX_ByteStringC& szTime, | 2086 const CFX_ByteStringC& szTime, |
2098 const CFX_ByteStringC& szFormat, | 2087 const CFX_ByteStringC& szFormat, |
2099 const CFX_ByteStringC& szLocale, | 2088 const CFX_ByteStringC& szLocale, |
2100 CFX_ByteString& strIsoTime) { | 2089 CFX_ByteString& strIsoTime) { |
2101 CXFA_FM2JSContext* pContext = | 2090 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2102 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2103 CXFA_Document* pDoc = pContext->GetDocument(); | 2091 CXFA_Document* pDoc = pContext->GetDocument(); |
2104 if (!pDoc) { | 2092 if (!pDoc) { |
2105 return FALSE; | 2093 return FALSE; |
2106 } | 2094 } |
2107 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2095 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2108 IFX_Locale* pLocale = NULL; | 2096 IFX_Locale* pLocale = NULL; |
2109 if (szLocale.IsEmpty()) { | 2097 if (szLocale.IsEmpty()) { |
2110 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2098 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2111 ASSERT(pThisNode); | 2099 ASSERT(pThisNode); |
2112 CXFA_WidgetData widgetData(pThisNode); | 2100 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 17 matching lines...) Expand all Loading... |
2130 CFX_Unitime utime = widgetValue.GetTime(); | 2118 CFX_Unitime utime = widgetValue.GetTime(); |
2131 strIsoTime.Format("%02d:%02d:%02d.%03d", utime.GetHour(), utime.GetMinute(), | 2119 strIsoTime.Format("%02d:%02d:%02d.%03d", utime.GetHour(), utime.GetMinute(), |
2132 utime.GetSecond(), utime.GetMillisecond()); | 2120 utime.GetSecond(), utime.GetMillisecond()); |
2133 return TRUE; | 2121 return TRUE; |
2134 } | 2122 } |
2135 FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, | 2123 FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, |
2136 const CFX_ByteStringC& szDate, | 2124 const CFX_ByteStringC& szDate, |
2137 const CFX_ByteStringC& szFormat, | 2125 const CFX_ByteStringC& szFormat, |
2138 const CFX_ByteStringC& szLocale, | 2126 const CFX_ByteStringC& szLocale, |
2139 CFX_ByteString& strLocalDate) { | 2127 CFX_ByteString& strLocalDate) { |
2140 CXFA_FM2JSContext* pContext = | 2128 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2141 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2142 CXFA_Document* pDoc = pContext->GetDocument(); | 2129 CXFA_Document* pDoc = pContext->GetDocument(); |
2143 if (!pDoc) { | 2130 if (!pDoc) { |
2144 return FALSE; | 2131 return FALSE; |
2145 } | 2132 } |
2146 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2133 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2147 IFX_Locale* pLocale = NULL; | 2134 IFX_Locale* pLocale = NULL; |
2148 if (szLocale.IsEmpty()) { | 2135 if (szLocale.IsEmpty()) { |
2149 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2136 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2150 ASSERT(pThisNode); | 2137 ASSERT(pThisNode); |
2151 CXFA_WidgetData widgetData(pThisNode); | 2138 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 16 matching lines...) Expand all Loading... |
2168 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, | 2155 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, |
2169 XFA_VALUEPICTURE_Display); | 2156 XFA_VALUEPICTURE_Display); |
2170 strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); | 2157 strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
2171 return TRUE; | 2158 return TRUE; |
2172 } | 2159 } |
2173 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, | 2160 FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, |
2174 const CFX_ByteStringC& szTime, | 2161 const CFX_ByteStringC& szTime, |
2175 const CFX_ByteStringC& szFormat, | 2162 const CFX_ByteStringC& szFormat, |
2176 const CFX_ByteStringC& szLocale, | 2163 const CFX_ByteStringC& szLocale, |
2177 CFX_ByteString& strLocalTime) { | 2164 CFX_ByteString& strLocalTime) { |
2178 CXFA_FM2JSContext* pContext = | 2165 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2179 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2180 CXFA_Document* pDoc = pContext->GetDocument(); | 2166 CXFA_Document* pDoc = pContext->GetDocument(); |
2181 if (!pDoc) { | 2167 if (!pDoc) { |
2182 return FALSE; | 2168 return FALSE; |
2183 } | 2169 } |
2184 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2170 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2185 IFX_Locale* pLocale = NULL; | 2171 IFX_Locale* pLocale = NULL; |
2186 if (szLocale.IsEmpty()) { | 2172 if (szLocale.IsEmpty()) { |
2187 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2173 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2188 ASSERT(pThisNode); | 2174 ASSERT(pThisNode); |
2189 CXFA_WidgetData widgetData(pThisNode); | 2175 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 18 matching lines...) Expand all Loading... |
2208 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, | 2194 widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, |
2209 XFA_VALUEPICTURE_Display); | 2195 XFA_VALUEPICTURE_Display); |
2210 strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); | 2196 strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); |
2211 return TRUE; | 2197 return TRUE; |
2212 } | 2198 } |
2213 FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, | 2199 FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, |
2214 const CFX_ByteStringC& szTime, | 2200 const CFX_ByteStringC& szTime, |
2215 const CFX_ByteStringC& szFormat, | 2201 const CFX_ByteStringC& szFormat, |
2216 const CFX_ByteStringC& szLocale, | 2202 const CFX_ByteStringC& szLocale, |
2217 CFX_ByteString& strGMTTime) { | 2203 CFX_ByteString& strGMTTime) { |
2218 CXFA_FM2JSContext* pContext = | 2204 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2219 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2220 CXFA_Document* pDoc = pContext->GetDocument(); | 2205 CXFA_Document* pDoc = pContext->GetDocument(); |
2221 if (!pDoc) { | 2206 if (!pDoc) { |
2222 return FALSE; | 2207 return FALSE; |
2223 } | 2208 } |
2224 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2209 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2225 IFX_Locale* pLocale = NULL; | 2210 IFX_Locale* pLocale = NULL; |
2226 if (szLocale.IsEmpty()) { | 2211 if (szLocale.IsEmpty()) { |
2227 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2212 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2228 ASSERT(pThisNode); | 2213 ASSERT(pThisNode); |
2229 CXFA_WidgetData widgetData(pThisNode); | 2214 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 case 3: | 2327 case 3: |
2343 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; | 2328 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; |
2344 break; | 2329 break; |
2345 case 4: | 2330 case 4: |
2346 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; | 2331 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; |
2347 break; | 2332 break; |
2348 default: | 2333 default: |
2349 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; | 2334 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
2350 break; | 2335 break; |
2351 } | 2336 } |
2352 CXFA_FM2JSContext* pContext = | 2337 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2353 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2354 CXFA_Document* pDoc = pContext->GetDocument(); | 2338 CXFA_Document* pDoc = pContext->GetDocument(); |
2355 if (!pDoc) { | 2339 if (!pDoc) { |
2356 return; | 2340 return; |
2357 } | 2341 } |
2358 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2342 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2359 IFX_Locale* pLocale = NULL; | 2343 IFX_Locale* pLocale = NULL; |
2360 if (szLocalStr.IsEmpty()) { | 2344 if (szLocalStr.IsEmpty()) { |
2361 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2345 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2362 ASSERT(pThisNode); | 2346 ASSERT(pThisNode); |
2363 CXFA_WidgetData widgetData(pThisNode); | 2347 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 case 3: | 2380 case 3: |
2397 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; | 2381 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Long; |
2398 break; | 2382 break; |
2399 case 4: | 2383 case 4: |
2400 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; | 2384 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Full; |
2401 break; | 2385 break; |
2402 default: | 2386 default: |
2403 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; | 2387 strStyle = FX_LOCALEDATETIMESUBCATEGORY_Medium; |
2404 break; | 2388 break; |
2405 } | 2389 } |
2406 CXFA_FM2JSContext* pContext = | 2390 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2407 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2408 CXFA_Document* pDoc = pContext->GetDocument(); | 2391 CXFA_Document* pDoc = pContext->GetDocument(); |
2409 if (!pDoc) { | 2392 if (!pDoc) { |
2410 return; | 2393 return; |
2411 } | 2394 } |
2412 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2395 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
2413 IFX_Locale* pLocale = NULL; | 2396 IFX_Locale* pLocale = NULL; |
2414 if (szLocalStr.IsEmpty()) { | 2397 if (szLocalStr.IsEmpty()) { |
2415 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2398 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
2416 ASSERT(pThisNode); | 2399 ASSERT(pThisNode); |
2417 CXFA_WidgetData widgetData(pThisNode); | 2400 CXFA_WidgetData widgetData(pThisNode); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 int32_t iLocalHour = pLocal->tm_hour; | 2475 int32_t iLocalHour = pLocal->tm_hour; |
2493 int32_t iLocalMin = pLocal->tm_min; | 2476 int32_t iLocalMin = pLocal->tm_min; |
2494 int32_t iLocalSec = pLocal->tm_sec; | 2477 int32_t iLocalSec = pLocal->tm_sec; |
2495 iHour = iLocalHour - iGMHour; | 2478 iHour = iLocalHour - iGMHour; |
2496 iMin = iLocalMin - iGMMin; | 2479 iMin = iLocalMin - iGMMin; |
2497 iSec = iLocalSec - iGMSec; | 2480 iSec = iLocalSec - iGMSec; |
2498 } | 2481 } |
2499 void CXFA_FM2JSContext::Apr(FXJSE_HOBJECT hThis, | 2482 void CXFA_FM2JSContext::Apr(FXJSE_HOBJECT hThis, |
2500 const CFX_ByteStringC& szFuncName, | 2483 const CFX_ByteStringC& szFuncName, |
2501 CFXJSE_Arguments& args) { | 2484 CFXJSE_Arguments& args) { |
2502 CXFA_FM2JSContext* pContext = | 2485 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2503 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2504 if (args.GetLength() == 3) { | 2486 if (args.GetLength() == 3) { |
2505 FX_BOOL bFlags = FALSE; | 2487 FX_BOOL bFlags = FALSE; |
2506 FX_DOUBLE nPrincipal = 0; | 2488 FX_DOUBLE nPrincipal = 0; |
2507 FX_DOUBLE nPayment = 0; | 2489 FX_DOUBLE nPayment = 0; |
2508 FX_DOUBLE nPeriods = 0; | 2490 FX_DOUBLE nPeriods = 0; |
2509 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2491 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2510 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2492 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2511 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2493 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2512 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2494 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2513 HValueIsNull(hThis, argThree)); | 2495 HValueIsNull(hThis, argThree)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 FXJSE_Value_Release(argTwo); | 2540 FXJSE_Value_Release(argTwo); |
2559 FXJSE_Value_Release(argThree); | 2541 FXJSE_Value_Release(argThree); |
2560 } else { | 2542 } else { |
2561 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2543 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2562 L"Apr"); | 2544 L"Apr"); |
2563 } | 2545 } |
2564 } | 2546 } |
2565 void CXFA_FM2JSContext::CTerm(FXJSE_HOBJECT hThis, | 2547 void CXFA_FM2JSContext::CTerm(FXJSE_HOBJECT hThis, |
2566 const CFX_ByteStringC& szFuncName, | 2548 const CFX_ByteStringC& szFuncName, |
2567 CFXJSE_Arguments& args) { | 2549 CFXJSE_Arguments& args) { |
2568 CXFA_FM2JSContext* pContext = | 2550 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2569 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2570 if (args.GetLength() == 3) { | 2551 if (args.GetLength() == 3) { |
2571 FX_BOOL bFlags = FALSE; | 2552 FX_BOOL bFlags = FALSE; |
2572 FX_FLOAT nRate = 0; | 2553 FX_FLOAT nRate = 0; |
2573 FX_FLOAT nFutureValue = 0; | 2554 FX_FLOAT nFutureValue = 0; |
2574 FX_FLOAT nInitAmount = 0; | 2555 FX_FLOAT nInitAmount = 0; |
2575 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2556 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2576 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2557 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2577 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2558 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2578 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2559 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2579 HValueIsNull(hThis, argThree)); | 2560 HValueIsNull(hThis, argThree)); |
(...skipping 16 matching lines...) Expand all Loading... |
2596 FXJSE_Value_Release(argTwo); | 2577 FXJSE_Value_Release(argTwo); |
2597 FXJSE_Value_Release(argThree); | 2578 FXJSE_Value_Release(argThree); |
2598 } else { | 2579 } else { |
2599 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2580 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2600 L"CTerm"); | 2581 L"CTerm"); |
2601 } | 2582 } |
2602 } | 2583 } |
2603 void CXFA_FM2JSContext::FV(FXJSE_HOBJECT hThis, | 2584 void CXFA_FM2JSContext::FV(FXJSE_HOBJECT hThis, |
2604 const CFX_ByteStringC& szFuncName, | 2585 const CFX_ByteStringC& szFuncName, |
2605 CFXJSE_Arguments& args) { | 2586 CFXJSE_Arguments& args) { |
2606 CXFA_FM2JSContext* pContext = | 2587 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2607 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2608 if (args.GetLength() == 3) { | 2588 if (args.GetLength() == 3) { |
2609 FX_BOOL bFlags = FALSE; | 2589 FX_BOOL bFlags = FALSE; |
2610 FX_DOUBLE nAmount = 0; | 2590 FX_DOUBLE nAmount = 0; |
2611 FX_DOUBLE nRate = 0; | 2591 FX_DOUBLE nRate = 0; |
2612 FX_DOUBLE nPeriod = 0; | 2592 FX_DOUBLE nPeriod = 0; |
2613 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2593 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2614 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2594 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2615 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2595 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2616 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2596 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2617 HValueIsNull(hThis, argThree)); | 2597 HValueIsNull(hThis, argThree)); |
(...skipping 24 matching lines...) Expand all Loading... |
2642 FXJSE_Value_Release(argTwo); | 2622 FXJSE_Value_Release(argTwo); |
2643 FXJSE_Value_Release(argThree); | 2623 FXJSE_Value_Release(argThree); |
2644 } else { | 2624 } else { |
2645 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2625 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2646 L"FV"); | 2626 L"FV"); |
2647 } | 2627 } |
2648 } | 2628 } |
2649 void CXFA_FM2JSContext::IPmt(FXJSE_HOBJECT hThis, | 2629 void CXFA_FM2JSContext::IPmt(FXJSE_HOBJECT hThis, |
2650 const CFX_ByteStringC& szFuncName, | 2630 const CFX_ByteStringC& szFuncName, |
2651 CFXJSE_Arguments& args) { | 2631 CFXJSE_Arguments& args) { |
2652 CXFA_FM2JSContext* pContext = | 2632 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2653 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2654 if (args.GetLength() == 5) { | 2633 if (args.GetLength() == 5) { |
2655 FX_BOOL bFlags = FALSE; | 2634 FX_BOOL bFlags = FALSE; |
2656 FX_FLOAT nPrincpalAmount = 0; | 2635 FX_FLOAT nPrincpalAmount = 0; |
2657 FX_FLOAT nRate = 0; | 2636 FX_FLOAT nRate = 0; |
2658 FX_FLOAT nPayment = 0; | 2637 FX_FLOAT nPayment = 0; |
2659 FX_FLOAT nFirstMonth = 0; | 2638 FX_FLOAT nFirstMonth = 0; |
2660 FX_FLOAT nNumberOfMonths = 0; | 2639 FX_FLOAT nNumberOfMonths = 0; |
2661 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2640 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2662 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2641 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2663 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2642 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2715 FXJSE_Value_Release(argFour); | 2694 FXJSE_Value_Release(argFour); |
2716 FXJSE_Value_Release(argFive); | 2695 FXJSE_Value_Release(argFive); |
2717 } else { | 2696 } else { |
2718 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2697 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2719 L"IPmt"); | 2698 L"IPmt"); |
2720 } | 2699 } |
2721 } | 2700 } |
2722 void CXFA_FM2JSContext::NPV(FXJSE_HOBJECT hThis, | 2701 void CXFA_FM2JSContext::NPV(FXJSE_HOBJECT hThis, |
2723 const CFX_ByteStringC& szFuncName, | 2702 const CFX_ByteStringC& szFuncName, |
2724 CFXJSE_Arguments& args) { | 2703 CFXJSE_Arguments& args) { |
2725 CXFA_FM2JSContext* pContext = | 2704 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2726 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2727 int32_t argc = args.GetLength(); | 2705 int32_t argc = args.GetLength(); |
2728 if (argc > 2) { | 2706 if (argc > 2) { |
2729 FX_BOOL bFlags = FALSE; | 2707 FX_BOOL bFlags = FALSE; |
2730 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argc); | 2708 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argc); |
2731 for (int32_t i = 0; i < argc; i++) { | 2709 for (int32_t i = 0; i < argc; i++) { |
2732 argValues[i] = GetSimpleHValue(hThis, args, i); | 2710 argValues[i] = GetSimpleHValue(hThis, args, i); |
2733 if (HValueIsNull(hThis, argValues[i])) { | 2711 if (HValueIsNull(hThis, argValues[i])) { |
2734 bFlags = TRUE; | 2712 bFlags = TRUE; |
2735 } | 2713 } |
2736 } | 2714 } |
(...skipping 29 matching lines...) Expand all Loading... |
2766 } | 2744 } |
2767 FX_Free(argValues); | 2745 FX_Free(argValues); |
2768 } else { | 2746 } else { |
2769 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2747 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2770 L"NPV"); | 2748 L"NPV"); |
2771 } | 2749 } |
2772 } | 2750 } |
2773 void CXFA_FM2JSContext::Pmt(FXJSE_HOBJECT hThis, | 2751 void CXFA_FM2JSContext::Pmt(FXJSE_HOBJECT hThis, |
2774 const CFX_ByteStringC& szFuncName, | 2752 const CFX_ByteStringC& szFuncName, |
2775 CFXJSE_Arguments& args) { | 2753 CFXJSE_Arguments& args) { |
2776 CXFA_FM2JSContext* pContext = | 2754 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2777 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2778 if (args.GetLength() == 3) { | 2755 if (args.GetLength() == 3) { |
2779 FX_BOOL bFlags = FALSE; | 2756 FX_BOOL bFlags = FALSE; |
2780 FX_FLOAT nPrincipal = 0; | 2757 FX_FLOAT nPrincipal = 0; |
2781 FX_FLOAT nRate = 0; | 2758 FX_FLOAT nRate = 0; |
2782 FX_FLOAT nPeriods = 0; | 2759 FX_FLOAT nPeriods = 0; |
2783 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2760 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2784 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2761 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2785 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2762 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2786 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2763 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2787 HValueIsNull(hThis, argThree)); | 2764 HValueIsNull(hThis, argThree)); |
(...skipping 21 matching lines...) Expand all Loading... |
2809 FXJSE_Value_Release(argTwo); | 2786 FXJSE_Value_Release(argTwo); |
2810 FXJSE_Value_Release(argThree); | 2787 FXJSE_Value_Release(argThree); |
2811 } else { | 2788 } else { |
2812 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2789 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2813 L"Pmt"); | 2790 L"Pmt"); |
2814 } | 2791 } |
2815 } | 2792 } |
2816 void CXFA_FM2JSContext::PPmt(FXJSE_HOBJECT hThis, | 2793 void CXFA_FM2JSContext::PPmt(FXJSE_HOBJECT hThis, |
2817 const CFX_ByteStringC& szFuncName, | 2794 const CFX_ByteStringC& szFuncName, |
2818 CFXJSE_Arguments& args) { | 2795 CFXJSE_Arguments& args) { |
2819 CXFA_FM2JSContext* pContext = | 2796 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2820 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2821 if (args.GetLength() == 5) { | 2797 if (args.GetLength() == 5) { |
2822 FX_BOOL bFlags = FALSE; | 2798 FX_BOOL bFlags = FALSE; |
2823 FX_FLOAT nPrincpalAmount = 0; | 2799 FX_FLOAT nPrincpalAmount = 0; |
2824 FX_FLOAT nRate = 0; | 2800 FX_FLOAT nRate = 0; |
2825 FX_FLOAT nPayment = 0; | 2801 FX_FLOAT nPayment = 0; |
2826 FX_FLOAT nFirstMonth = 0; | 2802 FX_FLOAT nFirstMonth = 0; |
2827 FX_FLOAT nNumberOfMonths = 0; | 2803 FX_FLOAT nNumberOfMonths = 0; |
2828 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2804 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2829 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2805 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2830 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2806 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 FXJSE_Value_Release(argFour); | 2859 FXJSE_Value_Release(argFour); |
2884 FXJSE_Value_Release(argFive); | 2860 FXJSE_Value_Release(argFive); |
2885 } else { | 2861 } else { |
2886 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2862 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2887 L"PPmt"); | 2863 L"PPmt"); |
2888 } | 2864 } |
2889 } | 2865 } |
2890 void CXFA_FM2JSContext::PV(FXJSE_HOBJECT hThis, | 2866 void CXFA_FM2JSContext::PV(FXJSE_HOBJECT hThis, |
2891 const CFX_ByteStringC& szFuncName, | 2867 const CFX_ByteStringC& szFuncName, |
2892 CFXJSE_Arguments& args) { | 2868 CFXJSE_Arguments& args) { |
2893 CXFA_FM2JSContext* pContext = | 2869 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2894 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2895 if (args.GetLength() == 3) { | 2870 if (args.GetLength() == 3) { |
2896 FX_BOOL bFlags = FALSE; | 2871 FX_BOOL bFlags = FALSE; |
2897 FX_DOUBLE nAmount = 0; | 2872 FX_DOUBLE nAmount = 0; |
2898 FX_DOUBLE nRate = 0; | 2873 FX_DOUBLE nRate = 0; |
2899 FX_DOUBLE nPeriod = 0; | 2874 FX_DOUBLE nPeriod = 0; |
2900 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2875 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2901 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2876 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2902 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2877 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2903 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2878 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2904 HValueIsNull(hThis, argThree)); | 2879 HValueIsNull(hThis, argThree)); |
(...skipping 20 matching lines...) Expand all Loading... |
2925 FXJSE_Value_Release(argTwo); | 2900 FXJSE_Value_Release(argTwo); |
2926 FXJSE_Value_Release(argThree); | 2901 FXJSE_Value_Release(argThree); |
2927 } else { | 2902 } else { |
2928 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2903 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2929 L"PV"); | 2904 L"PV"); |
2930 } | 2905 } |
2931 } | 2906 } |
2932 void CXFA_FM2JSContext::Rate(FXJSE_HOBJECT hThis, | 2907 void CXFA_FM2JSContext::Rate(FXJSE_HOBJECT hThis, |
2933 const CFX_ByteStringC& szFuncName, | 2908 const CFX_ByteStringC& szFuncName, |
2934 CFXJSE_Arguments& args) { | 2909 CFXJSE_Arguments& args) { |
2935 CXFA_FM2JSContext* pContext = | 2910 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2936 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2937 if (args.GetLength() == 3) { | 2911 if (args.GetLength() == 3) { |
2938 FX_BOOL bFlags = FALSE; | 2912 FX_BOOL bFlags = FALSE; |
2939 FX_FLOAT nFuture = 0; | 2913 FX_FLOAT nFuture = 0; |
2940 FX_FLOAT nPresent = 0; | 2914 FX_FLOAT nPresent = 0; |
2941 FX_FLOAT nTotalNumber = 0; | 2915 FX_FLOAT nTotalNumber = 0; |
2942 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2916 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2943 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2917 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2944 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2918 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2945 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || | 2919 bFlags = (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo) || |
2946 HValueIsNull(hThis, argThree)); | 2920 HValueIsNull(hThis, argThree)); |
(...skipping 17 matching lines...) Expand all Loading... |
2964 FXJSE_Value_Release(argTwo); | 2938 FXJSE_Value_Release(argTwo); |
2965 FXJSE_Value_Release(argThree); | 2939 FXJSE_Value_Release(argThree); |
2966 } else { | 2940 } else { |
2967 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2941 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
2968 L"Rate"); | 2942 L"Rate"); |
2969 } | 2943 } |
2970 } | 2944 } |
2971 void CXFA_FM2JSContext::Term(FXJSE_HOBJECT hThis, | 2945 void CXFA_FM2JSContext::Term(FXJSE_HOBJECT hThis, |
2972 const CFX_ByteStringC& szFuncName, | 2946 const CFX_ByteStringC& szFuncName, |
2973 CFXJSE_Arguments& args) { | 2947 CFXJSE_Arguments& args) { |
2974 CXFA_FM2JSContext* pContext = | 2948 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
2975 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
2976 if (args.GetLength() == 3) { | 2949 if (args.GetLength() == 3) { |
2977 FX_BOOL bFlags = FALSE; | 2950 FX_BOOL bFlags = FALSE; |
2978 FX_FLOAT nMount = 0; | 2951 FX_FLOAT nMount = 0; |
2979 FX_FLOAT nRate = 0; | 2952 FX_FLOAT nRate = 0; |
2980 FX_FLOAT nFuture = 0; | 2953 FX_FLOAT nFuture = 0; |
2981 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 2954 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
2982 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 2955 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
2983 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); | 2956 FXJSE_HVALUE argThree = GetSimpleHValue(hThis, args, 2); |
2984 bFlags = (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo) || | 2957 bFlags = (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo) || |
2985 FXJSE_Value_IsNull(argThree)); | 2958 FXJSE_Value_IsNull(argThree)); |
(...skipping 17 matching lines...) Expand all Loading... |
3003 FXJSE_Value_Release(argTwo); | 2976 FXJSE_Value_Release(argTwo); |
3004 FXJSE_Value_Release(argThree); | 2977 FXJSE_Value_Release(argThree); |
3005 } else { | 2978 } else { |
3006 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 2979 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3007 L"Term"); | 2980 L"Term"); |
3008 } | 2981 } |
3009 } | 2982 } |
3010 void CXFA_FM2JSContext::Choose(FXJSE_HOBJECT hThis, | 2983 void CXFA_FM2JSContext::Choose(FXJSE_HOBJECT hThis, |
3011 const CFX_ByteStringC& szFuncName, | 2984 const CFX_ByteStringC& szFuncName, |
3012 CFXJSE_Arguments& args) { | 2985 CFXJSE_Arguments& args) { |
3013 CXFA_FM2JSContext* pContext = | 2986 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3014 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3015 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 2987 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
3016 int32_t argc = args.GetLength(); | 2988 int32_t argc = args.GetLength(); |
3017 if (argc > 1) { | 2989 if (argc > 1) { |
3018 FXJSE_HVALUE argOne = args.GetValue(0); | 2990 FXJSE_HVALUE argOne = args.GetValue(0); |
3019 FX_BOOL argOneIsNull = FALSE; | 2991 FX_BOOL argOneIsNull = FALSE; |
3020 int32_t iIndex = 0; | 2992 int32_t iIndex = 0; |
3021 argOneIsNull = HValueIsNull(hThis, argOne); | 2993 argOneIsNull = HValueIsNull(hThis, argOne); |
3022 if (!argOneIsNull) { | 2994 if (!argOneIsNull) { |
3023 iIndex = (int32_t)HValueToFloat(hThis, argOne); | 2995 iIndex = (int32_t)HValueToFloat(hThis, argOne); |
3024 } | 2996 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 } | 3052 } |
3081 FXJSE_Value_Release(argIndexValue); | 3053 FXJSE_Value_Release(argIndexValue); |
3082 iArgIndex++; | 3054 iArgIndex++; |
3083 } | 3055 } |
3084 if (!bFound) { | 3056 if (!bFound) { |
3085 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 3057 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
3086 } | 3058 } |
3087 } | 3059 } |
3088 } else { | 3060 } else { |
3089 CXFA_FM2JSContext* pContext = | 3061 CXFA_FM2JSContext* pContext = |
3090 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3062 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3091 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3063 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3092 L"Choose"); | 3064 L"Choose"); |
3093 } | 3065 } |
3094 } | 3066 } |
3095 void CXFA_FM2JSContext::Exists(FXJSE_HOBJECT hThis, | 3067 void CXFA_FM2JSContext::Exists(FXJSE_HOBJECT hThis, |
3096 const CFX_ByteStringC& szFuncName, | 3068 const CFX_ByteStringC& szFuncName, |
3097 CFXJSE_Arguments& args) { | 3069 CFXJSE_Arguments& args) { |
3098 if (args.GetLength() == 1) { | 3070 if (args.GetLength() == 1) { |
3099 FXJSE_HVALUE argOne = args.GetValue(0); | 3071 FXJSE_HVALUE argOne = args.GetValue(0); |
3100 FXJSE_Value_SetInteger(args.GetReturnValue(), FXJSE_Value_IsObject(argOne)); | 3072 FXJSE_Value_SetInteger(args.GetReturnValue(), FXJSE_Value_IsObject(argOne)); |
3101 FXJSE_Value_Release(argOne); | 3073 FXJSE_Value_Release(argOne); |
3102 } else { | 3074 } else { |
3103 CXFA_FM2JSContext* pContext = | 3075 CXFA_FM2JSContext* pContext = |
3104 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3076 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3105 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3077 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3106 L"Exists"); | 3078 L"Exists"); |
3107 } | 3079 } |
3108 } | 3080 } |
3109 void CXFA_FM2JSContext::HasValue(FXJSE_HOBJECT hThis, | 3081 void CXFA_FM2JSContext::HasValue(FXJSE_HOBJECT hThis, |
3110 const CFX_ByteStringC& szFuncName, | 3082 const CFX_ByteStringC& szFuncName, |
3111 CFXJSE_Arguments& args) { | 3083 CFXJSE_Arguments& args) { |
3112 if (args.GetLength() == 1) { | 3084 if (args.GetLength() == 1) { |
3113 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3085 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
3114 if (FXJSE_Value_IsUTF8String(argOne)) { | 3086 if (FXJSE_Value_IsUTF8String(argOne)) { |
3115 CFX_ByteString valueStr; | 3087 CFX_ByteString valueStr; |
3116 FXJSE_Value_ToUTF8String(argOne, valueStr); | 3088 FXJSE_Value_ToUTF8String(argOne, valueStr); |
3117 valueStr.TrimLeft(); | 3089 valueStr.TrimLeft(); |
3118 FXJSE_Value_SetInteger(args.GetReturnValue(), (!valueStr.IsEmpty())); | 3090 FXJSE_Value_SetInteger(args.GetReturnValue(), (!valueStr.IsEmpty())); |
3119 } else if (FXJSE_Value_IsNumber(argOne) || FXJSE_Value_IsBoolean(argOne)) { | 3091 } else if (FXJSE_Value_IsNumber(argOne) || FXJSE_Value_IsBoolean(argOne)) { |
3120 FXJSE_Value_SetInteger(args.GetReturnValue(), TRUE); | 3092 FXJSE_Value_SetInteger(args.GetReturnValue(), TRUE); |
3121 } else { | 3093 } else { |
3122 FXJSE_Value_SetInteger(args.GetReturnValue(), FALSE); | 3094 FXJSE_Value_SetInteger(args.GetReturnValue(), FALSE); |
3123 } | 3095 } |
3124 FXJSE_Value_Release(argOne); | 3096 FXJSE_Value_Release(argOne); |
3125 } else { | 3097 } else { |
3126 CXFA_FM2JSContext* pContext = | 3098 CXFA_FM2JSContext* pContext = |
3127 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3099 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3128 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3100 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3129 L"HasValue"); | 3101 L"HasValue"); |
3130 } | 3102 } |
3131 } | 3103 } |
3132 void CXFA_FM2JSContext::Oneof(FXJSE_HOBJECT hThis, | 3104 void CXFA_FM2JSContext::Oneof(FXJSE_HOBJECT hThis, |
3133 const CFX_ByteStringC& szFuncName, | 3105 const CFX_ByteStringC& szFuncName, |
3134 CFXJSE_Arguments& args) { | 3106 CFXJSE_Arguments& args) { |
3135 int32_t argc = args.GetLength(); | 3107 int32_t argc = args.GetLength(); |
3136 if (argc > 1) { | 3108 if (argc > 1) { |
3137 FX_BOOL bFlags = FALSE; | 3109 FX_BOOL bFlags = FALSE; |
3138 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3110 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
3139 FXJSE_HVALUE* parametersValue = 0; | 3111 FXJSE_HVALUE* parametersValue = 0; |
3140 int32_t iCount = 0; | 3112 int32_t iCount = 0; |
3141 unfoldArgs(hThis, args, parametersValue, iCount, 1); | 3113 unfoldArgs(hThis, args, parametersValue, iCount, 1); |
3142 for (int32_t i = 0; i < iCount; i++) { | 3114 for (int32_t i = 0; i < iCount; i++) { |
3143 if (simpleValueCompare(hThis, argOne, parametersValue[i])) { | 3115 if (simpleValueCompare(hThis, argOne, parametersValue[i])) { |
3144 bFlags = TRUE; | 3116 bFlags = TRUE; |
3145 break; | 3117 break; |
3146 } | 3118 } |
3147 } | 3119 } |
3148 FXJSE_Value_SetInteger(args.GetReturnValue(), bFlags); | 3120 FXJSE_Value_SetInteger(args.GetReturnValue(), bFlags); |
3149 FXJSE_Value_Release(argOne); | 3121 FXJSE_Value_Release(argOne); |
3150 for (int32_t i = 0; i < iCount; i++) { | 3122 for (int32_t i = 0; i < iCount; i++) { |
3151 FXJSE_Value_Release(parametersValue[i]); | 3123 FXJSE_Value_Release(parametersValue[i]); |
3152 } | 3124 } |
3153 FX_Free(parametersValue); | 3125 FX_Free(parametersValue); |
3154 parametersValue = 0; | 3126 parametersValue = 0; |
3155 } else { | 3127 } else { |
3156 CXFA_FM2JSContext* pContext = | 3128 CXFA_FM2JSContext* pContext = |
3157 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3129 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3158 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3130 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3159 L"Oneof"); | 3131 L"Oneof"); |
3160 } | 3132 } |
3161 } | 3133 } |
3162 void CXFA_FM2JSContext::Within(FXJSE_HOBJECT hThis, | 3134 void CXFA_FM2JSContext::Within(FXJSE_HOBJECT hThis, |
3163 const CFX_ByteStringC& szFuncName, | 3135 const CFX_ByteStringC& szFuncName, |
3164 CFXJSE_Arguments& args) { | 3136 CFXJSE_Arguments& args) { |
3165 int32_t argc = args.GetLength(); | 3137 int32_t argc = args.GetLength(); |
3166 if (argc == 3) { | 3138 if (argc == 3) { |
3167 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3139 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
(...skipping 20 matching lines...) Expand all Loading... |
3188 args.GetReturnValue(), | 3160 args.GetReturnValue(), |
3189 ((oneString.Compare(lowString.AsStringC()) >= 0) && | 3161 ((oneString.Compare(lowString.AsStringC()) >= 0) && |
3190 (oneString.Compare(heightString.AsStringC()) <= 0))); | 3162 (oneString.Compare(heightString.AsStringC()) <= 0))); |
3191 } | 3163 } |
3192 FXJSE_Value_Release(argLow); | 3164 FXJSE_Value_Release(argLow); |
3193 FXJSE_Value_Release(argHeight); | 3165 FXJSE_Value_Release(argHeight); |
3194 } | 3166 } |
3195 FXJSE_Value_Release(argOne); | 3167 FXJSE_Value_Release(argOne); |
3196 } else { | 3168 } else { |
3197 CXFA_FM2JSContext* pContext = | 3169 CXFA_FM2JSContext* pContext = |
3198 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3170 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3199 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3171 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3200 L"Within"); | 3172 L"Within"); |
3201 } | 3173 } |
3202 } | 3174 } |
3203 void CXFA_FM2JSContext::If(FXJSE_HOBJECT hThis, | 3175 void CXFA_FM2JSContext::If(FXJSE_HOBJECT hThis, |
3204 const CFX_ByteStringC& szFuncName, | 3176 const CFX_ByteStringC& szFuncName, |
3205 CFXJSE_Arguments& args) { | 3177 CFXJSE_Arguments& args) { |
3206 if (args.GetLength() == 3) { | 3178 if (args.GetLength() == 3) { |
3207 FXJSE_HVALUE argCondition = GetSimpleHValue(hThis, args, 0); | 3179 FXJSE_HVALUE argCondition = GetSimpleHValue(hThis, args, 0); |
3208 FXJSE_HVALUE argFirstValue = GetSimpleHValue(hThis, args, 1); | 3180 FXJSE_HVALUE argFirstValue = GetSimpleHValue(hThis, args, 1); |
3209 FXJSE_HVALUE argSecondValue = GetSimpleHValue(hThis, args, 2); | 3181 FXJSE_HVALUE argSecondValue = GetSimpleHValue(hThis, args, 2); |
3210 FX_BOOL bCondition = FXJSE_Value_ToBoolean(argCondition); | 3182 FX_BOOL bCondition = FXJSE_Value_ToBoolean(argCondition); |
3211 FXJSE_Value_Set(args.GetReturnValue(), | 3183 FXJSE_Value_Set(args.GetReturnValue(), |
3212 bCondition ? argFirstValue : argSecondValue); | 3184 bCondition ? argFirstValue : argSecondValue); |
3213 FXJSE_Value_Release(argSecondValue); | 3185 FXJSE_Value_Release(argSecondValue); |
3214 FXJSE_Value_Release(argFirstValue); | 3186 FXJSE_Value_Release(argFirstValue); |
3215 FXJSE_Value_Release(argCondition); | 3187 FXJSE_Value_Release(argCondition); |
3216 } else { | 3188 } else { |
3217 CXFA_FM2JSContext* pContext = | 3189 CXFA_FM2JSContext* pContext = |
3218 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3190 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3219 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3191 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3220 L"If"); | 3192 L"If"); |
3221 } | 3193 } |
3222 } | 3194 } |
3223 void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, | 3195 void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, |
3224 const CFX_ByteStringC& szFuncName, | 3196 const CFX_ByteStringC& szFuncName, |
3225 CFXJSE_Arguments& args) { | 3197 CFXJSE_Arguments& args) { |
3226 CXFA_FM2JSContext* pContext = | 3198 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3227 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3228 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 3199 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
3229 if (args.GetLength() == 1) { | 3200 if (args.GetLength() == 1) { |
3230 FXJSE_HVALUE scriptValue = GetSimpleHValue(hThis, args, 0); | 3201 FXJSE_HVALUE scriptValue = GetSimpleHValue(hThis, args, 0); |
3231 CFX_ByteString utf8ScriptString; | 3202 CFX_ByteString utf8ScriptString; |
3232 HValueToUTF8String(scriptValue, utf8ScriptString); | 3203 HValueToUTF8String(scriptValue, utf8ScriptString); |
3233 if (utf8ScriptString.IsEmpty()) { | 3204 if (utf8ScriptString.IsEmpty()) { |
3234 FXJSE_Value_SetNull(args.GetReturnValue()); | 3205 FXJSE_Value_SetNull(args.GetReturnValue()); |
3235 } else { | 3206 } else { |
3236 CFX_WideTextBuf wsJavaScriptBuf; | 3207 CFX_WideTextBuf wsJavaScriptBuf; |
3237 CFX_WideString javaScript; | 3208 CFX_WideString javaScript; |
(...skipping 14 matching lines...) Expand all Loading... |
3252 } | 3223 } |
3253 FXJSE_Value_Release(scriptValue); | 3224 FXJSE_Value_Release(scriptValue); |
3254 } else { | 3225 } else { |
3255 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3226 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3256 L"Eval"); | 3227 L"Eval"); |
3257 } | 3228 } |
3258 } | 3229 } |
3259 void CXFA_FM2JSContext::Ref(FXJSE_HOBJECT hThis, | 3230 void CXFA_FM2JSContext::Ref(FXJSE_HOBJECT hThis, |
3260 const CFX_ByteStringC& szFuncName, | 3231 const CFX_ByteStringC& szFuncName, |
3261 CFXJSE_Arguments& args) { | 3232 CFXJSE_Arguments& args) { |
3262 CXFA_FM2JSContext* pContext = | 3233 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3263 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3264 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 3234 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
3265 if (args.GetLength() == 1) { | 3235 if (args.GetLength() == 1) { |
3266 FXJSE_HVALUE argOne = args.GetValue(0); | 3236 FXJSE_HVALUE argOne = args.GetValue(0); |
3267 if (FXJSE_Value_IsNull(argOne)) { | 3237 if (FXJSE_Value_IsNull(argOne)) { |
3268 FXJSE_HVALUE rgValues[3]; | 3238 FXJSE_HVALUE rgValues[3]; |
3269 for (int32_t i = 0; i < 3; i++) { | 3239 for (int32_t i = 0; i < 3; i++) { |
3270 rgValues[i] = FXJSE_Value_Create(pIsolate); | 3240 rgValues[i] = FXJSE_Value_Create(pIsolate); |
3271 } | 3241 } |
3272 FXJSE_Value_SetInteger(rgValues[0], 4); | 3242 FXJSE_Value_SetInteger(rgValues[0], 4); |
3273 FXJSE_Value_SetNull(rgValues[1]); | 3243 FXJSE_Value_SetNull(rgValues[1]); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3437 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mp"); | 3407 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mp"); |
3438 break; | 3408 break; |
3439 default: | 3409 default: |
3440 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); | 3410 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); |
3441 break; | 3411 break; |
3442 } | 3412 } |
3443 } | 3413 } |
3444 FXJSE_Value_Release(unitspanValue); | 3414 FXJSE_Value_Release(unitspanValue); |
3445 } else { | 3415 } else { |
3446 CXFA_FM2JSContext* pContext = | 3416 CXFA_FM2JSContext* pContext = |
3447 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3417 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3448 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3418 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3449 L"UnitType"); | 3419 L"UnitType"); |
3450 } | 3420 } |
3451 } | 3421 } |
3452 void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, | 3422 void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, |
3453 const CFX_ByteStringC& szFuncName, | 3423 const CFX_ByteStringC& szFuncName, |
3454 CFXJSE_Arguments& args) { | 3424 CFXJSE_Arguments& args) { |
3455 int32_t argc = args.GetLength(); | 3425 int32_t argc = args.GetLength(); |
3456 if ((argc == 1) || (argc == 2)) { | 3426 if ((argc == 1) || (argc == 2)) { |
3457 FXJSE_HVALUE unitspanValue = GetSimpleHValue(hThis, args, 0); | 3427 FXJSE_HVALUE unitspanValue = GetSimpleHValue(hThis, args, 0); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3596 } else { | 3566 } else { |
3597 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 3567 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
3598 } | 3568 } |
3599 } | 3569 } |
3600 FXJSE_Value_Release(unitspanValue); | 3570 FXJSE_Value_Release(unitspanValue); |
3601 if (argc == 2) { | 3571 if (argc == 2) { |
3602 FXJSE_Value_Release(unitValue); | 3572 FXJSE_Value_Release(unitValue); |
3603 } | 3573 } |
3604 } else { | 3574 } else { |
3605 CXFA_FM2JSContext* pContext = | 3575 CXFA_FM2JSContext* pContext = |
3606 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3576 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3607 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3577 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3608 L"UnitValue"); | 3578 L"UnitValue"); |
3609 } | 3579 } |
3610 } | 3580 } |
3611 void CXFA_FM2JSContext::At(FXJSE_HOBJECT hThis, | 3581 void CXFA_FM2JSContext::At(FXJSE_HOBJECT hThis, |
3612 const CFX_ByteStringC& szFuncName, | 3582 const CFX_ByteStringC& szFuncName, |
3613 CFXJSE_Arguments& args) { | 3583 CFXJSE_Arguments& args) { |
3614 CXFA_FM2JSContext* pContext = | 3584 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3615 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3616 if (args.GetLength() == 2) { | 3585 if (args.GetLength() == 2) { |
3617 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3586 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
3618 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 3587 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
3619 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3588 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
3620 FXJSE_Value_SetNull(args.GetReturnValue()); | 3589 FXJSE_Value_SetNull(args.GetReturnValue()); |
3621 } else { | 3590 } else { |
3622 CFX_ByteString stringTwo; | 3591 CFX_ByteString stringTwo; |
3623 HValueToUTF8String(argTwo, stringTwo); | 3592 HValueToUTF8String(argTwo, stringTwo); |
3624 if (stringTwo.IsEmpty()) { | 3593 if (stringTwo.IsEmpty()) { |
3625 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 3594 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
3626 } else { | 3595 } else { |
3627 CFX_ByteString stringOne; | 3596 CFX_ByteString stringOne; |
3628 HValueToUTF8String(argOne, stringOne); | 3597 HValueToUTF8String(argOne, stringOne); |
3629 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); | 3598 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); |
3630 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); | 3599 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); |
3631 } | 3600 } |
3632 } | 3601 } |
3633 FXJSE_Value_Release(argOne); | 3602 FXJSE_Value_Release(argOne); |
3634 FXJSE_Value_Release(argTwo); | 3603 FXJSE_Value_Release(argTwo); |
3635 } else { | 3604 } else { |
3636 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3605 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3637 L"At"); | 3606 L"At"); |
3638 } | 3607 } |
3639 } | 3608 } |
3640 void CXFA_FM2JSContext::Concat(FXJSE_HOBJECT hThis, | 3609 void CXFA_FM2JSContext::Concat(FXJSE_HOBJECT hThis, |
3641 const CFX_ByteStringC& szFuncName, | 3610 const CFX_ByteStringC& szFuncName, |
3642 CFXJSE_Arguments& args) { | 3611 CFXJSE_Arguments& args) { |
3643 CXFA_FM2JSContext* pContext = | 3612 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3644 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3645 int32_t argc = args.GetLength(); | 3613 int32_t argc = args.GetLength(); |
3646 if (argc >= 1) { | 3614 if (argc >= 1) { |
3647 CFX_ByteString resultString; | 3615 CFX_ByteString resultString; |
3648 FX_BOOL bAllNull = TRUE; | 3616 FX_BOOL bAllNull = TRUE; |
3649 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argc); | 3617 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argc); |
3650 for (int32_t i = 0; i < argc; i++) { | 3618 for (int32_t i = 0; i < argc; i++) { |
3651 argValues[i] = GetSimpleHValue(hThis, args, i); | 3619 argValues[i] = GetSimpleHValue(hThis, args, i); |
3652 if (!HValueIsNull(hThis, argValues[i])) { | 3620 if (!HValueIsNull(hThis, argValues[i])) { |
3653 CFX_ByteString valueStr; | 3621 CFX_ByteString valueStr; |
3654 HValueToUTF8String(argValues[i], valueStr); | 3622 HValueToUTF8String(argValues[i], valueStr); |
(...skipping 12 matching lines...) Expand all Loading... |
3667 resultString.AsStringC()); | 3635 resultString.AsStringC()); |
3668 } | 3636 } |
3669 } else { | 3637 } else { |
3670 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3638 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
3671 L"Concat"); | 3639 L"Concat"); |
3672 } | 3640 } |
3673 } | 3641 } |
3674 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, | 3642 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, |
3675 const CFX_ByteStringC& szFuncName, | 3643 const CFX_ByteStringC& szFuncName, |
3676 CFXJSE_Arguments& args) { | 3644 CFXJSE_Arguments& args) { |
3677 CXFA_FM2JSContext* pContext = | 3645 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3678 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3679 int32_t argc = args.GetLength(); | 3646 int32_t argc = args.GetLength(); |
3680 if (argc == 1) { | 3647 if (argc == 1) { |
3681 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3648 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
3682 if (HValueIsNull(hThis, argOne)) { | 3649 if (HValueIsNull(hThis, argOne)) { |
3683 FXJSE_Value_SetNull(args.GetReturnValue()); | 3650 FXJSE_Value_SetNull(args.GetReturnValue()); |
3684 } else { | 3651 } else { |
3685 CFX_ByteString toDecodeString; | 3652 CFX_ByteString toDecodeString; |
3686 HValueToUTF8String(argOne, toDecodeString); | 3653 HValueToUTF8String(argOne, toDecodeString); |
3687 CFX_ByteTextBuf resultBuf; | 3654 CFX_ByteTextBuf resultBuf; |
3688 DecodeURL(toDecodeString.AsStringC(), resultBuf); | 3655 DecodeURL(toDecodeString.AsStringC(), resultBuf); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3938 iCode = 0; | 3905 iCode = 0; |
3939 } | 3906 } |
3940 wsXMLBuf.AppendChar(0); | 3907 wsXMLBuf.AppendChar(0); |
3941 szResultString.Clear(); | 3908 szResultString.Clear(); |
3942 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()) | 3909 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()) |
3943 .AsStringC(); | 3910 .AsStringC(); |
3944 } | 3911 } |
3945 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, | 3912 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, |
3946 const CFX_ByteStringC& szFuncName, | 3913 const CFX_ByteStringC& szFuncName, |
3947 CFXJSE_Arguments& args) { | 3914 CFXJSE_Arguments& args) { |
3948 CXFA_FM2JSContext* pContext = | 3915 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
3949 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
3950 int32_t argc = args.GetLength(); | 3916 int32_t argc = args.GetLength(); |
3951 if (argc == 1) { | 3917 if (argc == 1) { |
3952 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3918 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
3953 if (HValueIsNull(hThis, argOne)) { | 3919 if (HValueIsNull(hThis, argOne)) { |
3954 FXJSE_Value_SetNull(args.GetReturnValue()); | 3920 FXJSE_Value_SetNull(args.GetReturnValue()); |
3955 } else { | 3921 } else { |
3956 CFX_ByteString toEncodeString; | 3922 CFX_ByteString toEncodeString; |
3957 HValueToUTF8String(argOne, toEncodeString); | 3923 HValueToUTF8String(argOne, toEncodeString); |
3958 CFX_ByteTextBuf resultBuf; | 3924 CFX_ByteTextBuf resultBuf; |
3959 EncodeURL(toEncodeString.AsStringC(), resultBuf); | 3925 EncodeURL(toEncodeString.AsStringC(), resultBuf); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4349 iIndex++; | 4315 iIndex++; |
4350 } | 4316 } |
4351 if (patternType == XFA_VT_NULL) { | 4317 if (patternType == XFA_VT_NULL) { |
4352 patternType = XFA_VT_TEXT | XFA_VT_FLOAT; | 4318 patternType = XFA_VT_TEXT | XFA_VT_FLOAT; |
4353 } | 4319 } |
4354 return FALSE; | 4320 return FALSE; |
4355 } | 4321 } |
4356 void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis, | 4322 void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis, |
4357 const CFX_ByteStringC& szFuncName, | 4323 const CFX_ByteStringC& szFuncName, |
4358 CFXJSE_Arguments& args) { | 4324 CFXJSE_Arguments& args) { |
4359 CXFA_FM2JSContext* pContext = | 4325 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4360 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4361 int32_t argc = args.GetLength(); | 4326 int32_t argc = args.GetLength(); |
4362 if (argc >= 2) { | 4327 if (argc >= 2) { |
4363 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4328 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4364 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4329 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
4365 CFX_ByteString szPattern; | 4330 CFX_ByteString szPattern; |
4366 HValueToUTF8String(argOne, szPattern); | 4331 HValueToUTF8String(argOne, szPattern); |
4367 CFX_ByteString szValue; | 4332 CFX_ByteString szValue; |
4368 HValueToUTF8String(argTwo, szValue); | 4333 HValueToUTF8String(argTwo, szValue); |
4369 CXFA_Document* pDoc = pContext->GetDocument(); | 4334 CXFA_Document* pDoc = pContext->GetDocument(); |
4370 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4335 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4437 FXJSE_Value_Release(argOne); | 4402 FXJSE_Value_Release(argOne); |
4438 FXJSE_Value_Release(argTwo); | 4403 FXJSE_Value_Release(argTwo); |
4439 } else { | 4404 } else { |
4440 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4405 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4441 L"Format"); | 4406 L"Format"); |
4442 } | 4407 } |
4443 } | 4408 } |
4444 void CXFA_FM2JSContext::Left(FXJSE_HOBJECT hThis, | 4409 void CXFA_FM2JSContext::Left(FXJSE_HOBJECT hThis, |
4445 const CFX_ByteStringC& szFuncName, | 4410 const CFX_ByteStringC& szFuncName, |
4446 CFXJSE_Arguments& args) { | 4411 CFXJSE_Arguments& args) { |
4447 CXFA_FM2JSContext* pContext = | 4412 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4448 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4449 if (args.GetLength() == 2) { | 4413 if (args.GetLength() == 2) { |
4450 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4414 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4451 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4415 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
4452 FX_BOOL argIsNull = FALSE; | 4416 FX_BOOL argIsNull = FALSE; |
4453 if ((HValueIsNull(hThis, argOne)) || (HValueIsNull(hThis, argTwo))) { | 4417 if ((HValueIsNull(hThis, argOne)) || (HValueIsNull(hThis, argTwo))) { |
4454 argIsNull = TRUE; | 4418 argIsNull = TRUE; |
4455 } | 4419 } |
4456 if (argIsNull) { | 4420 if (argIsNull) { |
4457 FXJSE_Value_SetNull(args.GetReturnValue()); | 4421 FXJSE_Value_SetNull(args.GetReturnValue()); |
4458 } else { | 4422 } else { |
4459 CFX_ByteString sourceString; | 4423 CFX_ByteString sourceString; |
4460 HValueToUTF8String(argOne, sourceString); | 4424 HValueToUTF8String(argOne, sourceString); |
4461 int32_t count = HValueToInteger(hThis, argTwo); | 4425 int32_t count = HValueToInteger(hThis, argTwo); |
4462 if (count < 0) { | 4426 if (count < 0) { |
4463 count = 0; | 4427 count = 0; |
4464 } | 4428 } |
4465 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4429 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4466 sourceString.Left(count).AsStringC()); | 4430 sourceString.Left(count).AsStringC()); |
4467 } | 4431 } |
4468 FXJSE_Value_Release(argOne); | 4432 FXJSE_Value_Release(argOne); |
4469 FXJSE_Value_Release(argTwo); | 4433 FXJSE_Value_Release(argTwo); |
4470 } else { | 4434 } else { |
4471 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4435 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4472 L"Left"); | 4436 L"Left"); |
4473 } | 4437 } |
4474 } | 4438 } |
4475 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, | 4439 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, |
4476 const CFX_ByteStringC& szFuncName, | 4440 const CFX_ByteStringC& szFuncName, |
4477 CFXJSE_Arguments& args) { | 4441 CFXJSE_Arguments& args) { |
4478 CXFA_FM2JSContext* pContext = | 4442 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4479 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4480 if (args.GetLength() == 1) { | 4443 if (args.GetLength() == 1) { |
4481 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4444 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4482 if (HValueIsNull(hThis, argOne)) { | 4445 if (HValueIsNull(hThis, argOne)) { |
4483 FXJSE_Value_SetNull(args.GetReturnValue()); | 4446 FXJSE_Value_SetNull(args.GetReturnValue()); |
4484 } else { | 4447 } else { |
4485 CFX_ByteString sourceString; | 4448 CFX_ByteString sourceString; |
4486 HValueToUTF8String(argOne, sourceString); | 4449 HValueToUTF8String(argOne, sourceString); |
4487 FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); | 4450 FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); |
4488 } | 4451 } |
4489 FXJSE_Value_Release(argOne); | 4452 FXJSE_Value_Release(argOne); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4531 args.GetReturnValue(), | 4494 args.GetReturnValue(), |
4532 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) | 4495 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) |
4533 .AsStringC()); | 4496 .AsStringC()); |
4534 if (argc == 2) { | 4497 if (argc == 2) { |
4535 FXJSE_Value_Release(localeValue); | 4498 FXJSE_Value_Release(localeValue); |
4536 } | 4499 } |
4537 } | 4500 } |
4538 FXJSE_Value_Release(argOne); | 4501 FXJSE_Value_Release(argOne); |
4539 } else { | 4502 } else { |
4540 CXFA_FM2JSContext* pContext = | 4503 CXFA_FM2JSContext* pContext = |
4541 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4504 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4542 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4505 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4543 L"Lower"); | 4506 L"Lower"); |
4544 } | 4507 } |
4545 } | 4508 } |
4546 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, | 4509 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, |
4547 const CFX_ByteStringC& szFuncName, | 4510 const CFX_ByteStringC& szFuncName, |
4548 CFXJSE_Arguments& args) { | 4511 CFXJSE_Arguments& args) { |
4549 CXFA_FM2JSContext* pContext = | 4512 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4550 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4551 if (args.GetLength() == 1) { | 4513 if (args.GetLength() == 1) { |
4552 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4514 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4553 if (HValueIsNull(hThis, argOne)) { | 4515 if (HValueIsNull(hThis, argOne)) { |
4554 FXJSE_Value_SetNull(args.GetReturnValue()); | 4516 FXJSE_Value_SetNull(args.GetReturnValue()); |
4555 } else { | 4517 } else { |
4556 CFX_ByteString sourceString; | 4518 CFX_ByteString sourceString; |
4557 HValueToUTF8String(argOne, sourceString); | 4519 HValueToUTF8String(argOne, sourceString); |
4558 sourceString.TrimLeft(); | 4520 sourceString.TrimLeft(); |
4559 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4521 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4560 sourceString.AsStringC()); | 4522 sourceString.AsStringC()); |
4561 } | 4523 } |
4562 FXJSE_Value_Release(argOne); | 4524 FXJSE_Value_Release(argOne); |
4563 } else { | 4525 } else { |
4564 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4526 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4565 L"Ltrim"); | 4527 L"Ltrim"); |
4566 } | 4528 } |
4567 } | 4529 } |
4568 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, | 4530 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, |
4569 const CFX_ByteStringC& szFuncName, | 4531 const CFX_ByteStringC& szFuncName, |
4570 CFXJSE_Arguments& args) { | 4532 CFXJSE_Arguments& args) { |
4571 CXFA_FM2JSContext* pContext = | 4533 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4572 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4573 if (args.GetLength() == 2) { | 4534 if (args.GetLength() == 2) { |
4574 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4535 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4575 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4536 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
4576 if (HValueIsNull(hThis, argTwo)) { | 4537 if (HValueIsNull(hThis, argTwo)) { |
4577 FXJSE_Value_SetNull(args.GetReturnValue()); | 4538 FXJSE_Value_SetNull(args.GetReturnValue()); |
4578 } else { | 4539 } else { |
4579 CFX_ByteString szPattern; | 4540 CFX_ByteString szPattern; |
4580 HValueToUTF8String(argOne, szPattern); | 4541 HValueToUTF8String(argOne, szPattern); |
4581 CFX_ByteString szValue; | 4542 CFX_ByteString szValue; |
4582 HValueToUTF8String(argTwo, szValue); | 4543 HValueToUTF8String(argTwo, szValue); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4761 } | 4722 } |
4762 resultString.AppendChar(0); | 4723 resultString.AppendChar(0); |
4763 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); | 4724 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
4764 FXJSE_Value_Release(argOne); | 4725 FXJSE_Value_Release(argOne); |
4765 FXJSE_Value_Release(argTwo); | 4726 FXJSE_Value_Release(argTwo); |
4766 if (argc == 3) { | 4727 if (argc == 3) { |
4767 FXJSE_Value_Release(argThree); | 4728 FXJSE_Value_Release(argThree); |
4768 } | 4729 } |
4769 } else { | 4730 } else { |
4770 CXFA_FM2JSContext* pContext = | 4731 CXFA_FM2JSContext* pContext = |
4771 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4732 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4772 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4733 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4773 L"Replace"); | 4734 L"Replace"); |
4774 } | 4735 } |
4775 } | 4736 } |
4776 void CXFA_FM2JSContext::Right(FXJSE_HOBJECT hThis, | 4737 void CXFA_FM2JSContext::Right(FXJSE_HOBJECT hThis, |
4777 const CFX_ByteStringC& szFuncName, | 4738 const CFX_ByteStringC& szFuncName, |
4778 CFXJSE_Arguments& args) { | 4739 CFXJSE_Arguments& args) { |
4779 CXFA_FM2JSContext* pContext = | 4740 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4780 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4781 if (args.GetLength() == 2) { | 4741 if (args.GetLength() == 2) { |
4782 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4742 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4783 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4743 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
4784 FX_BOOL argIsNull = FALSE; | 4744 FX_BOOL argIsNull = FALSE; |
4785 if ((HValueIsNull(hThis, argOne)) || (HValueIsNull(hThis, argTwo))) { | 4745 if ((HValueIsNull(hThis, argOne)) || (HValueIsNull(hThis, argTwo))) { |
4786 argIsNull = TRUE; | 4746 argIsNull = TRUE; |
4787 } | 4747 } |
4788 if (argIsNull) { | 4748 if (argIsNull) { |
4789 FXJSE_Value_SetNull(args.GetReturnValue()); | 4749 FXJSE_Value_SetNull(args.GetReturnValue()); |
4790 } else { | 4750 } else { |
4791 CFX_ByteString sourceString; | 4751 CFX_ByteString sourceString; |
4792 HValueToUTF8String(argOne, sourceString); | 4752 HValueToUTF8String(argOne, sourceString); |
4793 int32_t count = HValueToInteger(hThis, argTwo); | 4753 int32_t count = HValueToInteger(hThis, argTwo); |
4794 if (count < 0) { | 4754 if (count < 0) { |
4795 count = 0; | 4755 count = 0; |
4796 } | 4756 } |
4797 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4757 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4798 sourceString.Right(count).AsStringC()); | 4758 sourceString.Right(count).AsStringC()); |
4799 } | 4759 } |
4800 FXJSE_Value_Release(argOne); | 4760 FXJSE_Value_Release(argOne); |
4801 FXJSE_Value_Release(argTwo); | 4761 FXJSE_Value_Release(argTwo); |
4802 } else { | 4762 } else { |
4803 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4763 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4804 L"Right"); | 4764 L"Right"); |
4805 } | 4765 } |
4806 } | 4766 } |
4807 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, | 4767 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, |
4808 const CFX_ByteStringC& szFuncName, | 4768 const CFX_ByteStringC& szFuncName, |
4809 CFXJSE_Arguments& args) { | 4769 CFXJSE_Arguments& args) { |
4810 CXFA_FM2JSContext* pContext = | 4770 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4811 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4812 if (args.GetLength() == 1) { | 4771 if (args.GetLength() == 1) { |
4813 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4772 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4814 if (HValueIsNull(hThis, argOne)) { | 4773 if (HValueIsNull(hThis, argOne)) { |
4815 FXJSE_Value_SetNull(args.GetReturnValue()); | 4774 FXJSE_Value_SetNull(args.GetReturnValue()); |
4816 } else { | 4775 } else { |
4817 CFX_ByteString sourceString; | 4776 CFX_ByteString sourceString; |
4818 HValueToUTF8String(argOne, sourceString); | 4777 HValueToUTF8String(argOne, sourceString); |
4819 sourceString.TrimRight(); | 4778 sourceString.TrimRight(); |
4820 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4779 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
4821 sourceString.AsStringC()); | 4780 sourceString.AsStringC()); |
4822 } | 4781 } |
4823 FXJSE_Value_Release(argOne); | 4782 FXJSE_Value_Release(argOne); |
4824 } else { | 4783 } else { |
4825 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4784 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4826 L"Rtrim"); | 4785 L"Rtrim"); |
4827 } | 4786 } |
4828 } | 4787 } |
4829 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, | 4788 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, |
4830 const CFX_ByteStringC& szFuncName, | 4789 const CFX_ByteStringC& szFuncName, |
4831 CFXJSE_Arguments& args) { | 4790 CFXJSE_Arguments& args) { |
4832 CXFA_FM2JSContext* pContext = | 4791 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4833 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
4834 if (args.GetLength() == 1) { | 4792 if (args.GetLength() == 1) { |
4835 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4793 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
4836 if (FXJSE_Value_IsNull(argOne)) { | 4794 if (FXJSE_Value_IsNull(argOne)) { |
4837 FXJSE_Value_SetNull(args.GetReturnValue()); | 4795 FXJSE_Value_SetNull(args.GetReturnValue()); |
4838 } else { | 4796 } else { |
4839 int32_t count = 0; | 4797 int32_t count = 0; |
4840 count = HValueToInteger(hThis, argOne); | 4798 count = HValueToInteger(hThis, argOne); |
4841 count = (count < 0) ? 0 : count; | 4799 count = (count < 0) ? 0 : count; |
4842 CFX_ByteTextBuf spaceString; | 4800 CFX_ByteTextBuf spaceString; |
4843 int32_t index = 0; | 4801 int32_t index = 0; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4968 } | 4926 } |
4969 FXJSE_Value_Release(numberValue); | 4927 FXJSE_Value_Release(numberValue); |
4970 if (argc > 1) { | 4928 if (argc > 1) { |
4971 FXJSE_Value_Release(widthValue); | 4929 FXJSE_Value_Release(widthValue); |
4972 if (argc == 3) { | 4930 if (argc == 3) { |
4973 FXJSE_Value_Release(precisionValue); | 4931 FXJSE_Value_Release(precisionValue); |
4974 } | 4932 } |
4975 } | 4933 } |
4976 } else { | 4934 } else { |
4977 CXFA_FM2JSContext* pContext = | 4935 CXFA_FM2JSContext* pContext = |
4978 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4936 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
4979 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4937 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
4980 L"Str"); | 4938 L"Str"); |
4981 } | 4939 } |
4982 } | 4940 } |
4983 void CXFA_FM2JSContext::Stuff(FXJSE_HOBJECT hThis, | 4941 void CXFA_FM2JSContext::Stuff(FXJSE_HOBJECT hThis, |
4984 const CFX_ByteStringC& szFuncName, | 4942 const CFX_ByteStringC& szFuncName, |
4985 CFXJSE_Arguments& args) { | 4943 CFXJSE_Arguments& args) { |
4986 int32_t argc = args.GetLength(); | 4944 int32_t argc = args.GetLength(); |
4987 if ((argc == 3) || (argc == 4)) { | 4945 if ((argc == 3) || (argc == 4)) { |
4988 CFX_ByteString sourceString; | 4946 CFX_ByteString sourceString; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5030 resultString.AppendChar(0); | 4988 resultString.AppendChar(0); |
5031 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); | 4989 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); |
5032 FXJSE_Value_Release(sourceValue); | 4990 FXJSE_Value_Release(sourceValue); |
5033 FXJSE_Value_Release(startValue); | 4991 FXJSE_Value_Release(startValue); |
5034 FXJSE_Value_Release(deleteValue); | 4992 FXJSE_Value_Release(deleteValue); |
5035 if (argc == 4) { | 4993 if (argc == 4) { |
5036 FXJSE_Value_Release(insertValue); | 4994 FXJSE_Value_Release(insertValue); |
5037 } | 4995 } |
5038 } else { | 4996 } else { |
5039 CXFA_FM2JSContext* pContext = | 4997 CXFA_FM2JSContext* pContext = |
5040 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4998 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5041 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4999 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5042 L"Stuff"); | 5000 L"Stuff"); |
5043 } | 5001 } |
5044 } | 5002 } |
5045 void CXFA_FM2JSContext::Substr(FXJSE_HOBJECT hThis, | 5003 void CXFA_FM2JSContext::Substr(FXJSE_HOBJECT hThis, |
5046 const CFX_ByteStringC& szFuncName, | 5004 const CFX_ByteStringC& szFuncName, |
5047 CFXJSE_Arguments& args) { | 5005 CFXJSE_Arguments& args) { |
5048 int32_t argc = args.GetLength(); | 5006 int32_t argc = args.GetLength(); |
5049 if (argc == 3) { | 5007 if (argc == 3) { |
5050 FXJSE_HVALUE stringValue = GetSimpleHValue(hThis, args, 0); | 5008 FXJSE_HVALUE stringValue = GetSimpleHValue(hThis, args, 0); |
(...skipping 25 matching lines...) Expand all Loading... |
5076 iStart -= 1; | 5034 iStart -= 1; |
5077 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5035 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
5078 szSourceStr.Mid(iStart, iCount).AsStringC()); | 5036 szSourceStr.Mid(iStart, iCount).AsStringC()); |
5079 } | 5037 } |
5080 } | 5038 } |
5081 FXJSE_Value_Release(stringValue); | 5039 FXJSE_Value_Release(stringValue); |
5082 FXJSE_Value_Release(startValue); | 5040 FXJSE_Value_Release(startValue); |
5083 FXJSE_Value_Release(endValue); | 5041 FXJSE_Value_Release(endValue); |
5084 } else { | 5042 } else { |
5085 CXFA_FM2JSContext* pContext = | 5043 CXFA_FM2JSContext* pContext = |
5086 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5044 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5087 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5045 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5088 L"Substr"); | 5046 L"Substr"); |
5089 } | 5047 } |
5090 } | 5048 } |
5091 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, | 5049 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, |
5092 const CFX_ByteStringC& szFuncName, | 5050 const CFX_ByteStringC& szFuncName, |
5093 CFXJSE_Arguments& args) { | 5051 CFXJSE_Arguments& args) { |
5094 int32_t argc = args.GetLength(); | 5052 int32_t argc = args.GetLength(); |
5095 if ((argc == 0) || (argc == 1)) { | 5053 if ((argc == 0) || (argc == 1)) { |
5096 int32_t iNum = 0; | 5054 int32_t iNum = 0; |
5097 FXJSE_HVALUE argOne = 0; | 5055 FXJSE_HVALUE argOne = 0; |
5098 if (argc == 1) { | 5056 if (argc == 1) { |
5099 argOne = GetSimpleHValue(hThis, args, 0); | 5057 argOne = GetSimpleHValue(hThis, args, 0); |
5100 iNum = (int32_t)HValueToFloat(hThis, argOne); | 5058 iNum = (int32_t)HValueToFloat(hThis, argOne); |
5101 } | 5059 } |
5102 FX_GUID guid; | 5060 FX_GUID guid; |
5103 FX_GUID_CreateV4(&guid); | 5061 FX_GUID_CreateV4(&guid); |
5104 CFX_ByteString bsUId; | 5062 CFX_ByteString bsUId; |
5105 FX_GUID_ToString(&guid, bsUId, iNum); | 5063 FX_GUID_ToString(&guid, bsUId, iNum); |
5106 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); | 5064 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); |
5107 if (argc == 1) { | 5065 if (argc == 1) { |
5108 FXJSE_Value_Release(argOne); | 5066 FXJSE_Value_Release(argOne); |
5109 } | 5067 } |
5110 } else { | 5068 } else { |
5111 CXFA_FM2JSContext* pContext = | 5069 CXFA_FM2JSContext* pContext = |
5112 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5070 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5113 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5071 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5114 L"Uuid"); | 5072 L"Uuid"); |
5115 } | 5073 } |
5116 } | 5074 } |
5117 void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis, | 5075 void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis, |
5118 const CFX_ByteStringC& szFuncName, | 5076 const CFX_ByteStringC& szFuncName, |
5119 CFXJSE_Arguments& args) { | 5077 CFXJSE_Arguments& args) { |
5120 int32_t argc = args.GetLength(); | 5078 int32_t argc = args.GetLength(); |
5121 if ((argc > 0) && (argc < 3)) { | 5079 if ((argc > 0) && (argc < 3)) { |
5122 CFX_ByteString argString; | 5080 CFX_ByteString argString; |
(...skipping 30 matching lines...) Expand all Loading... |
5153 args.GetReturnValue(), | 5111 args.GetReturnValue(), |
5154 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) | 5112 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) |
5155 .AsStringC()); | 5113 .AsStringC()); |
5156 if (argc == 2) { | 5114 if (argc == 2) { |
5157 FXJSE_Value_Release(localeValue); | 5115 FXJSE_Value_Release(localeValue); |
5158 } | 5116 } |
5159 } | 5117 } |
5160 FXJSE_Value_Release(argOne); | 5118 FXJSE_Value_Release(argOne); |
5161 } else { | 5119 } else { |
5162 CXFA_FM2JSContext* pContext = | 5120 CXFA_FM2JSContext* pContext = |
5163 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5121 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5164 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5122 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5165 L"Upper"); | 5123 L"Upper"); |
5166 } | 5124 } |
5167 } | 5125 } |
5168 void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis, | 5126 void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis, |
5169 const CFX_ByteStringC& szFuncName, | 5127 const CFX_ByteStringC& szFuncName, |
5170 CFXJSE_Arguments& args) { | 5128 CFXJSE_Arguments& args) { |
5171 int32_t argc = args.GetLength(); | 5129 int32_t argc = args.GetLength(); |
5172 if ((argc > 0) && (argc < 4)) { | 5130 if ((argc > 0) && (argc < 4)) { |
5173 FX_BOOL bFlags = FALSE; | 5131 FX_BOOL bFlags = FALSE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5213 } | 5171 } |
5214 FXJSE_Value_Release(numberValue); | 5172 FXJSE_Value_Release(numberValue); |
5215 if (argc > 1) { | 5173 if (argc > 1) { |
5216 FXJSE_Value_Release(identifierValue); | 5174 FXJSE_Value_Release(identifierValue); |
5217 if (argc == 3) { | 5175 if (argc == 3) { |
5218 FXJSE_Value_Release(localeValue); | 5176 FXJSE_Value_Release(localeValue); |
5219 } | 5177 } |
5220 } | 5178 } |
5221 } else { | 5179 } else { |
5222 CXFA_FM2JSContext* pContext = | 5180 CXFA_FM2JSContext* pContext = |
5223 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5181 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5224 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5182 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5225 L"WordNum"); | 5183 L"WordNum"); |
5226 } | 5184 } |
5227 } | 5185 } |
5228 void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, | 5186 void CXFA_FM2JSContext::TrillionUS(const CFX_ByteStringC& szData, |
5229 CFX_ByteTextBuf& strBuf) { | 5187 CFX_ByteTextBuf& strBuf) { |
5230 CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four", | 5188 CFX_ByteStringC pUnits[] = {"zero", "one", "two", "three", "four", |
5231 "five", "six", "seven", "eight", "nine"}; | 5189 "five", "six", "seven", "eight", "nine"}; |
5232 CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", | 5190 CFX_ByteStringC pCapUnits[] = {"Zero", "One", "Two", "Three", "Four", |
5233 "Five", "Six", "Seven", "Eight", "Nine"}; | 5191 "Five", "Six", "Seven", "Eight", "Nine"}; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5416 strBuf << " Cents"; | 5374 strBuf << " Cents"; |
5417 } | 5375 } |
5418 } break; | 5376 } break; |
5419 default: | 5377 default: |
5420 break; | 5378 break; |
5421 } | 5379 } |
5422 } | 5380 } |
5423 void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis, | 5381 void CXFA_FM2JSContext::Get(FXJSE_HOBJECT hThis, |
5424 const CFX_ByteStringC& szFuncName, | 5382 const CFX_ByteStringC& szFuncName, |
5425 CFXJSE_Arguments& args) { | 5383 CFXJSE_Arguments& args) { |
5426 CXFA_FM2JSContext* pContext = | 5384 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5427 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5428 int32_t argc = args.GetLength(); | 5385 int32_t argc = args.GetLength(); |
5429 if (argc == 1) { | 5386 if (argc == 1) { |
5430 CXFA_Document* pDoc = pContext->GetDocument(); | 5387 CXFA_Document* pDoc = pContext->GetDocument(); |
5431 if (!pDoc) { | 5388 if (!pDoc) { |
5432 return; | 5389 return; |
5433 } | 5390 } |
5434 IXFA_AppProvider* pAppProvider = | 5391 IXFA_AppProvider* pAppProvider = |
5435 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5392 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
5436 if (!pAppProvider) { | 5393 if (!pAppProvider) { |
5437 return; | 5394 return; |
(...skipping 14 matching lines...) Expand all Loading... |
5452 } | 5409 } |
5453 FXJSE_Value_Release(argOne); | 5410 FXJSE_Value_Release(argOne); |
5454 } else { | 5411 } else { |
5455 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5412 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5456 L"Get"); | 5413 L"Get"); |
5457 } | 5414 } |
5458 } | 5415 } |
5459 void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, | 5416 void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, |
5460 const CFX_ByteStringC& szFuncName, | 5417 const CFX_ByteStringC& szFuncName, |
5461 CFXJSE_Arguments& args) { | 5418 CFXJSE_Arguments& args) { |
5462 CXFA_FM2JSContext* pContext = | 5419 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5463 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5464 int32_t argc = args.GetLength(); | 5420 int32_t argc = args.GetLength(); |
5465 if ((argc >= 2) && (argc <= 5)) { | 5421 if ((argc >= 2) && (argc <= 5)) { |
5466 CXFA_Document* pDoc = pContext->GetDocument(); | 5422 CXFA_Document* pDoc = pContext->GetDocument(); |
5467 if (!pDoc) { | 5423 if (!pDoc) { |
5468 return; | 5424 return; |
5469 } | 5425 } |
5470 IXFA_AppProvider* pAppProvider = | 5426 IXFA_AppProvider* pAppProvider = |
5471 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5427 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
5472 if (!pAppProvider) { | 5428 if (!pAppProvider) { |
5473 return; | 5429 return; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5523 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5479 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
5524 } | 5480 } |
5525 } else { | 5481 } else { |
5526 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5482 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5527 L"Post"); | 5483 L"Post"); |
5528 } | 5484 } |
5529 } | 5485 } |
5530 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, | 5486 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, |
5531 const CFX_ByteStringC& szFuncName, | 5487 const CFX_ByteStringC& szFuncName, |
5532 CFXJSE_Arguments& args) { | 5488 CFXJSE_Arguments& args) { |
5533 CXFA_FM2JSContext* pContext = | 5489 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5534 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5535 int32_t argc = args.GetLength(); | 5490 int32_t argc = args.GetLength(); |
5536 if ((argc == 2) || (argc == 3)) { | 5491 if ((argc == 2) || (argc == 3)) { |
5537 CXFA_Document* pDoc = pContext->GetDocument(); | 5492 CXFA_Document* pDoc = pContext->GetDocument(); |
5538 if (!pDoc) { | 5493 if (!pDoc) { |
5539 return; | 5494 return; |
5540 } | 5495 } |
5541 IXFA_AppProvider* pAppProvider = | 5496 IXFA_AppProvider* pAppProvider = |
5542 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5497 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
5543 if (!pAppProvider) { | 5498 if (!pAppProvider) { |
5544 return; | 5499 return; |
(...skipping 25 matching lines...) Expand all Loading... |
5570 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5525 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
5571 } | 5526 } |
5572 } else { | 5527 } else { |
5573 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5528 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
5574 L"Put"); | 5529 L"Put"); |
5575 } | 5530 } |
5576 } | 5531 } |
5577 void CXFA_FM2JSContext::assign_value_operator(FXJSE_HOBJECT hThis, | 5532 void CXFA_FM2JSContext::assign_value_operator(FXJSE_HOBJECT hThis, |
5578 const CFX_ByteStringC& szFuncName, | 5533 const CFX_ByteStringC& szFuncName, |
5579 CFXJSE_Arguments& args) { | 5534 CFXJSE_Arguments& args) { |
5580 CXFA_FM2JSContext* pContext = | 5535 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5581 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5582 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5536 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
5583 if (args.GetLength() == 2) { | 5537 if (args.GetLength() == 2) { |
5584 FXJSE_HVALUE lValue = args.GetValue(0); | 5538 FXJSE_HVALUE lValue = args.GetValue(0); |
5585 FXJSE_HVALUE rValue = GetSimpleHValue(hThis, args, 1); | 5539 FXJSE_HVALUE rValue = GetSimpleHValue(hThis, args, 1); |
5586 FX_BOOL bSetStatus = TRUE; | 5540 FX_BOOL bSetStatus = TRUE; |
5587 if (FXJSE_Value_IsArray(lValue)) { | 5541 if (FXJSE_Value_IsArray(lValue)) { |
5588 FXJSE_HVALUE leftLengthValue = FXJSE_Value_Create(pIsolate); | 5542 FXJSE_HVALUE leftLengthValue = FXJSE_Value_Create(pIsolate); |
5589 FXJSE_Value_GetObjectProp(lValue, "length", leftLengthValue); | 5543 FXJSE_Value_GetObjectProp(lValue, "length", leftLengthValue); |
5590 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue); | 5544 int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue); |
5591 FXJSE_Value_Release(leftLengthValue); | 5545 FXJSE_Value_Release(leftLengthValue); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5635 FXJSE_Value_SetNull(args.GetReturnValue()); | 5589 FXJSE_Value_SetNull(args.GetReturnValue()); |
5636 } else { | 5590 } else { |
5637 FX_FLOAT first = HValueToFloat(hThis, argFirst); | 5591 FX_FLOAT first = HValueToFloat(hThis, argFirst); |
5638 FX_FLOAT second = HValueToFloat(hThis, argSecond); | 5592 FX_FLOAT second = HValueToFloat(hThis, argSecond); |
5639 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); | 5593 FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); |
5640 } | 5594 } |
5641 FXJSE_Value_Release(argFirst); | 5595 FXJSE_Value_Release(argFirst); |
5642 FXJSE_Value_Release(argSecond); | 5596 FXJSE_Value_Release(argSecond); |
5643 } else { | 5597 } else { |
5644 CXFA_FM2JSContext* pContext = | 5598 CXFA_FM2JSContext* pContext = |
5645 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5599 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5646 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5600 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5647 } | 5601 } |
5648 } | 5602 } |
5649 void CXFA_FM2JSContext::logical_and_operator(FXJSE_HOBJECT hThis, | 5603 void CXFA_FM2JSContext::logical_and_operator(FXJSE_HOBJECT hThis, |
5650 const CFX_ByteStringC& szFuncName, | 5604 const CFX_ByteStringC& szFuncName, |
5651 CFXJSE_Arguments& args) { | 5605 CFXJSE_Arguments& args) { |
5652 if (args.GetLength() == 2) { | 5606 if (args.GetLength() == 2) { |
5653 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5607 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5654 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5608 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5655 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { | 5609 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { |
5656 FXJSE_Value_SetNull(args.GetReturnValue()); | 5610 FXJSE_Value_SetNull(args.GetReturnValue()); |
5657 } else { | 5611 } else { |
5658 FX_FLOAT first = HValueToFloat(hThis, argFirst); | 5612 FX_FLOAT first = HValueToFloat(hThis, argFirst); |
5659 FX_FLOAT second = HValueToFloat(hThis, argSecond); | 5613 FX_FLOAT second = HValueToFloat(hThis, argSecond); |
5660 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); | 5614 FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); |
5661 } | 5615 } |
5662 FXJSE_Value_Release(argFirst); | 5616 FXJSE_Value_Release(argFirst); |
5663 FXJSE_Value_Release(argSecond); | 5617 FXJSE_Value_Release(argSecond); |
5664 } else { | 5618 } else { |
5665 CXFA_FM2JSContext* pContext = | 5619 CXFA_FM2JSContext* pContext = |
5666 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5620 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5667 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5621 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5668 } | 5622 } |
5669 } | 5623 } |
5670 void CXFA_FM2JSContext::equality_operator(FXJSE_HOBJECT hThis, | 5624 void CXFA_FM2JSContext::equality_operator(FXJSE_HOBJECT hThis, |
5671 const CFX_ByteStringC& szFuncName, | 5625 const CFX_ByteStringC& szFuncName, |
5672 CFXJSE_Arguments& args) { | 5626 CFXJSE_Arguments& args) { |
5673 if (args.GetLength() == 2) { | 5627 if (args.GetLength() == 2) { |
5674 if (fm_ref_equal(hThis, args)) { | 5628 if (fm_ref_equal(hThis, args)) { |
5675 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 5629 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
5676 } else { | 5630 } else { |
(...skipping 17 matching lines...) Expand all Loading... |
5694 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5648 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5695 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5649 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5696 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5650 FXJSE_Value_SetInteger(args.GetReturnValue(), |
5697 (first == second) ? 1 : 0); | 5651 (first == second) ? 1 : 0); |
5698 } | 5652 } |
5699 FXJSE_Value_Release(argFirst); | 5653 FXJSE_Value_Release(argFirst); |
5700 FXJSE_Value_Release(argSecond); | 5654 FXJSE_Value_Release(argSecond); |
5701 } | 5655 } |
5702 } else { | 5656 } else { |
5703 CXFA_FM2JSContext* pContext = | 5657 CXFA_FM2JSContext* pContext = |
5704 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5658 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5705 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5659 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5706 } | 5660 } |
5707 } | 5661 } |
5708 void CXFA_FM2JSContext::notequality_operator(FXJSE_HOBJECT hThis, | 5662 void CXFA_FM2JSContext::notequality_operator(FXJSE_HOBJECT hThis, |
5709 const CFX_ByteStringC& szFuncName, | 5663 const CFX_ByteStringC& szFuncName, |
5710 CFXJSE_Arguments& args) { | 5664 CFXJSE_Arguments& args) { |
5711 if (args.GetLength() == 2) { | 5665 if (args.GetLength() == 2) { |
5712 if (fm_ref_equal(hThis, args)) { | 5666 if (fm_ref_equal(hThis, args)) { |
5713 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5667 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
5714 } else { | 5668 } else { |
(...skipping 16 matching lines...) Expand all Loading... |
5731 } else { | 5685 } else { |
5732 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5686 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5733 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5687 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5734 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); | 5688 FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); |
5735 } | 5689 } |
5736 FXJSE_Value_Release(argFirst); | 5690 FXJSE_Value_Release(argFirst); |
5737 FXJSE_Value_Release(argSecond); | 5691 FXJSE_Value_Release(argSecond); |
5738 } | 5692 } |
5739 } else { | 5693 } else { |
5740 CXFA_FM2JSContext* pContext = | 5694 CXFA_FM2JSContext* pContext = |
5741 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5695 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5742 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5696 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5743 } | 5697 } |
5744 } | 5698 } |
5745 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(FXJSE_HOBJECT hThis, | 5699 FX_BOOL CXFA_FM2JSContext::fm_ref_equal(FXJSE_HOBJECT hThis, |
5746 CFXJSE_Arguments& args) { | 5700 CFXJSE_Arguments& args) { |
5747 FX_BOOL bRet = FALSE; | 5701 FX_BOOL bRet = FALSE; |
5748 CXFA_FM2JSContext* pContext = | 5702 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5749 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5750 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 5703 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
5751 FXJSE_HVALUE argFirst = args.GetValue(0); | 5704 FXJSE_HVALUE argFirst = args.GetValue(0); |
5752 FXJSE_HVALUE argSecond = args.GetValue(0); | 5705 FXJSE_HVALUE argSecond = args.GetValue(0); |
5753 if (FXJSE_Value_IsArray(argFirst) && FXJSE_Value_IsArray(argSecond)) { | 5706 if (FXJSE_Value_IsArray(argFirst) && FXJSE_Value_IsArray(argSecond)) { |
5754 FXJSE_HVALUE firstFlagValue = FXJSE_Value_Create(pIsolate); | 5707 FXJSE_HVALUE firstFlagValue = FXJSE_Value_Create(pIsolate); |
5755 FXJSE_HVALUE secondFlagValue = FXJSE_Value_Create(pIsolate); | 5708 FXJSE_HVALUE secondFlagValue = FXJSE_Value_Create(pIsolate); |
5756 FXJSE_Value_GetObjectPropByIdx(argFirst, 0, firstFlagValue); | 5709 FXJSE_Value_GetObjectPropByIdx(argFirst, 0, firstFlagValue); |
5757 FXJSE_Value_GetObjectPropByIdx(argSecond, 0, secondFlagValue); | 5710 FXJSE_Value_GetObjectPropByIdx(argSecond, 0, secondFlagValue); |
5758 if ((FXJSE_Value_ToInteger(firstFlagValue) == 3) && | 5711 if ((FXJSE_Value_ToInteger(firstFlagValue) == 3) && |
5759 (FXJSE_Value_ToInteger(secondFlagValue) == 3)) { | 5712 (FXJSE_Value_ToInteger(secondFlagValue) == 3)) { |
5760 FXJSE_HVALUE firstJSObject = FXJSE_Value_Create(pIsolate); | 5713 FXJSE_HVALUE firstJSObject = FXJSE_Value_Create(pIsolate); |
5761 FXJSE_HVALUE secondJSObject = FXJSE_Value_Create(pIsolate); | 5714 FXJSE_HVALUE secondJSObject = FXJSE_Value_Create(pIsolate); |
5762 FXJSE_Value_GetObjectPropByIdx(argFirst, 2, firstJSObject); | 5715 FXJSE_Value_GetObjectPropByIdx(argFirst, 2, firstJSObject); |
5763 FXJSE_Value_GetObjectPropByIdx(argSecond, 2, secondJSObject); | 5716 FXJSE_Value_GetObjectPropByIdx(argSecond, 2, secondJSObject); |
5764 if (!FXJSE_Value_IsNull(firstJSObject) && | 5717 if (!FXJSE_Value_IsNull(firstJSObject) && |
5765 !FXJSE_Value_IsNull(secondJSObject)) { | 5718 !FXJSE_Value_IsNull(secondJSObject)) { |
5766 bRet = (FXJSE_Value_ToObject(firstJSObject, NULL) == | 5719 bRet = (FXJSE_Value_ToObject(firstJSObject) == |
5767 FXJSE_Value_ToObject(secondJSObject, NULL)); | 5720 FXJSE_Value_ToObject(secondJSObject)); |
5768 } | 5721 } |
5769 FXJSE_Value_Release(firstJSObject); | 5722 FXJSE_Value_Release(firstJSObject); |
5770 FXJSE_Value_Release(secondJSObject); | 5723 FXJSE_Value_Release(secondJSObject); |
5771 } | 5724 } |
5772 FXJSE_Value_Release(firstFlagValue); | 5725 FXJSE_Value_Release(firstFlagValue); |
5773 FXJSE_Value_Release(secondFlagValue); | 5726 FXJSE_Value_Release(secondFlagValue); |
5774 } | 5727 } |
5775 FXJSE_Value_Release(argFirst); | 5728 FXJSE_Value_Release(argFirst); |
5776 FXJSE_Value_Release(argSecond); | 5729 FXJSE_Value_Release(argSecond); |
5777 return bRet; | 5730 return bRet; |
(...skipping 17 matching lines...) Expand all Loading... |
5795 firstOutput.Compare(secondOutput.AsStringC()) == -1); | 5748 firstOutput.Compare(secondOutput.AsStringC()) == -1); |
5796 } else { | 5749 } else { |
5797 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5750 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5798 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5751 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5799 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); | 5752 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
5800 } | 5753 } |
5801 FXJSE_Value_Release(argFirst); | 5754 FXJSE_Value_Release(argFirst); |
5802 FXJSE_Value_Release(argSecond); | 5755 FXJSE_Value_Release(argSecond); |
5803 } else { | 5756 } else { |
5804 CXFA_FM2JSContext* pContext = | 5757 CXFA_FM2JSContext* pContext = |
5805 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5758 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5806 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5759 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5807 } | 5760 } |
5808 } | 5761 } |
5809 void CXFA_FM2JSContext::lessequal_operator(FXJSE_HOBJECT hThis, | 5762 void CXFA_FM2JSContext::lessequal_operator(FXJSE_HOBJECT hThis, |
5810 const CFX_ByteStringC& szFuncName, | 5763 const CFX_ByteStringC& szFuncName, |
5811 CFXJSE_Arguments& args) { | 5764 CFXJSE_Arguments& args) { |
5812 if (args.GetLength() == 2) { | 5765 if (args.GetLength() == 2) { |
5813 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5766 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5814 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5767 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5815 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5768 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
(...skipping 12 matching lines...) Expand all Loading... |
5828 firstOutput.Compare(secondOutput.AsStringC()) != 1); | 5781 firstOutput.Compare(secondOutput.AsStringC()) != 1); |
5829 } else { | 5782 } else { |
5830 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5783 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5831 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5784 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5832 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); | 5785 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
5833 } | 5786 } |
5834 FXJSE_Value_Release(argFirst); | 5787 FXJSE_Value_Release(argFirst); |
5835 FXJSE_Value_Release(argSecond); | 5788 FXJSE_Value_Release(argSecond); |
5836 } else { | 5789 } else { |
5837 CXFA_FM2JSContext* pContext = | 5790 CXFA_FM2JSContext* pContext = |
5838 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5791 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5839 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5792 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5840 } | 5793 } |
5841 } | 5794 } |
5842 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, | 5795 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, |
5843 const CFX_ByteStringC& szFuncName, | 5796 const CFX_ByteStringC& szFuncName, |
5844 CFXJSE_Arguments& args) { | 5797 CFXJSE_Arguments& args) { |
5845 if (args.GetLength() == 2) { | 5798 if (args.GetLength() == 2) { |
5846 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5799 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5847 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5800 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5848 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5801 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
5849 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5802 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
5850 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5803 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
5851 FXJSE_Value_IsUTF8String(argSecond)) { | 5804 FXJSE_Value_IsUTF8String(argSecond)) { |
5852 CFX_ByteString firstOutput; | 5805 CFX_ByteString firstOutput; |
5853 CFX_ByteString secondOutput; | 5806 CFX_ByteString secondOutput; |
5854 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5807 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
5855 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5808 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
5856 FXJSE_Value_SetInteger( | 5809 FXJSE_Value_SetInteger( |
5857 args.GetReturnValue(), | 5810 args.GetReturnValue(), |
5858 firstOutput.Compare(secondOutput.AsStringC()) == 1); | 5811 firstOutput.Compare(secondOutput.AsStringC()) == 1); |
5859 } else { | 5812 } else { |
5860 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5813 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5861 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5814 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5862 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); | 5815 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
5863 } | 5816 } |
5864 FXJSE_Value_Release(argFirst); | 5817 FXJSE_Value_Release(argFirst); |
5865 FXJSE_Value_Release(argSecond); | 5818 FXJSE_Value_Release(argSecond); |
5866 } else { | 5819 } else { |
5867 CXFA_FM2JSContext* pContext = | 5820 CXFA_FM2JSContext* pContext = |
5868 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5821 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5869 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5822 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5870 } | 5823 } |
5871 } | 5824 } |
5872 void CXFA_FM2JSContext::greaterequal_operator(FXJSE_HOBJECT hThis, | 5825 void CXFA_FM2JSContext::greaterequal_operator(FXJSE_HOBJECT hThis, |
5873 const CFX_ByteStringC& szFuncName, | 5826 const CFX_ByteStringC& szFuncName, |
5874 CFXJSE_Arguments& args) { | 5827 CFXJSE_Arguments& args) { |
5875 if (args.GetLength() == 2) { | 5828 if (args.GetLength() == 2) { |
5876 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5829 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5877 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5830 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5878 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5831 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
(...skipping 12 matching lines...) Expand all Loading... |
5891 firstOutput.Compare(secondOutput.AsStringC()) != -1); | 5844 firstOutput.Compare(secondOutput.AsStringC()) != -1); |
5892 } else { | 5845 } else { |
5893 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5846 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5894 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5847 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5895 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); | 5848 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
5896 } | 5849 } |
5897 FXJSE_Value_Release(argFirst); | 5850 FXJSE_Value_Release(argFirst); |
5898 FXJSE_Value_Release(argSecond); | 5851 FXJSE_Value_Release(argSecond); |
5899 } else { | 5852 } else { |
5900 CXFA_FM2JSContext* pContext = | 5853 CXFA_FM2JSContext* pContext = |
5901 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5854 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5902 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5855 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5903 } | 5856 } |
5904 } | 5857 } |
5905 void CXFA_FM2JSContext::plus_operator(FXJSE_HOBJECT hThis, | 5858 void CXFA_FM2JSContext::plus_operator(FXJSE_HOBJECT hThis, |
5906 const CFX_ByteStringC& szFuncName, | 5859 const CFX_ByteStringC& szFuncName, |
5907 CFXJSE_Arguments& args) { | 5860 CFXJSE_Arguments& args) { |
5908 if (args.GetLength() == 2) { | 5861 if (args.GetLength() == 2) { |
5909 FXJSE_HVALUE argFirst = args.GetValue(0); | 5862 FXJSE_HVALUE argFirst = args.GetValue(0); |
5910 FXJSE_HVALUE argSecond = args.GetValue(1); | 5863 FXJSE_HVALUE argSecond = args.GetValue(1); |
5911 if (HValueIsNull(hThis, argFirst) && HValueIsNull(hThis, argSecond)) { | 5864 if (HValueIsNull(hThis, argFirst) && HValueIsNull(hThis, argSecond)) { |
5912 FXJSE_Value_SetNull(args.GetReturnValue()); | 5865 FXJSE_Value_SetNull(args.GetReturnValue()); |
5913 } else { | 5866 } else { |
5914 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5867 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5915 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5868 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5916 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); | 5869 FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); |
5917 } | 5870 } |
5918 FXJSE_Value_Release(argFirst); | 5871 FXJSE_Value_Release(argFirst); |
5919 FXJSE_Value_Release(argSecond); | 5872 FXJSE_Value_Release(argSecond); |
5920 } else { | 5873 } else { |
5921 CXFA_FM2JSContext* pContext = | 5874 CXFA_FM2JSContext* pContext = |
5922 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5875 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5923 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5876 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5924 } | 5877 } |
5925 } | 5878 } |
5926 void CXFA_FM2JSContext::minus_operator(FXJSE_HOBJECT hThis, | 5879 void CXFA_FM2JSContext::minus_operator(FXJSE_HOBJECT hThis, |
5927 const CFX_ByteStringC& szFuncName, | 5880 const CFX_ByteStringC& szFuncName, |
5928 CFXJSE_Arguments& args) { | 5881 CFXJSE_Arguments& args) { |
5929 if (args.GetLength() == 2) { | 5882 if (args.GetLength() == 2) { |
5930 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5883 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5931 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5884 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5932 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { | 5885 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { |
5933 FXJSE_Value_SetNull(args.GetReturnValue()); | 5886 FXJSE_Value_SetNull(args.GetReturnValue()); |
5934 } else { | 5887 } else { |
5935 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5888 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5936 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5889 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5937 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); | 5890 FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); |
5938 } | 5891 } |
5939 FXJSE_Value_Release(argFirst); | 5892 FXJSE_Value_Release(argFirst); |
5940 FXJSE_Value_Release(argSecond); | 5893 FXJSE_Value_Release(argSecond); |
5941 } else { | 5894 } else { |
5942 CXFA_FM2JSContext* pContext = | 5895 CXFA_FM2JSContext* pContext = |
5943 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5896 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5944 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5897 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5945 } | 5898 } |
5946 } | 5899 } |
5947 void CXFA_FM2JSContext::multiple_operator(FXJSE_HOBJECT hThis, | 5900 void CXFA_FM2JSContext::multiple_operator(FXJSE_HOBJECT hThis, |
5948 const CFX_ByteStringC& szFuncName, | 5901 const CFX_ByteStringC& szFuncName, |
5949 CFXJSE_Arguments& args) { | 5902 CFXJSE_Arguments& args) { |
5950 if (args.GetLength() == 2) { | 5903 if (args.GetLength() == 2) { |
5951 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5904 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5952 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5905 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5953 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { | 5906 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { |
5954 FXJSE_Value_SetNull(args.GetReturnValue()); | 5907 FXJSE_Value_SetNull(args.GetReturnValue()); |
5955 } else { | 5908 } else { |
5956 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5909 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5957 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5910 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5958 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); | 5911 FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); |
5959 } | 5912 } |
5960 FXJSE_Value_Release(argFirst); | 5913 FXJSE_Value_Release(argFirst); |
5961 FXJSE_Value_Release(argSecond); | 5914 FXJSE_Value_Release(argSecond); |
5962 } else { | 5915 } else { |
5963 CXFA_FM2JSContext* pContext = | 5916 CXFA_FM2JSContext* pContext = |
5964 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5917 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5965 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5918 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
5966 } | 5919 } |
5967 } | 5920 } |
5968 void CXFA_FM2JSContext::divide_operator(FXJSE_HOBJECT hThis, | 5921 void CXFA_FM2JSContext::divide_operator(FXJSE_HOBJECT hThis, |
5969 const CFX_ByteStringC& szFuncName, | 5922 const CFX_ByteStringC& szFuncName, |
5970 CFXJSE_Arguments& args) { | 5923 CFXJSE_Arguments& args) { |
5971 CXFA_FM2JSContext* pContext = | 5924 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
5972 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
5973 if (args.GetLength() == 2) { | 5925 if (args.GetLength() == 2) { |
5974 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5926 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
5975 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5927 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
5976 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { | 5928 if (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) { |
5977 FXJSE_Value_SetNull(args.GetReturnValue()); | 5929 FXJSE_Value_SetNull(args.GetReturnValue()); |
5978 } else { | 5930 } else { |
5979 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5931 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
5980 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5932 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
5981 if (second == 0.0) { | 5933 if (second == 0.0) { |
5982 pContext->ThrowScriptErrorMessage(XFA_IDS_DIVIDE_ZERO); | 5934 pContext->ThrowScriptErrorMessage(XFA_IDS_DIVIDE_ZERO); |
(...skipping 15 matching lines...) Expand all Loading... |
5998 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 5950 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
5999 if (FXJSE_Value_IsNull(argOne)) { | 5951 if (FXJSE_Value_IsNull(argOne)) { |
6000 FXJSE_Value_SetNull(args.GetReturnValue()); | 5952 FXJSE_Value_SetNull(args.GetReturnValue()); |
6001 } else { | 5953 } else { |
6002 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5954 FXJSE_Value_SetDouble(args.GetReturnValue(), |
6003 0.0 + HValueToDouble(hThis, argOne)); | 5955 0.0 + HValueToDouble(hThis, argOne)); |
6004 } | 5956 } |
6005 FXJSE_Value_Release(argOne); | 5957 FXJSE_Value_Release(argOne); |
6006 } else { | 5958 } else { |
6007 CXFA_FM2JSContext* pContext = | 5959 CXFA_FM2JSContext* pContext = |
6008 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5960 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6009 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5961 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6010 } | 5962 } |
6011 } | 5963 } |
6012 void CXFA_FM2JSContext::negative_operator(FXJSE_HOBJECT hThis, | 5964 void CXFA_FM2JSContext::negative_operator(FXJSE_HOBJECT hThis, |
6013 const CFX_ByteStringC& szFuncName, | 5965 const CFX_ByteStringC& szFuncName, |
6014 CFXJSE_Arguments& args) { | 5966 CFXJSE_Arguments& args) { |
6015 int32_t iLength = args.GetLength(); | 5967 int32_t iLength = args.GetLength(); |
6016 if (iLength == 1) { | 5968 if (iLength == 1) { |
6017 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 5969 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
6018 if (FXJSE_Value_IsNull(argOne)) { | 5970 if (FXJSE_Value_IsNull(argOne)) { |
6019 FXJSE_Value_SetNull(args.GetReturnValue()); | 5971 FXJSE_Value_SetNull(args.GetReturnValue()); |
6020 } else { | 5972 } else { |
6021 FXJSE_Value_SetDouble(args.GetReturnValue(), | 5973 FXJSE_Value_SetDouble(args.GetReturnValue(), |
6022 0.0 - HValueToDouble(hThis, argOne)); | 5974 0.0 - HValueToDouble(hThis, argOne)); |
6023 } | 5975 } |
6024 FXJSE_Value_Release(argOne); | 5976 FXJSE_Value_Release(argOne); |
6025 } else { | 5977 } else { |
6026 CXFA_FM2JSContext* pContext = | 5978 CXFA_FM2JSContext* pContext = |
6027 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5979 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6028 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5980 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6029 } | 5981 } |
6030 } | 5982 } |
6031 void CXFA_FM2JSContext::logical_not_operator(FXJSE_HOBJECT hThis, | 5983 void CXFA_FM2JSContext::logical_not_operator(FXJSE_HOBJECT hThis, |
6032 const CFX_ByteStringC& szFuncName, | 5984 const CFX_ByteStringC& szFuncName, |
6033 CFXJSE_Arguments& args) { | 5985 CFXJSE_Arguments& args) { |
6034 int32_t iLength = args.GetLength(); | 5986 int32_t iLength = args.GetLength(); |
6035 if (iLength == 1) { | 5987 if (iLength == 1) { |
6036 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 5988 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
6037 if (FXJSE_Value_IsNull(argOne)) { | 5989 if (FXJSE_Value_IsNull(argOne)) { |
6038 FXJSE_Value_SetNull(args.GetReturnValue()); | 5990 FXJSE_Value_SetNull(args.GetReturnValue()); |
6039 } else { | 5991 } else { |
6040 FX_DOUBLE first = HValueToDouble(hThis, argOne); | 5992 FX_DOUBLE first = HValueToDouble(hThis, argOne); |
6041 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); | 5993 FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); |
6042 } | 5994 } |
6043 FXJSE_Value_Release(argOne); | 5995 FXJSE_Value_Release(argOne); |
6044 } else { | 5996 } else { |
6045 CXFA_FM2JSContext* pContext = | 5997 CXFA_FM2JSContext* pContext = |
6046 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5998 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6047 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5999 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6048 } | 6000 } |
6049 } | 6001 } |
6050 void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis, | 6002 void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis, |
6051 const CFX_ByteStringC& szFuncName, | 6003 const CFX_ByteStringC& szFuncName, |
6052 CFXJSE_Arguments& args) { | 6004 CFXJSE_Arguments& args) { |
6053 CXFA_FM2JSContext* pContext = | 6005 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6054 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6055 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6006 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6056 int32_t argc = args.GetLength(); | 6007 int32_t argc = args.GetLength(); |
6057 if ((argc == 4) || (argc == 5)) { | 6008 if ((argc == 4) || (argc == 5)) { |
6058 FX_BOOL bIsStar = TRUE; | 6009 FX_BOOL bIsStar = TRUE; |
6059 FXJSE_HVALUE argAccessor = args.GetValue(0); | 6010 FXJSE_HVALUE argAccessor = args.GetValue(0); |
6060 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 6011 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
6061 CFX_ByteString szName = args.GetUTF8String(2); | 6012 CFX_ByteString szName = args.GetUTF8String(2); |
6062 int32_t iIndexFlags = args.GetInt32(3); | 6013 int32_t iIndexFlags = args.GetInt32(3); |
6063 int32_t iIndexValue = 0; | 6014 int32_t iIndexValue = 0; |
6064 FXJSE_HVALUE argIndex = NULL; | 6015 FXJSE_HVALUE argIndex = NULL; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6195 FXJSE_Value_Release(argIndex); | 6146 FXJSE_Value_Release(argIndex); |
6196 } | 6147 } |
6197 FXJSE_Value_Release(argAccessor); | 6148 FXJSE_Value_Release(argAccessor); |
6198 } else { | 6149 } else { |
6199 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6150 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6200 } | 6151 } |
6201 } | 6152 } |
6202 void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis, | 6153 void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis, |
6203 const CFX_ByteStringC& szFuncName, | 6154 const CFX_ByteStringC& szFuncName, |
6204 CFXJSE_Arguments& args) { | 6155 CFXJSE_Arguments& args) { |
6205 CXFA_FM2JSContext* pContext = | 6156 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6206 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6207 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6157 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6208 int32_t argc = args.GetLength(); | 6158 int32_t argc = args.GetLength(); |
6209 if ((argc == 4) || (argc == 5)) { | 6159 if ((argc == 4) || (argc == 5)) { |
6210 FX_BOOL bIsStar = TRUE; | 6160 FX_BOOL bIsStar = TRUE; |
6211 FXJSE_HVALUE argAccessor = args.GetValue(0); | 6161 FXJSE_HVALUE argAccessor = args.GetValue(0); |
6212 CFX_ByteString bsAccessorName = args.GetUTF8String(1); | 6162 CFX_ByteString bsAccessorName = args.GetUTF8String(1); |
6213 CFX_ByteString szName = args.GetUTF8String(2); | 6163 CFX_ByteString szName = args.GetUTF8String(2); |
6214 int32_t iIndexFlags = args.GetInt32(3); | 6164 int32_t iIndexFlags = args.GetInt32(3); |
6215 int32_t iIndexValue = 0; | 6165 int32_t iIndexValue = 0; |
6216 FXJSE_HVALUE argIndex = NULL; | 6166 FXJSE_HVALUE argIndex = NULL; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6342 FXJSE_Value_Release(argIndex); | 6292 FXJSE_Value_Release(argIndex); |
6343 } | 6293 } |
6344 FXJSE_Value_Release(argAccessor); | 6294 FXJSE_Value_Release(argAccessor); |
6345 } else { | 6295 } else { |
6346 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6296 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6347 } | 6297 } |
6348 } | 6298 } |
6349 void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, | 6299 void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, |
6350 const CFX_ByteStringC& szFuncName, | 6300 const CFX_ByteStringC& szFuncName, |
6351 CFXJSE_Arguments& args) { | 6301 CFXJSE_Arguments& args) { |
6352 CXFA_FM2JSContext* pContext = | 6302 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6353 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6354 int32_t argc = args.GetLength(); | 6303 int32_t argc = args.GetLength(); |
6355 if (argc == 1) { | 6304 if (argc == 1) { |
6356 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 6305 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
6357 CFX_ByteString argString; | 6306 CFX_ByteString argString; |
6358 HValueToUTF8String(argOne, argString); | 6307 HValueToUTF8String(argOne, argString); |
6359 if (argString.IsEmpty()) { | 6308 if (argString.IsEmpty()) { |
6360 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 6309 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
6361 } else { | 6310 } else { |
6362 CFX_WideString scriptString = | 6311 CFX_WideString scriptString = |
6363 CFX_WideString::FromUTF8(argString.AsStringC()); | 6312 CFX_WideString::FromUTF8(argString.AsStringC()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6401 FX_BOOL bIsArray = FXJSE_Value_IsArray(argOne); | 6350 FX_BOOL bIsArray = FXJSE_Value_IsArray(argOne); |
6402 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); | 6351 FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); |
6403 FXJSE_Value_Release(argOne); | 6352 FXJSE_Value_Release(argOne); |
6404 } else { | 6353 } else { |
6405 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); | 6354 FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); |
6406 } | 6355 } |
6407 } | 6356 } |
6408 void CXFA_FM2JSContext::get_fm_value(FXJSE_HOBJECT hThis, | 6357 void CXFA_FM2JSContext::get_fm_value(FXJSE_HOBJECT hThis, |
6409 const CFX_ByteStringC& szFuncName, | 6358 const CFX_ByteStringC& szFuncName, |
6410 CFXJSE_Arguments& args) { | 6359 CFXJSE_Arguments& args) { |
6411 CXFA_FM2JSContext* pContext = | 6360 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6412 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6413 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6361 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6414 int32_t iLength = args.GetLength(); | 6362 int32_t iLength = args.GetLength(); |
6415 if (iLength == 1) { | 6363 if (iLength == 1) { |
6416 FXJSE_HVALUE argOne = args.GetValue(0); | 6364 FXJSE_HVALUE argOne = args.GetValue(0); |
6417 if (FXJSE_Value_IsArray(argOne)) { | 6365 if (FXJSE_Value_IsArray(argOne)) { |
6418 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); | 6366 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); |
6419 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); | 6367 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); |
6420 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 6368 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
6421 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); | 6369 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); |
6422 if (FXJSE_Value_IsNull(propertyValue)) { | 6370 if (FXJSE_Value_IsNull(propertyValue)) { |
(...skipping 13 matching lines...) Expand all Loading... |
6436 } | 6384 } |
6437 FXJSE_Value_Release(argOne); | 6385 FXJSE_Value_Release(argOne); |
6438 } else { | 6386 } else { |
6439 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6387 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6440 } | 6388 } |
6441 } | 6389 } |
6442 void CXFA_FM2JSContext::get_fm_jsobj(FXJSE_HOBJECT hThis, | 6390 void CXFA_FM2JSContext::get_fm_jsobj(FXJSE_HOBJECT hThis, |
6443 const CFX_ByteStringC& szFuncName, | 6391 const CFX_ByteStringC& szFuncName, |
6444 CFXJSE_Arguments& args) { | 6392 CFXJSE_Arguments& args) { |
6445 CXFA_FM2JSContext* pContext = | 6393 CXFA_FM2JSContext* pContext = |
6446 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(hThis, nullptr)); | 6394 static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(hThis)); |
6447 int32_t argc = args.GetLength(); | 6395 int32_t argc = args.GetLength(); |
6448 if (argc == 1) { | 6396 if (argc == 1) { |
6449 FXJSE_HVALUE argOne = args.GetValue(0); | 6397 FXJSE_HVALUE argOne = args.GetValue(0); |
6450 if (FXJSE_Value_IsArray(argOne)) { | 6398 if (FXJSE_Value_IsArray(argOne)) { |
6451 #ifndef NDEBUG | 6399 #ifndef NDEBUG |
6452 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6400 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6453 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6401 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6454 FXJSE_Value_GetObjectProp(argOne, "length", lengthValue); | 6402 FXJSE_Value_GetObjectProp(argOne, "length", lengthValue); |
6455 ASSERT(FXJSE_Value_ToInteger(lengthValue) >= 3); | 6403 ASSERT(FXJSE_Value_ToInteger(lengthValue) >= 3); |
6456 FXJSE_Value_Release(lengthValue); | 6404 FXJSE_Value_Release(lengthValue); |
6457 #endif | 6405 #endif |
6458 FXJSE_Value_GetObjectPropByIdx(argOne, 2, args.GetReturnValue()); | 6406 FXJSE_Value_GetObjectPropByIdx(argOne, 2, args.GetReturnValue()); |
6459 } else { | 6407 } else { |
6460 FXJSE_Value_Set(args.GetReturnValue(), argOne); | 6408 FXJSE_Value_Set(args.GetReturnValue(), argOne); |
6461 } | 6409 } |
6462 FXJSE_Value_Release(argOne); | 6410 FXJSE_Value_Release(argOne); |
6463 } else { | 6411 } else { |
6464 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6412 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6465 } | 6413 } |
6466 } | 6414 } |
6467 void CXFA_FM2JSContext::fm_var_filter(FXJSE_HOBJECT hThis, | 6415 void CXFA_FM2JSContext::fm_var_filter(FXJSE_HOBJECT hThis, |
6468 const CFX_ByteStringC& szFuncName, | 6416 const CFX_ByteStringC& szFuncName, |
6469 CFXJSE_Arguments& args) { | 6417 CFXJSE_Arguments& args) { |
6470 CXFA_FM2JSContext* pContext = | 6418 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6471 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6472 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6419 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6473 int32_t argc = args.GetLength(); | 6420 int32_t argc = args.GetLength(); |
6474 if (argc == 1) { | 6421 if (argc == 1) { |
6475 FXJSE_HVALUE argOne = args.GetValue(0); | 6422 FXJSE_HVALUE argOne = args.GetValue(0); |
6476 if (FXJSE_Value_IsArray(argOne)) { | 6423 if (FXJSE_Value_IsArray(argOne)) { |
6477 #ifndef NDEBUG | 6424 #ifndef NDEBUG |
6478 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6425 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6479 FXJSE_Value_GetObjectProp(argOne, "length", lengthValue); | 6426 FXJSE_Value_GetObjectProp(argOne, "length", lengthValue); |
6480 ASSERT(FXJSE_Value_ToInteger(lengthValue) >= 3); | 6427 ASSERT(FXJSE_Value_ToInteger(lengthValue) >= 3); |
6481 FXJSE_Value_Release(lengthValue); | 6428 FXJSE_Value_Release(lengthValue); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6516 FXJSE_Value_Release(simpleValue); | 6463 FXJSE_Value_Release(simpleValue); |
6517 } | 6464 } |
6518 FXJSE_Value_Release(argOne); | 6465 FXJSE_Value_Release(argOne); |
6519 } else { | 6466 } else { |
6520 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6467 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
6521 } | 6468 } |
6522 } | 6469 } |
6523 void CXFA_FM2JSContext::concat_fm_object(FXJSE_HOBJECT hThis, | 6470 void CXFA_FM2JSContext::concat_fm_object(FXJSE_HOBJECT hThis, |
6524 const CFX_ByteStringC& szFuncName, | 6471 const CFX_ByteStringC& szFuncName, |
6525 CFXJSE_Arguments& args) { | 6472 CFXJSE_Arguments& args) { |
6526 CXFA_FM2JSContext* pContext = | 6473 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6527 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6528 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6474 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6529 uint32_t iLength = 0; | 6475 uint32_t iLength = 0; |
6530 int32_t argCount = args.GetLength(); | 6476 int32_t argCount = args.GetLength(); |
6531 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argCount); | 6477 FXJSE_HVALUE* argValues = FX_Alloc(FXJSE_HVALUE, argCount); |
6532 for (int32_t i = 0; i < argCount; i++) { | 6478 for (int32_t i = 0; i < argCount; i++) { |
6533 argValues[i] = args.GetValue(i); | 6479 argValues[i] = args.GetValue(i); |
6534 if (FXJSE_Value_IsArray(argValues[i])) { | 6480 if (FXJSE_Value_IsArray(argValues[i])) { |
6535 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6481 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6536 FXJSE_Value_GetObjectProp(argValues[i], "length", lengthValue); | 6482 FXJSE_Value_GetObjectProp(argValues[i], "length", lengthValue); |
6537 int32_t length = FXJSE_Value_ToInteger(lengthValue); | 6483 int32_t length = FXJSE_Value_ToInteger(lengthValue); |
(...skipping 27 matching lines...) Expand all Loading... |
6565 } | 6511 } |
6566 FX_Free(argValues); | 6512 FX_Free(argValues); |
6567 for (int32_t i = 0; i < (int32_t)iLength; i++) { | 6513 for (int32_t i = 0; i < (int32_t)iLength; i++) { |
6568 FXJSE_Value_Release(returnValues[i]); | 6514 FXJSE_Value_Release(returnValues[i]); |
6569 } | 6515 } |
6570 FX_Free(returnValues); | 6516 FX_Free(returnValues); |
6571 } | 6517 } |
6572 FXJSE_HVALUE CXFA_FM2JSContext::GetSimpleHValue(FXJSE_HOBJECT hThis, | 6518 FXJSE_HVALUE CXFA_FM2JSContext::GetSimpleHValue(FXJSE_HOBJECT hThis, |
6573 CFXJSE_Arguments& args, | 6519 CFXJSE_Arguments& args, |
6574 uint32_t index) { | 6520 uint32_t index) { |
6575 CXFA_FM2JSContext* pContext = | 6521 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6576 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6577 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6522 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6578 ASSERT(index < (uint32_t)args.GetLength()); | 6523 ASSERT(index < (uint32_t)args.GetLength()); |
6579 FXJSE_HVALUE argIndex = args.GetValue(index); | 6524 FXJSE_HVALUE argIndex = args.GetValue(index); |
6580 if (FXJSE_Value_IsArray(argIndex)) { | 6525 if (FXJSE_Value_IsArray(argIndex)) { |
6581 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6526 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6582 FXJSE_Value_GetObjectProp(argIndex, "length", lengthValue); | 6527 FXJSE_Value_GetObjectProp(argIndex, "length", lengthValue); |
6583 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); | 6528 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); |
6584 FXJSE_Value_Release(lengthValue); | 6529 FXJSE_Value_Release(lengthValue); |
6585 FXJSE_HVALUE simpleValue = FXJSE_Value_Create(pIsolate); | 6530 FXJSE_HVALUE simpleValue = FXJSE_Value_Create(pIsolate); |
6586 if (iLength > 2) { | 6531 if (iLength > 2) { |
(...skipping 19 matching lines...) Expand all Loading... |
6606 } else if (FXJSE_Value_IsObject(argIndex)) { | 6551 } else if (FXJSE_Value_IsObject(argIndex)) { |
6607 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(pIsolate); | 6552 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(pIsolate); |
6608 GetObjectDefaultValue(argIndex, defaultValue); | 6553 GetObjectDefaultValue(argIndex, defaultValue); |
6609 FXJSE_Value_Release(argIndex); | 6554 FXJSE_Value_Release(argIndex); |
6610 return defaultValue; | 6555 return defaultValue; |
6611 } else { | 6556 } else { |
6612 return argIndex; | 6557 return argIndex; |
6613 } | 6558 } |
6614 } | 6559 } |
6615 FX_BOOL CXFA_FM2JSContext::HValueIsNull(FXJSE_HOBJECT hThis, FXJSE_HVALUE arg) { | 6560 FX_BOOL CXFA_FM2JSContext::HValueIsNull(FXJSE_HOBJECT hThis, FXJSE_HVALUE arg) { |
6616 CXFA_FM2JSContext* pContext = | 6561 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6617 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6618 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6562 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6619 FX_BOOL isNull = FALSE; | 6563 FX_BOOL isNull = FALSE; |
6620 if (FXJSE_Value_IsNull(arg)) { | 6564 if (FXJSE_Value_IsNull(arg)) { |
6621 isNull = TRUE; | 6565 isNull = TRUE; |
6622 } else if (FXJSE_Value_IsArray(arg)) { | 6566 } else if (FXJSE_Value_IsArray(arg)) { |
6623 int32_t iLength = hvalue_get_array_length(hThis, arg); | 6567 int32_t iLength = hvalue_get_array_length(hThis, arg); |
6624 if (iLength > 2) { | 6568 if (iLength > 2) { |
6625 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); | 6569 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); |
6626 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(pIsolate); | 6570 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(pIsolate); |
6627 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 6571 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
(...skipping 26 matching lines...) Expand all Loading... |
6654 GetObjectDefaultValue(arg, defaultValue); | 6598 GetObjectDefaultValue(arg, defaultValue); |
6655 if (FXJSE_Value_IsNull(defaultValue)) { | 6599 if (FXJSE_Value_IsNull(defaultValue)) { |
6656 isNull = TRUE; | 6600 isNull = TRUE; |
6657 } | 6601 } |
6658 FXJSE_Value_Release(defaultValue); | 6602 FXJSE_Value_Release(defaultValue); |
6659 } | 6603 } |
6660 return isNull; | 6604 return isNull; |
6661 } | 6605 } |
6662 int32_t CXFA_FM2JSContext::hvalue_get_array_length(FXJSE_HOBJECT hThis, | 6606 int32_t CXFA_FM2JSContext::hvalue_get_array_length(FXJSE_HOBJECT hThis, |
6663 FXJSE_HVALUE arg) { | 6607 FXJSE_HVALUE arg) { |
6664 CXFA_FM2JSContext* pContext = | 6608 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6665 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6666 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6609 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6667 int32_t iLength = 0; | 6610 int32_t iLength = 0; |
6668 if (FXJSE_Value_IsArray(arg)) { | 6611 if (FXJSE_Value_IsArray(arg)) { |
6669 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6612 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6670 FXJSE_Value_GetObjectProp(arg, "length", lengthValue); | 6613 FXJSE_Value_GetObjectProp(arg, "length", lengthValue); |
6671 iLength = FXJSE_Value_ToInteger(lengthValue); | 6614 iLength = FXJSE_Value_ToInteger(lengthValue); |
6672 FXJSE_Value_Release(lengthValue); | 6615 FXJSE_Value_Release(lengthValue); |
6673 } | 6616 } |
6674 return iLength; | 6617 return iLength; |
6675 } | 6618 } |
(...skipping 17 matching lines...) Expand all Loading... |
6693 FXJSE_Value_IsNull(secondValue)) { | 6636 FXJSE_Value_IsNull(secondValue)) { |
6694 bReturn = TRUE; | 6637 bReturn = TRUE; |
6695 } | 6638 } |
6696 return bReturn; | 6639 return bReturn; |
6697 } | 6640 } |
6698 void CXFA_FM2JSContext::unfoldArgs(FXJSE_HOBJECT hThis, | 6641 void CXFA_FM2JSContext::unfoldArgs(FXJSE_HOBJECT hThis, |
6699 CFXJSE_Arguments& args, | 6642 CFXJSE_Arguments& args, |
6700 FXJSE_HVALUE*& resultValues, | 6643 FXJSE_HVALUE*& resultValues, |
6701 int32_t& iCount, | 6644 int32_t& iCount, |
6702 int32_t iStart) { | 6645 int32_t iStart) { |
6703 CXFA_FM2JSContext* pContext = | 6646 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6704 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6705 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6647 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6706 iCount = 0; | 6648 iCount = 0; |
6707 int32_t argc = args.GetLength(); | 6649 int32_t argc = args.GetLength(); |
6708 FXJSE_HVALUE* argsValue = FX_Alloc(FXJSE_HVALUE, argc); | 6650 FXJSE_HVALUE* argsValue = FX_Alloc(FXJSE_HVALUE, argc); |
6709 for (int32_t i = iStart; i < argc; i++) { | 6651 for (int32_t i = iStart; i < argc; i++) { |
6710 argsValue[i] = args.GetValue(i); | 6652 argsValue[i] = args.GetValue(i); |
6711 if (FXJSE_Value_IsArray(argsValue[i])) { | 6653 if (FXJSE_Value_IsArray(argsValue[i])) { |
6712 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); | 6654 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(pIsolate); |
6713 FXJSE_Value_GetObjectProp(argsValue[i], "length", lengthValue); | 6655 FXJSE_Value_GetObjectProp(argsValue[i], "length", lengthValue); |
6714 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); | 6656 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6760 index++; | 6702 index++; |
6761 } | 6703 } |
6762 } | 6704 } |
6763 for (int32_t i = iStart; i < argc; i++) { | 6705 for (int32_t i = iStart; i < argc; i++) { |
6764 FXJSE_Value_Release(argsValue[i]); | 6706 FXJSE_Value_Release(argsValue[i]); |
6765 } | 6707 } |
6766 FX_Free(argsValue); | 6708 FX_Free(argsValue); |
6767 } | 6709 } |
6768 void CXFA_FM2JSContext::GetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 6710 void CXFA_FM2JSContext::GetObjectDefaultValue(FXJSE_HVALUE hObjectValue, |
6769 FXJSE_HVALUE hDefaultValue) { | 6711 FXJSE_HVALUE hDefaultValue) { |
6770 CXFA_Node* pNode = | 6712 CXFA_Node* pNode = ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue)); |
6771 ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL)); | |
6772 if (pNode) { | 6713 if (pNode) { |
6773 pNode->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); | 6714 pNode->Script_Som_DefaultValue(hDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); |
6774 } else { | 6715 } else { |
6775 FXJSE_Value_SetNull(hDefaultValue); | 6716 FXJSE_Value_SetNull(hDefaultValue); |
6776 } | 6717 } |
6777 } | 6718 } |
6778 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 6719 FX_BOOL CXFA_FM2JSContext::SetObjectDefaultValue(FXJSE_HVALUE hObjectValue, |
6779 FXJSE_HVALUE hNewValue) { | 6720 FXJSE_HVALUE hNewValue) { |
6780 CXFA_Node* pNode = | 6721 CXFA_Node* pNode = ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue)); |
6781 ToNode((CXFA_Object*)FXJSE_Value_ToObject(hObjectValue, NULL)); | |
6782 if (pNode) { | 6722 if (pNode) { |
6783 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); | 6723 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); |
6784 return TRUE; | 6724 return TRUE; |
6785 } | 6725 } |
6786 return FALSE; | 6726 return FALSE; |
6787 } | 6727 } |
6788 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, | 6728 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, |
6789 int32_t iIndexFlags, | 6729 int32_t iIndexFlags, |
6790 int32_t iIndexValue, | 6730 int32_t iIndexValue, |
6791 FX_BOOL bIsStar, | 6731 FX_BOOL bIsStar, |
(...skipping 20 matching lines...) Expand all Loading... |
6812 iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue; | 6752 iIndexValue = (iIndexValue < 0) ? (0 - iIndexValue) : iIndexValue; |
6813 szSomExp += CFX_ByteString::FormatInteger(iIndexValue); | 6753 szSomExp += CFX_ByteString::FormatInteger(iIndexValue); |
6814 szSomExp += "]"; | 6754 szSomExp += "]"; |
6815 } | 6755 } |
6816 } | 6756 } |
6817 FX_BOOL CXFA_FM2JSContext::GetObjectByName( | 6757 FX_BOOL CXFA_FM2JSContext::GetObjectByName( |
6818 FXJSE_HOBJECT hThis, | 6758 FXJSE_HOBJECT hThis, |
6819 FXJSE_HVALUE accessorValue, | 6759 FXJSE_HVALUE accessorValue, |
6820 const CFX_ByteStringC& szAccessorName) { | 6760 const CFX_ByteStringC& szAccessorName) { |
6821 FX_BOOL bFlags = FALSE; | 6761 FX_BOOL bFlags = FALSE; |
6822 CXFA_FM2JSContext* pContext = | 6762 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6823 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6824 CXFA_Document* pDoc = pContext->GetDocument(); | 6763 CXFA_Document* pDoc = pContext->GetDocument(); |
6825 if (!pDoc) { | 6764 if (!pDoc) { |
6826 return bFlags; | 6765 return bFlags; |
6827 } | 6766 } |
6828 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6767 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
6829 XFA_RESOLVENODE_RS resoveNodeRS; | 6768 XFA_RESOLVENODE_RS resoveNodeRS; |
6830 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 6769 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
6831 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6770 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
6832 int32_t iRet = pScriptContext->ResolveObjects( | 6771 int32_t iRet = pScriptContext->ResolveObjects( |
6833 pScriptContext->GetThisObject(), | 6772 pScriptContext->GetThisObject(), |
6834 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, | 6773 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, |
6835 dwFlags); | 6774 dwFlags); |
6836 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6775 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
6837 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( | 6776 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( |
6838 resoveNodeRS.nodes.GetAt(0))); | 6777 resoveNodeRS.nodes.GetAt(0))); |
6839 bFlags = TRUE; | 6778 bFlags = TRUE; |
6840 } | 6779 } |
6841 return bFlags; | 6780 return bFlags; |
6842 } | 6781 } |
6843 int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, | 6782 int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, |
6844 FXJSE_HVALUE hRefValue, | 6783 FXJSE_HVALUE hRefValue, |
6845 const CFX_ByteStringC& bsSomExp, | 6784 const CFX_ByteStringC& bsSomExp, |
6846 XFA_RESOLVENODE_RS& resoveNodeRS, | 6785 XFA_RESOLVENODE_RS& resoveNodeRS, |
6847 FX_BOOL bdotAccessor, | 6786 FX_BOOL bdotAccessor, |
6848 FX_BOOL bHasNoResolveName) { | 6787 FX_BOOL bHasNoResolveName) { |
6849 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); | 6788 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); |
6850 int32_t iRet = -1; | 6789 int32_t iRet = -1; |
6851 CXFA_FM2JSContext* pContext = | 6790 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6852 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6853 CXFA_Document* pDoc = pContext->GetDocument(); | 6791 CXFA_Document* pDoc = pContext->GetDocument(); |
6854 if (!pDoc) { | 6792 if (!pDoc) { |
6855 return iRet; | 6793 return iRet; |
6856 } | 6794 } |
6857 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6795 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
6858 CXFA_Object* pNode = NULL; | 6796 CXFA_Object* pNode = NULL; |
6859 uint32_t dFlags = 0UL; | 6797 uint32_t dFlags = 0UL; |
6860 if (bdotAccessor) { | 6798 if (bdotAccessor) { |
6861 if (FXJSE_Value_IsNull(hRefValue)) { | 6799 if (FXJSE_Value_IsNull(hRefValue)) { |
6862 pNode = pScriptContext->GetThisObject(); | 6800 pNode = pScriptContext->GetThisObject(); |
6863 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6801 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
6864 } else { | 6802 } else { |
6865 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); | 6803 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue); |
6866 ASSERT(pNode); | 6804 ASSERT(pNode); |
6867 if (bHasNoResolveName) { | 6805 if (bHasNoResolveName) { |
6868 CFX_WideString wsName; | 6806 CFX_WideString wsName; |
6869 if (CXFA_Node* pXFANode = pNode->AsNode()) { | 6807 if (CXFA_Node* pXFANode = pNode->AsNode()) { |
6870 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); | 6808 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); |
6871 } | 6809 } |
6872 if (wsName.IsEmpty()) { | 6810 if (wsName.IsEmpty()) { |
6873 CFX_WideStringC className; | 6811 CFX_WideStringC className; |
6874 pNode->GetClassName(className); | 6812 pNode->GetClassName(className); |
6875 wsName = FX_WSTRC(L"#") + className; | 6813 wsName = FX_WSTRC(L"#") + className; |
6876 } | 6814 } |
6877 wsSomExpression = wsName + wsSomExpression; | 6815 wsSomExpression = wsName + wsSomExpression; |
6878 dFlags = XFA_RESOLVENODE_Siblings; | 6816 dFlags = XFA_RESOLVENODE_Siblings; |
6879 } else { | 6817 } else { |
6880 dFlags = (bsSomExp == "*") | 6818 dFlags = (bsSomExp == "*") |
6881 ? (XFA_RESOLVENODE_Children) | 6819 ? (XFA_RESOLVENODE_Children) |
6882 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 6820 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
6883 XFA_RESOLVENODE_Properties); | 6821 XFA_RESOLVENODE_Properties); |
6884 } | 6822 } |
6885 } | 6823 } |
6886 } else { | 6824 } else { |
6887 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); | 6825 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue); |
6888 dFlags = XFA_RESOLVENODE_AnyChild; | 6826 dFlags = XFA_RESOLVENODE_AnyChild; |
6889 } | 6827 } |
6890 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), | 6828 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), |
6891 resoveNodeRS, dFlags); | 6829 resoveNodeRS, dFlags); |
6892 return iRet; | 6830 return iRet; |
6893 } | 6831 } |
6894 void CXFA_FM2JSContext::ParseResolveResult( | 6832 void CXFA_FM2JSContext::ParseResolveResult( |
6895 FXJSE_HOBJECT hThis, | 6833 FXJSE_HOBJECT hThis, |
6896 const XFA_RESOLVENODE_RS& resoveNodeRS, | 6834 const XFA_RESOLVENODE_RS& resoveNodeRS, |
6897 FXJSE_HVALUE hParentValue, | 6835 FXJSE_HVALUE hParentValue, |
6898 FXJSE_HVALUE*& resultValues, | 6836 FXJSE_HVALUE*& resultValues, |
6899 int32_t& iSize, | 6837 int32_t& iSize, |
6900 FX_BOOL& bAttribute) { | 6838 FX_BOOL& bAttribute) { |
6901 CXFA_FM2JSContext* pContext = | 6839 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6902 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6903 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6840 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6904 iSize = 0; | 6841 iSize = 0; |
6905 resultValues = NULL; | 6842 resultValues = NULL; |
6906 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6843 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
6907 bAttribute = FALSE; | 6844 bAttribute = FALSE; |
6908 iSize = resoveNodeRS.nodes.GetSize(); | 6845 iSize = resoveNodeRS.nodes.GetSize(); |
6909 resultValues = FX_Alloc(FXJSE_HVALUE, iSize); | 6846 resultValues = FX_Alloc(FXJSE_HVALUE, iSize); |
6910 for (int32_t i = 0; i < iSize; i++) { | 6847 for (int32_t i = 0; i < iSize; i++) { |
6911 resultValues[i] = FXJSE_Value_Create(pIsolate); | 6848 resultValues[i] = FXJSE_Value_Create(pIsolate); |
6912 FXJSE_Value_Set( | 6849 FXJSE_Value_Set( |
(...skipping 17 matching lines...) Expand all Loading... |
6930 resultValues = FX_Alloc(FXJSE_HVALUE, iSize); | 6867 resultValues = FX_Alloc(FXJSE_HVALUE, iSize); |
6931 for (int32_t i = 0; i < iSize; i++) { | 6868 for (int32_t i = 0; i < iSize; i++) { |
6932 resultValues[i] = FXJSE_Value_Create(pIsolate); | 6869 resultValues[i] = FXJSE_Value_Create(pIsolate); |
6933 FXJSE_Value_Set(resultValues[i], objectProperties[i]); | 6870 FXJSE_Value_Set(resultValues[i], objectProperties[i]); |
6934 } | 6871 } |
6935 } | 6872 } |
6936 } | 6873 } |
6937 } | 6874 } |
6938 int32_t CXFA_FM2JSContext::HValueToInteger(FXJSE_HOBJECT hThis, | 6875 int32_t CXFA_FM2JSContext::HValueToInteger(FXJSE_HOBJECT hThis, |
6939 FXJSE_HVALUE hValue) { | 6876 FXJSE_HVALUE hValue) { |
6940 CXFA_FM2JSContext* pContext = | 6877 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6941 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6942 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6878 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6943 int32_t iValue = 0; | 6879 int32_t iValue = 0; |
6944 if (FXJSE_Value_IsArray(hValue)) { | 6880 if (FXJSE_Value_IsArray(hValue)) { |
6945 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); | 6881 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); |
6946 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); | 6882 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); |
6947 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); | 6883 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); |
6948 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); | 6884 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); |
6949 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); | 6885 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); |
6950 if (FXJSE_Value_IsNull(propertyValue)) { | 6886 if (FXJSE_Value_IsNull(propertyValue)) { |
6951 GetObjectDefaultValue(jsobjectValue, newProperty); | 6887 GetObjectDefaultValue(jsobjectValue, newProperty); |
(...skipping 22 matching lines...) Expand all Loading... |
6974 iValue = FXJSE_Value_ToInteger(hValue); | 6910 iValue = FXJSE_Value_ToInteger(hValue); |
6975 } | 6911 } |
6976 return iValue; | 6912 return iValue; |
6977 } | 6913 } |
6978 FX_DOUBLE CXFA_FM2JSContext::StringToDouble( | 6914 FX_DOUBLE CXFA_FM2JSContext::StringToDouble( |
6979 const CFX_ByteStringC& szStringVal) { | 6915 const CFX_ByteStringC& szStringVal) { |
6980 return XFA_ByteStringToDouble(szStringVal); | 6916 return XFA_ByteStringToDouble(szStringVal); |
6981 } | 6917 } |
6982 FX_FLOAT CXFA_FM2JSContext::HValueToFloat(FXJSE_HOBJECT hThis, | 6918 FX_FLOAT CXFA_FM2JSContext::HValueToFloat(FXJSE_HOBJECT hThis, |
6983 FXJSE_HVALUE arg) { | 6919 FXJSE_HVALUE arg) { |
6984 CXFA_FM2JSContext* pContext = | 6920 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
6985 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
6986 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6921 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
6987 FX_FLOAT fRet = 0.0f; | 6922 FX_FLOAT fRet = 0.0f; |
6988 if (FXJSE_Value_IsArray(arg)) { | 6923 if (FXJSE_Value_IsArray(arg)) { |
6989 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); | 6924 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); |
6990 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); | 6925 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); |
6991 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); | 6926 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); |
6992 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 6927 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
6993 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 6928 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
6994 if (FXJSE_Value_IsNull(propertyValue)) { | 6929 if (FXJSE_Value_IsNull(propertyValue)) { |
6995 GetObjectDefaultValue(jsobjectValue, newProperty); | 6930 GetObjectDefaultValue(jsobjectValue, newProperty); |
(...skipping 18 matching lines...) Expand all Loading... |
7014 fRet = (FX_FLOAT)StringToDouble(bsOutput.AsStringC()); | 6949 fRet = (FX_FLOAT)StringToDouble(bsOutput.AsStringC()); |
7015 } else if (FXJSE_Value_IsUndefined(arg)) { | 6950 } else if (FXJSE_Value_IsUndefined(arg)) { |
7016 fRet = 0; | 6951 fRet = 0; |
7017 } else { | 6952 } else { |
7018 fRet = FXJSE_Value_ToFloat(arg); | 6953 fRet = FXJSE_Value_ToFloat(arg); |
7019 } | 6954 } |
7020 return fRet; | 6955 return fRet; |
7021 } | 6956 } |
7022 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, | 6957 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, |
7023 FXJSE_HVALUE arg) { | 6958 FXJSE_HVALUE arg) { |
7024 CXFA_FM2JSContext* pContext = | 6959 CXFA_FM2JSContext* pContext = (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis); |
7025 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | |
7026 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); | 6960 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); |
7027 FX_DOUBLE dRet = 0; | 6961 FX_DOUBLE dRet = 0; |
7028 if (FXJSE_Value_IsArray(arg)) { | 6962 if (FXJSE_Value_IsArray(arg)) { |
7029 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); | 6963 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(pIsolate); |
7030 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); | 6964 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(pIsolate); |
7031 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); | 6965 FXJSE_HVALUE newProperty = FXJSE_Value_Create(pIsolate); |
7032 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 6966 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
7033 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 6967 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
7034 if (FXJSE_Value_IsNull(propertyValue)) { | 6968 if (FXJSE_Value_IsNull(propertyValue)) { |
7035 GetObjectDefaultValue(jsobjectValue, newProperty); | 6969 GetObjectDefaultValue(jsobjectValue, newProperty); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7201 CFX_WideString wsFormat; | 7135 CFX_WideString wsFormat; |
7202 pAppProvider->LoadString(iStringID, wsFormat); | 7136 pAppProvider->LoadString(iStringID, wsFormat); |
7203 CFX_WideString wsMessage; | 7137 CFX_WideString wsMessage; |
7204 va_list arg_ptr; | 7138 va_list arg_ptr; |
7205 va_start(arg_ptr, iStringID); | 7139 va_start(arg_ptr, iStringID); |
7206 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); | 7140 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); |
7207 va_end(arg_ptr); | 7141 va_end(arg_ptr); |
7208 FXJSE_ThrowMessage( | 7142 FXJSE_ThrowMessage( |
7209 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); | 7143 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); |
7210 } | 7144 } |
OLD | NEW |