comparison src/os_vms.c @ 13353:8412df1479a3 v8.0.1550

patch 8.0.1550: various small problems in source files commit https://github.com/vim/vim/commit/792f0e36593d1ec13ccb8a622ca5542c500577b4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 27 17:27:13 2018 +0100 patch 8.0.1550: various small problems in source files Problem: Various small problems in source files. Solution: Fix the problems.
author Christian Brabandt <cb@256bit.org>
date Tue, 27 Feb 2018 17:30:08 +0100
parents 299f1669c20e
children cec5137d5332
comparison
equal deleted inserted replaced
13352:764ce635fdc7 13353:8412df1479a3
16 # include <gen64def.h> 16 # include <gen64def.h>
17 #else 17 #else
18 /* based on Alpha's gen64def.h; the file is absent on VAX */ 18 /* based on Alpha's gen64def.h; the file is absent on VAX */
19 typedef struct _generic_64 { 19 typedef struct _generic_64 {
20 # pragma __nomember_alignment 20 # pragma __nomember_alignment
21 __union { /* You can treat me as... */ 21 __union { /* You can treat me as... */
22 /* long long is not available on VAXen */ 22 /* long long is not available on VAXen */
23 /* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */ 23 /* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */
24 24
25 unsigned int gen64$l_longword [2]; /* ...two 32-bit values, or */ 25 unsigned int gen64$l_longword [2]; /* ...two 32-bit values, or */
26 unsigned short int gen64$w_word [4]; /* ...four 16-bit values */ 26 unsigned short int gen64$w_word [4]; /* ...four 16-bit values */
459 459
460 vms_match_num = 0; /* reset collection counter */ 460 vms_match_num = 0; /* reset collection counter */
461 result = decc$translate_vms(vms_fixfilename(buf)); 461 result = decc$translate_vms(vms_fixfilename(buf));
462 if ( (int) result == 0 || (int) result == -1 ) { 462 if ( (int) result == 0 || (int) result == -1 ) {
463 cnt = 0; 463 cnt = 0;
464 } 464 } else {
465 else {
466 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; 465 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ;
467 } 466 }
468 if (cnt > 0) 467 if (cnt > 0)
469 cnt = vms_match_num; 468 cnt = vms_match_num;
470 469
517 vms_match_num = 0; 516 vms_match_num = 0;
518 /* the result from the decc$translate_vms needs to be handled */ 517 /* the result from the decc$translate_vms needs to be handled */
519 /* otherwise it might create ACCVIO error in decc$to_vms */ 518 /* otherwise it might create ACCVIO error in decc$to_vms */
520 result = decc$translate_vms(vms_fixfilename(path)); 519 result = decc$translate_vms(vms_fixfilename(path));
521 if ( (int) result == 0 || (int) result == -1 ) { 520 if ( (int) result == 0 || (int) result == -1 ) {
522 cnt = 0; 521 cnt = 0;
523 } 522 } else {
524 else { 523 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
525 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
526 } 524 }
527 if (cnt > 0) 525 if (cnt > 0)
528 cnt = vms_match_num; 526 cnt = vms_match_num;
529 for (i = 0; i < cnt; i++) 527 for (i = 0; i < cnt; i++)
530 { 528 {
739 /* make sure the iochan is set */ 737 /* make sure the iochan is set */
740 if (!iochan) 738 if (!iochan)
741 get_tty(); 739 get_tty();
742 740
743 if (sec > 0) { 741 if (sec > 0) {
744 /* time-out specified; convert it to absolute time */ 742 /* time-out specified; convert it to absolute time */
745 /* sec>0 requirement of lib$cvtf_to_internal_time()*/ 743 /* sec>0 requirement of lib$cvtf_to_internal_time()*/
746 744
747 /* get current time (number of 100ns ticks since the VMS Epoch) */ 745 /* get current time (number of 100ns ticks since the VMS Epoch) */
748 status = sys$gettim(&time_curr); 746 status = sys$gettim(&time_curr);
749 if (status != SS$_NORMAL) 747 if (status != SS$_NORMAL)
750 return 0; /* error */ 748 return 0; /* error */
751 /* construct the delta time */ 749 /* construct the delta time */
752 #if __G_FLOAT==0 750 #if __G_FLOAT==0
753 # ifndef VAX 751 # ifndef VAX
754 /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */ 752 /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */
755 status = lib$cvts_to_internal_time( 753 status = lib$cvts_to_internal_time(
756 &convert_operation, &sec, &time_diff); 754 &convert_operation, &sec, &time_diff);
757 # endif 755 # endif
758 #else /* default on Alpha and VAX */ 756 #else /* default on Alpha and VAX */
759 status = lib$cvtf_to_internal_time( 757 status = lib$cvtf_to_internal_time(
760 &convert_operation, &sec, &time_diff); 758 &convert_operation, &sec, &time_diff);
761 #endif 759 #endif
762 if (status != LIB$_NORMAL) 760 if (status != LIB$_NORMAL)
763 return 0; /* error */ 761 return 0; /* error */
764 /* add them up */ 762 /* add them up */
765 status = lib$add_times( 763 status = lib$add_times(
766 &time_curr, 764 &time_curr,
767 &time_diff, 765 &time_diff,
768 &time_out); 766 &time_out);
769 if (status != LIB$_NORMAL) 767 if (status != LIB$_NORMAL)
770 return 0; /* error */ 768 return 0; /* error */
771 } 769 }
772 770
773 while (TRUE) { 771 while (TRUE) {
774 /* select() */ 772 /* select() */
775 status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, 773 status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
776 0, 0, &typeahead, 8, 0, 0, 0, 0); 774 0, 0, &typeahead, 8, 0, 0, 0, 0);
777 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL) 775 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
778 return 0; /* error */ 776 return 0; /* error */
779 777
780 if (typeahead.numchars) 778 if (typeahead.numchars)
781 return 1; /* ready to read */ 779 return 1; /* ready to read */
782 780
783 /* there's nothing to read; what now? */ 781 /* there's nothing to read; what now? */
784 if (msec == 0) { 782 if (msec == 0) {
785 /* immediate time-out; return impatiently */ 783 /* immediate time-out; return impatiently */
786 return 0; 784 return 0;
787 } 785 } else if (msec < 0) {
788 else if (msec < 0) { 786 /* no time-out; wait on indefinitely */
789 /* no time-out; wait on indefinitely */ 787 continue;
790 continue; 788 } else {
791 } 789 /* time-out needs to be checked */
792 else { 790 status = sys$gettim(&time_curr);
793 /* time-out needs to be checked */ 791 if (status != SS$_NORMAL)
794 status = sys$gettim(&time_curr); 792 return 0; /* error */
795 if (status != SS$_NORMAL) 793
796 return 0; /* error */ 794 status = lib$sub_times(
797 795 &time_out,
798 status = lib$sub_times( 796 &time_curr,
799 &time_out, 797 &time_diff);
800 &time_curr, 798 if (status != LIB$_NORMAL)
801 &time_diff); 799 return 0; /* error, incl. time_diff < 0 (i.e. time-out) */
802 if (status != LIB$_NORMAL) 800
803 return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ 801 /* otherwise wait some more */
804 802 }
805 /* otherwise wait some more */ 803 }
806 } 804 }
807 }
808 }