diff --git a/src/bpt/Makefile b/src/bpt/Makefile new file mode 100644 index 000000000..977081d2d --- /dev/null +++ b/src/bpt/Makefile @@ -0,0 +1,18 @@ +# +# $Id$ +# +# Lowest Level Directroy Makefile +# by Janet Anderson +# +# $Log$ +# Revision 1.1 1994/09/07 19:25:39 jba +# New file +# +# + +EPICS=../../.. + +include $(EPICS)/config/CONFIG_BASE + +include $(EPICS)/config/RULES_ARCHS + diff --git a/src/bpt/Makefile.Unix b/src/bpt/Makefile.Unix new file mode 100644 index 000000000..ef523606d --- /dev/null +++ b/src/bpt/Makefile.Unix @@ -0,0 +1,11 @@ +EPICS = ../../../.. +include Target.include +include $(EPICS)/config/CONFIG_BASE + + + +SRCS.c = ../makeBpt +OBJS = makeBpt +PROD = makeBpt + +include $(EPICS)/config/RULES.Unix diff --git a/src/bpt/Makefile.Vx b/src/bpt/Makefile.Vx new file mode 100644 index 000000000..5a6078498 --- /dev/null +++ b/src/bpt/Makefile.Vx @@ -0,0 +1,25 @@ +EPICS = ../../../.. +include Target.include +include $(EPICS)/config/CONFIG_BASE + +USR_CFLAGS = -ansi +VX_WARN_YES = -Wall -pedantic + +MENUS += menuConvert.h + +BPTS += bptTypeJdegC.ascii +BPTS += bptTypeJdegF.ascii +BPTS += bptTypeKdegC.ascii +BPTS += bptTypeKdegF.ascii + + +SRCS.c = \ + ../cvtBpt.c + +LIBOBJS = \ + cvtBpt.o + +LIBNAME = pbtLib + +include $(EPICS)/config/RULES.Vx + diff --git a/src/bpt/bptTypeJdegC.data b/src/bpt/bptTypeJdegC.data new file mode 100644 index 000000000..a2ac1928f --- /dev/null +++ b/src/bpt/bptTypeJdegC.data @@ -0,0 +1,142 @@ +!header +"typeJdegC" 0 0 700 4095 .5 -210 760 1 +!data + +-8.096 -8.076 -8.057 -8.037 -8.017 -7.996 -7.976 -7.955 -7.934 -7.912 + + +-7.890 -7.868 -7.846 -7.824 -7.801 -7.778 -7.755 -7.731 -7.707 -7.683 +-7.659 -7.634 -7.609 -7.584 -7.559 -7.533 -7.508 -7.482 -7.455 -7.429 +-7.402 -7.375 -7.348 -7.321 -7.293 -7.265 -7.237 -7.209 -7.180 -7.151 +-7.122 -7.093 -7.064 -7.034 -7.004 -6.974 -6.944 -6.914 -6.883 -6.852 +-6.821 -6.790 -6.758 -6.727 -6.695 -6.663 -6.630 -6.598 -6.565 -6.532 + + +-6.499 -6.466 -6.433 -6.399 -6.365 -6.331 -6.297 -6.263 -6.228 -6.194 +-6.159 -6.124 -6.089 -6.053 -6.018 -5.982 -5.946 -5.910 -5.874 -5.837 +-5.801 -5.764 -5.727 -5.690 -5.653 -5.615 -5.578 -5.540 -5.502 -5.464 +-5.426 -5.388 -5.349 -5.311 -5.272 -5.233 -5.194 -5.155 -5.115 -5.076 +-5.036 -4.996 -4.956 -4.916 -4.876 -4.836 -4.795 -4.755 -4.714 -4.673 + + +-4.632 -4.591 -4.550 -4.508 -4.467 -4.425 -4.383 -4.341 -4.299 -4.257 +-4.215 -4.172 -4.130 -4.087 -4.044 -4.001 -3.958 -3.915 -3.872 -3.829 +-3.785 -3.742 -3.698 -3.654 -3.610 -3.566 -3.522 -3.478 -3.433 -3.389 +-3.344 -3.299 -3.255 -3.210 -3.165 -3.120 -3.074 -3.029 -2.984 -2.938 +-2.892 -2.847 -2.801 -2.755 -2.709 -2.663 -2.617 -2.570 -2.524 -2.478 + + +-2.431 -2.384 -2.338 -2.291 -2.244 -2.197 -2.150 -2.102 -2.055 -2.008 +-1.960 -1.913 -1.865 -1.818 -1.770 -1.722 -1.674 -1.626 -1.578 -1.530 +-1.481 -1.433 -1.385 -1.336 -1.288 -1.239 -1.190 -1.141 -1.093 -1.044 +-0.995 -0.945 -0.896 -0.847 -0.798 -0.748 -0.699 -0.650 -0.600 -0.550 +-0.501 -0.451 -0.401 -0.351 -0.301 -0.251 -0.201 -0.151 -0.101 -0.050 + + +0.0 0.050 0.101 0.151 0.202 0.253 0.303 0.354 0.405 0.456 +0.507 0.558 0.609 0.660 0.711 0.762 0.813 0.865 0.916 0.967 +1.019 1.070 1.122 1.174 1.225 1.277 1.329 1.381 1.432 1.484 +1.536 1.588 1.640 1.693 1.745 1.797 1.849 1.901 1.954 2.006 +2.058 2.111 2.163 2.216 2.268 2.321 2.374 2.426 2.479 2.532 + + +2.585 2.638 2.691 2.743 2.796 2.849 2.902 2.956 3.009 3.062 +3.115 3.168 3.221 3.275 3.328 3.381 3.435 3.488 3.542 3.595 +3.649 3.702 3.756 3.809 3.863 3.917 3.971 4.024 4.078 4.132 +4.186 4.239 4.293 4.347 4.401 4.455 4.509 4.563 4.617 4.671 +4.725 4.780 4.834 4.888 4.942 4.996 5.050 5.105 5.159 5.213 + + +5.268 5.322 5.376 5.431 5.485 5.540 5.594 5.649 5.703 5.758 +5.812 5.867 5.921 5.976 6.031 6.085 6.140 6.195 6.249 6.304 +6.359 6.414 6.468 6.523 6.578 6.633 6.688 6.742 6.797 6.852 +6.907 6.962 7.017 7.072 7.127 7.182 7.237 7.292 7.347 7.402 +7.457 7.512 7.567 7.622 7.677 7.732 7.787 7.843 7.898 7.953 + + +8.008 8.063 8.118 8.174 8.229 8.284 8.339 8.394 8.450 8.505 +8.560 8.616 8.671 8.726 8.781 8.837 8.892 8.947 9.003 9.058 +9.113 9.169 9.224 9.279 9.335 9.390 9.446 9.501 9.556 9.612 +9.667 9.723 9.778 9.834 9.889 9.944 10.000 10.055 10.111 10.166 +10.222 10.277 10.333 10.388 10.444 10.499 10.555 10.610 10.666 10.721 + + +10.777 10.832 10.888 10.943 10.999 11.054 11.110 11.165 11.221 11.276 +11.332 11.387 11.443 11.498 11.554 11.609 11.665 11.720 11.776 11.831 +11.887 11.943 11.998 12.054 12.109 12.165 12.220 12.276 12.331 12.387 +12.442 12.498 12.553 12.609 12.664 12.720 12.776 12.831 12.887 12.942 +12.998 13.053 13.109 13.164 13.220 13.275 13.331 13.386 13.442 13.497 + + +13.553 13.608 13.664 13.719 13.775 13.830 13.886 13.941 13.997 14.052 +14.108 14.163 14.219 14.274 14.330 14.385 14.441 14.496 14.552 14.607 +14.663 14.718 14.774 14.829 14.885 14.940 14.995 15.051 15.106 15.162 +15.217 15.273 15.328 15.383 15.439 15.494 15.550 15.605 15.661 15.716 +15.771 15.827 15.882 15.938 15.993 16.048 16.104 16.159 16.214 16.270 + + +16.325 16.380 16.436 16.491 16.547 16.602 16.657 16.713 16.768 16.823 +16.879 16.934 16.989 17.044 17.100 17.155 17.210 17.266 17.321 17.376 +17.432 17.487 17.542 17.597 17.653 17.708 17.763 17.818 17.874 17.929 +17.984 18.039 18.095 18.150 18.205 18.260 18.316 18.371 18.426 18.481 +18.537 18.592 18.647 18.702 18.757 18.813 18.868 18.923 18.978 19.033 + + +19.089 19.144 19.199 19.254 19.309 19.364 19.420 19.475 19.530 19.585 +19.640 19.695 19.751 19.806 19.861 19.916 19.971 20.026 20.081 20.137 +20.192 20.247 20.302 20.357 20.412 20.467 20.523 20.578 20.633 20.688 +20.743 20.798 20.853 20.909 20.964 21.019 21.074 21.129 21.184 21.239 +21.295 21.350 21.405 21.460 21.515 21.570 21.625 21.680 21.736 21.791 + + +21.846 21.901 21.956 22.011 22.066 22.122 22.177 22.232 22.287 22.342 +22.397 22.453 22.508 22.563 22.618 22.673 22.728 22.784 22.839 22.894 +22.949 23.004 23.060 23.115 23.170 23.225 23.280 23.336 23.391 23.446 +23.501 23.556 23.612 23.667 23.722 23.777 23.833 23.888 23.943 23.999 +24.054 24.109 24.164 24.220 24.275 24.330 24.386 24.441 24.496 24.552 + + +24.607 24.662 24.718 24.773 24.829 24.884 24.939 24.995 25.050 25.106 +25.161 25.217 25.272 25.327 25.383 25.438 25.494 25.549 25.605 25.661 +25.716 25.772 25.827 25.883 25.938 25.994 26.050 26.105 26.161 26.216 +26.272 26.328 26.383 26.439 26.495 26.551 26.606 26.662 26.718 26.774 +26.829 26.885 26.941 26.997 27.053 27.109 27.165 27.220 27.276 27.332 + + +27.388 27.444 27.500 27.556 27.612 27.668 27.724 27.780 27.836 27.893 +27.949 28.005 28.061 28.117 28.173 28.230 28.286 28.342 28.398 28.455 +28.511 28.567 28.624 28.680 28.736 28.793 28.849 28.906 28.962 29.019 +29.075 29.132 29.188 29.245 29.301 29.358 29.415 29.471 29.528 29.585 +29.642 29.698 29.755 29.812 29.869 29.926 29.983 30.039 30.096 30.153 + + +30.210 30.267 30.324 30.381 30.439 30.496 30.553 30.610 30.667 30.724 +30.782 30.839 30.896 30.954 31.011 31.068 31.126 31.183 31.241 31.298 +31.356 31.413 31.471 31.528 31.586 31.644 31.702 31.759 31.817 31.875 +31.933 31.991 32.048 32.106 32.164 32.222 32.280 32.338 32.396 32.455 +32.513 32.571 32.629 32.687 32.746 32.804 32.862 32.921 32.979 33.038 + + +33.096 33.155 33.213 33.272 33.330 33.389 33.448 33.506 33.565 33.624 +33.683 33.742 33.800 33.859 33.918 33.977 34.036 34.095 34.155 34.214 +34.273 34.332 34.391 34.451 34.510 34.569 34.629 34.688 34.748 34.807 +34.867 34.926 34.986 35.046 35.105 35.165 35.225 35.285 35.344 35.404 +35.464 35.524 35.584 35.644 35.704 35.764 35.825 35.885 35.945 36.005 + + +36.066 36.126 36.186 36.247 36.307 36.368 36.428 36.489 36.549 36.610 +36.671 36.732 36.792 36.853 36.914 36.975 37.036 37.097 37.158 37.219 +37.280 37.341 37.402 37.463 37.525 37.586 37.647 37.709 37.770 37.831 +37.893 37.954 38.016 38.078 38.139 38.201 38.262 38.324 38.386 38.448 +38.510 38.572 38.633 38.695 38.757 38.819 38.882 38.944 39.006 39.068 + + +39.130 39.192 39.255 39.317 39.379 39.442 39.504 39.567 39.629 39.692 +39.754 39.817 39.880 39.942 40.005 40.068 40.131 40.193 40.256 40.319 +40.382 40.445 40.508 40.571 40.634 40.697 40.760 40.823 40.886 40.950 +41.013 41.076 41.139 41.203 41.266 41.329 41.393 41.456 41.520 41.583 +41.647 41.710 41.774 41.837 41.901 41.965 42.028 42.092 42.156 42.219 + + +42.283 42.347 42.411 42.475 42.538 42.602 42.666 42.730 42.794 42.858 +42.922 diff --git a/src/bpt/bptTypeJdegF.data b/src/bpt/bptTypeJdegF.data new file mode 100644 index 000000000..f912cb87e --- /dev/null +++ b/src/bpt/bptTypeJdegF.data @@ -0,0 +1,213 @@ +! cvtTypeJdegF.data +"typeJdegF" 32 0 1200 4095 1.0 -350 1400 1 +! +-8.137 -8.127 -8.117 -8.106 -8.096 -8.085 -8.074 -8.063 -8.052 -8.041 +-8.030 -8.019 -8.008 -7.996 -7.985 -7.973 -7.962 -7.950 -7.938 -7.927 +-7.915 -7.903 -7.890 -7.878 -7.866 -7.854 -7.841 -7.829 -7.816 -7.803 +-7.791 -7.778 -7.765 -7.752 -7.739 -7.726 -7.712 -7.699 -7.686 -7.672 +-7.659 -7.645 -7.631 -7.618 -7.604 -7.590 -7.576 -7.562 -7.548 -7.533 + +-7.519 -7.505 -7.490 -7.476 -7.461 -7.447 -7.432 -7.417 -7.402 -7.387 +-7.372 -7.357 -7.342 -7.327 -7.311 -7.296 -7.281 -7.265 -7.250 -7.234 +-7.218 -7.202 -7.187 -7.171 -7.155 -7.139 -7.122 -7.106 -7.090 -7.074 +-7.057 -7.041 -7.024 -7.008 -6.991 -6.974 -6.958 -6.941 -6.924 -6.907 +-6.890 -6.873 -6.856 -6.838 -6.821 -6.804 -6.786 -6.769 -6.751 -6.734 + +-6.716 -6.698 -6.680 -6.663 -6.645 -6.627 -6.609 -6.591 -6.572 -6.554 +-6.536 -6.518 -6.499 -6.481 -6.462 -6.444 -6.425 -6.407 -6.388 -6.369 +-6.350 -6.331 -6.312 -6.293 -6.274 -6.255 -6.236 -6.217 -6.198 -6.178 +-6.159 -6.139 -6.120 -6.100 -6.081 -6.061 -6.041 -6.022 -6.002 -5.982 +-5.962 -5.942 -5.922 -5.902 -5.882 -5.861 -5.841 -5.821 -5.801 -5.780 + +-5.760 -5.739 -5.719 -5.698 -5.678 -5.657 -5.636 -5.615 -5.594 -5.574 +-5.553 -5.532 -5.511 -5.490 -5.468 -5.447 -5.426 -5.405 -5.383 -5.362 +-5.341 -5.319 -5.298 -5.276 -5.255 -5.233 -5.211 -5.190 -5.168 -5.146 +-5.124 -5.102 -5.080 -5.058 -5.036 -5.014 -4.992 -4.970 -4.948 -4.925 +-4.903 -4.881 -4.858 -4.836 -4.813 -4.791 -4.768 -4.746 -4.723 -4.700 + +-4.678 -4.655 -4.632 -4.609 -4.586 -4.563 -4.540 -4.517 -4.494 -4.471 +-4.448 -4.425 -4.402 -4.379 -4.355 -4.332 -4.309 -4.285 -4.262 -4.238 +-4.215 -4.191 -4.168 -4.144 -4.120 -4.097 -4.073 -4.049 -4.025 -4.001 +-3.978 -3.954 -3.930 -3.906 -3.882 -3.858 -3.833 -3.809 -3.785 -3.761 +-3.737 -3.712 -3.688 -3.664 -3.639 -3.615 -3.590 -3.566 -3.541 -3.517 + +-3.492 -3.468 -3.443 -3.418 -3.394 -3.369 -3.344 -3.319 -3.294 -3.270 +-3.245 -3.220 -3.195 -3.170 -3.145 -3.120 -3.094 -3.069 -3.044 -3.019 +-2.994 -2.968 -2.943 -2.918 -2.892 -2.867 -2.842 -2.816 -2.791 -2.765 +-2.740 -2.714 -2.689 -2.663 -2.637 -2.612 -2.586 -2.560 -2.534 -2.509 +-2.483 -2.457 -2.431 -2.405 -2.379 -2.353 -2.327 -2.301 -2.275 -2.249 + +-2.223 -2.197 -2.171 -2.144 -2.118 -2.092 -2.066 -2.039 -2.013 -1.987 +-1.960 -1.934 -1.908 -1.881 -1.855 -1.828 -1.802 -1.775 -1.748 -1.722 +-1.695 -1.669 -1.642 -1.615 -1.589 -1.562 -1.535 -1.508 -1.481 -1.455 +-1.428 -1.401 -1.374 -1.347 -1.320 -1.293 -1.266 -1.239 -1.212 -1.185 +-1.158 -1.131 -1.103 -1.076 -1.049 -1.022 -0.995 -0.967 -0.940 -0.913 + +-0.885 -0.858 -0.831 -0.803 -0.776 -0.748 -0.721 -0.694 -0.666 -0.639 +-0.611 -0.583 -0.556 -0.528 -0.501 -0.473 -0.445 -0.418 -0.390 -0.362 +-0.334 -0.307 -0.279 -0.251 -0.223 -0.195 -0.168 -0.140 -0.112 -0.084 +-0.056 -0.028 0.000 0.028 0.056 0.084 0.112 0.140 0.168 0.196 +0.224 0.253 0.281 0.309 0.337 0.365 0.394 0.422 0.450 0.478 + +0.507 0.535 0.563 0.592 0.620 0.648 0.677 0.705 0.734 0.762 +0.791 0.819 0.848 0.876 0.905 0.933 0.962 0.990 1.019 1.048 +1.076 1.105 1.134 1.162 1.191 1.220 1.248 1.277 1.306 1.335 +1.363 1.392 1.421 1.450 1.479 1.507 1.536 1.565 1.594 1.623 +1.652 1.681 1.710 1.739 1.768 1.797 1.826 1.855 1.884 1.913 + +1.942 1.971 2.000 2.029 2.058 2.088 2.117 2.146 2.175 2.204 +2.233 2.263 2.292 2.321 2.350 2.380 2.409 2.438 2.467 2.497 +2.526 2.555 2.585 2.614 2.644 2.673 2.702 2.732 2.761 2.791 +2.820 2.849 2.879 2.908 2.938 2.967 2.997 3.026 3.056 3.085 +3.115 3.145 3.174 3.204 3.233 3.263 3.293 3.322 3.352 3.381 + +3.411 3.441 3.470 3.500 3.530 3.560 3.589 3.619 3.649 3.678 +3.708 3.738 3.768 3.798 3.827 3.857 3.887 3.917 3.947 3.976 +4.006 4.036 4.066 4.096 4.126 4.156 4.186 4.216 4.245 4.275 +4.305 4.335 4.365 4.395 4.425 4.455 4.485 4.515 4.545 4.575 +4.605 4.635 4.665 4.695 4.725 4.755 4.786 4.816 4.846 4.876 + +4.906 4.936 4.966 4.996 5.026 5.057 5.087 5.117 5.147 5.177 +5.207 5.238 5.268 5.298 5.328 5.358 5.389 5.419 5.449 5.479 +5.509 5.540 5.570 5.600 5.630 5.661 5.691 5.721 5.752 5.782 +5.812 5.843 5.873 5.903 5.934 5.964 5.994 6.025 6.055 6.085 +6.116 6.146 6.176 6.207 6.237 6.268 6.298 6.328 6.359 6.389 + +6.420 6.450 6.481 6.511 6.541 6.572 6.602 6.633 6.663 6.694 +6.724 6.755 6.785 6.816 6.846 6.877 6.907 6.938 6.968 6.999 +7.029 7.060 7.090 7.121 7.151 7.182 7.212 7.243 7.274 7.304 +7.335 7.365 7.396 7.426 7.457 7.488 7.518 7.549 7.579 7.610 +7.641 7.671 7.702 7.732 7.763 7.794 7.824 7.855 7.885 7.916 + +7.947 7.977 8.008 8.039 8.069 8.100 8.131 8.161 8.192 8.223 +8.253 8.284 8.315 8.345 8.376 8.407 8.437 8.468 8.499 8.530 +8.560 8.591 8.622 8.652 8.683 8.714 8.745 8.775 8.806 8.837 +8.867 8.898 8.929 8.960 8.990 9.021 9.052 9.083 9.113 9.144 +9.175 9.206 9.236 9.267 9.298 9.329 9.359 9.390 9.421 9.452 + +9.483 9.513 9.544 9.575 9.606 9.636 9.667 9.698 9.729 9.760 +9.790 9.821 9.852 9.883 9.914 9.944 9.975 10.006 10.037 10.068 +10.098 10.129 10.160 10.191 10.222 10.252 10.283 10.314 10.345 10.376 +10.407 10.437 10.468 10.499 10.530 10.561 10.592 10.622 10.653 10.684 +10.715 10.746 10.777 10.807 10.838 10.869 10.900 10.931 10.962 10.992 + +11.023 11.054 11.085 11.116 11.147 11.177 11.208 11.239 11.270 11.301 +11.332 11.363 11.393 11.424 11.455 11.486 11.517 11.548 11.578 11.609 +11.640 11.671 11.702 11.733 11.764 11.794 11.825 11.856 11.887 11.918 +11.949 11.980 12.010 12.041 12.072 12.103 12.134 12.165 12.196 12.226 +12.257 12.288 12.319 12.350 12.381 12.411 12.442 12.473 12.504 12.535 + +12.566 12.597 12.627 12.658 12.689 12.720 12.751 12.782 12.813 12.843 +12.874 12.905 12.936 12.967 12.998 13.029 13.059 13.090 13.121 13.152 +13.183 13.214 13.244 13.275 13.306 13.337 13.368 13.399 13.430 13.460 +13.491 13.522 13.553 13.584 13.615 13.645 13.676 13.707 13.738 13.769 +13.800 13.830 13.861 13.892 13.923 13.954 13.985 14.015 14.046 14.077 + +14.108 14.139 14.170 14.200 14.231 14.262 14.293 14.324 14.355 14.385 +14.416 14.447 14.478 14.509 14.539 14.570 14.601 14.632 14.663 14.694 +14.724 14.755 14.786 14.817 14.848 14.878 14.909 14.940 14.971 15.002 +15.032 15.063 15.094 15.125 15.156 15.186 15.217 15.248 15.279 15.310 +15.340 15.371 15.402 15.433 15.464 15.494 15.525 15.556 15.587 15.617 + +15.648 15.679 15.710 15.741 15.771 15.802 15.833 15.864 15.894 15.925 +15.956 15.987 16.018 16.048 16.079 16.110 16.141 16.171 16.202 16.233 +16.264 16.294 16.325 16.356 16.387 16.417 16.448 16.479 16.510 16.540 +16.571 16.602 16.633 16.663 16.694 16.725 16.756 16.786 16.817 16.848 +16.879 16.909 16.940 16.971 17.001 17.032 17.063 17.094 17.124 17.155 + +17.186 17.217 17.247 17.278 17.309 17.339 17.370 17.401 17.432 17.462 +17.493 17.524 17.554 17.585 17.616 17.646 17.677 17.708 17.739 17.769 +17.800 17.831 17.861 17.892 17.923 17.953 17.984 18.015 18.046 18.076 +18.107 18.138 18.168 18.199 18.230 18.260 18.291 18.322 18.352 18.383 +18.414 18.444 18.475 18.506 18.537 18.567 18.598 18.629 18.659 18.690 + +18.721 18.751 18.782 18.813 18.843 18.874 18.905 18.935 18.966 18.997 +19.027 19.058 19.089 19.119 19.150 19.180 19.211 19.242 19.272 19.303 +19.334 19.364 19.395 19.426 19.456 19.487 19.518 19.548 19.579 19.610 +19.640 19.671 19.702 19.732 19.763 19.793 19.824 19.855 19.885 19.916 +19.947 19.977 20.008 20.039 20.069 20.100 20.131 20.161 20.192 20.222 + +20.253 20.284 20.314 20.345 20.376 20.406 20.437 20.467 20.498 20.529 +20.559 20.590 20.621 20.651 20.682 20.713 20.743 20.774 20.804 20.835 +20.866 20.896 20.927 20.958 20.988 21.019 21.049 21.080 21.111 21.141 +21.172 21.203 21.233 21.264 21.295 21.325 21.356 21.386 21.417 21.448 +21.478 21.509 21.540 21.570 21.601 21.631 21.662 21.693 21.723 21.754 + +21.785 21.815 21.846 21.877 21.907 21.938 21.968 21.999 22.030 22.060 +22.091 22.122 22.152 22.183 22.214 22.244 22.275 22.305 22.336 22.367 +22.397 22.428 22.459 22.489 22.520 22.551 22.581 22.612 22.643 22.673 +22.704 22.735 22.765 22.796 22.826 22.857 22.888 22.918 22.949 22.980 +23.010 23.041 23.072 23.102 23.133 23.164 23.194 23.225 23.256 23.286 + +23.317 23.348 23.378 23.409 23.440 23.471 23.501 23.532 23.563 23.593 +23.624 23.655 23.685 23.716 23.747 23.777 23.808 23.839 23.870 23.900 +23.931 23.962 23.992 24.023 24.054 24.085 24.115 24.146 24.177 24.207 +24.238 24.269 24.300 24.330 24.361 24.392 24.423 24.453 24.484 24.515 +24.546 24.576 24.607 24.638 24.669 24.699 24.730 24.761 24.792 24.822 + +24.853 24.854 24.915 24.946 24.976 25.007 25.038 25.069 25.099 25.130 +25.161 25.192 25.223 25.254 25.284 25.315 25.346 25.377 25.408 25.438 +25.469 25.500 25.531 25.562 25.593 25.623 25.654 25.685 25.716 25.747 +25.778 25.809 25.840 25.870 25.901 25.932 25.963 25.994 26.025 26.056 +26.087 26.118 26.148 26.179 26.210 26.241 26.272 26.303 26.334 26.365 + +26.396 26.427 26.458 26.489 26.520 26.551 26.582 26.613 26.644 26.675 +26.705 26.736 26.767 26.798 26.829 26.860 26.891 26.922 26.954 26.985 +27.016 27.047 27.078 27.109 27.140 27.171 27.202 27.233 27.264 27.295 +27.326 27.357 27.388 27.419 27.450 27.482 27.513 27.544 27.575 27.606 +27.637 27.668 27.699 27.731 27.762 27.793 27.824 27.855 27.886 27.917 + +27.949 27.980 28.011 28.042 28.073 28.105 28.136 28.167 28.198 28.230 +28.261 28.292 28.323 28.355 28.386 28.417 28.448 28.480 28.511 28.542 +28.573 28.605 28.636 28.667 28.699 28.730 28.761 28.793 28.824 28.855 +28.887 28.918 28.950 28.981 29.012 29.044 29.075 29.107 29.138 29.169 +29.201 29.232 29.264 29.295 29.327 29.358 29.390 29.421 29.452 29.484 + +29.515 29.547 29.578 29.610 29.642 29.673 29.705 29.736 29.768 29.799 +29.831 29.862 29.894 29.926 29.957 29.989 30.020 30.052 30.084 30.115 +30.147 30.179 30.210 30.242 30.274 30.305 30.337 30.369 30.400 30.432 +30.464 30.496 30.527 30.559 30.591 30.623 30.654 30.686 30.718 30.750 +30.782 30.813 30.845 30.877 30.909 30.941 30.973 31.005 31.036 31.068 + +31.100 31.132 31.164 31.196 31.228 31.260 31.292 31.324 31.356 31.388 +31.420 31.452 31.484 31.516 31.548 31.580 31.612 31.644 31.676 31.708 +31.740 31.772 31.804 31.836 31.868 31.901 31.933 31.965 31.997 32.029 +32.061 32.094 32.126 32.158 32.190 32.222 32.255 32.287 32.319 32.351 +32.384 32.416 32.448 32.480 32.513 32.545 32.577 32.610 32.642 32.674 + +32.707 32.739 32.772 32.804 32.836 32.869 32.901 32.934 32.966 32.999 +33.031 33.064 33.096 33.129 33.161 33.194 33.226 33.259 33.291 33.324 +33.356 33.389 33.422 33.454 33.487 33.519 33.552 33.585 33.617 33.650 +33.683 33.715 33.748 33.781 33.814 33.846 33.879 33.912 33.945 33.977 +34.010 34.043 34.076 34.109 34.141 34.174 34.207 34.240 34.273 34.306 + +34.339 34.372 34.405 34.437 34.470 34.503 34.536 34.569 34.602 34.635 +34.668 34.701 34.734 34.767 34.801 34.834 34.867 34.900 34.933 34.966 +34.999 35.032 35.065 35.099 35.132 35.165 35.198 35.231 35.265 35.298 +35.331 35.364 35.398 35.431 35.464 35.498 35.531 35.564 35.598 35.631 +35.664 35.698 35.731 35.764 35.798 35.831 35.865 35.898 35.932 35.965 + +35.999 36.032 36.066 36.099 36.133 36.166 36.200 36.233 36.267 36.301 +36.334 36.368 36.401 36.435 36.469 36.502 36.536 36.570 36.603 36.637 +36.671 36.705 36.738 36.772 36.806 36.840 36.873 36.907 36.941 36.975 +37.009 37.043 37.076 37.110 37.144 37.178 37.212 37.246 37.280 37.314 +37.348 37.382 37.416 37.450 37.484 37.518 37.552 37.586 37.620 37.654 + +37.688 37.722 37.756 37.790 37.825 37.859 37.893 37.927 37.961 37.995 +38.030 38.064 38.098 38.132 38.167 38.201 38.235 38.269 38.304 38.338 +38.372 38.407 38.441 38.475 38.510 38.544 38.578 38.613 38.647 38.682 +38.716 38.751 38.785 38.819 38.854 38.888 38.923 38.957 38.992 39.027 +39.061 39.096 39.130 39.165 39.199 39.234 39.269 39.303 39.338 39.373 + +39.407 39.442 39.477 39.511 39.546 39.581 39.615 39.650 39.685 39.720 +39.754 39.789 39.824 39.859 39.894 39.928 39.963 39.998 40.033 40.068 +40.103 40.138 40.172 40.207 40.242 40.277 40.312 40.347 40.382 40.417 +40.452 40.487 40.522 40.557 40.592 40.627 40.662 40.697 40.732 40.767 +40.802 40.837 40.872 40.908 40.943 40.978 41.013 41.048 41.083 41.118 + +41.154 41.189 41.224 41.259 41.294 41.329 41.365 41.400 41.435 41.470 +41.506 41.541 41.576 41.611 41.647 41.682 41.717 41.753 41.788 41.823 +41.859 41.894 41.929 41.965 42.000 42.035 42.071 42.106 42.142 42.177 +42.212 42.248 42.283 42.319 42.354 42.390 42.425 42.460 42.496 42.531 +42.567 42.602 42.638 42.673 42.709 42.744 42.780 42.815 42.851 42.886 +42.922 diff --git a/src/bpt/bptTypeKdegC.data b/src/bpt/bptTypeKdegC.data new file mode 100644 index 000000000..4136fa9b5 --- /dev/null +++ b/src/bpt/bptTypeKdegC.data @@ -0,0 +1,201 @@ +! cvtTypeKdegC.data +"typeKdegC" 0 0 1000 4095 .5 -270 1372 1 +! +-6.458 -6.457 -6.456 -6.455 -6.453 -6.452 -6.450 -6.448 -6.446 -6.444 +-6.441 -6.438 -6.435 -6.432 -6.429 -6.425 -6.421 -6.417 -6.413 -6.408 + +-6.404 -6.399 -6.394 -6.388 -6.382 -6.377 -6.371 -6.364 -6.358 -6.351 +-6.344 -6.337 -6.329 -6.322 -6.314 -6.306 -6.297 -6.289 -6.280 -6.271 +-6.262 -6.253 -6.243 -6.233 -6.223 -6.213 -6.202 -6.192 -6.181 -6.170 +-6.158 -6.147 -6.135 -6.123 -6.111 -6.099 -6.087 -6.074 -6.061 -6.048 +-6.035 -6.021 -6.007 -5.994 -5.980 -5.965 -5.951 -5.936 -5.922 -5.907 + +-5.891 -5.876 -5.860 -5.845 -5.829 -5.813 -5.796 -5.780 -5.763 -5.747 +-5.730 -5.712 -5.695 -5.678 -5.660 -5.642 -5.624 -5.606 -5.587 -5.569 +-5.550 -5.531 -5.512 -5.493 -5.474 -5.454 -5.434 -5.414 -5.394 -5.374 +-5.354 -5.333 -5.313 -5.292 -5.271 -5.249 -5.228 -5.207 -5.185 -5.163 +-5.141 -5.119 -5.097 -5.074 -5.051 -5.029 -5.006 -4.983 -4.959 -4.936 + +-4.912 -4.889 -4.865 -4.841 -4.817 -4.792 -4.768 -4.743 -4.719 -4.694 +-4.669 -4.644 -4.618 -4.593 -4.567 -4.541 -4.515 -4.489 -4.463 -4.437 +-4.410 -4.384 -4.357 -4.330 -4.303 -4.276 -4.248 -4.221 -4.193 -4.166 +-4.138 -4.110 -4.082 -4.053 -4.025 -3.997 -3.968 -3.939 -3.910 -3.881 +-3.852 -3.823 -3.793 -3.764 -3.734 -3.704 -3.674 -3.644 -3.614 -3.584 + +-3.553 -3.523 -3.492 -3.461 -3.430 -3.399 -3.368 -3.337 -3.305 -3.274 +-3.242 -3.211 -3.179 -3.147 -3.115 -3.082 -3.050 -3.018 -2.985 -2.953 +-2.920 -2.887 -2.854 -2.821 -2.788 -2.754 -2.721 -2.687 -2.654 -2.620 +-2.586 -2.552 -2.518 -2.484 -2.450 -2.416 -2.381 -2.347 -2.312 -2.277 +-2.243 -2.208 -2.173 -2.137 -2.102 -2.067 -2.032 -1.996 -1.961 -1.925 + +-1.889 -1.853 -1.817 -1.781 -1.745 -1.709 -1.673 -1.636 -1.600 -1.563 +-1.527 -1.490 -1.453 -1.416 -1.379 -1.342 -1.305 -1.268 -1.231 -1.193 +-1.156 -1.118 -1.081 -1.043 -1.005 -0.968 -0.930 -0.892 -0.854 -0.816 +-0.777 -0.739 -0.701 -0.662 -0.624 -0.585 -0.547 -0.508 -0.469 -0.431 +-0.392 -0.353 -0.314 -0.275 -0.236 -0.197 -0.157 -0.118 -0.079 -0.039 + +0.000 0.039 0.079 0.119 0.158 0.198 0.238 0.277 0.317 0.357 +0.397 0.437 0.477 0.517 0.557 0.597 0.637 0.677 0.718 0.758 +0.798 0.838 0.879 0.919 0.960 1.000 1.041 1.081 1.122 1.162 +1.203 1.244 1.285 1.325 1.366 1.407 1.448 1.489 1.529 1.570 +1.611 1.652 1.693 1.734 1.776 1.817 1.858 1.899 1.940 1.981 + +2.022 2.064 2.105 2.146 2.188 2.229 2.270 2.312 2.353 2.394 +2.436 2.477 2.519 2.560 2.601 2.643 2.684 2.726 2.767 2.809 +2.850 2.892 2.933 2.975 3.016 3.058 3.100 3.141 3.183 3.224 +3.266 3.307 3.349 3.390 3.432 3.473 3.515 3.556 3.598 3.639 +3.681 3.722 3.764 3.805 3.847 3.888 3.930 3.971 4.012 4.054 + +4.095 4.137 4.178 4.219 4.261 4.302 4.343 4.384 4.426 4.467 +4.508 4.549 4.590 4.632 4.673 4.714 4.755 4.796 4.837 4.878 +4.919 4.960 5.001 5.042 5.083 5.124 5.164 5.205 5.246 5.287 +5.327 5.368 5.409 5.450 5.490 5.531 5.571 5.612 5.652 5.693 +5.733 5.774 5.814 5.855 5.895 5.936 5.976 6.016 6.057 6.097 + +6.137 6.177 6.218 6.258 6.298 6.338 6.378 6.419 6.459 6.499 +6.539 6.579 6.619 6.659 6.699 6.739 6.779 6.819 6.859 6.899 +6.939 6.979 7.019 7.059 7.099 7.139 7.179 7.219 7.259 7.299 +7.338 7.378 7.418 7.458 7.498 7.538 7.578 7.618 7.658 7.697 +7.737 7.777 7.817 7.857 7.897 7.937 7.977 8.017 8.057 8.097 + +8.137 8.177 8.216 8.256 8.296 8.336 8.376 8.416 8.456 8.497 +8.537 8.577 8.617 8.657 8.697 8.737 8.777 8.817 8.857 8.898 +8.938 8.978 9.018 9.058 9.099 9.139 9.179 9.220 9.260 9.300 +9.341 9.381 9.421 9.462 9.502 9.543 9.583 9.624 9.664 9.705 +9.745 9.786 9.826 9.867 9.907 9.948 9.989 10.029 10.070 10.111 + +10.151 10.192 10.233 10.274 10.315 10.355 10.396 10.437 10.478 10.519 +10.560 10.600 10.641 10.682 10.723 10.764 10.805 10.846 10.887 10.928 +10.969 11.010 11.051 11.093 11.134 11.175 11.216 11.257 11.298 11.339 +11.381 11.422 11.463 11.504 11.546 11.587 11.628 11.669 11.711 11.752 +11.793 11.835 11.876 11.918 11.959 12.000 12.042 12.083 12.125 12.166 + +12.207 12.249 12.290 12.332 12.373 12.415 12.456 12.498 12.539 12.581 +12.623 12.664 12.706 12.747 12.789 12.831 12.872 12.914 12.955 12.997 +13.039 13.080 13.122 13.164 13.205 13.247 13.289 13.331 13.372 13.414 +13.456 13.497 13.539 13.581 13.623 13.665 13.706 13.748 13.790 13.832 +13.874 13.915 13.957 13.999 14.041 14.083 14.125 14.167 14.208 14.250 + +14.292 14.334 14.376 14.418 14.460 14.502 14.544 14.586 14.628 14.670 +14.712 14.754 14.796 14.838 14.880 14.922 14.964 15.006 15.048 15.090 +15.132 15.174 15.216 15.258 15.300 15.342 15.384 15.426 15.468 15.510 +15.552 15.594 15.636 15.679 15.721 15.763 15.805 15.847 15.889 15.931 +15.974 16.016 16.058 16.100 16.142 16.184 16.227 16.269 16.311 16.353 + +16.395 16.438 16.480 16.522 16.564 16.607 16.649 16.691 16.733 16.776 +16.818 16.860 16.902 16.945 16.987 17.029 17.072 17.114 17.156 17.199 +17.241 17.283 17.326 17.368 17.410 17.453 17.495 17.537 17.580 17.622 +17.664 17.707 17.749 17.792 17.834 17.876 17.919 17.961 18.004 18.046 +18.088 18.131 18.173 18.216 18.258 18.301 18.343 18.385 18.428 18.470 + +18.513 18.555 18.598 18.640 18.683 18.725 18.768 18.810 18.853 18.895 +18.938 18.980 19.023 19.065 19.108 19.150 19.193 19.235 19.278 19.320 +19.363 19.405 19.448 19.490 19.533 19.576 19.618 19.661 19.703 19.746 +19.788 19.831 19.873 19.916 19.959 20.001 20.044 20.086 20.129 20.172 +20.214 20.257 20.299 20.342 20.385 20.427 20.470 20.512 20.555 20.598 + +20.640 20.683 20.725 20.768 20.811 20.853 20.896 20.938 20.981 21.024 +21.066 21.109 21.152 21.194 21.237 21.280 21.322 21.365 21.407 21.450 +21.493 21.535 21.578 21.621 21.663 21.706 21.749 21.791 21.834 21.876 +21.919 21.962 22.004 22.047 22.090 22.132 22.175 22.218 22.260 22.303 +22.346 22.388 22.431 22.473 22.516 22.559 22.601 22.644 22.687 22.729 + +22.772 22.815 22.857 22.900 22.942 22.985 23.028 23.070 23.113 23.156 +23.198 23.241 23.284 23.326 23.369 23.411 23.454 23.497 23.539 23.582 +23.624 23.667 23.710 23.752 23.795 23.837 23.880 23.923 23.965 24.008 +24.050 24.093 24.136 24.178 24.221 24.263 24.306 24.348 24.391 24.434 +24.476 24.519 24.561 24.604 24.646 24.689 24.731 24.774 24.817 24.859 + +24.902 24.944 24.987 25.029 25.072 25.114 25.157 25.199 25.242 25.284 +25.327 25.369 25.412 25.454 25.497 25.539 25.582 25.624 25.666 25.709 +25.751 25.794 25.836 25.879 25.921 25.964 26.006 26.048 26.091 26.133 +26.176 26.218 26.260 26.303 26.345 26.387 26.430 26.472 26.515 26.557 +26.599 26.642 26.684 26.726 26.769 26.811 26.853 26.896 26.938 26.980 + +27.022 27.065 27.107 27.149 27.192 27.234 27.276 27.318 27.361 27.403 +27.445 27.487 27.529 27.572 27.614 27.656 27.698 27.740 27.783 27.825 +27.867 27.909 27.951 27.993 28.035 28.078 28.120 28.162 28.204 28.246 +28.288 28.330 28.372 28.414 28.456 28.498 28.540 28.583 28.625 28.667 +28.709 28.751 28.793 28.835 28.877 28.919 28.961 29.002 29.044 29.086 + +29.128 29.170 29.212 29.254 29.296 29.338 29.380 29.422 29.464 29.505 +29.547 29.589 29.631 29.673 29.715 29.756 29.798 29.840 29.882 29.924 +29.965 30.007 30.049 30.091 30.132 30.174 30.216 30.257 30.299 30.341 +30.383 30.424 30.466 30.508 30.549 30.591 30.632 30.674 30.716 30.757 +30.799 30.840 30.882 30.924 30.965 31.007 31.048 31.090 31.131 31.173 + +31.214 31.256 31.297 31.339 31.380 31.422 31.463 31.504 31.546 31.587 +31.629 31.670 31.712 31.753 31.794 31.836 31.877 31.918 31.960 32.001 +32.042 32.084 32.125 32.166 32.207 32.249 32.290 32.331 32.372 32.414 +32.455 32.496 32.537 32.578 32.619 32.661 32.702 32.743 32.784 32.825 +32.866 32.907 32.948 32.990 33.031 33.072 33.113 33.154 33.195 33.236 + +33.277 33.318 33.359 33.400 33.441 33.482 33.523 33.564 33.604 33.645 +33.686 33.727 33.768 33.809 33.850 33.891 33.931 33.972 34.013 34.054 +34.095 34.136 34.176 34.217 34.258 34.299 34.339 34.380 34.421 34.461 +34.502 34.543 34.583 34.624 34.665 34.705 34.746 34.787 34.827 34.868 +34.909 34.949 34.990 35.030 35.071 35.111 35.152 35.192 35.233 35.273 + +35.314 35.354 35.395 35.435 35.476 35.516 35.557 35.597 35.637 35.678 +35.718 35.758 35.799 35.839 35.880 35.920 35.960 36.000 36.041 36.081 +36.121 36.162 36.202 36.242 36.282 36.323 36.363 36.403 36.443 36.483 +36.524 36.564 36.604 36.644 36.684 36.724 36.764 36.804 36.844 36.885 +36.925 36.965 37.005 37.045 37.085 37.125 37.165 37.205 37.245 37.285 + +37.325 37.365 37.405 37.445 37.484 37.524 37.564 37.604 37.644 37.684 +37.724 37.764 37.803 37.843 37.883 37.923 37.963 38.002 38.042 38.082 +38.122 38.162 38.201 38.241 38.281 38.320 38.360 38.400 38.439 38.479 +38.519 38.558 38.598 38.638 38.677 38.717 38.756 38.796 38.836 38.875 +38.915 38.954 38.994 39.033 39.073 39.112 39.152 39.191 39.231 39.270 + +39.310 39.349 39.388 39.428 39.467 39.507 39.546 39.585 39.625 39.644 +39.703 39.743 39.782 39.821 39.861 39.900 39.939 39.979 40.018 40.057 +40.096 40.136 40.175 40.214 40.253 40.292 40.332 40.371 40.410 40.449 +40.488 40.527 40.566 40.605 40.645 40.684 40.723 40.762 40.801 40.840 +40.879 40.918 40.957 40.996 41.035 41.074 41.113 41.152 41.191 41.230 + +41.269 41.308 41.347 41.385 41.424 41.463 41.502 41.541 41.580 41.619 +41.657 41.696 41.735 41.774 41.813 41.851 41.890 41.929 41.968 42.006 +42.045 42.084 42.123 42.161 42.200 42.239 42.277 42.316 42.355 42.393 +42.432 42.470 42.509 42.548 42.586 42.625 42.663 42.702 42.740 42.779 +42.817 42.856 42.894 42.933 42.971 43.010 43.048 43.087 43.125 43.164 + +43.202 43.240 43.279 43.317 43.356 43.394 43.432 43.471 43.509 43.547 +43.585 43.624 43.662 43.700 43.739 43.777 43.815 43.853 43.891 43.930 +43.968 44.006 44.044 44.082 44.121 44.159 44.197 44.235 44.273 44.311 +44.349 44.387 44.425 44.463 44.501 44.539 44.577 44.615 44.653 44.691 +44.729 44.767 44.805 44.843 44.881 44.919 44.957 44.995 45.033 45.070 + +45.108 45.146 45.184 45.222 45.260 45.297 45.335 45.373 45.411 45.448 +45.486 45.524 45.561 45.599 45.637 45.675 45.712 45.750 45.787 45.825 +45.863 45.900 45.938 45.975 46.013 46.051 46.088 46.126 46.163 46.201 +46.238 46.275 46.313 46.350 46.388 46.425 46.463 46.500 46.537 46.575 +46.612 46.649 46.687 46.724 46.761 46.799 46.836 46.873 46.910 46.948 + +46.985 47.022 47.059 47.096 47.134 47.171 47.208 47.245 47.282 47.319 +47.356 47.393 47.430 47.468 47.505 47.542 47.579 47.616 47.653 47.689 +47.726 47.763 47.800 47.837 47.874 47.911 47.948 47.985 48.021 48.058 +48.095 48.132 48.169 48.205 48.242 48.279 48.316 48.352 48.389 48.426 +48.462 48.499 48.536 48.572 48.609 48.645 48.682 48.718 48.755 48.792 + +48.828 48.865 48.901 48.937 48.974 49.010 49.047 49.083 49.120 49.156 +49.192 49.229 49.265 49.301 49.338 49.374 49.410 49.446 49.483 49.519 +49.555 49.591 49.627 49.663 49.700 49.736 49.772 49.808 49.844 49.880 +49.916 49.952 49.988 50.024 50.060 50.096 50.132 50.168 50.204 50.240 +50.276 50.311 50.347 50.383 50.419 50.455 50.491 50.526 50.562 50.598 + +50.633 50.669 50.705 50.741 50.776 50.812 50.847 50.883 50.919 50.954 +50.990 51.025 51.061 51.096 51.132 51.167 51.203 51.238 51.274 51.309 +51.344 51.380 51.415 51.450 51.486 51.521 51.556 51.592 51.627 51.662 +51.697 51.733 51.768 51.803 51.838 51.873 51.908 51.943 51.979 52.014 +52.049 52.084 52.119 52.154 52.189 52.224 52.259 52.294 52.329 52.364 + +52.398 52.433 52.468 52.503 52.538 52.573 52.608 52.642 52.677 52.712 +52.747 52.781 52.816 52.851 52.886 52.920 52.955 52.989 53.024 53.059 +53.093 53.128 53.162 53.197 53.232 53.266 53.301 53.335 53.370 53.404 +53.439 53.473 53.507 53.542 53.576 53.611 53.645 53.679 53.714 53.748 +53.782 53.817 53.851 53.885 53.920 53.954 53.988 54.022 54.057 54.091 + +54.125 54.159 54.193 54.228 54.262 54.296 54.330 54.364 54.398 54.432 +54.466 54.501 54.535 54.569 54.603 54.637 54.671 54.705 54.739 54.773 +54.807 54.841 54.875 diff --git a/src/bpt/bptTypeKdegF.data b/src/bpt/bptTypeKdegF.data new file mode 100644 index 000000000..20210cc5a --- /dev/null +++ b/src/bpt/bptTypeKdegF.data @@ -0,0 +1,360 @@ +! cvtTypeKdegF.data +"typeKdegF" 32 0 1832 4095 1.0 -454 2500 1 +! + -6.458 -6.457 -6.457 -6.456 + +-6.456 -6.455 -6.454 -6.454 -6.453 -6.452 -6.451 -6.450 -6.449 -6.448 +-6.447 -6.445 -6.444 -6.443 -6.441 -6.440 -6.438 -6.436 -6.435 -6.433 +-6.431 -6.429 -6.427 -6.425 -6.423 -6.421 -6.419 -6.416 -6.414 -6.411 +-6.409 -6.406 -6.404 -6.401 -6.398 -6.395 -6.392 -6.389 -6.386 -6.383 +-6.380 -6.377 -6.373 -6.370 -6.366 -6.363 -6.359 -6.355 -6.352 -6.348 + +-6.344 -6.340 -6.336 -6.332 -6.328 -6.323 -6.319 -6.315 -6.310 -6.306 +-6.301 -6.296 -6.292 -6.287 -6.282 -6.277 -6.272 -6.267 -6.262 -6.257 +-6.251 -6.246 -6.241 -6.235 -6.230 -6.224 -6.219 -6.213 -6.207 -6.201 +-6.195 -6.189 -6.183 -6.177 -6.171 -6.165 -6.158 -6.152 -6.146 -6.139 +-6.133 -6.126 -6.119 -6.113 -6.106 -6.099 -6.092 -6.085 -6.078 -6.071 + +-6.064 -6.057 -6.049 -6.042 -6.035 -6.027 -6.020 -6.012 -6.004 -5.997 +-5.989 -5.981 -5.973 -5.965 -5.957 -5.949 -5.941 -5.933 -5.925 -5.917 +-5.908 -5.900 -5.891 -5.883 -5.874 -5.866 -5.857 -5.848 -5.839 -5.831 +-5.822 -5.813 -5.804 -5.795 -5.786 -5.776 -5.767 -5.758 -5.748 -5.739 +-5.730 -5.720 -5.711 -5.701 -5.691 -5.682 -5.672 -5.662 -5.652 -5.642 + +-5.632 -5.622 -5.612 -5.602 -5.592 -5.581 -5.571 -5.561 -5.550 -5.540 +-5.529 -5.519 -5.508 -5.497 -5.487 -5.476 -5.465 -5.454 -5.443 -5.432 +-5.421 -5.410 -5.399 -5.388 -5.376 -5.365 -5.354 -5.342 -5.331 -5.319 +-5.308 -5.296 -5.285 -5.273 -5.261 -5.249 -5.238 -5.226 -5.214 -5.202 +-5.190 -5.178 -5.165 -5.153 -5.141 -5.129 -5.116 -5.104 -5.092 -5.079 + +-5.067 -5.054 -5.041 -5.029 -5.016 -5.003 -4.990 -4.978 -4.965 -4.952 +-4.939 -4.926 -4.912 -4.899 -4.886 -4.873 -4.860 -4.846 -4.833 -4.819 +-4.806 -4.792 -4.779 -4.765 -4.752 -4.738 -4.724 -4.710 -4.697 -4.683 +-4.669 -4.655 -4.641 -4.627 -4.613 -4.598 -4.584 -4.570 -4.556 -4.541 +-4.527 -4.512 -4.498 -4.484 -4.469 -4.454 -4.440 -4.425 -4.410 -4.396 + +-4.381 -4.366 -4.351 -4.336 -4.321 -4.306 -4.291 -4.276 -4.261 -4.245 +-4.230 -4.215 -4.200 -4.184 -4.169 -4.153 -4.138 -4.122 -4.107 -4.091 +-4.075 -4.060 -4.044 -4.028 -4.012 -3.997 -3.981 -3.965 -3.949 -3.933 +-3.917 -3.901 -3.884 -3.868 -3.852 -3.836 -3.819 -3.803 -3.787 -3.770 +-3.754 -3.737 -3.721 -3.704 -3.688 -3.671 -3.654 -3.637 -3.621 -3.604 + +-3.587 -3.570 -3.553 -3.536 -3.519 -3.502 -3.485 -3.468 -3.451 -3.434 +-3.417 -3.399 -3.382 -3.365 -3.347 -3.330 -3.312 -3.295 -3.277 -3.260 +-3.242 -3.225 -3.207 -3.189 -3.172 -3.154 -3.136 -3.118 -3.100 -3.082 +-3.065 -3.047 -3.029 -3.010 -2.992 -2.974 -2.956 -2.938 -2.920 -2.902 +-2.883 -2.865 -2.847 -2.828 -2.810 -2.791 -2.773 -2.754 -2.736 -2.717 + +-2.699 -2.680 -2.661 -2.643 -2.624 -2.605 -2.586 -2.567 -2.549 -2.530 +-2.511 -2.492 -2.473 -2.454 -2.435 -2.416 -2.397 -2.377 -2.358 -2.339 +-2.320 -2.300 -2.281 -2.262 -2.243 -2.223 -2.204 -2.184 -2.165 -2.145 +-2.126 -2.106 -2.087 -2.067 -2.047 -2.028 -2.008 -1.988 -1.968 -1.949 +-1.929 -1.909 -1.889 -1.869 -1.849 -1.829 -1.809 -1.789 -1.769 -1.749 + +-1.729 -1.709 -1.689 -1.669 -1.648 -1.628 -1.608 -1.588 -1.567 -1.547 +-1.527 -1.506 -1.486 -1.465 -1.445 -1.424 -1.404 -1.383 -1.363 -1.342 +-1.322 -1.301 -1.280 -1.260 -1.239 -1.218 -1.197 -1.177 -1.156 -1.135 +-1.114 -1.093 -1.072 -1.051 -1.031 -1.010 -0.989 -0.968 -0.946 -0.925 +-0.904 -0.883 -0.862 -0.841 -0.820 -0.799 -0.777 -0.756 -0.735 -0.714 + +-0.692 -0.671 -0.650 -0.628 -0.607 -0.585 -0.564 -0.543 -0.521 -0.500 +-0.478 -0.457 -0.435 -0.413 -0.392 -0.370 -0.349 -0.327 -0.305 -0.284 +-0.262 -0.240 -0.218 -0.197 -0.175 -0.153 -0.131 -0.109 -0.088 -0.066 +-0.044 -0.022 0.000 0.022 0.044 0.066 0.088 0.110 0.132 0.154 +0.176 0.198 0.220 0.242 0.264 0.286 0.308 0.331 0.353 0.375 + +0.397 0.419 0.441 0.464 0.486 0.508 0.530 0.553 0.575 0.597 +0.619 0.642 0.664 0.686 0.709 0.731 0.753 0.776 0.798 0.821 +0.843 0.865 0.888 0.910 0.933 0.955 0.978 1.000 1.023 1.045 +1.068 1.090 1.113 1.135 1.158 1.181 1.203 1.226 1.248 1.271 +1.294 1.316 1.339 1.362 1.384 1.407 1.430 1.452 1.475 1.498 + +1.520 1.543 1.566 1.589 1.611 1.634 1.657 1.680 1.703 1.725 +1.748 1.771 1.794 1.817 1.839 1.862 1.885 1.908 1.931 1.954 +1.977 2.000 2.022 2.045 2.068 2.091 2.114 2.137 2.160 2.183 +2.206 2.229 2.252 2.275 2.298 2.321 2.344 2.367 2.390 2.413 +2.436 2.459 2.482 2.505 2.528 2.551 2.574 2.597 2.620 2.643 + +2.666 2.689 2.712 2.735 2.758 2.781 2.804 2.827 2.850 2.873 +2.896 2.920 2.943 2.966 2.989 3.012 3.035 3.058 3.081 3.104 +3.127 3.150 3.173 3.196 3.220 3.243 3.266 3.289 3.312 3.335 +3.358 3.381 3.404 3.427 3.450 3.473 3.496 3.519 3.543 3.566 +3.589 3.612 3.635 3.658 3.681 3.704 3.727 3.750 3.773 3.796 + +3.819 3.842 3.865 3.888 3.911 3.934 3.957 3.980 4.003 4.026 +4.049 4.072 4.095 4.118 4.141 4.164 4.187 4.210 4.233 4.256 +4.279 4.302 4.325 4.348 4.371 4.394 4.417 4.439 4.462 4.485 +4.508 4.531 4.554 4.577 4.600 4.622 4.645 4.668 4.691 4.714 +4.737 4.759 4.782 4.805 4.828 4.851 4.873 4.896 4.919 4.942 + +4.964 4.987 5.010 5.033 5.055 5.078 5.101 5.124 5.146 5.169 +5.192 5.214 5.237 5.260 5.282 5.305 5.327 5.350 5.373 5.395 +5.418 5.440 5.463 5.486 5.508 5.531 5.553 5.576 5.598 5.621 +5.643 5.666 5.688 5.711 5.733 5.756 5.778 5.801 5.823 5.846 +5.868 5.891 5.913 5.936 5.958 5.980 6.003 6.025 6.048 6.070 + +6.092 6.115 6.137 6.160 6.182 6.204 6.227 6.249 6.271 6.294 +6.316 6.338 6.361 6.383 6.405 6.428 6.450 6.472 6.494 6.517 +6.539 6.561 6.583 6.606 6.628 6.650 6.672 6.695 6.717 6.739 +6.761 6.784 6.806 6.828 6.850 6.873 6.895 6.917 6.939 6.961 +6.984 7.006 7.028 7.050 7.072 7.094 7.117 7.139 7.161 7.183 + +7.205 7.228 7.250 7.272 7.294 7.316 7.338 7.361 7.383 7.405 +7.427 7.449 7.471 7.494 7.516 7.538 7.560 7.582 7.604 7.627 +7.649 7.671 7.693 7.715 7.737 7.760 7.782 7.804 7.826 7.848 +7.870 7.893 7.915 7.937 7.959 7.981 8.003 8.026 8.048 8.070 +8.092 8.114 8.137 8.159 8.181 8.203 8.225 8.248 8.270 8.292 + +8.314 8.336 8.359 8.381 8.403 8.425 8.448 8.470 8.492 8.514 +8.537 8.559 8.581 8.603 8.626 8.648 8.670 8.692 8.715 8.737 +8.759 8.782 8.804 8.826 8.849 8.871 8.893 8.916 8.938 8.960 +8.983 9.005 9.027 9.050 9.072 9.094 9.117 9.139 9.161 9.184 +9.206 9.229 9.251 9.273 9.296 9.318 9.341 9.363 9.385 9.408 + +9.430 9.453 9.475 9.498 9.520 9.543 9.565 9.588 9.610 9.633 +9.655 9.678 9.700 9.723 9.745 9.768 9.790 9.813 9.835 9.858 +9.880 9.903 9.926 9.948 9.971 9.993 10.016 10.038 10.061 10.084 +10.106 10.129 10.151 10.174 10.197 10.219 10.242 10.265 10.287 10.310 +10.333 10.355 10.378 10.401 10.423 10.446 10.469 10.491 10.514 10.537 + +10.560 10.582 10.605 10.628 10.650 10.673 10.696 10.719 10.741 10.764 +10.787 10.810 10.833 10.855 10.878 10.901 10.924 10.947 10.969 10.992 +11.015 11.038 11.061 11.083 11.106 11.129 11.152 11.175 11.198 11.221 +11.243 11.266 11.289 11.312 11.335 11.358 11.381 11.404 11.426 11.449 +11.472 11.495 11.518 11.541 11.564 11.587 11.610 11.633 11.656 11.679 + +11.702 11.725 11.748 11.770 11.793 11.816 11.839 11.862 11.885 11.908 +11.931 11.954 11.977 12.000 12.023 12.046 12.069 12.092 12.115 12.138 +12.161 12.184 12.207 12.230 12.254 12.277 12.300 12.323 12.346 12.369 +12.392 12.415 12.438 12.461 12.484 12.507 12.530 12.553 12.576 12.599 +12.623 12.646 12.669 12.692 12.715 12.738 12.761 12.784 12.807 12.831 + +12.854 12.877 12.900 12.923 12.946 12.969 12.992 13.016 13.039 13.062 +13.085 13.108 13.131 13.154 13.178 13.201 13.224 13.247 13.270 13.293 +13.317 13.340 13.363 13.386 13.409 13.433 13.456 13.479 13.502 13.525 +13.549 13.572 13.595 13.618 13.641 13.665 13.688 13.711 13.734 13.757 +13.781 13.804 13.827 13.850 13.874 13.897 13.920 13.943 13.967 13.990 + +14.013 14.036 14.060 14.083 14.106 14.129 14.153 14.176 14.199 14.222 +14.246 14.269 14.292 14.316 14.339 14.362 14.385 14.409 14.432 14.455 +14.479 14.502 14.525 14.548 14.572 14.595 14.618 14.642 14.665 14.688 +14.712 14.735 14.758 14.782 14.805 14.828 14.852 14.875 14.898 14.922 +14.945 14.968 14.992 15.015 15.038 15.062 15.085 15.108 15.132 15.155 + +15.178 15.202 15.225 15.248 15.272 15.295 15.318 15.342 15.365 15.389 +15.412 15.435 15.459 15.482 15.505 15.529 15.552 15.576 15.599 15.622 +15.646 15.669 15.693 15.716 15.739 15.763 15.786 15.810 15.833 15.856 +15.880 15.903 15.927 15.950 15.974 15.997 16.020 16.044 16.067 16.091 +16.114 16.138 16.161 16.184 16.208 16.231 16.255 16.278 16.302 16.325 + +16.349 16.372 16.395 16.419 16.442 16.466 16.489 16.513 16.536 16.560 +16.583 16.607 16.630 16.654 16.677 16.700 16.724 16.747 16.771 16.794 +16.818 16.841 16.865 16.888 16.912 16.935 16.959 16.982 17.006 17.029 +17.053 17.076 17.100 17.123 17.147 17.170 17.194 17.217 17.241 17.264 +17.288 17.311 17.335 17.358 17.382 17.406 17.429 17.453 17.476 17.500 + +17.523 17.547 17.570 17.594 17.617 17.641 17.664 17.688 17.711 17.735 +17.759 17.782 17.806 17.829 17.853 17.876 17.900 17.923 17.947 17.971 +17.994 18.018 18.041 18.065 18.088 18.112 18.136 18.159 18.183 18.206 +18.230 18.253 18.277 18.301 18.324 18.348 18.371 18.395 18.418 18.442 +18.466 18.489 18.513 18.536 18.560 18.584 18.607 18.631 18.654 18.678 + +18.702 18.725 18.749 18.772 18.796 18.820 18.843 18.867 18.890 18.914 +18.938 18.961 18.985 19.008 19.032 19.056 19.079 19.103 19.127 19.150 +19.174 19.197 19.221 19.245 19.268 19.292 19.316 19.339 19.363 19.386 +19.410 19.434 19.457 19.481 19.505 19.528 19.552 19.576 19.599 19.623 +19.646 19.670 19.694 19.717 19.741 19.765 19.788 19.812 19.836 19.859 + +19.883 19.907 19.930 19.954 19.978 20.001 20.025 20.049 20.072 20.096 +20.120 20.143 20.167 20.190 20.214 20.238 20.261 20.285 20.309 20.332 +20.356 20.380 20.403 20.427 20.451 20.474 20.498 20.522 20.545 20.569 +20.593 20.616 20.640 20.664 20.688 20.711 20.735 20.759 20.782 20.806 +20.830 20.853 20.877 20.901 20.924 20.948 20.972 20.995 21.019 21.043 + +21.066 21.090 21.114 21.137 21.161 21.185 21.208 21.232 21.256 21.280 +21.303 21.327 21.351 21.374 21.398 21.422 21.445 21.469 21.493 21.516 +21.540 21.564 21.587 21.611 21.635 21.659 21.682 21.706 21.730 21.753 +21.777 21.801 21.824 21.848 21.872 21.895 21.919 21.943 21.966 21.990 +22.014 22.038 22.061 22.085 22.109 22.132 22.156 22.180 22.203 22.227 + +22.251 22.274 22.298 22.322 22.346 22.369 22.393 22.417 22.440 22.464 +22.488 22.511 22.535 22.559 22.582 22.606 22.630 22.654 22.677 22.701 +22.725 22.748 22.772 22.796 22.819 22.843 22.867 22.890 22.914 22.938 +22.961 22.985 23.009 23.032 23.056 23.080 23.104 23.127 23.151 23.175 +23.198 23.222 23.246 23.269 23.293 23.317 23.340 23.364 23.388 23.411 + +23.435 23.459 23.482 23.506 23.530 23.553 23.577 23.601 23.624 23.648 +23.672 23.695 23.719 23.743 23.766 23.790 23.814 23.837 23.861 23.885 +23.908 23.932 23.956 23.979 24.003 24.027 24.050 24.074 24.098 24.121 +24.145 24.169 24.192 24.216 24.240 24.263 24.287 24.311 24.334 24.358 +24.382 24.405 24.429 24.453 24.476 24.500 24.523 24.547 24.571 24.594 + +24.618 24.642 24.665 24.689 24.713 24.736 24.760 24.783 24.807 24.831 +24.854 24.878 24.902 24.925 24.949 24.972 24.996 25.020 25.043 25.067 +25.091 25.114 25.138 25.161 25.185 25.209 25.232 25.256 25.279 25.303 +25.327 25.350 25.374 25.397 25.421 25.445 25.468 25.492 25.515 25.539 +25.563 25.586 25.610 25.633 25.657 25.681 25.704 25.728 25.751 25.775 + +25.799 25.822 25.846 25.869 25.893 25.916 25.940 25.964 25.987 26.011 +26.034 26.058 26.081 26.105 26.128 26.152 26.176 26.199 26.223 26.246 +26.270 26.293 26.317 26.340 26.364 26.387 26.411 26.435 26.458 26.482 +26.505 26.529 26.552 26.576 26.599 26.623 26.646 26.670 26.693 26.717 +26.740 26.764 26.787 26.811 26.834 26.858 26.881 26.905 26.928 26.952 + +26.975 26.999 27.022 27.046 27.069 27.093 27.116 27.140 27.163 27.187 +27.210 27.234 27.257 27.281 27.304 27.328 27.351 27.375 27.398 27.422 +27.445 27.468 27.492 27.515 27.539 27.562 27.586 27.609 27.633 27.656 +27.679 27.703 27.726 27.750 27.773 27.797 27.820 27.843 27.867 27.890 +27.914 27.937 27.961 27.984 28.007 28.031 28.054 28.078 28.101 28.124 + +28.148 28.171 28.195 28.218 28.241 28.265 28.288 28.311 28.335 28.358 +28.382 28.405 28.428 28.452 28.475 28.498 28.522 28.545 28.569 28.592 +28.615 28.639 28.662 28.685 28.709 28.732 28.755 28.779 28.802 28.825 +28.849 28.872 28.895 28.919 28.942 28.965 28.988 29.012 29.035 29.058 +29.082 29.105 29.128 29.152 29.175 29.198 29.221 29.245 29.268 29.291 + +29.315 29.338 29.361 29.384 29.408 29.431 29.454 29.477 29.501 29.524 +29.547 29.570 29.594 29.617 29.640 29.663 29.687 29.710 29.733 29.756 +29.780 29.803 29.826 29.849 29.872 29.896 29.919 29.942 29.965 29.989 +30.012 30.035 30.058 30.081 30.104 30.128 30.151 30.174 30.197 30.220 +30.244 30.267 30.290 30.313 30.336 30.359 30.383 30.406 30.429 30.452 + +30.475 30.498 30.521 30.545 30.568 30.591 30.614 30.637 30.660 30.683 +30.706 30.730 30.753 30.776 30.799 30.822 30.845 30.868 30.891 30.914 +30.937 30.961 30.984 31.007 31.030 31.053 31.076 31.099 31.122 31.145 +31.168 31.191 31.214 31.237 31.260 31.283 31.306 31.329 31.353 31.376 +31.399 31.422 31.445 31.468 31.491 31.514 31.537 31.560 31.583 31.606 + +31.629 31.652 31.675 31.698 31.721 31.744 31.767 31.790 31.813 31.836 +31.859 31.882 31.905 31.927 31.950 31.973 31.996 32.019 32.042 32.065 +32.088 32.111 32.134 32.157 32.180 32.203 32.226 32.249 32.272 32.294 +32.317 32.340 32.363 32.386 32.409 32.432 32.455 32.478 32.501 32.523 +32.546 32.569 32.592 32.615 32.638 32.661 32.683 32.706 32.729 32.752 + +32.775 32.798 32.821 32.843 32.866 32.889 32.912 32.935 32.958 32.980 +33.003 33.026 33.049 33.072 33.094 33.117 33.140 33.163 33.186 33.208 +33.231 33.254 33.277 33.300 33.322 33.345 33.368 33.391 33.413 33.436 +33.459 33.482 33.504 33.527 33.550 33.573 33.595 33.618 33.641 33.664 +33.686 33.709 33.732 33.754 33.777 33.800 33.823 33.845 33.868 33.891 + +33.913 33.936 33.959 33.981 34.004 34.027 34.049 34.072 34.095 34.117 +34.140 34.163 34.185 34.208 34.231 34.253 34.276 34.299 34.321 34.344 +34.366 34.389 34.412 34.434 34.457 34.480 34.502 34.525 34.547 34.570 +34.593 34.615 34.638 34.660 34.683 34.705 34.728 34.751 34.773 34.796 +34.818 34.841 34.863 34.886 34.909 34.931 34.954 34.976 34.999 35.021 + +35.044 35.066 35.089 35.111 35.134 35.156 35.179 35.201 35.224 35.246 +35.269 35.291 35.314 35.336 35.359 35.381 35.404 35.426 35.449 35.471 +35.494 35.516 35.539 35.561 35.583 35.606 35.628 35.651 35.673 35.696 +35.718 35.741 35.763 35.785 35.808 35.830 35.853 35.875 35.897 35.920 +35.942 35.965 35.987 36.009 36.032 36.054 36.077 36.099 36.121 36.144 + +36.166 36.188 36.211 36.233 36.256 36.278 36.300 36.323 36.345 36.367 +36.390 36.412 36.434 36.457 36.479 36.501 36.524 36.546 36.568 36.590 +36.613 36.635 36.657 36.680 36.702 36.724 36.746 36.769 36.791 36.813 +36.836 36.858 36.880 36.902 36.925 36.947 36.969 36.991 37.014 37.036 +37.058 37.080 37.103 37.125 37.147 37.169 37.191 37.214 37.236 37.258 + +37.280 37.303 37.325 37.347 37.369 37.391 37.413 37.436 37.458 37.480 +37.502 37.524 37.547 37.569 37.591 37.613 37.635 37.657 37.679 37.702 +37.724 37.746 37.768 37.790 37.812 37.834 37.857 37.879 37.901 37.923 +37.945 37.967 37.989 38.011 38.033 38.055 38.078 38.100 38.122 38.144 +38.166 38.188 38.210 38.232 38.254 38.276 38.298 38.320 38.342 38.364 + +38.387 38.409 38.431 38.453 38.475 38.497 38.519 38.541 38.563 38.585 +38.607 38.629 38.651 38.673 38.695 38.717 38.739 38.761 38.783 38.805 +38.827 38.849 38.871 38.893 38.915 38.937 38.959 38.981 39.003 39.024 +39.046 39.068 39.090 39.112 39.134 39.156 39.178 39.200 39.222 39.244 +39.266 39.288 39.310 39.331 39.353 39.375 39.397 39.419 39.441 39.463 + +39.485 39.507 39.529 39.550 39.572 39.594 39.616 39.638 39.660 39.682 +39.703 39.725 39.747 39.769 39.791 39.813 39.835 39.856 39.878 39.900 +39.922 39.944 39.965 39.987 40.009 40.031 40.053 40.075 40.096 40.118 +40.140 40.162 40.183 40.205 40.227 40.249 40.271 40.292 40.314 40.336 +40.358 40.379 40.401 40.423 40.445 40.466 40.488 40.510 40.532 40.553 + +40.575 40.597 40.619 40.640 40.662 40.684 40.705 40.727 40.749 40.770 +40.792 40.814 40.836 40.857 40.879 40.901 40.922 40.944 40.966 40.987 +41.009 41.031 41.052 41.074 41.096 41.117 41.139 41.161 41.182 41.204 +41.225 41.247 41.269 41.290 41.312 41.334 41.355 41.377 41.398 41.420 +41.442 41.463 41.485 41.506 41.528 41.550 41.571 41.593 41.614 41.636 + +41.657 41.679 41.701 41.722 41.744 41.765 41.787 41.808 41.830 41.851 +41.873 41.895 41.916 41.938 41.959 41.981 42.002 42.024 42.045 42.067 +42.088 42.110 42.131 42.153 42.174 42.196 42.217 42.239 42.260 42.282 +42.303 42.325 42.346 42.367 42.389 42.410 42.432 42.453 42.475 42.496 +42.518 42.539 42.560 42.582 42.603 42.625 42.646 42.668 42.689 42.710 + +42.732 42.753 42.775 42.796 42.817 42.839 42.860 42.882 42.903 42.924 +42.946 42.967 42.989 43.010 43.031 43.053 43.074 43.095 43.117 43.138 +43.159 43.181 43.202 43.223 43.245 43.266 43.287 43.309 43.330 43.351 +43.373 43.394 43.415 43.436 43.458 43.479 43.500 43.522 43.543 43.564 +43.585 43.607 43.628 43.649 43.671 43.692 43.713 43.734 43.756 43.777 + +43.798 43.819 43.841 43.862 43.883 43.904 43.925 43.947 43.968 43.989 +44.010 44.031 44.053 44.074 44.095 44.116 44.137 44.159 44.180 44.201 +44.222 44.243 44.265 44.286 44.307 44.328 44.349 44.370 44.391 44.413 +44.434 44.455 44.476 44.497 44.518 44.539 44.560 44.582 44.603 44.624 +44.645 44.666 44.687 44.708 44.729 44.750 44.771 44.793 44.814 44.835 + +44.856 44.877 44.898 44.919 44.940 44.961 44.982 45.003 45.024 45.045 +45.066 45.087 45.108 45.129 45.150 45.171 45.192 45.213 45.234 45.255 +45.276 45.297 45.318 45.339 45.360 45.381 45.402 45.423 45.444 45.465 +45.486 45.507 45.528 45.549 45.570 45.591 45.612 45.633 45.654 45.675 +45.695 45.716 45.737 45.758 45.779 45.800 45.821 45.842 45.863 45.884 + +45.904 45.925 45.946 45.967 45.988 46.009 46.030 46.051 46.071 46.092 +46.113 46.134 46.155 46.176 46.196 46.217 46.238 46.259 46.280 46.300 +46.321 46.342 46.363 46.384 46.404 46.425 46.446 46.467 46.488 46.508 +46.529 46.550 46.571 46.591 46.612 46.633 46.654 46.674 46.695 46.716 +46.737 46.757 46.778 46.799 46.819 46.840 46.861 46.881 46.902 46.923 + +46.944 46.964 46.985 47.006 47.026 47.047 47.068 47.088 47.109 47.130 +47.150 47.171 47.191 47.212 47.233 47.253 47.274 47.295 47.315 47.336 +47.356 47.377 47.398 47.418 47.439 47.459 47.480 47.500 47.521 47.542 +47.562 47.583 47.603 47.624 47.644 47.665 47.685 47.706 47.726 47.747 +47.767 47.788 47.808 47.829 47.849 47.870 47.890 47.911 47.931 47.952 + +47.972 47.993 48.013 48.034 48.054 48.075 48.095 48.116 48.136 48.156 +48.177 48.197 48.218 48.238 48.258 48.279 48.299 48.320 48.340 48.360 +48.381 48.401 48.422 48.442 48.462 48.483 48.503 48.523 48.544 48.564 +48.584 48.605 48.625 48.645 48.666 48.686 48.706 48.727 48.747 48.767 +48.787 48.808 48.828 48.848 48.869 48.889 48.909 48.929 48.950 48.970 + +48.990 49.010 49.031 49.051 49.071 49.091 49.111 49.132 49.152 49.172 +49.192 49.212 49.233 49.253 49.273 49.293 49.313 49.333 49.354 49.374 +49.394 49.414 49.434 49.454 49.474 49.495 49.515 49.535 49.555 49.575 +49.595 49.615 49.635 49.655 49.675 49.696 49.716 49.736 49.756 49.776 +49.796 49.816 49.836 49.856 49.876 49.896 49.916 49.936 49.956 49.976 + +49.996 50.016 50.036 50.056 50.076 50.096 50.116 50.136 50.156 50.176 +50.196 50.216 50.236 50.256 50.276 50.296 50.315 50.335 50.355 50.375 +50.395 50.415 50.435 50.455 50.475 50.494 50.514 50.534 50.554 50.574 +50.594 50.614 50.633 50.653 50.673 50.693 50.713 50.733 50.752 50.772 +50.792 50.812 50.832 50.851 50.871 50.891 50.911 50.930 50.950 50.970 + +50.990 51.009 51.029 51.049 51.069 51.088 51.108 51.128 51.148 51.167 +51.187 51.207 51.226 51.246 51.266 51.285 51.305 51.325 51.344 51.364 +51.384 51.403 51.423 51.443 51.462 51.482 51.501 51.521 51.541 51.560 +51.580 51.599 51.619 51.639 51.658 51.678 51.697 51.717 51.736 51.756 +51.776 51.795 51.815 51.834 51.854 51.873 51.893 51.912 51.932 51.951 + +51.971 51.990 52.010 52.029 52.049 52.068 52.088 52.107 52.127 52.146 +52.165 52.185 52.204 52.224 52.243 52.263 52.282 52.301 52.321 52.340 +52.360 52.379 52.398 52.418 52.437 52.457 52.476 52.495 52.515 52.534 +52.553 52.573 52.592 52.611 52.631 52.650 52.669 52.689 52.708 52.727 +52.747 52.766 52.785 52.805 52.824 52.843 52.862 52.882 52.901 52.920 + +52.939 52.959 52.978 52.997 53.016 53.036 53.055 53.074 53.093 53.113 +53.132 53.151 53.170 53.189 53.209 53.228 53.247 53.266 53.285 53.304 +53.324 53.343 53.362 53.381 53.400 53.419 53.439 53.458 53.477 53.496 +53.515 53.534 53.553 53.572 53.592 53.611 53.630 53.649 53.668 53.687 +53.706 53.725 53.744 53.763 53.782 53.801 53.821 53.840 53.859 53.878 + +53.897 53.916 53.935 53.954 53.973 53.992 54.011 54.030 54.049 54.068 +54.087 54.106 54.125 54.144 54.163 54.182 54.201 54.220 54.239 54.258 +54.277 54.296 54.315 54.334 54.353 54.372 54.391 54.410 54.429 54.447 +54.466 54.485 54.504 54.523 54.542 54.561 54.580 54.599 54.618 54.637 +54.656 54.675 54.694 54.712 54.731 54.750 54.769 54.788 54.807 54.826 + +54.845 diff --git a/src/db/cvtBpt.c b/src/bpt/cvtBpt.c similarity index 50% rename from src/db/cvtBpt.c rename to src/bpt/cvtBpt.c index 944e55ad3..120694f71 100644 --- a/src/db/cvtBpt.c +++ b/src/bpt/cvtBpt.c @@ -1,9 +1,10 @@ /* $Id$ */ -/* cvtBpt.c - Convert using breakpoint table */ -/* - * Author: Janet Anderson - * Date: 9-19-91 +/* cvtBpt.c - Convert using breakpoint table + * + * Author: Marty Kraimer + * Date: 04OCT95 + * This is adaptation of old bldCvtTable * * Experimental Physics and Industrial Control System (EPICS) * @@ -29,63 +30,76 @@ * * Modification Log: * ----------------- - * nnn mm-dd-yy nnn Comment - * .02 05-18-92 rcz New database access - * .03 12-11-92 mrk ANSI prototypes + * 01 04OCT95 mrk Taken from old bldCvtTable */ #include -#include -#include +#include -#include -#include +#include #include +#include +#include +#include extern struct dbBase *pdbBase; -#ifdef __STDC__ -long cvtRawToEngBpt(double *pval,short linr,short init, void **ppbrk, short *plbrk) -#else /* __STDC__ */ -long cvtRawToEngBpt(pval, linr, init, ppbrk, plbrk) -double *pval; -short linr; -short init; -void **ppbrk; -short *plbrk; -#endif /* __STDC__ */ +static brkTable *findBrkTable(short linr) { - double val=*pval; - long status=0; - struct brkTable *pbrkTable; - struct brkInt *pInt; - struct brkInt *pnxtInt; - short lbrk; - int number; - struct arrBrkTable *pcvtTable; + brkTable *pbrkTable; + dbMenu *pdbMenu; + char name[50]; + char *pname = name; + int len,ind; - if(linr < 2) return(-1); - if(init==TRUE || *ppbrk == NULL) { /*must find breakpoint table*/ - if( !(pcvtTable=pdbBase->pcvtTable) || (pcvtTable->number < linr) - || (!(pcvtTable->papBrkTable[linr]))) { - errMessage(S_db_badField,"Breakpoint Table not Found"); - return(S_db_badField); - } - *ppbrk = (void *)(pcvtTable->papBrkTable[linr]); - /* Just start at the beginning */ - *plbrk=0; - } - pbrkTable = (struct brkTable *)*ppbrk; - number = pbrkTable->number; - lbrk = *plbrk; - /*make sure we dont go off end of table*/ - if( (lbrk+1) >= number ) lbrk--; - pInt = pbrkTable->papBrkInt[lbrk]; - pnxtInt = pbrkTable->papBrkInt[lbrk+1]; - /* find entry for increased value */ - while( (pnxtInt->raw) <= val ) { + pdbMenu = dbFindMenu(pdbBase,"menuConvert"); + len = strlen(pdbMenu->papChoiceValue[linr]); + if(len>=sizeof(name)) { + epicsPrintf("Break Tables(findBrkTable) choice name too long\n"); + return(0); + } + strcpy(pname,pdbMenu->papChoiceValue[linr]); + for(ind=0; indnumber; + lbrk = *plbrk; + /*make sure we dont go off end of table*/ + if( (lbrk+1) >= number ) lbrk--; + pInt = pbrkTable->papBrkInt[lbrk]; + pnxtInt = pbrkTable->papBrkInt[lbrk+1]; + /* find entry for increased value */ + while( (pnxtInt->raw) <= val ) { lbrk++; pInt = pbrkTable->papBrkInt[lbrk]; if( lbrk >= number-1) { @@ -93,54 +107,40 @@ short *plbrk; break; } pnxtInt = pbrkTable->papBrkInt[lbrk+1]; - } - while( (pInt->raw) > val) { + } + while( (pInt->raw) > val) { if(lbrk==0) { status=1; break; } lbrk--; pInt = pbrkTable->papBrkInt[lbrk]; - } - *plbrk = lbrk; - *pval = pInt->eng + (val - pInt->raw) * pInt->slope; - return(status); + } + *plbrk = lbrk; + *pval = pInt->eng + (val - pInt->raw) * pInt->slope; + return(status); } -#ifdef __STDC__ long cvtEngToRawBpt(double *pval,short linr,short init, void **ppbrk,short *plbrk) -#else /* __STDC__ */ -long cvtEngToRawBpt(pval,linr, init,ppbrk,plbrk) -double *pval; -short linr; -short init; -void **ppbrk; -short *plbrk; -#endif /* __STDC__ */ { - double val=*pval; - long status=0; - struct brkTable *pbrkTable; - struct brkInt *pInt; - struct brkInt *pnxtInt; - short lbrk; - int number; - struct arrBrkTable *pcvtTable; + double val=*pval; + long status=0; + brkTable *pbrkTable; + brkInt *pInt; + brkInt *pnxtInt; + short lbrk; + int number; if(linr < 2) return(-1); if(init==TRUE || *ppbrk == NULL) { /*must find breakpoint table*/ - if( !(pcvtTable=pdbBase->pcvtTable) || (pcvtTable->number < linr) - || (!(pcvtTable->papBrkTable[linr]))) { - errMessage(S_db_badField,"Breakpoint Table not Found"); - return(S_db_badField); - } - *ppbrk = (void *)(pcvtTable->papBrkTable[linr]); + pbrkTable = findBrkTable(linr); + if(!pbrkTable) return(S_dbLib_badField); + *ppbrk = (void *)pbrkTable; /* Just start at the beginning */ *plbrk=0; } - pbrkTable = (struct brkTable *)*ppbrk; number = pbrkTable->number; lbrk = *plbrk; diff --git a/src/bpt/makeBpt.c b/src/bpt/makeBpt.c new file mode 100644 index 000000000..0ab92921b --- /dev/null +++ b/src/bpt/makeBpt.c @@ -0,0 +1,402 @@ +/* $Id$ + * Author: Marty Kraimer + * Date: 9/28/95 + * Replacement for old bldCvtTable + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 28SEP95 mrk Replace old bldCvtTable + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_LINE_SIZE 160 +#define MAX_BREAKS 100 +struct brkCreateInfo { + float engLow; /* Lowest value desired: engineering units */ + float engHigh; /* Highest value desired: engineering units */ + float rawLow; /* Raw value for EngLow */ + float rawHigh; /* Raw value for EngHigh */ + float accuracy; /* accuracy desired in engineering units */ + float tblEngFirst;/* First table value: engineering units */ + float tblEngLast; /* Last table value: engineering units */ + float tblEngDelta;/* Change per table entry: eng units */ + long nTable; /* number of table entries */ + /* (last-first)/delta + 1 */ + float *pTable; /* addr of data table */ +} brkCreateInfo; + +brkInt brkint[MAX_BREAKS]; + +static int create_break(struct brkCreateInfo *pbci, brkInt *pabrkInt, + int max_breaks, int *n_breaks); +static char inbuf[MAX_LINE_SIZE]; +static int linenum=0; + +typedef struct dataList{ + struct dataList *next; + float value; +}dataList; + +static int getNumber(char **pbeg, float *value) +{ + int nchars=0; + + while(isspace(**pbeg) && **pbeg!= '\0') (*pbeg)++; + if(**pbeg == '!' || **pbeg == '\0') return(-1); + if(sscanf(*pbeg,"%f%n",value,&nchars)!=1) return(-1); + *pbeg += nchars; + return(0); +} + +static void errExit(char *pmessage) +{ + fprintf(stderr,pmessage); + fprintf(stderr,"\n"); + exit(-1); +} + +int main(argc, argv) + int argc; + char **argv; +{ + char *pbeg; + char *pend; + float value; + char *pname; + dataList *phead; + dataList *pdataList; + dataList *pnext; + float *pdata; + long ndata; + int nBreak,len,n; + char *outFilename; + char *pext; + FILE *outFile; + FILE *inFile; + + + if(argc!=2) { + fprintf(stderr,"usage: makeBpt file.data\n"); + exit(-1); + } + outFilename = calloc(1,strlen(argv[1])+2); + strcpy(outFilename,argv[1]); + pext = strstr(outFilename,".data"); + if(!pext) { + fprintf(stderr,"Input file MUST have .data extension\n"); + exit(-1); + } + strcpy(pext,".ascii"); + inFile = fopen(argv[1],"r"); + if(!inFile) { + fprintf(stderr,"Error opening %s\n",argv[1]); + exit(-1); + } + outFile = fopen(outFilename,"w"); + if(!outFile) { + fprintf(stderr,"Error opening %s\n",outFilename); + exit(-1); + } + while(fgets(inbuf,MAX_LINE_SIZE,inFile)) { + linenum++; + inbuf[strlen(inbuf)] = '\0'; /* remove newline*/ + pbeg = inbuf; + while(isspace(*pbeg) && *pbeg!= '\0') pbeg++; + if(*pbeg == '!' || *pbeg == '\0') continue; + while(*pbeg!='"' && *pbeg!= '\0') pbeg++; + if(*pbeg!='"' ) errExit("Illegal Header"); + pbeg++; pend = pbeg; + while(*pend!='"' && *pend!= '\0') pend++; + if(*pend!='"') errExit("Illegal Header"); + len = pend - pbeg; + if(len<=1) errExit("Illegal Header"); + pname = calloc(len,sizeof(char)); + strncpy(pname,pbeg,len); + pbeg = pend + 1; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.engLow = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.rawLow = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.engHigh = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.rawHigh = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.accuracy = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngFirst = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngLast = value; + if(getNumber(&pbeg,&value)) errExit("Illegal Header"); + brkCreateInfo.tblEngDelta = value; + goto got_header; + } + errExit("Illegal Header"); +got_header: + phead = pnext = 0; + ndata = 0; + errno = 0; + while(fgets(inbuf,MAX_LINE_SIZE,inFile)) { + float value; + + inbuf[strlen(inbuf)] = '\0'; /* remove newline*/ + pbeg = inbuf; + while(!getNumber(&pbeg,&value)) { + ndata++; + pdataList = (dataList *)calloc(1,sizeof(dataList)); + if(!phead) + phead = pdataList; + else + pnext->next = pdataList; + pdataList->value = value; + pnext = pdataList; + } + } + brkCreateInfo.nTable = ndata; + pdata = (float *)calloc(brkCreateInfo.nTable,sizeof(float)); + pnext = phead; + for(n=0; nvalue; + pdataList = pnext; + pnext = pnext->next; + free((void *)pdataList); + } + brkCreateInfo.pTable = pdata; + if(create_break(&brkCreateInfo,&brkint[0],MAX_BREAKS,&nBreak)) + errExit("create_break failed\n"); + fprintf(outFile,"breaktable(%s) {\n",pname); + for(n=0; npTable; + long ntable = pbci->nTable; + double ilow, + ihigh, + tbllow, + tblhigh, + slope, + offset; + int ibeg, + iend, + i, + inc, + imax, + n; + double rawBeg, + engBeg, + rawEnd, + engEnd, + engCalc, + engActual, + error; + int valid, + all_ok, + expanding; + /* make checks to ensure that brkCreateInfo makes sense */ + if (pbci->engLow >= pbci->engHigh) { + errExit("create_break: engLow >= engHigh"); + return (-1); + } + if ((pbci->engLow < pbci->tblEngFirst) + || (pbci->engHigh > pbci->tblEngLast)) { + errExit("create_break: engLow > engHigh"); + return (-1); + } + if (pbci->tblEngDelta <= 0.0) { + errExit("create_break: tblEngDelta <= 0.0"); + return (-1); + } + if (ntable < 3) { + errExit("raw data must have at least 3 elements"); + return (-1); + } +/*************************************************************************** + Convert Table to raw values + * + * raw and table values are assumed to be related by an equation of the form: + * + * raw = slope*table + offset + * + * The following algorithm converts each table value to raw units + * + * 1) Finds the locations in Table corresponding to engLow and engHigh + * Note that these locations need not be exact integers + * 2) Interpolates to obtain table values corresponding to engLow and enghigh + * we now have the equations: + * rawLow = slope*tblLow + offset + * rawHigh = slope*tblHigh + offset + * 4) Solving these equations for slope and offset gives: + * slope=(rawHigh-rawLow)/(tblHigh-tblLow) + * offset=rawHigh-slope*tblHigh + * 5) for each table value set table[i]=table[i]*slope+offset + *************************************************************************/ + /* Find engLow in Table and then compute tblLow */ + ilow = (pbci->engLow - pbci->tblEngFirst) / (pbci->tblEngDelta); + i = (int) ilow; + if (i >= ntable - 1) + i = ntable - 2; + tbllow = table[i] + (table[i + 1] - table[i]) * (ilow - (float) i); + /* Find engHigh in Table and then compute tblHigh */ + ihigh = (pbci->engHigh - pbci->tblEngFirst) / (pbci->tblEngDelta); + i = (int) ihigh; + if (i >= ntable - 1) + i = ntable - 2; + tblhigh = table[i] + (table[i + 1] - table[i]) * (ihigh - (float) i); + /* compute slope and offset */ + slope = (pbci->rawHigh - pbci->rawLow) / (tblhigh - tbllow); + offset = pbci->rawHigh - slope * tblhigh; + /* convert table to raw units */ + for (i = 0; i < ntable; i++) + table[i] = table[i] * slope + offset; + +/***************************************************************************** + * Now create break point table + * + * The algorithm does the following: + * + * It finds one breakpoint interval at a time. For each it does the following: + * + * 1) Use a relatively large portion of the remaining table as an interval + * 2) It attempts to use the entire interval as a breakpoint interval + * Success is determined by the following algorithm: + * a) compute the slope using the entire interval + * b) for each table entry in the interval determine the eng value + * using the slope just determined. + * c) compare the computed value with eng value associated with table + * d) if all table entries are within the accuracy desired then success. + * 3) If successful then attempt to expand the interval and try again. + * Note that it is expanded by up to 1/10 of the table size. + * 4) If not successful reduce the interval by 1 and try again. + * Once the interval is being decreased it will never be increased again. + * 5) The algorithm will ultimately fail or will have determined the optimum + * breakpoint interval + *************************************************************************/ + + /* Must start with table entry corresponding to engLow; */ + i = ilow; + if (i >= ntable - 1) + i = ntable - 2; + rawBeg = table[i] + (table[i + 1] - table[i]) * (ilow - (float) i); + engBeg = pbci->engLow; + ibeg = (int) (ilow); /* Make sure that ibeg > ilow */ + if( ibeg < ilow ) ibeg = ibeg + 1; + /* start first breakpoint interval */ + n = 1; + pbrkInt = pabrkInt; + pbrkInt->raw = rawBeg; + pbrkInt->eng = engBeg; + /* determine next breakpoint interval */ + while ((engBeg <= pbci->engHigh) && (ibeg < ntable - 1)) { + /* determine next interval to try. Up to 1/10 full range */ + iend = ibeg; + inc = (int) ((ihigh - ilow) / 10.0); + if (inc < 1) + inc = 1; + valid = TRUE; + /* keep trying intervals until cant do better */ + expanding = TRUE; /* originally we are trying larger and larger + * intervals */ + while (valid) { + imax = iend + inc; + if (imax >= ntable) { + /* don't go past end of table */ + imax = ntable - 1; + inc = ntable - iend - 1; + expanding = FALSE; + } + if (imax > (int) (ihigh + 1.0)) { /* Don't go to far past + * engHigh */ + imax = (int) (ihigh + 1.0); + inc = (int) (ihigh + 1.0) - iend; + expanding = FALSE; + } + if (imax <= ibeg) + break; /* failure */ + rawEnd = table[imax]; + engEnd = pbci->tblEngFirst + (float) imax *(pbci->tblEngDelta); + slope = (engEnd - engBeg) / (rawEnd - rawBeg); + all_ok = TRUE; + for (i = ibeg + 1; i <= imax; i++) { + engCalc = engBeg + slope * (table[i] - rawBeg); + engActual = pbci->tblEngFirst + ((float) i) * (pbci->tblEngDelta); + error = engCalc - engActual; + if (error < 0.0) + error = -error; + if (error >= pbci->accuracy) { + /* we will be trying smaller intervals */ + expanding = FALSE; + /* just decrease inc and let while(valid) try again */ + inc--; + all_ok = FALSE; + break; + } + } /* end for */ + if (all_ok) { + iend = imax; + /* if not expanding we found interval */ + if (!expanding) + break; + /* will automatically try larger interval */ + } + } /* end while(valid) */ + /* either we failed or optimal interval has been found */ + if ((iend <= ibeg) && (iend < (int) ihigh)) { + errExit("Could not meet accuracy criteria"); + return (-1); + } + pbrkInt->slope = slope; + /* get ready for next breakpoint interval */ + if (n++ >= max_breaks) { + errExit("Break point table too large"); + return (-1); + } + ibeg = iend; + pbrkInt++; + rawBeg = rawEnd; + engBeg = engEnd; + pbrkInt->raw = rawBeg; + pbrkInt->eng = engBeg + (pbrkInt->raw - rawBeg) * slope; + } + pbrkInt->slope = 0.0; + *n_breaks = n; + return (0); +} diff --git a/src/bpt/menuConvert.ascii b/src/bpt/menuConvert.ascii new file mode 100644 index 000000000..141440da3 --- /dev/null +++ b/src/bpt/menuConvert.ascii @@ -0,0 +1,16 @@ +menu(menuConvert) { + choice(menuConvertNO_CONVERSION,"NO CONVERSION") + choice(menuConvertLINEAR,"LINEAR") + choice(menuConverttypeKdegF,"typeKdegF") + choice(menuConverttypeKdegC,"typeKdegC") + choice(menuConverttypeJdegF,"typeJdegF") + choice(menuConverttypeJdegC,"typeJdegC") + choice(menuConverttypeEdegF,"typeEdegF(ixe only)") + choice(menuConverttypeEdegC,"typeEdegC(ixe only)") + choice(menuConverttypeTdegF,"typeTdegF") + choice(menuConverttypeTdegC,"typeTdegC") + choice(menuConverttypeRdegF,"typeRdegF") + choice(menuConverttypeRdegC,"typeRdegC") + choice(menuConverttypeSdegF,"typeSdegF") + choice(menuConverttypeSdegC,"typeSdegC") +} diff --git a/src/cvtDctsdr/Makefile b/src/cvtDctsdr/Makefile new file mode 100644 index 000000000..977081d2d --- /dev/null +++ b/src/cvtDctsdr/Makefile @@ -0,0 +1,18 @@ +# +# $Id$ +# +# Lowest Level Directroy Makefile +# by Janet Anderson +# +# $Log$ +# Revision 1.1 1994/09/07 19:25:39 jba +# New file +# +# + +EPICS=../../.. + +include $(EPICS)/config/CONFIG_BASE + +include $(EPICS)/config/RULES_ARCHS + diff --git a/src/cvtDctsdr/Makefile.Unix b/src/cvtDctsdr/Makefile.Unix new file mode 100644 index 000000000..18ebe0221 --- /dev/null +++ b/src/cvtDctsdr/Makefile.Unix @@ -0,0 +1,41 @@ +EPICS = ../../../.. +include Target.include +include $(EPICS)/config/CONFIG_BASE + +USR_LDLIBS = -lCom +USR_LDFLAGS = -L. + +DEPLIBS_BASE = $(EPICS_BASE_LIB) + +DEPLIBS = \ + $(DEPLIBS_BASE)/libCom.a + +SRCS.c = \ + ../sdr2gblmenu.c\ + ../sdr2driver.c\ + ../sdr2device.c\ + ../sdr2recordtype.c\ + ../dbStaticLib.c + +OBJS = \ + sdr2gblmenu.o \ + sdr2driver.o \ + sdr2device.o \ + sdr2recordtype.o \ + dbStaticLib.o + +TARGETS = sdr2gblmenu sdr2driver sdr2device sdr2recordtype + +include $(EPICS)/config/RULES.Unix + +sdr2gblmenu: sdr2gblmenu.o dbStaticLib.o + $(LINK.c) -o $@ sdr2gblmenu.o dbStaticLib.o $(LDLIBS) + +sdr2driver: sdr2driver.o dbStaticLib.o + $(LINK.c) -o $@ sdr2driver.o dbStaticLib.o $(LDLIBS) + +sdr2device: sdr2device.o dbStaticLib.o + $(LINK.c) -o $@ sdr2device.o dbStaticLib.o $(LDLIBS) + +sdr2recordtype: sdr2recordtype.o dbStaticLib.o + $(LINK.c) -o $@ sdr2recordtype.o dbStaticLib.o $(LDLIBS) diff --git a/src/cvtDctsdr/Makefile.Vx b/src/cvtDctsdr/Makefile.Vx new file mode 100644 index 000000000..1bf3bcb14 --- /dev/null +++ b/src/cvtDctsdr/Makefile.Vx @@ -0,0 +1,12 @@ +EPICS = ../../../.. +include Target.include +include $(EPICS)/config/CONFIG_BASE + +USR_CFLAGS = -DACCESS_SECURITY -D_NO_PROTO + +SRCS.c = +OBJS = +PROD = + +include $(EPICS)/config/RULES.Vx + diff --git a/src/cvtDctsdr/choice.h b/src/cvtDctsdr/choice.h new file mode 100644 index 000000000..0035a185d --- /dev/null +++ b/src/cvtDctsdr/choice.h @@ -0,0 +1,199 @@ +/* $Id$ + * + * Author: Marty Kraimer + * Date: 11-7-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-18-92 rcz removed extern's + * .02 05-18-92 rcz New database access + */ + + +#ifndef INCchoiceh +#define INCchoiceh 1 +struct choiceSet { /* This defines one set of choices*/ + unsigned long number; /*number of choices */ + char **papChoice;/*ptr to arr of ptr to choice string*/ + }; +struct arrChoiceSet{ /*An array of choice sets for particular record type*/ + unsigned long number; /*number of choice sets */ + struct choiceSet **papChoiceSet ;/*ptr to arr of ptr to choiceSet*/ + }; +struct choiceRec{ /*define choices for each record type*/ + unsigned long number; /*number of arrChoiceSet */ + struct arrChoiceSet **papArrChoiceSet; + /*ptr to arr of ptr to arrChoiceSet*/ + }; +/* device choices */ +struct devChoice{ + long link_type; /*link type for this device*/ + char *pchoice; /*ptr to choice string */ + }; +struct devChoiceSet { + unsigned long number; + struct devChoice **papDevChoice; + char **papChoice; + }; +struct devChoiceRec{ /*define device choices for each record type*/ + unsigned long number; /*number of devChoiceSet */ + struct devChoiceSet **papDevChoiceSet; + /*ptr to arr of ptr to devChoiceSet*/ + }; +/*NOTE: pchoiceCvt is initialized when cvtTable is loaded */ +/* pchoiceDev is initialized when devSup is loaded */ + +/************************************************************************ + * Except that entries could be null the following are valid references + * pchoiceCvt->papChoice[i] + * pchoiceGbl->papChoiceSet[i]->papChoice[j] + * pchoiceRec->papArrChoiceSet[i]->papChoiceSet[j]->papChoice[k] + * pchoiceDev->papDevChoiceSet[i]->papDevChoice[j]->pchoice->"" + * + * The memory layout is + * + * pchoiceCvt->choiceSet + * number + * papChoice->[0] + * [1]->"" + * + * pchoiceGbl->arrChoiceSet + * number + * papChoiceSet->[0] + * [1]->choiceSet + * number + * papChoice->[0] + * [1]->"" + * pchoiceRec->choiceRec + * number + * papArrChoiceSet->[0] + * [1]->arrChoiceSet + * number + * papChoiceSet->[0] + * [1]->choiceSet + * number + * papChoice->[0] + * [1]-> + * + * pchoiceDev->devChoiceRec + * number + * papDevChoiceSet->[0] + * [1]->devChoiceSet + * number + * papDevChoice->[0] + * [1]->devChoice + * link_type + * pchoice->"val" + *****************************************************************************/ + +/************************************************************************* + *The following macro returns NULL or a ptr to a string + * A typical usage is: + * + * char *pchoice; + * if(!(pchoice=GET_CHOICE(pchoiceSet,ind))){ } + ***************************************************************************/ +#define GET_CHOICE(PCHOICE_SET,IND_CHOICE)\ +(\ + (PCHOICE_SET)\ + ?(\ + ( ((unsigned)(IND_CHOICE)>=((struct choiceSet*)(PCHOICE_SET))->number) )\ + ? NULL\ + : ((PCHOICE_SET)->papChoice[(IND_CHOICE)])\ + )\ + : NULL\ +) + +/***************************************************************************** + * The following macro returns NULL or a ptr to a choiceSet structure + * A typical usage is: + * + * struct choiceSet *pchoiceSet; + * if(!(pchoiceSet=GET_PCHOICE_SET(parrChoiceSet,ind))){} + ***************************************************************************/ +#define GET_PCHOICE_SET(PARR_CHOICE_SET,IND_ARR)\ +(\ + (PARR_CHOICE_SET)\ + ?(\ + ( ((unsigned)(IND_ARR)>=((struct arrChoiceSet*)(PARR_CHOICE_SET))->number) )\ + ? NULL\ + : ((PARR_CHOICE_SET)->papChoiceSet[(IND_ARR)])\ + )\ + : NULL\ +) + +/***************************************************************************** + * The following macro returns NULL or a ptr to a arrChoiceSet structure + * A typical usage is: + * + * struct arrChoiceSet *parrChoiceSet; + * if(!(parrChoiceSet=GET_PARR_CHOICE_SET(pchoiceRec,ind))){} + ***************************************************************************/ +#define GET_PARR_CHOICE_SET(PCHOICE_REC,IND_REC)\ +(\ + (PCHOICE_REC)\ + ?(\ + ( ((unsigned)(IND_REC)>=((struct choiceRec*)(PCHOICE_REC))->number) )\ + ? NULL\ + : ((PCHOICE_REC)->papArrChoiceSet[(IND_REC)])\ + )\ + : NULL\ +) + +/************************************************************************* + *The following macro returns NULL or a ptr to a devChoice structure + * A typical usage is: + * + * struct devChoice *pdevChoice; + * if(!(pdevChoice=GET_DEV_CHOICE(pdevChoiceSet,ind))){ } + ***************************************************************************/ +#define GET_DEV_CHOICE(PDEV_CHOICE_SET,IND_CHOICE)\ +(\ + (PDEV_CHOICE_SET)\ + ?(\ + ( ((unsigned)(IND_CHOICE)>=((struct devChoiceSet*)(PDEV_CHOICE_SET))->number) )\ + ? NULL\ + : ((PDEV_CHOICE_SET)->papDevChoice[(IND_CHOICE)])\ + )\ + : NULL\ +) + +/***************************************************************************** + * The following macro returns NULL or a ptr to a devChoiceSet structure + * A typical usage is: + * + * struct devChoiceSet *pdevChoiceSet; + * if(!(pdevChoiceSet=GET_PDEV_CHOICE_SET(pchoiceDev,ind))){} + ***************************************************************************/ +#define GET_PDEV_CHOICE_SET(PCHOICE_DEV,IND_REC)\ +(\ + (PCHOICE_DEV)\ + ?(\ + ( ((unsigned)(IND_REC)>=((struct devChoiceRec*)(PCHOICE_DEV))->number) )\ + ? NULL\ + : ((PCHOICE_DEV)->papDevChoiceSet[(IND_REC)])\ + )\ + : NULL\ +) +#endif diff --git a/src/cvtDctsdr/choiceGbl.h b/src/cvtDctsdr/choiceGbl.h new file mode 100644 index 000000000..f661dad5e --- /dev/null +++ b/src/cvtDctsdr/choiceGbl.h @@ -0,0 +1,46 @@ +/* $Id$ + * + * Author: Bob Zieman + * Date: 12-10-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 12-13-91 jba Added GBL_PRIORITY + * .02 08-14-92 jba Added GBL_IVOA + */ + +#ifndef INCchoiceGblh +#define INCchoiceGblh 1 +#define GBL_YES_NO 0 +#define GBL_SCAN 1 +#define GBL_ALARM_SEV 2 +#define GBL_ALARM_STAT 3 +#define GBL_ARR_TYPE 4 +#define GBL_OMSL 5 +#define GBL_LINR 6 +#define GBL_FTYPE 7 +#define GBL_COMPRESS 8 +#define GBL_PRIORITY 9 +#define GBL_IVOA 10 +#endif diff --git a/src/cvtDctsdr/cvtTable.h b/src/cvtDctsdr/cvtTable.h new file mode 100644 index 000000000..27c5a6012 --- /dev/null +++ b/src/cvtDctsdr/cvtTable.h @@ -0,0 +1,94 @@ +/* $Id$ + * Breakpoint Tables + * + * Author: Marty Kraimer + * Date: 11-7-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-18-92 rcz removed extern + * .02 05-18-92 rcz new database access + * .03 08-19-92 jba add prototypes for cvtRawToEngBpt,cvtEngToRawBpt + */ + +#ifndef INCcvtTableh +#define INCcvtTableh 1 +#ifndef INCdbDefsh +#include "dbDefs.h" +#endif + +struct brkInt{ /* breakpoint interval */ + long raw; /*raw value for beginning of interval */ + float slope; /*slope for interval */ + float eng; /*converted value for beginning of interval*/ + }; + +struct brkTable { /* breakpoint table */ + char *name; /*breakpoint table name */ + long number; /*number of brkInt in this table*/ + long rawLow; /*lowest raw data value allowed */ + long rawHigh; /*highest raw data value allowed*/ + struct brkInt **papBrkInt; /* ptr to array of ptr to brkInt */ + }; + +struct arrBrkTable { /* array of brkTable */ + long number; /*number of break tables*/ + struct brkTable **papBrkTable; /* ptr to array of ptr to brkTable*/ + }; + +/*************************************************************************** + * except that some fields could be null the following is a valid reference + * pcvtTable->papBrkTable[i]->papBrkInt[j]-> + * + * The memory layout is as follows: + * + * pcvtTable->arrBrkTable + * number + * papBrkTable->[0]=NULL + * [1]=NULL + * [2]->brkTable + * *name + * number + * papBrkInt->[0] + * [1]->brkInt + * raw + * slope + * eng + *****************************************************************************/ + +/* Global Routines*/ +#ifdef __STDC__ +long cvtEngToRawBpt(double *pval,short linr,short init, + void **ppbrk,short *plbrk); + +long cvtRawToEngBpt(double *pval,short linr,short init, + void **ppbrk, short *plbrk); + +#else +long cvtEngToRawBpt(); +long cvtRawToEngBpt(); + +#endif /*__STDC__*/ + +#endif diff --git a/src/cvtDctsdr/dbBase.h b/src/cvtDctsdr/dbBase.h new file mode 100644 index 000000000..4de1433a1 --- /dev/null +++ b/src/cvtDctsdr/dbBase.h @@ -0,0 +1,91 @@ +/* $Id$ + * + * Current Author: Marty Kraimer + * Date: 03-19-92 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 03-19-92 mrk Original + * .02 05-18-92 rcz New database access + * .03 09-21-92 rcz removed #include + */ + +#ifndef INCdbBaseh +#define INCdbBaseh 1 + +#ifdef vxWorks +#ifndef INCchoiceh +#include +#endif +#ifndef INCcvtTableh +#include +#endif +#ifndef INCdbDefsh +#include +#endif +#ifndef INCdbRecDesh +#include +#endif +#ifndef INCdbRecTypeh +#include +#endif +#ifndef INCdbRecordsh +#include +#endif +#ifndef INCdevSuph +#include +#endif +#ifndef INCdrvSuph +#include +#endif +#ifndef INCrecSuph +#include +#endif +#endif /* vxWorks */ + +/****************************************************************** + * Note: Functions dbFreeMem() and dbRead() must be kept in sync if + * struct dbBase changes. + ******************************************************************/ +struct dbBase { + struct choiceSet *pchoiceCvt; + struct arrChoiceSet *pchoiceGbl; + struct choiceRec *pchoiceRec; + struct devChoiceRec *pchoiceDev; + struct arrBrkTable *pcvtTable; + struct recDes *precDes; + struct recType *precType; + struct recHeader *precHeader; + struct recDevSup *precDevSup; + struct drvSup *pdrvSup; + struct recSup *precSup; + struct pvd *pdbPvd; /* DCT pvd - remove when DCT goes away */ + void *ppvd;/* pointer to process variable directory*/ + char *pdbName;/* pointer to database name*/ + struct sdrSum *psdrSum;/* pointer to default sum */ + long sdrFileSize; /*size of default.dctsdr file*/ + long pvtSumFlag; /*internal use only*/ +}; + +#endif diff --git a/src/cvtDctsdr/dbFldTypes.h b/src/cvtDctsdr/dbFldTypes.h new file mode 100644 index 000000000..406a3f67f --- /dev/null +++ b/src/cvtDctsdr/dbFldTypes.h @@ -0,0 +1,72 @@ +/* $Id$ + * + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 mm-dd-yy iii Comment + */ +#ifndef INCdbFldTypesh +#define INCdbFldTypesh 1 + +/* field types */ +#define DBF_STRING 0 +#define DBF_CHAR 1 +#define DBF_UCHAR 2 +#define DBF_SHORT 3 +#define DBF_USHORT 4 +#define DBF_LONG 5 +#define DBF_ULONG 6 +#define DBF_FLOAT 7 +#define DBF_DOUBLE 8 +#define DBF_ENUM 9 +#define DBF_GBLCHOICE 10 +#define DBF_CVTCHOICE 11 +#define DBF_RECCHOICE 12 +#define DBF_DEVCHOICE 13 +#define DBF_INLINK 14 +#define DBF_OUTLINK 15 +#define DBF_FWDLINK 16 +#define DBF_NOACCESS 17 +#define DBF_NTYPES DBF_NOACCESS+1 + +/* data request buffer types */ +#define DBR_STRING DBF_STRING +#define DBR_CHAR DBF_CHAR +#define DBR_UCHAR DBF_UCHAR +#define DBR_SHORT DBF_SHORT +#define DBR_USHORT DBF_USHORT +#define DBR_LONG DBF_LONG +#define DBR_ULONG DBF_ULONG +#define DBR_FLOAT DBF_FLOAT +#define DBR_DOUBLE DBF_DOUBLE +#define DBR_ENUM DBF_ENUM +#define DBR_PUT_ACKT DBR_ENUM+1 +#define DBR_PUT_ACKS DBR_PUT_ACKT+1 +#define DBR_NOACCESS DBF_NOACCESS +#define VALID_DB_REQ(x) ((x >= 0) && (x <= DBR_PUT_ACKS)) +#define INVALID_DB_REQ(x) ((x < 0) || (x > DBR_PUT_ACKS)) + +#endif /*INCdbFldTypesh*/ diff --git a/src/cvtDctsdr/dbRecDes.h b/src/cvtDctsdr/dbRecDes.h new file mode 100644 index 000000000..03688c420 --- /dev/null +++ b/src/cvtDctsdr/dbRecDes.h @@ -0,0 +1,163 @@ +/* $Id$ + * + * Original Author: Bob Dalesio + * Current Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 mm-dd-yy iii Comment + * .02 05-18-92 rcz removed extern + * .03 05-18-92 rcz changed macro "GET_PRECTYPDES(" to "GET_PRECTYPDES(precDes," + * .04 05-18-92 rcz New database access + * .05 08-12-92 jba Removed dbr_field_type from struct fldDes + * .06 09-15-92 jba added short pad field to fldDes + * .07 06-23-93 mrk Moved pad so that fldname is NULL terminated + */ + +#ifndef INCdbRecDesCT +#define INCdbRecDesCT +/* conversion types*/ +#define CT_DECIMAL 0 +#define CT_HEX 1 +/* lowfl, highfl */ +#define CON 0 +#define VAR 1 +/* access level types */ +#define ASL0 0 +#define ASL1 1 +#endif +#ifndef INCdbRecDesh +#define INCdbRecDesh +#define PROMPT_SZ 24 +union fld_types{ + char char_value; + unsigned char uchar_value; + short short_value; + unsigned short ushort_value; + long long_value; + unsigned long ulong_value; + float float_value; + double double_value; + unsigned short enum_value; +}; +struct range { + long fldnum; + long pad; + union fld_types value; +}; +struct fldDes{ /* field description */ + char prompt[PROMPT_SZ]; /*Prompt string for DCT*/ + char fldname[FLDNAME_SZ];/*field name */ + short fldnamePad; /*make sure fldname is NULL termated */ + short offset; /*Offset in bytes from beginning of record*/ + short size; /*length in bytes of a field element */ + short special; /*Special processing requirements */ + short field_type; /*Field type as defined in dbFldTypes.h */ + short process_passive;/*should dbPutField process passive */ + short choice_set; /*index of choiceSet GBLCHOICE & RECCHOICE*/ + short cvt_type; /*Conversion type for DCT */ + short promptflag; /*Does DCT display this field */ + short lowfl; /*Is range1 CON or VAR */ + short highfl; /*Is range2 CON or VAR */ + short interest; /*interest level */ + short as_level; /*access security level */ + short pad2; + union fld_types initial;/*initial value */ + struct range range1; /*Low value for field (Used by DCT) */ + struct range range2; /*High value for field (Used by DCT) */ +}; +struct recTypDes{ /* record type description */ + short rec_size; /* size of the record */ + short no_fields; /* number of fields defined */ + short no_prompt; /* number of fields to configure*/ + short no_links; /* number of links */ + short *link_ind; /* addr of array of ind in apFldDes*/ + unsigned long *sortFldName; /* addr of array of sorted fldname*/ + short *sortFldInd; /* addr of array of ind in apFldDes*/ + struct fldDes **papFldDes; /* ptr to array of ptr to fldDes*/ +}; +struct recDes{ /* record description */ + long number; /*number of recTypDes*/ + struct recTypDes **papRecTypDes;/*ptr to arr of ptr to recTypDes*/ +}; + +/*************************************************************************** + * Except that some ptr could be NULL the following is a valid reference + * precDes->papRecTypDes[i]->papFldDes[j]-> + * + * The memory layout is as follows: + * + * precDes->recDes + * number + * papRecTypDes->[1] + * [2]->papFldDes->[0] + * [1]->fldDes + * prompt + * fldname + * ... + * + * sortFldName[*] is a sorted array of blank padded fieldnames + * that can be interpeted as a long which must be 32 bits + * Note that FLDNAME_SZ MUST be 4 + * sortFldInd[*] is an array of indices for sortFldName. + * Each element of this array is an index into papFldDes[*]. + *****************************************************************************/ + +/***************************************************************************** + * The following macro returns NULL or a ptr to a fldDes structure + * A typical usage is: + * + * struct fldDes *pfldDes; + * if(!(pfldDes=GET_PFLDDES(precTypDes,ind) + ****************************************************************************/ +#define GET_PFLDDES(PRECTYPDES,IND_FLD)\ +(\ + (PRECTYPDES)\ + ?(\ + ( ((IND_FLD)<0) ||\ + ((IND_FLD)>=((struct recTypDes *)(PRECTYPDES))->no_fields) )\ + ? NULL\ + : (((struct recTypDes *)(PRECTYPDES))->papFldDes[(IND_FLD)])\ + )\ + : NULL\ +) +/***************************************************************************** + * The following macro returns NULL or a ptr to a recTypDes structure + * A typical usage is: + * + * struct recTypDes *precTypDes; + * if(!(precTypDes=GET_PRECTYPDES(precDes,ind); + ****************************************************************************/ +#define GET_PRECTYPDES(PRECDES,IND_REC)\ +(\ + (PRECDES)\ + ?(\ + ( ((IND_REC)<1) || ((IND_REC)>=(PRECDES)->number) )\ + ? NULL\ + : ((PRECDES)->papRecTypDes[(IND_REC)])\ + )\ + : NULL\ +) +#endif diff --git a/src/cvtDctsdr/dbRecType.h b/src/cvtDctsdr/dbRecType.h new file mode 100644 index 000000000..a0b0b6a8d --- /dev/null +++ b/src/cvtDctsdr/dbRecType.h @@ -0,0 +1,72 @@ +/* $Id$ + * + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-18-92 rcz removed extern + * .02 05-18-92 rcz Changed GET_PRECTYPE to GET_PRECNAME + * .03 05-18-92 rcz New database access (removed extern) + */ + +#ifndef INCdbRecTypeh +#define INCdbRecTypeh 1 + +struct recType { + long number; /*number of types */ + char **papName; /*ptr to arr of ptr to name */ + }; + +#define S_rectype_noRecs (M_recType| 3) /*No record types are defined*/ + +/************************************************************************* + * Except that some entries may be null the following is valid access + * + * precType->papName[i] + * + * The memory layout is + * + * precType->papName[1]->"ai" + * [2]->"ao" + **************************************************************************/ + +/************************************************************************** + * The following macro returns NULL or a ptr to the rectype string + * A typical usage is: + * + * char *pstr; + * if(!(pstr=GET_PRECNAME(precType,type))) {} + **************************************************************************/ +#define GET_PRECNAME(PRECTYPE,REC_TYPE)\ +(\ + (PRECTYPE)\ + ?(\ + ( ((REC_TYPE)<1) || ((REC_TYPE)>=(PRECTYPE)->number) )\ + ? NULL\ + : ((PRECTYPE)->papName[(REC_TYPE)])\ + )\ + : NULL\ +) +#endif diff --git a/src/cvtDctsdr/dbRecords.h b/src/cvtDctsdr/dbRecords.h new file mode 100644 index 000000000..93b09fc5a --- /dev/null +++ b/src/cvtDctsdr/dbRecords.h @@ -0,0 +1,104 @@ +/* $Id$ + * + * Record Location + * + * Original Author: Bob Dalesio + * Current Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 mm-dd-yy iii Comment + * .02 03-26-92 mrk added pvdPvt private field for pvd routines + * .03 04-10-92 rcz changed pvdPvt to pList + * .04 05-18-92 rcz removed extern + * .05 05-18-92 rcz Changed macro call "GET_PRECLOC(" to "GET_PRECLOC(precHeader," + * .06 06-01-92 rcz Moved struct RECNODE + * .07 06-08-92 rcz Changed pList to preclist + * .08 06-08-92 rcz New database access + */ + +#ifndef INCdbRecordsh +#define INCdbRecordsh 1 +#include + +struct recLoc{ /* record location*/ + long no_records; /*OBSOLETE DO NOT USE*/ + long no_used; /*OBSOLETE DO NOT USE*/ + long rec_size; /*record size in bytes */ + long record_type; /*record type */ + void *pFirst; /*OBSOLETE DO NOT USE*/ + ELLLIST *preclist; /*LIST head of sorted RECNODEs */ +}; +struct recHeader{ /*record header*/ + long number; /*number of record types*/ + struct recLoc **papRecLoc; /*ptr to arr of ptr to recLoc*/ +}; + +#define S_record_noRecords (M_record| 1) /*No records */ + +/*********************************************************************** + * Except that some ptr could be null the following is a valid reference + * + * precHeader->papRecLoc[i]->preclist + * + * The memory layout is: + * + * precHeader->recHeader + * number + * papRecLoc->[1] + * [2]->recLoc + * rec_type + * pRECLIST-----> LIST---->RECNODE ... + ************************************************************************/ + +/************************************************************************ + * In the self defining record the following appears + * + * sdrHeader + * recLoc + * record 1 + * ... + * record n (n = recLoc.no_records + **************************************************************************/ + +/************************************************************************ + * The following macro returns NULL or a ptr to struct recLoc + * A typical usage is: + * + * struct recLoc *precLoc + * if(!(precLoc=GET_PRECLOC(precHeader,type))) {} + ***********************************************************************/ +#define GET_PRECLOC(PRECHEADER,REC_TYPE)\ +(\ + (PRECHEADER)\ + ?(\ + ( ((REC_TYPE)<1) || ((REC_TYPE)>=(PRECHEADER)->number) )\ + ? NULL\ + : ((PRECHEADER)->papRecLoc[(REC_TYPE)])\ + )\ + : NULL\ +) + +#endif diff --git a/src/db/dbStaticLib.c b/src/cvtDctsdr/dbStaticLib.c similarity index 98% rename from src/db/dbStaticLib.c rename to src/cvtDctsdr/dbStaticLib.c index a2915b2b9..e227bc74d 100644 --- a/src/db/dbStaticLib.c +++ b/src/cvtDctsdr/dbStaticLib.c @@ -57,15 +57,6 @@ #define messagesize 100 #define RPCL_LEN 184 - -#if defined(EPICS_LITTLE_ENDIAN) -#define BYTE_SWAP_4(A) \ - ( (((A) & 0xFF) << 24 ) | \ - (((A) & 0xFF00) << 8) | \ - (((A) & 0xFF0000) >> 8) | \ - (((A) & 0xFF000000) >> 24) ) -#endif - long postfix(char *pinfix, char *ppostfix,short *perror); static char *ppstring[2]={"NPP","PP"}; @@ -439,6 +430,7 @@ DBBASE *pdbbase; ELLLIST *preclist; int recType; if (!pdbbase || !ppvd || !precType) return; + dbPvdFreeMem(pdbbase); /* loop thru the recLocs - removing lists then recLoc only */ for (recType = 0; recType < precType->number; recType++) { if (!(precLoc = GET_PRECLOC(precHeader, recType))) continue; @@ -460,7 +452,6 @@ DBBASE *pdbbase; free((void *) precLoc); } /* free the rest of the memory allocations */ - dbPvdFreeMem(pdbbase); if (pdbbase->pchoiceCvt) free((void *) pdbbase->pchoiceCvt); if (pdbbase->pchoiceDev) @@ -749,7 +740,7 @@ char *precordName; struct recLoc *precLoc = NULL; short rec_size; - if(strlen(precordName)>(size_t)PVNAME_SZ) return(S_dbLib_nameLength); + if(strlen(precordName)>PVNAME_SZ) return(S_dbLib_nameLength); /* clear callers entry */ zeroDbentry(pdbentry); if(!dbFindRecord(pdbentry,precordName)) return (S_dbLib_recExists); @@ -947,7 +938,7 @@ char *newName; long status; DBENTRY dbentry; - if(strlen(newName)>(size_t)PVNAME_SZ) return(S_dbLib_nameLength); + if(strlen(newName)>PVNAME_SZ) return(S_dbLib_nameLength); if(!precnode) return(S_dbLib_recNotFound); dbInitEntry(pdbentry->pdbbase,&dbentry); status = dbFindRecord(&dbentry,newName); @@ -1017,23 +1008,15 @@ char *pfieldName; bottom = 0; test = (top + bottom) / 2; while (1) { - unsigned int t1, t2; - /* check the field name */ - t1 = (unsigned int) sortFldName[ test]; - t2 = (unsigned int) *(unsigned int*)pconvName; -#if defined(EPICS_LITTLE_ENDIAN) - t1 = BYTE_SWAP_4( t1); - t2 = BYTE_SWAP_4( t2); -#endif - if(t1 == t2) { + if (sortFldName[test] == *(unsigned long *) pconvName) { if(!(pflddes=GET_PFLDDES(precTypDes,sortFldInd[test]))) return(S_dbLib_recdesNotFound); pdbentry->pflddes = pflddes; pdbentry->pfield = precord + pflddes->offset; pdbentry->indfield = sortFldInd[test]; return (0); - } else if (t1 > t2) { + } else if (sortFldName[test] > *(unsigned long *) pconvName) { top = test - 1; if (top < bottom) return (S_dbLib_fieldNotFound); test = (top + bottom) / 2; @@ -1608,7 +1591,7 @@ char *pstring; if (!(pchoice = pdevChoiceSet->papDevChoice[i]->pchoice)) continue; if (strcmp(pchoice, pstring) == 0) { - long link_type; + long link_type,status; link_type = pdevChoiceSet->papDevChoice[i]->link_type; /*If no INP or OUT OK */ @@ -1640,7 +1623,7 @@ char *pstring; if(pstr[ind]!=' ' && pstr[ind]!='\t') break; pstr[ind] = '\0'; } - if(!pstr || strlen(pstr)==0 ) { + if(!pstr || strlen(pstr)<=0 ) { if(plink->type==PV_LINK) dbCvtLinkToConstant(pdbentry); if(plink->type!=CONSTANT) return(S_dbLib_badField); return(0); @@ -1706,18 +1689,12 @@ char *pstring; if(!(end = strchr(pstr,'N'))) return (S_dbLib_badField); pstr = end + 1; sscanf(pstr,"%hd",&plink->value.camacio.n); - if(!(end = strchr(pstr,'A'))) { - plink->value.camacio.a = 0; - } else { - pstr = end + 1; - sscanf(pstr,"%hd",&plink->value.camacio.a); - } - if(!(end = strchr(pstr,'F'))) { - plink->value.camacio.f = 0; - } else { - pstr = end + 1; - sscanf(pstr,"%hd",&plink->value.camacio.f); - } + if(!(end = strchr(pstr,'A'))) return (S_dbLib_badField); + pstr = end + 1; + sscanf(pstr,"%hd",&plink->value.camacio.a); + if(!(end = strchr(pstr,'F'))) return (S_dbLib_badField); + pstr = end + 1; + sscanf(pstr,"%hd",&plink->value.camacio.f); plink->value.camacio.parm[0] = 0; if(end = strchr(pstr,'@')) { pstr = end + 1; @@ -4150,23 +4127,10 @@ FILE *fp; } /* Beginning of Process Variable Directory Routines*/ -int dbPvdHashTableSize = 512; -static int dbPvdHashTableShift; -#define NTABLESIZES 9 -static struct { - unsigned int tablesize; - int shift; -}hashTableParms[9] = { - {256,0}, - {512,1}, - {1024,2}, - {2048,3}, - {4096,4}, - {8192,5}, - {16384,6}, - {32768,7}, - {65536,8} -}; +#define HASH_NO 2048 /* number of hash table entries */ +#define SHIFT 3 /*number of bits to shift*/ + + /*The hash algorithm is a modification of the algorithm described in */ /* Fast Hashing of Variable Length Text Strings, Peter K. Pearson, */ /* Communications of the ACM, June 1990 */ @@ -4208,7 +4172,7 @@ static unsigned short hash( char *pname, int length) } ind0 = (unsigned short)h0; ind1 = (unsigned short)h1; - return((ind1<=hashTableParms[i].tablesize) - && (dbPvdHashTableSizeppvd = (void *) ppvd; return; } @@ -4316,8 +4270,7 @@ RECNODE *precnode; ppvdlist=ppvd[hashInd]; ppvdNode = (PVDENTRY *) ellFirst(ppvdlist); while(ppvdNode) { - if(ppvdNode->precnode && ppvdNode->precnode->precord - && strcmp(name,(char *)ppvdNode->precnode->precord) == 0) { + if(strcmp(name,(char *)ppvdNode->precnode->precord) == 0) { ellDelete(ppvdlist, (ELLNODE*)ppvdNode); free((void *)ppvdNode); return; @@ -4341,7 +4294,7 @@ DBBASE *pdbbase; PVDENTRY *next; if (ppvd == NULL) return; - for (hashInd=0; hashInd<(unsigned short)dbPvdHashTableSize; hashInd++) { + for (hashInd=0; hashIndprecnode->precord); if(number++ ==2) {number=0;printf("\n ");} ppvdNode = (PVDENTRY *) ellNext((ELLNODE*)ppvdNode); diff --git a/src/cvtDctsdr/dbStaticLib.h b/src/cvtDctsdr/dbStaticLib.h new file mode 100644 index 000000000..cab7c4315 --- /dev/null +++ b/src/cvtDctsdr/dbStaticLib.h @@ -0,0 +1,282 @@ +/* $Id$ + * + * Author: Marty Kraimer + * Date: 06-08-93 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 06-08-93 mrk Replace dbManipulate + */ + +#ifndef INCdbStaticLibh +#define INCdbStaticLibh 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*Field types as seen by static database access clients*/ +#define DCT_STRING 0 +#define DCT_INTEGER 1 +#define DCT_REAL 2 +#define DCT_MENU 3 +#define DCT_MENUFORM 4 +#define DCT_INLINK 5 +#define DCT_OUTLINK 6 +#define DCT_FWDLINK 7 +#define DCT_NOACCESS 8 + +/*Link types as seen by static database access clients*/ +#define DCT_LINK_CONSTANT 0 +#define DCT_LINK_FORM 1 +#define DCT_LINK_PV 2 +#define DCT_LINK_DEVICE 3 + +/* conversion types for DBFLDDES.cvt_type*/ +#define CT_DECIMAL 0 +#define CT_HEX 1 + +/*options for dbRead and dbWrite*/ +#define DB_RECDES_IO 0x1 +#define DB_RECORD_IO 0x2 + +typedef struct dbBase DBBASE; + +typedef struct recNode { + ELLNODE node; + void *precord; +}RECNODE; + +typedef struct{ + DBBASE *pdbbase; + RECNODE *precnode; + struct fldDes *pflddes; + void *pfield; + char *message; + short record_type; + short indfield; + void *formpvt; +} DBENTRY; + + +/*directory*/ +typedef struct{ + ELLNODE node; + unsigned short record_type; + RECNODE *precnode; +} PVDENTRY; + +/* Static database access routines*/ +#if defined(__STDC__) || defined(__cplusplus) +void * dbCalloc(size_t nobj,size_t size); +void * dbMalloc(size_t size); +DBBASE *dbAllocBase(void); +void dbFreeBase(DBBASE *pdbbase); +DBENTRY *dbAllocEntry(DBBASE *pdbbase); +void dbFreeEntry(DBENTRY *pdbentry); +void dbInitEntry(DBBASE *pdbbase,DBENTRY *pdbentry); +void dbFinishEntry(DBENTRY *pdbentry); +DBENTRY *dbCopyEntry(DBENTRY *pdbentry); + +long dbRead(DBBASE *pdbbase,FILE *fp); +long dbWrite(DBBASE *pdbbase,FILE *fpdctsdr,FILE *fp); + +long dbFindRecdes(DBENTRY *pdbentry,char *recdesname); +long dbFirstRecdes(DBENTRY *pdbentry); +long dbNextRecdes(DBENTRY *pdbentry); +char *dbGetRecdesName(DBENTRY *pdbentry); +int dbGetNRecdes(DBENTRY *pdbentry); +long dbCopyRecdes(DBENTRY *from,DBENTRY *to); + +long dbCreateRecord(DBENTRY *pdbentry,char *precordName); +long dbDeleteRecord(DBENTRY *pdbentry); +long dbFindRecord(DBENTRY *pdbentry,char *precordName); +long dbFirstRecord(DBENTRY *pdbentry); /*first of record type*/ +long dbNextRecord(DBENTRY *pdbentry); +int dbGetNRecords(DBENTRY *pdbentry); +char *dbGetRecordName(DBENTRY *pdbentry); +long dbRenameRecord(DBENTRY *pdbentry,char *newName); +long dbCopyRecord(DBENTRY *from,DBENTRY *to); + +long dbFindField(DBENTRY *pdbentry,char *pfieldName); +long dbFirstFielddes(DBENTRY *pdbentry,int dctonly); +long dbNextFielddes(DBENTRY *pdbentry,int dctonly); +int dbGetFieldType(DBENTRY *pdbentry); +int dbGetNFields(DBENTRY *pdbentry,int dctonly); +char *dbGetFieldName(DBENTRY *pdbentry); +char *dbGetPrompt(DBENTRY *pdbentry); +int dbGetPromptGroup(DBENTRY *pdbentry); + +char *dbGetString(DBENTRY *pdbentry); +long dbPutString(DBENTRY *pdbentry,char *pstring); +char *dbVerify(DBENTRY *pdbentry,char *pstring); +char *dbGetRange(DBENTRY *pdbentry); +int dbIsDefaultValue(DBENTRY *pdbentry); + +char **dbGetChoices(DBENTRY *pdbentry); +int dbGetMenuIndex(DBENTRY *pdbentry); +long dbPutMenuIndex(DBENTRY *pdbentry,int index); +int dbGetNMenuChoices(DBENTRY *pdbentry); +long dbCopyMenu(DBENTRY *from,DBENTRY *to); + +int dbAllocForm(DBENTRY *pdbentry); +long dbFreeForm(DBENTRY *pdbentry); +char **dbGetFormPrompt(DBENTRY *pdbentry); +char **dbGetFormValue(DBENTRY *pdbentry); +long dbPutForm(DBENTRY *pdbentry,char **value); +char **dbVerifyForm(DBENTRY *pdbentry,char **value); + +int dbGetNLinks(DBENTRY *pdbentry); +long dbGetLinkField(DBENTRY *pdbentry,int index); +int dbGetLinkType(DBENTRY *pdbentry); +long dbCvtLinkToConstant(DBENTRY *pdbentry); +long dbCvtLinkToPvlink(DBENTRY *pdbentry); +long dbPutPvlink(DBENTRY *pdbentry,int pp,int ms,char *pvname); +long dbGetPvlink(DBENTRY *pdbentry,int *pp,int *ms,char *pvname); + +/*dump routines*/ +void dbDumpRecords(DBBASE *pdbbase,char *precdesname,int modOnly); +void dbDumpPvd(DBBASE *pdbbase); +void dbReportDeviceConfig(DBBASE *pdbbase,FILE *report); + +/* Misc useful routines*/ +/*general purpose allocation routines to invoke calloc and maloc */ +/* NOTE: These routines do NOT return if they fail. */ +void *dbCalloc(size_t nobj,size_t size); +void *dbMalloc(size_t size); + +/* The following routines should only be used by access routines*/ +void dbPvdInitPvt(DBBASE *pdbbase); +PVDENTRY *dbPvdFind(DBBASE *pdbbase,char *name,int lenname); +PVDENTRY *dbPvdAdd(DBBASE *pdbbase,unsigned short record_type,RECNODE *precnode); +void dbPvdDelete(DBBASE *pdbbase,RECNODE *precnod); +void dbPvdFreeMem(DBBASE *pdbbase); +void dbPvdDump(DBBASE *pdbbase); +#else +void * dbCalloc(); +void * dbMalloc(); +DBBASE *dbAllocBase(); +void dbFreeBase(); +DBENTRY *dbAllocEntry(); +void dbFreeEntry(); +void dbInitEntry(); +void dbFinishEntry(); +DBENTRY *dbCopyEntry(); + +long dbRead(); +long dbWrite(); + +long dbFindRecdes(); +long dbFirstRecdes(); +long dbNextRecdes(); +char *dbGetRecdesName(); +int dbGetNRecdes(); +long dbCopyRecdes(); + +long dbCreateRecord(); +long dbDeleteRecord(); +long dbFindRecord(); +long dbFirstRecord(); +long dbNextRecord(); +int dbGetNRecords(); +char *dbGetRecordName(); +long dbRenameRecord(); +long dbCopyRecord(); + +long dbFindField(); +long dbFirstFielddes(); +long dbNextFielddes(); +int dbGetFieldType(); +int dbGetNFields(); +char *dbGetFieldName(); +char *dbGetPrompt(); + +char *dbGetString(); +long dbPutString(); +char *dbVerify(); +char *dbGetRange(); +int dbIsDefaultValue(); + +char **dbGetChoices(); +int dbGetMenuIndex(); +long dbPutMenuIndex(); +int dbGetNMenuChoices(); +long dbCopyMenu(); + +int dbAllocForm(); +long dbFreeForm(); +char **dbGetFormPrompt(); +char **dbGetFormValue(); +long dbPutForm(); +char **dbVerifyForm(); + +int dbGetNLinks(); +long dbGetLinkField(); +int dbGetLinkType(); +long dbCvtLinkToConstant(); +long dbCvtLinkToPvlink(); +long dbPutPvlink(); +long dbGetPvlink(); + +/*dump routines*/ +void dbDumpRecords(); +void dbDumpPvd(); + +/* Misc useful routines*/ +/*general purpose allocation routines to invoke calloc and maloc */ +/* NOTE: These routines do NOT return if they fail. */ +void *dbCalloc(); +void *dbMalloc(); + +/* The following routines should only be used by access routines*/ +void dbPvdInitPvt(); +PVDENTRY *dbPvdFind(); +PVDENTRY *dbPvdAdd(); +void dbPvdDelete(); +void dbPvdFreeMem(); +void dbPvdDump(); +#endif /*__STDC__*/ + +#define S_dbLib_recdesNotFound (M_dbLib| 1) /*Record Type does not exist*/ +#define S_dbLib_recExists (M_dbLib| 3) /*Record Already exists*/ +#define S_dbLib_recNotFound (M_dbLib| 5) /*Record Not Found*/ +#define S_dbLib_flddesNotFound (M_dbLib| 7) /*Field Description Not Found*/ +#define S_dbLib_fieldNotFound (M_dbLib| 9) /*Field Not Found*/ +#define S_dbLib_badField (M_dbLib|11) /*Bad Field value*/ +#define S_dbLib_menuNotFound (M_dbLib|13) /*Menu not found*/ +#define S_dbLib_badLink (M_dbLib|15) /*Bad Link Field*/ +#define S_dbLib_nameLength (M_dbLib|17) /*Record Name is too long*/ +#endif /*INCdbStaticLibh*/ diff --git a/src/cvtDctsdr/devSup.h b/src/cvtDctsdr/devSup.h new file mode 100644 index 000000000..ba5682c5d --- /dev/null +++ b/src/cvtDctsdr/devSup.h @@ -0,0 +1,133 @@ +/* devSup.h Device Support */ +/* share/epicsH $Id$ */ +/* + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 10-04-91 jba Added error message + * .02 05-18-92 rcz Changed macro "GET_DEVSUP(" to "GET_PDEVSUP(precDevSup," + * .03 05-18-92 rcz Structure devSup changed element name from dsetName to papDsetName + * .04 05-18-92 rcz New database access + */ + +#ifndef INCdevSuph +#define INCdevSuph 1 + +#ifdef __cplusplus +typedef long (*DEVSUPFUN)(void*); /* ptr to device support function*/ +#else +typedef long (*DEVSUPFUN)(); /* ptr to device support function*/ +#endif + +struct dset { /* device support entry table */ + long number; /*number of support routines*/ + DEVSUPFUN report; /*print report*/ + DEVSUPFUN init; /*init support*/ + DEVSUPFUN init_record; /*init support for particular record*/ + DEVSUPFUN get_ioint_info; /* get io interrupt information*/ + /*other functions are record dependent*/ + }; + +struct devSup { + long number; /*number of dset */ + char **papDsetName; /*ptr of arr of ptr to name */ + struct dset **papDset; /*ptr to arr of ptr to dset */ + }; + +struct recDevSup { + long number; /*number of record types */ + struct devSup **papDevSup; /*ptr to arr of ptr to devSup */ + }; + +#define S_dev_noDevSup (M_devSup| 1) /*SDR_DEVSUP: Device support missing*/ +#define S_dev_noDSET (M_devSup| 3) /*Missing device support entry table*/ +#define S_dev_missingSup (M_devSup| 5) /*Missing device support routine*/ +#define S_dev_badInpType (M_devSup| 7) /*Bad INP link type*/ +#define S_dev_badOutType (M_devSup| 9) /*Bad OUT link type*/ +#define S_dev_badInitRet (M_devSup|11) /*Bad init_rec return value */ +#define S_dev_badBus (M_devSup|13) /*Illegal bus type*/ +#define S_dev_badCard (M_devSup|15) /*Illegal or nonexistant module*/ +#define S_dev_badSignal (M_devSup|17) /*Illegal signal*/ +#define S_dev_NoInit (M_devSup|19) /*No init*/ +#define S_dev_Conflict (M_devSup|21) /*Multiple records accessing same signal*/ + +/*************************************************************************** + * except that some fields could be null the following is a valid reference + * + * precDevSup->papDevSup[i]->papDset[j]->report(); + * + * The memory layout is + * + * precDevSup->recDevSup + * number + * papDevSup->[1] + * [2]->devSup + * number + * papDsetName->[0]->"name" + * papDset-->[0] + * [1]->dset + * number + * report->report() + * ... + ***************************************************************************/ + +/*************************************************************************** + * The following macro returns NULL or ptr to struct devSup + * A typical usage is: + * + * struct devSup *pdevSup; + * if(!(pdevSup=GET_PDEVSUP(precDevSup,rectype))) {} + **************************************************************************/ +#define GET_PDEVSUP(PRECDEVSUP,REC_TYPE)\ +(\ + (PRECDEVSUP)\ + ?(\ + ( ((REC_TYPE)<1) || ((REC_TYPE)>=(PRECDEVSUP)->number) )\ + ? NULL\ + : ((PRECDEVSUP)->papDevSup[(REC_TYPE)])\ + )\ + : NULL\ +) + + +/*************************************************************************** + * The following macro returns NULL of ptr to struct dset + * A typical usage is: + * + * struct dset *pdset; + * if(!(pdset=GET_PDSET(pdevSup,dtyp))) {} + **************************************************************************/ +#define GET_PDSET(PDEVSUP,DTYP)\ +(\ + (PDEVSUP)\ + ?(\ + ( (((unsigned)DTYP)>=((struct devSup*)(PDEVSUP))->number) )\ + ? NULL\ + : ( ((struct devSup*)(PDEVSUP))->papDset[(DTYP)] )\ + )\ + : NULL\ +) +#endif diff --git a/src/cvtDctsdr/drvSup.h b/src/cvtDctsdr/drvSup.h new file mode 100644 index 000000000..7a816daa8 --- /dev/null +++ b/src/cvtDctsdr/drvSup.h @@ -0,0 +1,112 @@ +/* drvSup.h Driver Support */ +/* share/epicsH $Id$ */ + +/* + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-21-92 rcz changed drvetName to papDrvName + * .02 05-18-92 rcz New database access (removed extern) + */ + +#ifndef INCdrvSuph +#define INCdrvSuph 1 + +typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/ + +struct drvet { /* driver entry table */ + long number; /*number of support routines*/ + DRVSUPFUN report; /*print report*/ + DRVSUPFUN init; /*init support*/ + DRVSUPFUN reboot; /*reboot support*/ + /*other functions are device dependent*/ + }; + +struct drvSup { + long number; /*number of dset */ + char **papDrvName; /*ptr to arr of ptr to drvetName*/ + struct drvet **papDrvet; /*ptr to arr ptr to drvet */ + }; +#define DRVETNUMBER ( (sizeof(struct drvet) -sizeof(long))/sizeof(DRVSUPFUN) ) + +#define S_drv_noDrvSup (M_drvSup| 1) /*SDR_DRVSUP: Driver support missing*/ +#define S_drv_noDrvet (M_drvSup| 3) /*Missing driver support entry table*/ + +/************************************************************************** + * + *The following are valid references + * + * pdrvSup->drvetName[i] This is address of name string + * pdrvSup->papDrvet[i]->report(); + * + * The memory layout is + * + * pdrvSup->drvSup + * number + * papDrvName->[0]->"name" + * papDrvet-->[0] + * [1]->drvet + * number + * report->report() + * ... + *************************************************************************/ + +/************************************************************************** + * The following macro returns either the addr of drvet or NULL + * A typical usage is: + * + * struct drvet *pdrvet; + * if(!(pdrvet=GET_PDRVET(pdrvSup,type))) {= PDRVSUP->number))\ + ? NULL\ + : (PDRVSUP->papDrvet[(TYPE)])\ + )\ + : NULL\ +) + +/************************************************************************** + * The following macro returns either the addr of drvName or NULL + * A typical usage is: + * + * char *pdrvName; + * if(!(pdrvName=GET_PDRVNAME(pdrvSup,type))) {= PDRVSUP->number))\ + ? NULL\ + : (PDRVSUP->papDrvName[(TYPE)])\ + )\ + : NULL\ +) +#endif diff --git a/src/cvtDctsdr/link.h b/src/cvtDctsdr/link.h new file mode 100644 index 000000000..6edbdd3fa --- /dev/null +++ b/src/cvtDctsdr/link.h @@ -0,0 +1,189 @@ +/* link.h */ +/* base/include $Id$ */ + +/* + * Original Author: Bob Dalesio + * Current Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 12-18-91 jba Changed caddr_t to void * + * .02 3-16-92 frl changed link.value.value to double + * .03 9-9-92 frl added vxi link type + * .04 12-13-93 mcn added conversion pointer for fast links + * .05 1-10-95 jt added rf_io structure + */ + +#include + +/* link types */ +#ifndef INClinkLT +#define INClinkLT +#define CONSTANT 0 +#define PV_LINK 1 +#define VME_IO 2 +#define CAMAC_IO 3 +#define AB_IO 4 +#define GPIB_IO 5 +#define BITBUS_IO 6 +#define DB_LINK 10 +#define CA_LINK 11 +#define INST_IO 12 /* instrument */ +#define BBGPIB_IO 13 /* bitbus -> gpib */ +#define RF_IO 14 +#define VXI_IO 15 +#endif /*INClinkLT*/ + +#ifndef INClinkh +#define INClinkh 1 +#define INSTIO_FLD_SZ 36 /* field size for instio */ +#define LINK_PARAM_SZ 32 +#define VME_PARAM_SZ 32 +#define AB_PARAM_SZ 26 +#define CAMAC_PARAM_SZ 26 +#define VXI_PARAM_SZ 26 +#define VXIDYNAMIC 0 +#define VXISTATIC 1 + +/* structure of a link to a process variable*/ +struct pv_link { + short process_passive; /* should in/out passive link be processed*/ + short maximize_sevr; /* maximize sevr of link. stat=LINK_ALARM*/ + char pvname[PVNAME_SZ+1]; + char pad[3]; + char fldname[FLDNAME_SZ]; +}; + +/* structure of a link to a database link */ +struct db_link { + short process_passive; /* should in/out passive link be processed */ + short maximize_sevr; /* maximize sevr of link. stat=LINK_ALARM */ + void *pdbAddr; /* pointer to database address structure */ + long (*conversion)(); /* conversion routine for fast links */ +}; + +/* structure of a VME io channel */ +struct vmeio { + short card; + short signal; + char parm[VME_PARAM_SZ]; +}; + +/* structure of a CAMAC io channel */ +struct camacio { + short b; + short c; + short n; + short a; + short f; + char parm[CAMAC_PARAM_SZ]; +}; + +/* structure of a RF io channel */ +struct rfio { + short branch; + short cryo; + short micro; + short dataset; + short element; + long ext; +}; + +/* structure of a Allen-Bradley io channel */ +struct abio { + short link; + short adapter; + short card; + short signal; + short plc_flag; + char parm[AB_PARAM_SZ]; +}; + +/* structure of a gpib io channel */ +struct gpibio { + short link; + short addr; /* device address */ + char parm[LINK_PARAM_SZ]; +}; + +/* structure of a bitbus io channel */ +struct bitbusio { + unsigned char link; + unsigned char node; + unsigned char port; + unsigned char signal; + char parm[LINK_PARAM_SZ]; +}; + +/* structure of a bitbus to gpib io channel */ +struct bbgpibio { + unsigned char link; + unsigned char bbaddr; + unsigned char gpibaddr; + unsigned char pad; + char parm[LINK_PARAM_SZ]; +}; + +/* structure of an instrument io link */ +struct instio { + char string[INSTIO_FLD_SZ]; /* the cat of location. + signal.parameter */ +}; + +/* structure of a vxi link */ +struct vxiio{ + short flag; /* 0 = frame/slot, 1 = SA */ + short frame; + short slot; + short la; /* logical address if flag =1 */ + short signal; + char parm[VXI_PARAM_SZ]; +}; + +/* union of possible address structures */ +union value{ + double value; /* constant */ + struct pv_link pv_link; /* link to process variable*/ + struct vmeio vmeio; /* vme io point */ + struct camacio camacio; /* camac io point */ + struct rfio rfio; /* CEBAF RF buffer interface */ + struct abio abio; /* allen-bradley io point */ + struct gpibio gpibio; + struct bitbusio bitbusio; + struct db_link db_link; /* Data base link */ + void *ca_link; /* Channel Access link */ + struct instio instio; /* instrument io link */ + struct bbgpibio bbgpibio; /* bitbus to gpib io link */ + struct vxiio vxiio; /* vxi io */ +}; + +struct link{ + long type; + long pad; + union value value; +}; + +typedef struct link DBLINK; +#endif diff --git a/src/cvtDctsdr/recSup.h b/src/cvtDctsdr/recSup.h new file mode 100644 index 000000000..f1f9c2581 --- /dev/null +++ b/src/cvtDctsdr/recSup.h @@ -0,0 +1,233 @@ +/* $Id$ + * Record Support + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 11-11-91 jba Added include dbCommon.h,recGblSetSevr,recGblResetSevr + * .02 12-18-91 jba Changed caddr_t to void * + * .03 03-04-92 jba Added include for dbAccess.h + * .04 05-18-92 rcz removed extern + * .05 05-18-92 rcz Changed macro "GET_PRSET(" to "GET_PRSET(precSup," + * .06 05-18-92 rcz New database access (removed extern) + * .07 07-16-92 jba Added macro recGblFwdLink + * .08 07-16-92 jba changed VALID_ALARM to INVALID_ALARM + * .09 08-10-92 jba added #defines for SIMM processing + * .10 08-11-92 jba added DB_INTEREST masks + * .11 08-13-92 jba added prototype for recGblGetAlarmDouble, + * .12 08-14-92 jba added prototypes recGblGetLinkValue,recGblPutLinkValue + * .13 09-15-92 jba added vxWorks ifdef + * .14 -7-27-93 mrk remove recGblResetSevr add recGblResetAlarms + * .15 03-18-94 mcn added fast link macros and prototypes + */ +#ifndef INCrecSuph +#define INCrecSuph 1 + + +#ifdef vxWorks +#ifndef INCdbCommonh +#include +#endif +#endif + +/* + * One ABSOLUTELY must include dbAccess.h before the + * definitions in this file + */ + +#ifndef INCdbAccessh +#include +#endif +#ifndef INCalarmh +#include +#endif + +/************************************************************************* + * The following must match definitions in choiceGbl.ascii + *************************************************************************/ + +/* GBL_IVOA */ +#define IVOA_CONTINUE 0 +#define IVOA_NO_OUTPUT 1 +#define IVOA_OUTPUT_IVOV 2 + +/*************************************************************************/ + +#define DB_INTEREST_SCAN 0x00000001 +#define DB_INTEREST_CONTROL 0x00000002 +#define DB_INTEREST_ALARMS 0x00000004 +#define DB_INTEREST_DISPLAY 0x00000008 +#define DB_INTEREST_IO 0x00000010 +#define DB_INTEREST_CONVERT 0x00000020 +#define DB_INTEREST_PRIVATE 0x00000040 + +#define recGblGetFastLink(PLNK,PREC,PVAL) \ +\ + ((((PLNK)->type == CONSTANT) ||\ + (! (((PLNK)->type == DB_LINK) || ((PLNK)->type == CA_LINK)) ))\ + ? 0\ + : dbFastLinkGet((PLNK),(struct dbCommon *)(PREC),(PVAL))) + + +#define recGblPutFastLink(PLNK,PREC,PVAL) \ +\ + ((((PLNK)->type == CONSTANT) ||\ + (! (((PLNK)->type == DB_LINK) || ((PLNK)->type == CA_LINK)) ))\ + ? 0\ + : dbFastLinkPut((PLNK),(struct dbCommon *)(PREC),(PVAL))) + + +#define recGblSetSevr(PREC,NSTA,NSEV) \ +(\ + ((PREC)->nsev<(NSEV))\ + ? ((PREC)->nsta=(NSTA),(PREC)->nsev=(NSEV),TRUE)\ + : FALSE\ +) + +typedef long (*RECSUPFUN) (); /* ptr to record support function*/ + +struct rset { /* record support entry table */ + long number; /*number of support routines */ + RECSUPFUN report; /*print report */ + RECSUPFUN init; /*init support */ + RECSUPFUN init_record; /*init record */ + RECSUPFUN process; /*process record */ + RECSUPFUN special; /*special processing */ + RECSUPFUN get_value; /*get value field */ + RECSUPFUN cvt_dbaddr; /*cvt dbAddr */ + RECSUPFUN get_array_info; + RECSUPFUN put_array_info; + RECSUPFUN get_units; + RECSUPFUN get_precision; + RECSUPFUN get_enum_str; /*get string from enum item*/ + RECSUPFUN get_enum_strs; /*get all enum strings */ + RECSUPFUN put_enum_str; /*put string from enum item*/ + RECSUPFUN get_graphic_double; + RECSUPFUN get_control_double; + RECSUPFUN get_alarm_double; + }; +struct recSup { + long number; /*number of record types */ + struct rset **papRset; /*ptr to arr of ptr to rset */ + }; +#define RSETNUMBER ( (sizeof(struct rset) - sizeof(long))/sizeof(RECSUPFUN) ) + +#define S_rec_noRSET (M_recSup| 1) /*Missing record support entry table*/ +#define S_rec_outMem (M_recSup| 3) /*Out of Memory*/ + +/************************************************************************* + * + * The following is a valid reference + * + * precSup->papRset[1]->report() + *************************************************************************/ + + +/* Definition os structure for routine get_value */ + +struct valueDes { + long field_type; + long no_elements; + void * pvalue; +}; + +/************************************************************************** + * The following macro returns either the addr of rset or NULL + * A typical usage is: + * + * struct rset *prset; + * if(!(prset=GET_PRSET(precSup,type))) {= (PRECSUP)->number))\ + ? NULL\ + : ((PRECSUP)->papRset[(REC_TYPE)])\ + )\ + : NULL\ +) + + + +/************************************************************************ + * report(FILE fp,void *precord); + * init(); + * init_record(precord,pass); + * process(void *precord); + * special(struct db_addr *paddr, after); + * get_value(precord,struct valueDes *p); + * cvt_dbaddr(struct db_addr *paddr); + * get_array_info(paddr,long *no_elements,long *offset); + * put_array_info(paddr,nNew); + * get_units(paddr,char units[8]); + * get_precision(struct db_addr *paddr,long *precision); + * get_enum_str(paddr,pbuffer); + * get_enum_strs(paddr,struct dbr_enumStrs *p); + * put_enum_str(paddr,pbuffer); + * get_graphic_double(paddr,struct dbr_grDouble *p); + * get_control_double(paddr,struct dbr_ctrlDouble *p); + * get_alarm_double(paddr,struct dbr_ctrlDouble *p); + ***********************************************************************/ + +/* Global Record Support Routines*/ +#ifdef __STDC__ + +void recGblDbaddrError(long status, struct dbAddr *paddr, char *pcaller_name); +void recGblRecordError(long status, void *precord, char *pcaller_name); +void recGblRecSupError(long status, struct dbAddr *paddr, char *pcaller_name, char *psupport_name); +void recGblGetGraphicDouble(struct dbAddr *paddr, struct dbr_grDouble *pgd); +void recGblGetControlDouble(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd); +void recGblGetAlarmDouble(struct dbAddr *paddr, struct dbr_alDouble *pad); +void recGblGetPrec(struct dbAddr *paddr, long *pprecision); +long recGblGetLinkValue(struct link *plink,void *precord, + short dbrType,void *pdest,long *poptions,long *pnRequest); +long recGblPutLinkValue(struct link *plink,void *precord, + short dbrType,void *pdest,long *pnRequest); +unsigned short recGblResetAlarms(void *precord); +void recGblFwdLink(void *precord); +void recGblGetTimeStamp(void *precord); +long recGblInitFastInLink(struct link *plink, void *precord, short dbrType, char *fld_name); +long recGblInitFastOutLink(struct link *plink, void *precord, short dbrType, char *fld_name); + +#else + +void recGblDbaddrError(); +void recGblRecordError(); +void recGblRecSupError(); +void recGblGetGraphicDouble(); +void recGblGetControlDouble(); +void recGblGetAlarmDouble(); +void recGblGetPrec(); +long recGblGetLinkValue(); +long recGblPutLinkValue(); +unsigned short recGblResetAlarms(); +long recGblInitFastInLink(); +long recGblInitFastOutLink(); + +#endif /*__STDC__*/ + +#endif /*INCrecSuph*/ diff --git a/src/cvtDctsdr/sdr2device.c b/src/cvtDctsdr/sdr2device.c new file mode 100644 index 000000000..0ed568ce5 --- /dev/null +++ b/src/cvtDctsdr/sdr2device.c @@ -0,0 +1,123 @@ +/*sdr2device.c*/ +/* Convert device support to new ascii formats*/ +/* + * + * Author: Marty Kraimer + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-10-95 mrk Original Version + */ + +#include +#include +#include +#include +#include +#include +#include +#include +DBBASE *pdbbase; + +#define NUM_LINK_TYPES 16 + +static char *plink_type_name[NUM_LINK_TYPES] = { + "CONSTANT", + "PV_LINK", + "VME_IO", + "CAMAC_IO", + "AB_IO", + "GPIB_IO", + "BITBUS_IO", + 0,0,0, + "DB_LINK", + "CA_LINK", + "INST_IO", + "BBGPIB_IO", + "RF_IO", + "VXI_IO" +}; + +static char *defdctsdr = "default.dctsdr"; + +int main(int argc,char **argv) +{ + FILE *fp; + long status; + char *sdr_filename; + char filename[40]; + char *pfilename = filename; + struct recType *precType; + struct devChoiceRec *pdevChoiceRec; + struct devChoiceSet *pdevChoiceSet; + struct devChoice *pdevChoice; + struct recDevSup *precDevSup; + struct devSup *pdevSup; + int i,j; + + if(argc==2) { + sdr_filename = argv[1]; + } else { + sdr_filename = defdctsdr; + } + fp = fopen(sdr_filename,"r"); + if(!fp) { + printf("Error opening file %s\n",sdr_filename); + exit(-1); + } + pdbbase=dbAllocBase(); + status=dbRead(pdbbase,fp); + if(status) { + errMessage(status,"dbRead"); + exit(-1); + } + fclose(fp); + strcpy(pfilename,"device.ascii"); + fp = fopen(pfilename,"w"); + if(!fp) { + printf("Error opening file %s\n",pfilename); + exit(-1); + } + precType = pdbbase->precType; + precDevSup = pdbbase->precDevSup; + pdevChoiceRec = pdbbase->pchoiceDev; + for(i=0; inumber; i++) { + pdevSup = precDevSup->papDevSup[i]; + if(!pdevSup) continue; + pdevChoiceSet = pdevChoiceRec->papDevChoiceSet[i]; + if(!pdevChoiceSet) continue; + for(j=0; jnumber; j++) { + if(!pdevSup->papDsetName[j]) continue; + pdevChoice = pdevChoiceSet->papDevChoice[j]; + if(!pdevChoice) continue; + fprintf(fp,"device(%s,%s,%s,\"%s\")\n", + precType->papName[i], + plink_type_name[pdevChoice->link_type], + pdevSup->papDsetName[j], + pdevChoice->pchoice); + } + } + fclose(fp); + return(0); +} diff --git a/src/db/atdb.c b/src/cvtDctsdr/sdr2driver.c similarity index 56% rename from src/db/atdb.c rename to src/cvtDctsdr/sdr2driver.c index 0dec21d01..e05631002 100644 --- a/src/db/atdb.c +++ b/src/cvtDctsdr/sdr2driver.c @@ -1,5 +1,5 @@ -/*atodb.c*/ -/* share/src/db @(#)atdb.c 1.7 2/25/94 */ +/*sdr2driver.c*/ +/* Convert driver support to new ascii formats*/ /* * * Author: Marty Kraimer @@ -27,7 +27,7 @@ * * Modification Log: * ----------------- - * .01 07-13-93 mrk Original version + * .01 05-10-95 mrk Original Version */ #include @@ -37,57 +37,48 @@ #include #include #include +#include DBBASE *pdbbase; -DBENTRY *pdbentry; - -#ifdef __STDC__ -main(int argc,char **argv) -#else -main(argc,argv) -int argc; -char **argv; -#endif /*__STDC__*/ -{ - FILE *fpdctsdr; - FILE *fp; - long status; - char *ptime; - time_t timeofday; - char *rectype; - - if(argc!=3) { - printf("Usage: atdb default.dctsdr file.database < file.rpt\n"); - exit(-1); +static char *defdctsdr = "default.dctsdr"; + +int main(int argc,char **argv) +{ + FILE *fp; + long status; + char *sdr_filename; + char filename[40]; + char *pfilename = filename; + struct drvSup *pdrvSup; + int i,j; + + if(argc==2) { + sdr_filename = argv[1]; + } else { + sdr_filename = defdctsdr; } - fpdctsdr = fopen(argv[1],"r"); - if(!fpdctsdr) { - errMessage(0,"Error opening input file"); - exit(-1); - } - if(fopen(argv[2],"r")) { - errMessage(-1,"Output File already exists"); + fp = fopen(sdr_filename,"r"); + if(!fp) { + printf("Error opening file %s\n",sdr_filename); exit(-1); } pdbbase=dbAllocBase(); - pdbentry=dbAllocEntry(pdbbase); - status=dbRead(pdbbase,fpdctsdr); + status=dbRead(pdbbase,fp); if(status) { errMessage(status,"dbRead"); exit(-1); } - yyreset(); - yyparse(); - fp=fopen(argv[2],"w"); - if(fp==NULL) { - errMessage(0,"Error opening output file"); - exit(-1); - } - status = dbWrite(pdbbase,fpdctsdr,fp); - if(status) errMessage(status,"dbWrite"); - fclose(fpdctsdr); fclose(fp); - dbFreeEntry(pdbentry); - dbFreeBase(pdbbase); + strcpy(pfilename,"driver.ascii"); + fp = fopen(pfilename,"w"); + if(!fp) { + printf("Error opening file %s\n",pfilename); + exit(-1); + } + pdrvSup = pdbbase->pdrvSup; + for(i=0; inumber; i++) { + fprintf(fp,"driver(%s)\n",pdrvSup->papDrvName[i]); + } + fclose(fp); return(0); } diff --git a/src/cvtDctsdr/sdr2gblmenu.c b/src/cvtDctsdr/sdr2gblmenu.c new file mode 100644 index 000000000..ebe67e672 --- /dev/null +++ b/src/cvtDctsdr/sdr2gblmenu.c @@ -0,0 +1,115 @@ +/*sdr2gblmenu.c*/ +/* Convert global menus from old .dctsdr file to new ascii formats */ +/* + * + * Author: Marty Kraimer + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-10-95 mrk Original Version + */ + +#include +#include +#include +#include +#include +#include +#include +DBBASE *pdbbase; + +#define NUM_GBL_MENUS 11 + +static char *aiMenuName[NUM_GBL_MENUS] = { + "menuYesNo", + "menuScan", + "menuAlarmSevr", + "menuAlarmStat", + "menuArrType", + "menuOmsl", + "menuLinr", + "menuFtype", + "menuCompress", + "menuPriority", + "menuIvoa" +}; + +static char *defdctsdr = "default.dctsdr"; + +int main(int argc,char **argv) +{ + FILE *fp; + long status; + char *sdr_filename; + char filename[40]; + char *pfilename = filename; + char choice_name[50]; + char temp_str[50]; + char *ptemp; + struct choiceSet *pchoiceSet; + int i,j; + + if(argc==2) { + sdr_filename = argv[1]; + } else { + sdr_filename = defdctsdr; + } + fp = fopen(sdr_filename,"r"); + if(!fp) { + printf("Error opening file %s\n",sdr_filename); + exit(-1); + } + pdbbase=dbAllocBase(); + status=dbRead(pdbbase,fp); + if(status) { + errMessage(status,"dbRead"); + exit(-1); + } + fclose(fp); + for(i=0; ipchoiceGbl->papChoiceSet[i]; + fprintf(fp,"menu(%s) {\n",aiMenuName[i]); + for(j=0; jnumber; j++) { + strcpy(temp_str,pchoiceSet->papChoice[j]); + ptemp = temp_str; + while(*ptemp) { + if(!isalnum(*ptemp)) *ptemp = '_'; + ptemp++; + } + sprintf(choice_name,"%s%s",aiMenuName[i],temp_str); + fprintf(fp,"\tchoice(%s,\"%s\")\n", + choice_name,pchoiceSet->papChoice[j]); + } + fprintf(fp,"}\n"); + fclose(fp); + } + return(0); +} diff --git a/src/cvtDctsdr/sdr2recordtype.c b/src/cvtDctsdr/sdr2recordtype.c new file mode 100644 index 000000000..59cb34a94 --- /dev/null +++ b/src/cvtDctsdr/sdr2recordtype.c @@ -0,0 +1,427 @@ +/*sdr2recordtype.c*/ +/* Convert recordtype and record menus from .dctsdr file to new ascii formats */ +/* sdr2recordtype +/* + * + * Author: Marty Kraimer + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 05-15-95 mrk Original Version + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +DBBASE *pdbbase; + +static char *defdctsdr = "default.dctsdr"; + +static char *ptypename[DBF_NTYPES] = { + "DBF_STRING", + "DBF_CHAR", + "DBF_UCHAR", + "DBF_SHORT", + "DBF_USHORT", + "DBF_LONG", + "DBF_ULONG", + "DBF_FLOAT", + "DBF_DOUBLE", + "DBF_ENUM", + "DBF_MENU", + "DBF_MENU", + "DBF_MENU", + "DBF_DEVICE", + "DBF_INLINK", + "DBF_OUTLINK", + "DBF_FWDLINK", + "DBF_NOACCESS" +}; + +static char *pguigroup[] = { + "", + "GUI_COMMON", + "GUI_ALARMS", + "GUI_BITS1", + "GUI_BITS2", + "GUI_CALC", + "GUI_CLOCK", + "GUI_COMPRESS", + "GUI_CONVERT", + "GUI_DISPLAY", + "GUI_HIST", + "GUI_INPUTS", + "GUI_LINKS", + "GUI_MBB", + "GUI_MOTOR", + "GUI_OUTPUT", + "GUI_PID", + "GUI_PULSE", + "GUI_SELECT", + "GUI_SEQ1", + "GUI_SEQ2", + "GUI_SEQ3", + "GUI_SUB", + "GUI_TIMER", + "GUI_WAVE", + "GUI_SCAN" +}; + +static char *pgblMenuNames[11] = { + "menuYesNo", + "menuScan", + "menuAlarmSevr", + "menuAlarmStat", + "menuArrType", + "menuOmsl", + "menuLinr", + "menuFtype", + "menuCompress", + "menuPriority", + "menuIvoa" +}; + +int main(int argc,char **argv) +{ + FILE *fp,*fpInclude; + long status; + char *sdrFilename; + char *recordtypeName; + char *recordtypeInclude; + char filename[40]; + char *pfilename = filename; + struct recType *precType; + struct recDes *precDes; + struct choiceRec *pchoiceRec; + struct arrChoiceSet *parrChoiceSet; + struct choiceSet *pchoiceSet; + struct recTypDes *precTypDes; + struct fldDes *pfldDes; + char menuname[50]; + char *pmenuname = menuname; + char choiceName[50]; + char tempStr[50]; + char *ptemp; + int indRectype; + int i,j; + int indFldDes; + char includeLine[80]; + DBENTRY dbentry; + DBENTRY *pdbentry=&dbentry; + char valuestring[80]; + char *pstr; + char **paprecChoiceNames; + int makeCommon=FALSE; + + if(argc<3 || argc>4) { + fprintf(stderr,"usage: sdr2recordtype []"); + exit(-1); + } + recordtypeName = argv[1]; + if(strcmp(recordtypeName,"dbCommon")==0) makeCommon=TRUE; + recordtypeInclude = argv[2]; + if(argc==4) { + sdrFilename = argv[3]; + } else { + sdrFilename = defdctsdr; + } + fpInclude = fopen(recordtypeInclude,"r"); + if(!fpInclude) { + fprintf(stderr,"Error opening file %s\n",recordtypeInclude); + exit(-1); + } + /*skip all lines up to beginning of structure*/ + while(TRUE) { + pstr = fgets(includeLine,80,fpInclude); + if(!pstr) { + fprintf(stderr,"Does not appear to be include file%s\n", + recordtypeInclude); + exit(-1); + } + if(strstr(includeLine,"struct ")) break; + } + fp = fopen(sdrFilename,"r"); + if(!fp) { + fprintf(stderr,"Error opening file %s\n",sdrFilename); + exit(-1); + } + pdbbase=dbAllocBase(); + status=dbRead(pdbbase,fp); + if(status) { + errMessage(status,"dbRead"); + exit(-1); + } + fclose(fp); + precType = pdbbase->precType; + for(indRectype=0; indRectype< precType->number; indRectype++) { + if(!precType->papName[indRectype]) continue; + if(makeCommon) break; + if(strcmp(recordtypeName,precType->papName[indRectype]) == 0) break; + } + if(indRectype>=precType->number) { + fprintf(stderr,"%s not found\n",recordtypeName); + exit(-1); + } + if(makeCommon) { + strcpy(pfilename,"dbCommon"); + } else { + strcpy(pfilename,recordtypeName); + strcat(pfilename,"Record"); + } + strcat(pfilename,".ascii"); + fp = fopen(pfilename,"w"); + if(!fp) { + fprintf(stderr,"Error opening file %s\n",pfilename); + exit(-1); + } + /*Create record instance with initial values*/ + dbInitEntry(pdbbase,pdbentry); + status = dbFindRecdes(pdbentry,precType->papName[indRectype]); + if(status) {printf("No record description\n"); exit(-1);} + status = dbCreateRecord(pdbentry,"temp"); + if(status) {printf("dbCreateRecord failed\n"); exit(-1);} + /*For menus let name be */ + precTypDes = pdbbase->precDes->papRecTypDes[indRectype]; + parrChoiceSet = pdbbase->pchoiceRec->papArrChoiceSet[indRectype]; + if(!parrChoiceSet) goto gen_rectype; + if(makeCommon) goto gen_rectype; + paprecChoiceNames = (char **)calloc(parrChoiceSet->number,sizeof(char *)); + for(i=0; i< parrChoiceSet->number; i++) { + /*Find first field that uses this choice set */ + for(j=0; j< precTypDes->no_fields; j++) { + pfldDes = precTypDes->papFldDes[j]; + if(pfldDes->field_type==DBF_RECCHOICE + && pfldDes->choice_set==i) break; + } + if(j>=precTypDes->no_fields) continue; + strcpy(pmenuname,recordtypeName); + strcat(pmenuname,pfldDes->fldname); + for(j=strlen(pmenuname)-1; j>0; j--) { + if(pmenuname[j] == ' ') pmenuname[j] = 0; + } + paprecChoiceNames[i] = calloc(1,strlen(pmenuname) + 1); + strcpy(paprecChoiceNames[i],pmenuname); + fprintf(fp,"menu(%s) {\n",pmenuname); + pchoiceSet = parrChoiceSet->papChoiceSet[i]; + for(j=0; jnumber; j++) { + strcpy(tempStr,pchoiceSet->papChoice[j]); + ptemp = tempStr; + while(*ptemp) { + if(!isalnum(*ptemp)) *ptemp = '_'; + ptemp++; + } + sprintf(choiceName,"%s_%s",pmenuname,tempStr); + fprintf(fp,"\tchoice(%s,\"%s\")\n", + choiceName,pchoiceSet->papChoice[j]); + } + fprintf(fp,"}\n"); + } +gen_rectype: + if(makeCommon) { + indFldDes=-1; + } else { + fprintf(fp,"recordtype(%s) {\n",recordtypeName); + fprintf(fp,"\tinclude \"dbCommon.ascii\" \n"); + /*Skip fields in dbCommon*/ + for(indFldDes=0; indFldDes< precTypDes->no_fields; indFldDes++) { + if(strcmp(precTypDes->papFldDes[indFldDes]->fldname,"FLNK")==0) break; + } + } + while(++indFldDes < precTypDes->no_fields) { + pfldDes = precTypDes->papFldDes[indFldDes]; + if(pfldDes->field_type==DBF_NOACCESS) { + char *prtn; + char fldname[5]; + + strcpy(fldname,pfldDes->fldname); + pstr = fldname; + while(*pstr) { + if(*pstr == ' ') { + *pstr = 0; + break; + } + *pstr = tolower(*pstr); + pstr++; + } + while(TRUE) { + prtn = fgets(includeLine,80,fpInclude); + if(!prtn) { + fprintf(stderr, "field %s not found in %s\n", + pfldDes->fldname,recordtypeInclude); + break; + } + if(!(pstr = strstr(includeLine,fldname))) continue; + if(isalnum(*(pstr + strlen(fldname)))) continue; + break; + } + if(!prtn) continue; + if(strstr(pstr,"Created Pad")) continue; + } + strcpy(tempStr,pfldDes->fldname); + for(j=strlen(tempStr)-1; j>0; j--) { + if(tempStr[j] == ' ') tempStr[j] = 0; + } + fprintf(fp,"\tfield(%s,%s) {\n", + tempStr,ptypename[pfldDes->field_type]); + if(pfldDes->prompt[0]!=0) { + fprintf(fp,"\t\tprompt(\"%s\")\n",pfldDes->prompt); + } + if(pfldDes->promptflag) { + fprintf(fp,"\t\tpromptgroup(%s)\n",pguigroup[pfldDes->promptflag]); + } + if(pfldDes->as_level == 0) fprintf(fp,"\t\tasl(ASL0)\n"); + if(pfldDes->special) { + fprintf(fp,"\t\tspecial("); + switch(pfldDes->special) { + case SPC_NOMOD: fprintf(fp,"SPC_NOMOD)\n"); break; + case SPC_DBADDR: fprintf(fp,"SPC_DBADDR)\n"); break; + case SPC_SCAN: fprintf(fp,"SPC_SCAN)\n"); break; + case SPC_HDWLINK: fprintf(fp,"SPC_HDWLINK)\n"); break; + case SPC_ALARMACK: fprintf(fp,"SPC_ALARMACK)\n"); break; + case SPC_AS: fprintf(fp,"SPC_AS)\n"); break; + case SPC_MOD: fprintf(fp,"SPC_MOD)\n"); break; + case SPC_RESET: fprintf(fp,"SPC_RESET)\n"); break; + case SPC_LINCONV: fprintf(fp,"SPC_LINCONV)\n"); break; + case SPC_CALC: fprintf(fp,"SPC_CALC)\n"); break; + default : fprintf(fp,"%d)\n",pfldDes->special); + } + } + if(pfldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n"); + if(pfldDes->cvt_type) fprintf(fp,"\t\tbase(HEX)\n"); + if(pfldDes->interest) + fprintf(fp,"\t\tinterest(%d)\n",pfldDes->interest); + switch(pfldDes->field_type) { + case DBF_STRING: { + fprintf(fp,"\t\tsize(%d)\n",pfldDes->size); + } + break; + case DBF_CHAR: { + status = dbFindField(pdbentry,pfldDes->fldname); + if(status) {printf("dbFindField failed\n"); exit(-1);} + pstr = dbGetString(pdbentry); + if(pfldDes->initial.char_value) + fprintf(fp,"\t\tinitial(\"%d\")\n", + pfldDes->initial.char_value); + } + break; + case DBF_UCHAR: { + if(pfldDes->initial.uchar_value) + fprintf(fp,"\t\tinitial(\"%u\")\n", + pfldDes->initial.uchar_value); + } + break; + case DBF_SHORT: { + if(pfldDes->initial.short_value) + fprintf(fp,"\t\tinitial(\"%d\")\n", + pfldDes->initial.short_value); + } + break; + case DBF_USHORT: { + if(pfldDes->initial.ushort_value) + fprintf(fp,"\t\tinitial(\"%u\")\n", + pfldDes->initial.ushort_value); + } + break; + case DBF_LONG: { + if(pfldDes->initial.long_value) + fprintf(fp,"\t\tinitial(\"%d\")\n", + pfldDes->initial.long_value); + } + break; + case DBF_ULONG: { + if(pfldDes->initial.ulong_value) + fprintf(fp,"\t\tinitial(\"%u\")\n", + pfldDes->initial.ulong_value); + } + break; + case DBF_FLOAT: { + if(pfldDes->initial.float_value) + fprintf(fp,"\t\tinitial(\"%g\")\n", + pfldDes->initial.float_value); + } + break; + case DBF_DOUBLE: { + if(pfldDes->initial.double_value) + fprintf(fp,"\t\tinitial(\"%g\")\n", + pfldDes->initial.double_value); + } + break; + case DBF_ENUM: { + if(pfldDes->initial.enum_value) + fprintf(fp,"\t\tinitial(\"%u\")\n", + pfldDes->initial.enum_value); + } + break; + case DBF_GBLCHOICE: { + fprintf(fp,"\t\tmenu(%s)\n",pgblMenuNames[pfldDes->choice_set]); + } + break; + case DBF_CVTCHOICE: { + fprintf(fp,"\t\tmenu(menuConvert)\n"); + } + break; + case DBF_RECCHOICE: { + fprintf(fp,"\t\tmenu(%s)\n",paprecChoiceNames[pfldDes->choice_set]); + } + break; + case DBF_DEVCHOICE: { + } + break; + case DBF_INLINK: { + } + break; + case DBF_OUTLINK: { + } + break; + case DBF_FWDLINK: { + } + break; + case DBF_NOACCESS: { /*includeLine holds definition*/ + char *ptempStr = tempStr; + + fprintf(fp,"\t\tsize(%d)\n",pfldDes->size); + ptemp = includeLine; + while(*ptemp==' ' || *ptemp=='\t') ptemp++; + while(*ptemp!=';') *ptempStr++ = *ptemp++; + *ptempStr = 0; + fprintf(fp,"\t\textra(\"%s\")\n",tempStr); + } + break; + } + fprintf(fp,"\t}\n"); + if(makeCommon + && (strcmp(precTypDes->papFldDes[indFldDes]->fldname,"FLNK")==0)) + break; + } + if(!makeCommon)fprintf(fp,"}\n"); + fclose(fpInclude); + fclose(fp); + return(0); +} diff --git a/src/cvtDctsdr/sdrHeader.h b/src/cvtDctsdr/sdrHeader.h new file mode 100644 index 000000000..b58abd7e6 --- /dev/null +++ b/src/cvtDctsdr/sdrHeader.h @@ -0,0 +1,80 @@ +/* sdrHeader.h - header for self defining record */ +/* share/epicsH $Id$ */ + +/* + * Author: Marty Kraimer + * Date: 6-1-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 mm-dd-yy iii Comment + * .02 05-03-92 rcz New database access (removed extern) + */ + +#ifndef INCsdrHeader +#define INCsdrHeader 1 +struct sdrHeader { + long magic; /* magic number */ + long nbytes; /* number of bytes of data*/ + short type; /* sdr record type */ + short pad; /* padding */ + long create_date; /* creation date */ +}; + +#define DBMAGIC 0x494f4300 /* In ascii this is IOC */ + +/*The following types are defined*/ +#define SDR_DB_RECTYPE 0 /*Record types */ +#define SDR_DB_RECORDS 1 /*database records. index is type */ +#define SDR_DB_RECDES 2 /*Database Run Time Record Description */ +#define SDR_DB_PVD 3 /*Process Variable Directory */ +#define SDR_CHOICEGBL 4 /*Choice table. Global */ +#define SDR_CHOICECVT 5 /*Choice table. Convert */ +#define SDR_CHOICEREC 6 /*Choice table. Record Specific */ +#define SDR_CHOICEDEV 7 /*Choice table. Device Specific */ +#define SDR_DEVSUP 8 /*device support tables */ +#define SDR_CVTTABLE 9 /*breakpoint tables */ +#define SDR_DRVSUP 10 /*driver support tables */ +#define SDR_RECSUP 11 /*record support tables */ +#define SDR_ALLSUMS 12 /*special sum structure*/ +#define SDR_NTYPES SDR_ALLSUMS+1 + +/************************************************************************/ +#define S_sdr_notLoaded (M_sdr| 1) /*dbRecType.sdr not loaded*/ +#define S_sdr_noOpen (M_sdr| 3) /*Can't open file*/ +#define S_sdr_noRead (M_sdr| 5) /*read failure*/ +#define S_sdr_noMagic (M_sdr| 7) /*wrong magic number*/ +#define S_sdr_noRecDef (M_sdr| 9) /*undefined record type*/ +#define S_sdr_noAlloc (M_sdr|11) /*malloc error*/ +#define S_sdr_noReplace (M_sdr|13) /*Can't replace loaded SDR file*/ +#define S_sdr_seqLoad (M_sdr|15) /*dbRecType.sdr not first*/ +#define S_sdr_noSdrType (M_sdr|17) /*undefined sdr type*/ +#define S_sdr_sumError (M_sdr|19) /*sdrSum Error*/ + +#define SUM_LEN 50 +struct sdrSum { + char allSdrSums[SUM_LEN]; +}; + +#endif /*INCsdrHeader*/ diff --git a/src/db/Makefile.Unix b/src/db/Makefile.Unix deleted file mode 100644 index 134a470c7..000000000 --- a/src/db/Makefile.Unix +++ /dev/null @@ -1,45 +0,0 @@ -EPICS = ../../../.. -include Target.include -include $(EPICS)/config/CONFIG_BASE - -USR_LDLIBS = -lDb -lCom -lm -USR_LDFLAGS = -L. - -LEX = $(ELEX) -YACC = $(EYACC) -YACCOPT = -l -LEXOPT = -L - -DEPLIBS_BASE = $(EPICS_BASE_LIB) -DEPLIBS = ./libDb.a\ - $(DEPLIBS_BASE)/libCom.a -# $(DEPLIBS_BASE)/libDb.a - - -SRCS.c = \ - ../dbStaticLib.c \ - atdb_yacc.c \ - ../dbta.c \ - ../dbl.c \ - ../dbls.c - - -LIBOBJS = dbStaticLib.o - -LIBNAME = libDb.a - -PROD = atdb dbl dbls dbta - -include $(EPICS)/config/RULES.Unix - -atdb: atdb_yacc.o $(DEPLIBS) - $(LINK.c) -o $@ atdb_yacc.o $(LDLIBS) - -# Extra rule since atdb_lex.c is included in atdb_yacc.c -# In my opinion, these objects should really be built -# independently. -atdb_yacc.o: atdb_lex.c ../atdb.c - -clean:: - @$(RM) atdb_lex.c atdb_yacc.c - diff --git a/src/db/Makefile.Vx b/src/db/Makefile.Vx index d59e5beea..edfa9a9d2 100644 --- a/src/db/Makefile.Vx +++ b/src/db/Makefile.Vx @@ -5,18 +5,60 @@ include $(EPICS)/config/CONFIG_BASE USR_CFLAGS = -ansi VX_WARN_YES = -Wall -pedantic +MENUS += menuAlarmSevr.h +MENUS += menuAlarmStat.h +MENUS += menuArrType.h +MENUS += menuCompress.h +MENUS += menuFtype.h +MENUS += menuIvoa.h +MENUS += menuLinr.h +MENUS += menuOmsl.h +MENUS += menuPriority.h +MENUS += menuScan.h +MENUS += menuYesNo.h + +RECTYPES += dbCommon.h + SRCS.c = \ - ../dbAccess.c ../dbBkpt.c ../dbFastLinkConv.c ../dbLink.c \ - ../dbNotify.c ../dbStaticLib.c ../iocInit.c ../drvTS.c ../dbScan.c \ - ../dbEvent.c ../dbTest.c ../dbls.c ../db_access.c \ - ../db_test.c ../recGbl.c ../callback.c ../taskwd.c \ - ../dbCaLink.c ../dbCaDblink.c ../devLib.c ../initHooks.c ../cvtBpt.c + ../dbAccess.c\ + ../dbBkpt.c\ + ../dbConvert.c\ + ../dbFastLinkConv.c\ + ../dbNotify.c\ + ../iocInit.c\ + ../drvTS.c\ + ../dbScan.c \ + ../dbEvent.c\ + ../dbTest.c\ + ../db_access.c \ + ../db_test.c\ + ../recGbl.c\ + ../callback.c\ + ../taskwd.c \ + ../dbCaLink.c\ + ../dbCaDblink.c\ + ../devLib.c\ + ../initHooks.c LIBOBJS = \ - dbAccess.o dbBkpt.o dbFastLinkConv.o dbLink.o dbNotify.o \ - dbStaticLib.o iocInit.o drvTS.o dbScan.o dbEvent.o dbTest.o dbls.o \ - db_access.o db_test.o recGbl.o callback.o taskwd.o dbCaLink.o \ - dbCaDblink.o devLib.o cvtBpt.o + dbAccess.o\ + dbBkpt.o\ + dbConvert.o\ + dbFastLinkConv.o\ + dbNotify.o \ + iocInit.o\ + drvTS.o\ + dbScan.o\ + dbEvent.o\ + dbTest.o\ + db_access.o\ + db_test.o\ + recGbl.o\ + callback.o\ + taskwd.o\ + dbCaLink.o \ + dbCaDblink.o\ + devLib.o PROD = initHooks.o @@ -24,3 +66,13 @@ LIBNAME = dbLib include $(EPICS)/config/RULES.Vx +pre_build: $(INSTALL_REC)/dbCommon.ascii $(INSTALL_REC)/menuGlobal.ascii $(INSTALL_REC)/all.ascii + +$(INSTALL_REC)/dbCommon.h: ../dbCommonRecord.ascii + @echo "Installing $@" + @test -d $(INSTALL_REC) || mkdir $(INSTALL_REC) + @$(INSTALL) -m 644 $< $(INSTALL_REC) + cd $(INSTALL_REC); $(RM) $(notdir $@); \ + ../bin/$(HOST_ARCH)/dbAsciiToRecordtypeH $(notdir $<) + + diff --git a/src/db/all.ascii b/src/db/all.ascii new file mode 100644 index 000000000..6877a4e79 --- /dev/null +++ b/src/db/all.ascii @@ -0,0 +1,234 @@ +path "./base/rec" +include "menuGlobal.ascii" +include "menuConvert.ascii" +include "aiRecord.ascii" +#include "aaiRecord.ascii" +include "aoRecord.ascii" +#include "aaoRecord.ascii" +include "biRecord.ascii" +include "boRecord.ascii" +include "calcRecord.ascii" +include "compressRecord.ascii" +include "dfanoutRecord.ascii" +include "egRecord.ascii" +include "egeventRecord.ascii" +include "erRecord.ascii" +include "ereventRecord.ascii" +include "eventRecord.ascii" +include "fanoutRecord.ascii" +include "histogramRecord.ascii" +include "longinRecord.ascii" +include "longoutRecord.ascii" +include "mbbiRecord.ascii" +include "mbbiDirectRecord.ascii" +include "mbboRecord.ascii" +include "mbboDirectRecord.ascii" +include "permissiveRecord.ascii" +include "pidRecord.ascii" +include "pulseCounterRecord.ascii" +include "pulseDelayRecord.ascii" +include "pulseTrainRecord.ascii" +include "scanRecord.ascii" +include "selRecord.ascii" +include "seqRecord.ascii" +include "stateRecord.ascii" +include "steppermotorRecord.ascii" +include "stringinRecord.ascii" +include "stringoutRecord.ascii" +include "subRecord.ascii" +#include "gsubRecord.ascii" +#include "palRecord.ascii" +include "subArrayRecord.ascii" +include "timerRecord.ascii" +include "waitRecord.ascii" +include "waveformRecord.ascii" +device(ai,CONSTANT,devAiSoft,"Soft Channel") +device(ai,CONSTANT,devAiSoftRaw,"Raw Soft Channel") +device(ai,VME_IO,devAiXy566Se,"XYCOM-566 SE Scanned") +device(ai,VME_IO,devAiXy566Di,"XYCOM-566 Dif Scanned") +device(ai,VME_IO,devAiXy566DiL,"XYCOM-566 Dif Latched") +device(ai,VME_IO,devAiDvx2502,"DVX-2502") +device(ai,CONSTANT,devAiTestAsyn,"Test Asyn") +device(ai,CONSTANT,devAiSymb,"vxWorks Variable") +device(ai,AB_IO,devAiAb1771Il,"AB-1771IL-Analog In") +device(ai,AB_IO,devAiAb1771Ife,"AB-1771IFE") +device(ai,AB_IO,devAiAb1771Ixe,"AB-1771IXE-Millivolt In") +device(ai,AB_IO,devAiAb1771IfeSe,"AB-1771IFE-SE") +device(ai,AB_IO,devAiAb1771IfeMa,"AB-1771IFE-4to20MA") +device(ai,AB_IO,devAiAb1771Ife0to5V,"AB-1771IFE-0to5Volt") +device(ai,AB_IO,devAiAb1771IrPlatinum,"AB-1771RTD-Platinum") +device(ai,AB_IO,devAiAb1771IrCopper,"AB-1771RTD-Copper") +#device(ai,CAMAC_IO,devAiCamac,"Camac") +device(ai,VME_IO,devAiAt5Vxi,"VXI-AT5-AI") +#device(ai,GPIB_IO,devAiK486Gpib,"Keithley-486") +#device(ai,VME_IO,devAiKscV215,"KSC-V215") +device(ai,VME_IO,devAiSysmon,"SYSMON") +#device(aai,CAMAC_IO,devAaiCamac,"Camac") +device(ao,CONSTANT,devAoSoft,"Soft Channel") +device(ao,CONSTANT,devAoSoftRaw,"Raw Soft Channel") +device(ao,VME_IO,devAoVmiVme4100,"VMIVME-4100") +device(ao,CONSTANT,devAoTestAsyn,"Test Asyn") +device(ao,CONSTANT,devAoSymb,"vxWorks Variable") +device(ao,AB_IO,devAoAb1771Ofe,"AB-1771OFE") +#device(ao,CAMAC_IO,devAoCamac,"Camac") +device(ao,VME_IO,devAoAt5Vxi,"VXI-AT5-AO") +device(bi,CONSTANT,devBiSoft,"Soft Channel") +device(bi,CONSTANT,devBiSoftRaw,"Raw Soft Channel") +device(bi,VME_IO,devBiMpv910,"MPV-910") +device(bi,VME_IO,devBiXVme210,"XVME-210") +device(bi,CONSTANT,devBiTestAsyn,"Test Asyn") +device(bi,AB_IO,devBiAb,"AB-Binary Input") +device(bi,AB_IO,devBiAb16,"AB-16 bit BI") +device(bi,AB_IO,devBiAb32,"AB-32 bit BI") +#device(bi,CAMAC_IO,devBiCamac,"Camac") +device(bi,VME_IO,devBiAt5Vxi,"VXI-AT5-BI") +#device(bi,VME_IO,devBiXy240,"XYCOM-240") +device(bi,VME_IO,devBiHpe1368a,"VXI-HPE1368-VS") +#device(bi,VME_IO,devBiAt8Fp,"AT8-FP10S") +device(bi,VME_IO,devBiAvme9440,"AVME9440 I") +device(bi,VME_IO,devBiSysmon,"SYSMON") +device(bi,VME_IO,devBiMpc,"MPC") +device(bo,CONSTANT,devBoSoft,"Soft Channel") +device(bo,CONSTANT,devBoSoftRaw,"Raw Soft Channel") +device(bo,VME_IO,devBoMpv902,"MPV-902") +device(bo,VME_IO,devBoXVme220,"XVME-220") +device(bo,CONSTANT,devBoTestAsyn,"Test Asyn") +device(bo,AB_IO,devBoAb,"AB-Binary Output") +device(bo,AB_IO,devBoAb16,"AB-16 bit BO") +device(bo,AB_IO,devBoAb32,"AB-32 bit BO") +#device(bo,CAMAC_IO,devBoCamac,"Camac") +device(bo,VME_IO,devBoAt5Vxi,"VXI-AT5-BO") +#device(bo,GPIB_IO,devBoK486Gpib,"Keithley-486") +#device(bo,VME_IO,devBoXy240,"XYCOM-240") +device(bo,VME_IO,devBoHpe1368a,"VXI-HPE1368-VS") +#device(bo,VME_IO,devBoAt8Fp,"AT8-FP10S") +device(bo,VME_IO,devBoAvme9440,"AVME9440 O") +device(bo,VME_IO,devBoSysmon,"SYSMON") +device(bo,VME_IO,devBoMpc,"MPC") +device(event,CONSTANT,devEventSoft,"Soft Channel") +device(event,VME_IO,devEventMz8310,"Mizar-8310") +device(event,CONSTANT,devEventTestIoEvent,"Test IoEvent") +device(event,VME_IO,devErEpicsEvent,"APS event receiver") +device(histogram,CONSTANT,devHistogramSoft,"Soft Channel") +device(histogram,CONSTANT,devHistogramTestAsyn,"Test Asyn") +device(longin,CONSTANT,devLiSoft,"Soft Channel") +device(longin,CONSTANT,devLiSymb,"vxWorks Variable") +#device(longin,CAMAC_IO,devLiCamac,"Camac") +device(longout,CONSTANT,devLoSoft,"Soft Channel") +device(longout,CONSTANT,devLoSymb,"vxWorks Variable") +#device(longout,CAMAC_IO,devLoCamac,"Camac") +device(mbbi,CONSTANT,devMbbiSoft,"Soft Channel") +device(mbbi,CONSTANT,devMbbiSoftRaw,"Raw Soft Channel") +device(mbbi,VME_IO,devMbbiMpv910,"MPV-910") +device(mbbi,VME_IO,devMbbiXVme210,"XVME-210") +device(mbbi,CONSTANT,devMbbiTestAsyn,"Test Asyn") +device(mbbi,AB_IO,devMbbiAb,"AB-Binary Input") +device(mbbi,AB_IO,devMbbiAb16,"AB-16 bit BI") +device(mbbi,AB_IO,devMbbiAb32,"AB-32 bit BI") +device(mbbi,AB_IO,devMbbiAbAdapterStat,"AB-Adapter Status") +device(mbbi,AB_IO,devMbbiAbCardStat,"AB-Card Status") +#device(mbbi,CAMAC_IO,devMbbiCamac,"Camac") +device(mbbi,VME_IO,devMbbiAt5Vxi,"VXI-AT5-BI") +#device(mbbi,VME_IO,devMbbiXy240,"XYCOM-240") +device(mbbi,VME_IO,devMbbiHpe1368a,"VXI-HPE1368-VS") +#device(mbbi,VME_IO,devMbbiAt8Fp,"AT8-FP10S") +device(mbbi,VME_IO,devMbbiAvme9440,"AVME9440 I") +device(mbbi,VME_IO,devMbbiSysmon,"SYSMON") +device(mbbiDirect,CONSTANT,devMbbiDirectSoft,"Soft Channel") +device(mbbiDirect,CONSTANT,devMbbiDirectSoftRaw,"Raw Soft Channel") +device(mbbiDirect,VME_IO,devMbbiDirectMpv910,"MPV-910") +device(mbbiDirect,VME_IO,devMbbiDirectXVme210,"XVME-210") +device(mbbiDirect,AB_IO,devMbbiDirectAb,"AB-Binary Input") +device(mbbiDirect,AB_IO,devMbbiDirectAb16,"AB-16 bit BI") +device(mbbiDirect,AB_IO,devMbbiDirectAb32,"AB-32 bit BI") +#device(mbbiDirect,CAMAC_IO,devMbbiDirectCamac,"Camac") +device(mbbiDirect,VME_IO,devMbbiDirectAt5Vxi,"VXI-AT5-BI") +device(mbbo,CONSTANT,devMbboSoft,"Soft Channel") +device(mbbo,CONSTANT,devMbboSoftRaw,"Raw Soft Channel") +device(mbbo,VME_IO,devMbboMpv902,"MPV-902") +device(mbbo,VME_IO,devMbboXVme220,"XVME-220") +device(mbbo,CONSTANT,devMbboTestAsyn,"Test Asyn") +device(mbbo,AB_IO,devMbboAb,"AB-Binary Output") +device(mbbo,AB_IO,devMbboAb16,"AB-16 bit BO") +device(mbbo,AB_IO,devMbboAb32,"AB-32 bit BO") +device(mbbo,VME_IO,devMbboAt5Vxi,"VXI-AT5-BO") +#device(mbbo,GPIB_IO,devMbboK486Gpib,"Keithley-486") +#device(mbbo,VME_IO,devMbboXy240,"XYCOM-240") +device(mbbo,VME_IO,devMbboHpe1368a,"VXI-HPE1368-VS") +#device(mbbo,VME_IO,devMbboAt8Fp,"AT8-FP10S") +device(mbbo,VME_IO,devMbboAvme9440,"AVME9440 O") +device(mbbo,VME_IO,devMbboSysmon,"SYSMON") +device(mbboDirect,CONSTANT,devMbboDirectSoft,"Soft Channel") +device(mbboDirect,CONSTANT,devMbboDirectSoftRaw,"Raw Soft Channel") +device(mbboDirect,VME_IO,devMbboDirectMpv902,"MPV-902") +device(mbboDirect,VME_IO,devMbboDirectXVme220,"XVME-220") +device(mbboDirect,AB_IO,devMbboDirectAb,"AB-Binary Output") +device(mbboDirect,AB_IO,devMbboDirectAb16,"AB-16 bit BO") +device(mbboDirect,AB_IO,devMbboDirectAb32,"AB-32 bit BO") +#device(mbboDirect,CAMAC_IO,devMbboDirectCamac,"Camac") +device(mbboDirect,VME_IO,devMbboDirectAt5Vxi,"VXI-AT5-BO") +device(pulseCounter,VME_IO,devPcMz8310,"Mizar-8310") +device(pulseDelay,VME_IO,devPdMz8310,"Mizar-8310") +device(pulseDelay,VXI_IO,devPdVxiTDM,"VXI Time Delay Module") +device(pulseTrain,CONSTANT,devPtSoft,"Soft Channel") +device(pulseTrain,VME_IO,devPtMz8310,"Mizar-8310") +device(steppermotor,VME_IO,devSmCompumotor1830,"Compumotor 1830") +device(steppermotor,VME_IO,devSmOms6Axis,"OMS 6-Axis") +device(stringin,CONSTANT,devSiSoft,"Soft Channel") +device(stringin,CONSTANT,devSiTestAsyn,"Test Asyn") +device(stringin,CONSTANT,devSiSymb,"vxWorks Variable") +device(stringout,CONSTANT,devSoSoft,"Soft Channel") +device(stringout,CONSTANT,devSoTestAsyn,"Test Asyn") +device(stringout,CONSTANT,devSoSymb,"vxWorks Variable") +device(subArray,CONSTANT,devSASoft,"Soft Channel") +device(timer,VME_IO,devTmMizar8310,"Mizar-8310") +device(timer,VME_IO,devTmDg535,"DG 535") +device(timer,VME_IO,devTmAt5Vxi,"VXI-AT5-TIME") +device(waveform,CONSTANT,devWfSoft,"Soft Channel") +device(waveform,VME_IO,devWfXy566Sc,"XYCOM-566 Single Channel") +device(waveform,VME_IO,devWfComet,"Comet Digitizer") +device(waveform,VME_IO,devWfJoergerVtr1,"Joerger Digitizer") +device(waveform,CONSTANT,devWfTestAsyn,"Test Asyn") +device(waveform,VME_IO,devWfDvx2502,"DVX-2502") +device(waveform,VME_IO,devWfPentek4261,"Pentek 4261") +#device(waveform,CAMAC_IO,devWfCamac,"Camac") +#device(waveform,VME_IO,devWfJoergerVtr1,"Joerger-VTR1") +#device(waveform,VME_IO,devWfComet,"Omnibyte-COMET") +device(eg,VME_IO,devEg,"APS event generator G") +device(egevent,VME_IO,devEgEvent,"APS event generator E") +device(er,VME_IO,devEr,"APS event receiver") +device(erevent,VME_IO,devErevent,"APS event receiver") +device(wait,CONSTANT,devWaitIoEvent,"Soft Channel") +#device(ai,INST_IO,devAiCan,"CANbus") +#device(ao,INST_IO,devAoCan,"CANbus") +#device(bi,INST_IO,devBiCan,"CANbus") +#device(bo,INST_IO,devBoCan,"CANbus") +#device(mbbi,INST_IO,devMbbiCan,"CANbus") +#device(mbbo,INST_IO,devMbboCan,"CANbus") +#device(mbbiDirect,INST_IO,devMbbiDirectCan,"CANbus") +#device(mbboDirect,INST_IO,devMbboDirectCan,"CANbus") +driver(drvXy010) +driver(drvVxi) +driver(drvGpib) +driver(drvBitBus) +driver(drvBb910) +driver(drvXy210) +driver(drvBb902) +driver(drvXy220) +driver(drvXy566) +driver(drvDvx) +driver(drvVmi4100) +driver(drvAb) +driver(drvAt5Vxi) +driver(drvCompuSm) +driver(drvOms) +driver(drvMz8310) +driver(drvHpe1368a) +#driver(drvXy240) +#driver(drvKscV215) +#driver(drvComet) +#driver(drvJgvtr1) +#driver(drvFp) +#driver(drvFpm) +#driver(drvIpac) +#driver(drvTip810) diff --git a/src/db/atdb_lex.l b/src/db/atdb_lex.l deleted file mode 100644 index 8cc5b4fc6..000000000 --- a/src/db/atdb_lex.l +++ /dev/null @@ -1,34 +0,0 @@ -b [a-zA-Z0-9_] -a [ \t] -d [a-zA-Z0-9_\,\./\*#\[\]%:;!|\'\-&\(\)@\?\+<>=$\^\~] - -%{ - -yyreset() -{ - line_num=1; - BEGIN INITIAL; - return(0); -} - -%} - -%% - -^[A-Z0-9_]+ { yylval.Str=(char *)malloc(strlen(yytext)+1); - strcpy(yylval.Str,yytext); - return(FIELD); } - -^"PV:" { return(PV); } -"Type:" { return(TYPE); } -" " { return(CLOSE); } -"$$end" { return(CLOSE); } - -{d}+ { yylval.Str=(char *)malloc(strlen(yytext)+1); - strcpy(yylval.Str,yytext); - return(WORD); } - -. ; -\n { line_num++; } - -%% diff --git a/src/db/atdb_yacc.y b/src/db/atdb_yacc.y deleted file mode 100644 index ad92bae3c..000000000 --- a/src/db/atdb_yacc.y +++ /dev/null @@ -1,135 +0,0 @@ -%{ -#include -#include -#include -static int yy_start; -#include -/* kludge for buggy lex/yacc. exploits the fact that we know the union */ -/* below will be given the name YYSTYPE. done so that ifndef YYSTYPE */ -/* (as it appears in pdb.c) fails */ -#define YYSTYPE OUR_YYSTYPE -int line_num; - -extern DBENTRY *pdbentry; -char rectype[100]; -char recname[100]; - -char curr_field[10]; -char curr_value[200]; -char message[200]; -long status; - -#ifdef __STDC__ -static void printMessage(char *mess) { -#else -static void printMessage(mess) -char *mess; -{ -#endif /*__STDC__*/ - - sprintf(message,"%s Error near line %d Type: %s Name: %s Field: %s Value: %s", - mess,line_num,rectype,recname,curr_field,curr_value); - errMessage(status,message); -} -%} - -%start conv - -%token WORD -%token FIELD -%token TYPE -%token PV CLOSE - -%union -{ - int Int; - char Char; - char *Str; - double Real; -} - -%% - -conv: things - ; - -things: - | things thing - ; - -thing: header fields CLOSE - | header CLOSE - | junko - ; - -header: PV WORD TYPE WORD WORD -{ - strcpy(rectype,$4); - strcpy(recname,$2); - status = dbFindRecdes(pdbentry,rectype); - if(status) printMessage("dbFindRecdes"); - status = dbCreateRecord(pdbentry,recname); - if(status) printMessage("dbCreateRecord"); -} - -header: PV WORD TYPE WORD -{ - strcpy(rectype,$4); - strcpy(recname,$2); - status = dbFindRecdes(pdbentry,rectype); - if(status) printMessage("dbFindRecdes"); - status = dbCreateRecord(pdbentry,recname); - if(status) printMessage("dbCreateRecord"); -} - -fields: field - | fields field - ; - -field: f_name words -{ - status = dbPutString(pdbentry,curr_value); - if(status) printMessage("dbPutString"); -} - ; - -f_name: FIELD -{ - - curr_value[0]='\0'; - strcpy(curr_field,$1); - status = dbFindField(pdbentry,$1); - if(status) printMessage("dbFindField"); -} - ; - -words: - | words WORD -{ - char* p; - /* pretty crappy stuff */ - if((p=strstr($2,".PP.MS"))) {p[0]=' ';p[3]=' ';} - else if((p=strstr($2,".PP.NMS"))) {p[0]=' ';p[3]=' ';} - else if((p=strstr($2,".NPP.MS"))) {p[0]=' ';p[4]=' ';} - else if((p=strstr($2,".NPP.NMS"))) {p[0]=' ';p[4]=' ';} - else if(strlen(curr_value)>(size_t)0) { strcat(curr_value," "); } - strcat(curr_value,$2); -} - ; - -junko: WORD - | CLOSE - ; - -%% - -#include "atdb_lex.c" - -yyerror(str) -char *str; -{ - sprintf(message,"Error line %d : %s %s\n",line_num, yytext,str); - errMessage(-1,message); -} - -#include "atdb.c" diff --git a/src/db/callback.c b/src/db/callback.c index 768752fb7..55e0ad10c 100644 --- a/src/db/callback.c +++ b/src/db/callback.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #define QUEUESIZE 1000 @@ -169,14 +170,16 @@ static void wdCallback(long ind) static void ProcessCallback(CALLBACK *pCallback) { - struct dbCommon *pRec; + dbCommon *pRec = NULL; + struct rset *prset = (struct rset *)pRec->rset; callbackGetUser(pRec, pCallback); dbScanLock(pRec); - ((struct rset*)(pRec->rset))->process(pRec); + (*prset->process)(pRec); dbScanUnlock(pRec); } -void callbackRequestProcessCallback(CALLBACK *pCallback, int Priority, void *pRec) +void callbackRequestProcessCallback(CALLBACK *pCallback, + int Priority, void *pRec) { callbackSetCallback(ProcessCallback, pCallback); callbackSetPriority(Priority, pCallback); diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index 18da4c8b8..593992595 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -49,22 +49,9 @@ * .18 03-18-94 mcn Split dbAccess.c into dbAccess.c and dbLink.c * .19 03-18-94 mcn Added breakpoint capability * .20 03-18-94 mcn Added comments/whitespace + * .21 10-20-95 mrk Combined dbAccess and dbLink; Created dbConvert */ -/* This is a major revision of the original implementation of database access.*/ - -/* Global Database Access Routines - * - * dbCommonInit Initialize dbCommon - * - * dbScanLock Lock for scanning records - * dbScanUnlock Unlock for scanning records - * dbScanLockInit Initialize scan lock - * - * dbScanPassive process if record is passively scanned - * dbProcess process a database record - * dbNameToAddr Given "pv<.field>" compute dbAddr - */ #include #include @@ -79,35 +66,32 @@ #include #include #include -#include #include #include #include -#include #include +#include +#include #include #include #include -#include -#include #include #include #include #include +#include #include #include extern struct dbBase *pdbBase; extern long lset_stack_not_empty; -static short mapDBFToDBR[DBF_NTYPES] = { DBF_STRING, DBF_CHAR, DBF_UCHAR, DBF_SHORT, DBF_USHORT, - DBF_LONG, DBF_ULONG, DBF_FLOAT, DBF_DOUBLE, DBF_ENUM, DBF_ENUM, DBF_ENUM, DBF_ENUM, DBF_ENUM, - DBF_NOACCESS, DBF_NOACCESS, DBF_NOACCESS, DBF_NOACCESS}; - -/* Added for Channel Access Links */ -long dbCaAddInlink(); -long dbCaGetLink(); -long dbCommonInit(); +static short mapDBFToDBR[DBF_NTYPES] = { + DBR_STRING, DBR_CHAR, DBR_UCHAR, DBR_SHORT, DBR_USHORT, + DBR_LONG, DBR_ULONG, DBR_FLOAT, DBR_DOUBLE, + DBR_ENUM, DBR_ENUM, DBR_ENUM, + DBR_NOACCESS, DBR_NOACCESS, DBR_NOACCESS, DBR_NOACCESS +}; /* * The number of consecutive attempts that can be made to process an @@ -131,18 +115,28 @@ struct scanLock { int task_id; }; -/* - * Structure that contains private information about the record - * locking mechanism. It stores the total number of locksets - * in the database (computed by iocInit). It also contains - * a pointer to the allocated array of all the scanLock - * structures. - */ static struct { int nset; /* Number of sets */ struct scanLock *pscanLock; /*addr of array of struct scanLock */ } dbScanPvt; +struct rset *dbGetRset(struct dbAddr *paddr) +{ + return(((struct dbFldDes *)paddr->pfldDes)->pdbRecDes->prset); +} + +int dbIsValueField(struct dbFldDes *pdbFldDes) +{ + if(pdbFldDes->pdbRecDes->indvalFlddes == pdbFldDes->indRecDes) + return(TRUE); + else + return(FALSE); +} + +int dbGetFieldIndex(struct dbAddr *paddr) +{ + return(((struct dbFldDes *)paddr->pfldDes)->indRecDes); +} /* * Initialize the record's dbCommon structure. @@ -150,7 +144,7 @@ static struct { * common to all record types. These fields serve * as a header to each record's structure. */ -long dbCommonInit(struct dbCommon *precord, int pass) +long dbCommonInit(dbCommon *precord, int pass) { long status; @@ -162,15 +156,15 @@ long dbCommonInit(struct dbCommon *precord, int pass) * processed if the value retrieved through this link * is equal to constant set in the record's disv field. */ - status = recGblInitFastInLink(&(precord->sdis), (void *) precord, DBF_SHORT, "DISA"); - + status = recGblInitFastInLink(&(precord->sdis), + (void *) precord, DBF_SHORT, "DISA"); if (status) recGblRecordError(status, (void *) precord, "dbCommonInit: SDIS"); - /* * Initialize the time stamp link. */ - status = recGblInitFastInLink(&(precord->tsel), (void *) precord, DBF_SHORT, "TSE"); + status = recGblInitFastInLink(&(precord->tsel), + (void *) precord, DBF_SHORT, "TSE"); if (status) recGblRecordError(status, (void *)precord, "dbCommonInit: TSEL"); @@ -178,15 +172,10 @@ long dbCommonInit(struct dbCommon *precord, int pass) return(0); } /* end dbCommonInit() */ -/* - * Wait on a semaphore for access to the record's lockset. - * A lockset should be locked for actions including but - * not limited to database processing. - */ -void dbScanLock(struct dbCommon *precord) +void dbScanLock(dbCommon *precord) { struct scanLock *pscanLock; - short lset=((struct dbCommon *)precord)->lset - 1; + short lset=((dbCommon *)precord)->lset - 1; /* Move range check to iocInit */ if(lset < 0 || lset >= dbScanPvt.nset) { @@ -201,14 +190,10 @@ void dbScanLock(struct dbCommon *precord) return; } -/* - * Unlock the semaphore. Allow other processes to perform - * operations on the records within the lockset. - */ -void dbScanUnlock(struct dbCommon *precord) +void dbScanUnlock(dbCommon *precord) { struct scanLock *pscanLock; - short lset=((struct dbCommon *)precord)->lset - 1; + short lset=((dbCommon *)precord)->lset - 1; /* Put check in iocInit() */ if(lset<0 || lset>=dbScanPvt.nset) { @@ -221,9 +206,6 @@ void dbScanUnlock(struct dbCommon *precord) return; } -/* - * Initialize the locking mechanism for all locksets. - */ void dbScanLockInit(int nset) { struct scanLock *pscanLock; @@ -258,7 +240,7 @@ void dbScanLockInit(int nset) * Will notify if processing is complete by callback. * (only if you are interested in completion) */ -long dbScanPassive(struct dbCommon *pfrom, struct dbCommon *pto) +long dbScanPassive(dbCommon *pfrom, dbCommon *pto) { long status; @@ -271,7 +253,7 @@ long dbScanPassive(struct dbCommon *pfrom, struct dbCommon *pto) } /*KLUDGE: Following needed so that dbPutLink to PROC field works correctly*/ -long dbScanLink(struct dbCommon *pfrom, struct dbCommon *pto) +long dbScanLink(dbCommon *pfrom, dbCommon *pto) { long status; @@ -285,12 +267,11 @@ long dbScanLink(struct dbCommon *pfrom, struct dbCommon *pto) * 1. Check for breakpoints. * 2. Check the process active flag (PACT). * 3. Check the disable link. - * 4. Check the RSET (record support entry table) exists.(PUT THIS IN IOCIN -IT) + * 4. Check the RSET (record support entry table) exists. * 5. Run the process routine specific to the record type. * 6. Check to see if record contents should be automatically printed. */ -long dbProcess(struct dbCommon *precord) +long dbProcess(dbCommon *precord) { struct rset *prset; unsigned char tpro=precord->tpro; @@ -365,7 +346,8 @@ long dbProcess(struct dbCommon *precord) * processed if the value retrieved through this link * is equal to constant set in the record's disv field. */ - status = recGblGetFastLink(&(precord->sdis), (void *)precord, &(precord->disa)); + status = recGblGetFastLink(&(precord->sdis), + (void *)precord, &(precord->disa)); /* if disabled check disable alarm severity and return success */ if (precord->disa == precord->disv) { @@ -444,17 +426,16 @@ all_done: * Returns error codes from StaticLib module, not * from dbAccess. */ -long dbNameToAddr(char *pname,struct dbAddr *paddr) +long dbNameToAddr(char *pname,DBADDR *paddr) { DBENTRY dbEntry; long status=0; struct rset *prset; - struct fldDes *pflddes; + dbFldDes *pflddes; dbInitEntry(pdbBase,&dbEntry); if(status = dbFindRecord(&dbEntry,pname)) return(status); paddr->precord = dbEntry.precnode->precord; - paddr->record_type = dbEntry.record_type; if(!dbEntry.pfield) { if(status=dbFindField(&dbEntry,"VAL"))return(status); } @@ -464,7 +445,6 @@ long dbNameToAddr(char *pname,struct dbAddr *paddr) paddr->field_type = pflddes->field_type; paddr->dbr_field_type = mapDBFToDBR[pflddes->field_type]; paddr->field_size = pflddes->size; - paddr->choice_set = pflddes->choice_set; paddr->special = pflddes->special; /*if special is SPC_DBADDR then call cvt_dbaddr */ @@ -472,52 +452,56 @@ long dbNameToAddr(char *pname,struct dbAddr *paddr) /*field_size,and special*/ paddr->no_elements=1; if( ((paddr->special)==SPC_DBADDR) - && (prset=GET_PRSET(pdbBase->precSup,paddr->record_type)) + && (prset=dbGetRset(paddr)) && (prset->cvt_dbaddr) ) status = (*prset->cvt_dbaddr)(paddr); return(status); } + +long dbValueSize( + short dbr_type +) +{ + /* sizes for value associated with each DBR request type */ + static long size[] = { + MAX_STRING_SIZE, /* STRING */ + sizeof(char), /* CHAR */ + sizeof(unsigned char), /* UCHAR */ + sizeof(short), /* SHORT */ + sizeof(unsigned short), /* USHORT */ + sizeof(long), /* LONG */ + sizeof(unsigned long), /* ULONG */ + sizeof(float), /* FLOAT */ + sizeof(double), /* DOUBLE */ + sizeof(unsigned short)}; /* ENUM */ -/* - * Fast Database Links - * - * Currently, single-valued GET links have improved by a factor of 4, - * and PUT links by a factor of 2. - * - * The check for CONSTANT links is done in recSup.h with macros. This - * removes an expensive subroutine call when it is not necessary to - * call one. This is a performance improvement over all of record - * support. - * - * Wish List -- - * - * 1. CA optimizations ? - * 2. Array Support. - * 3. Support something with the same callable interface as dbGetLink() - * and dbPutLink() that would interact with channel access (and - * support OPTIONS for instance ...). - * - * CA/Arrays - can also be set as different "flavor" functions - * by adding another function to the link structure, then - * recGblInitFastInLink() or recGblInitFastOutLink() can figure - * out which "flavor" of the put or get to use. - * - * Arrays can be efficiently supported by providing conversion - * routines suited for them. - * - * Flavor functions would also be able to improve the performance of - * both GET and PUT db_links more, since checking for PP/MS etc. - * will no longer be necessary. - * - * If 2,3 are granted, it is almost possible to replace all the - * functionality of previous link routines in dbLink.c with - * dbFastLink.c and dbFastLinkConv.c. And the code will be - * smaller, easier to understand, more maintainable, and more - * efficient. - */ - + return(size[dbr_type]); +} + +long dbBufferSize( + short dbr_type, + long options, + long no_elements +) +{ + long nbytes=0; + nbytes += dbValueSize(dbr_type) * no_elements; + if(options & DBR_STATUS) nbytes += dbr_status_size; + if(options & DBR_UNITS) nbytes += dbr_units_size; + if(options & DBR_PRECISION) nbytes += dbr_precision_size; + if(options & DBR_TIME) nbytes += dbr_time_size; + if(options & DBR_ENUM_STRS) nbytes += dbr_enumStrs_size; + if(options & DBR_GR_LONG) nbytes += dbr_grLong_size; + if(options & DBR_GR_DOUBLE) nbytes += dbr_grDouble_size; + if(options & DBR_CTRL_LONG) nbytes += dbr_ctrlLong_size; + if(options & DBR_CTRL_DOUBLE)nbytes += dbr_ctrlDouble_size; + if(options & DBR_AL_LONG) nbytes += dbr_alLong_size; + if(options & DBR_AL_DOUBLE) nbytes += dbr_alDouble_size; + return(nbytes); +} + /* * Get value through fast input link. * @@ -529,7 +513,7 @@ long dbNameToAddr(char *pname,struct dbAddr *paddr) */ long dbFastLinkGet( struct link *plink, - struct dbCommon *precord, + dbCommon *precord, void *pdest) { long status = 0; @@ -545,7 +529,7 @@ long dbFastLinkGet( } else { struct db_link *pdb_link = &(plink->value.db_link); - struct dbAddr *pdb_addr = (struct dbAddr *) (pdb_link->pdbAddr); + DBADDR *pdb_addr = (DBADDR *) (pdb_link->pdbAddr); if (pdb_link->process_passive) { status = dbScanPassive(precord, pdb_addr->precord); @@ -569,7 +553,350 @@ long dbFastLinkGet( precord->pact = pact; return(status); } + +long dbGetField( +DBADDR *paddr, +short dbrType, +void *pbuffer, +long *options, +long *nRequest, +void *pflin +) +{ + dbCommon *precord = (dbCommon *)(paddr->precord); + long status; + dbScanLock(precord); + status = dbGet(paddr,dbrType,pbuffer,options,nRequest,pflin); + dbScanUnlock(precord); + return(status); +} + +long dbGetLink( + struct db_link *pdblink, + dbCommon *pdest, + short dbrType, + void *pbuffer, + long *options, + long *nRequest +) +{ + DBADDR *paddr=(DBADDR*)(pdblink->pdbAddr); + dbCommon *psource=paddr->precord; + long status; + + if(pdblink->process_passive && psource->scan==0) { + status=dbScanPassive(pdest,psource); + if(status) return(status); + } + if(pdblink->maximize_sevr) recGblSetSevr(pdest,LINK_ALARM,psource->sevr); + + status= dbGet(paddr,dbrType,pbuffer,options,nRequest,NULL); + if(status) recGblRecordError(status,(void *)pdest,"dbGetLink"); + return(status); +} + +static void get_enum_strs(DBADDR *paddr,void **ppbuffer, + struct rset *prset,long *options) +{ + short field_type=paddr->field_type; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbMenu *pdbMenu; + dbDeviceMenu *pdbDeviceMenu; + char **papChoice; + unsigned long no_str; + char *ptemp; + struct dbr_enumStrs *pdbr_enumStrs=(struct dbr_enumStrs*)(*ppbuffer); + int i; + + memset(pdbr_enumStrs,'\0',dbr_enumStrs_size); + switch(field_type) { + case DBF_ENUM: + if( prset && prset->get_enum_strs ) { + (*prset->get_enum_strs)(paddr,pdbr_enumStrs); + } else { + *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ + } + break; + case DBF_MENU: + pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + no_str = pdbMenu->nChoice; + papChoice= pdbMenu->papChoiceValue; + goto choice_common; + case DBF_DEVICE: + pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + no_str = pdbDeviceMenu->nChoice; + papChoice = pdbDeviceMenu->papChoice; + goto choice_common; +choice_common: + i = sizeof(pdbr_enumStrs->strs)/ + sizeof(pdbr_enumStrs->strs[0]); + if(ino_str = no_str; + ptemp = &(pdbr_enumStrs->strs[0][0]); + for (i=0; istrs[0])); + *(ptemp+sizeof(pdbr_enumStrs->strs[0])-1) = 0; + } + ptemp += sizeof(pdbr_enumStrs->strs[0]); + } + break; + default: + *options = (*options)^DBR_ENUM_STRS;/*Turn off option*/ + break; + } + *ppbuffer = ((char *)*ppbuffer) + dbr_enumStrs_size; + return; +} + +static void get_graphics(DBADDR *paddr,void **ppbuffer, + struct rset *prset,long *options) +{ + struct dbr_grDouble grd; + int got_data=FALSE; + + if( prset && prset->get_graphic_double ) { + (*prset->get_graphic_double)(paddr,&grd); + got_data=TRUE; + } + if( (*options) & (DBR_GR_LONG) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_grLong *pgr=(struct dbr_grLong*)pbuffer; + pgr->upper_disp_limit = grd.upper_disp_limit; + pgr->lower_disp_limit = grd.lower_disp_limit; + } else { + memset(pbuffer,'\0',dbr_grLong_size); + *options = (*options) ^ DBR_GR_LONG; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_grLong_size; + } + if( (*options) & (DBR_GR_DOUBLE) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_grDouble *pgr=(struct dbr_grDouble*)pbuffer; + pgr->upper_disp_limit = grd.upper_disp_limit; + pgr->lower_disp_limit = grd.lower_disp_limit; + } else { + memset(pbuffer,'\0',dbr_grDouble_size); + *options = (*options) ^ DBR_GR_DOUBLE; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_grDouble_size; + } + return; +} + +static void get_control(DBADDR *paddr,void **ppbuffer, + struct rset *prset,long *options) +{ + struct dbr_ctrlDouble ctrld; + int got_data=FALSE; + + if( prset && prset->get_control_double ) { + (*prset->get_control_double)(paddr,&ctrld); + got_data=TRUE; + } + if( (*options) & (DBR_CTRL_LONG) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_ctrlLong *pctrl=(struct dbr_ctrlLong*)pbuffer; + pctrl->upper_ctrl_limit = ctrld.upper_ctrl_limit; + pctrl->lower_ctrl_limit = ctrld.lower_ctrl_limit; + } else { + memset(pbuffer,'\0',dbr_ctrlLong_size); + *options = (*options) ^ DBR_CTRL_LONG; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlLong_size; + } + if( (*options) & (DBR_CTRL_DOUBLE) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_ctrlDouble *pctrl=(struct dbr_ctrlDouble*)pbuffer; + pctrl->upper_ctrl_limit = ctrld.upper_ctrl_limit; + pctrl->lower_ctrl_limit = ctrld.lower_ctrl_limit; + } else { + memset(pbuffer,'\0',dbr_ctrlDouble_size); + *options = (*options) ^ DBR_CTRL_DOUBLE; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_ctrlDouble_size; + } + return; +} + +static void get_alarm(DBADDR *paddr,void **ppbuffer, + struct rset *prset,long *options) +{ + struct dbr_alDouble ald; + int got_data=FALSE; + + if( prset && prset->get_alarm_double ) { + (*prset->get_alarm_double)(paddr,&ald); + got_data=TRUE; + } + if( (*options) & (DBR_AL_LONG) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_alLong *pal=(struct dbr_alLong*)pbuffer; + pal->upper_alarm_limit = ald.upper_alarm_limit; + pal->upper_warning_limit = ald.upper_warning_limit; + pal->lower_warning_limit = ald.lower_warning_limit; + pal->lower_alarm_limit = ald.lower_alarm_limit; + } else { + memset(pbuffer,'\0',dbr_alLong_size); + *options = (*options) ^ DBR_AL_LONG; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_alLong_size; + } + if( (*options) & (DBR_AL_DOUBLE) ) { + char *pbuffer=*ppbuffer; + + if(got_data) { + struct dbr_alDouble *pal=(struct dbr_alDouble*)pbuffer; + pal->upper_alarm_limit = ald.upper_alarm_limit; + pal->upper_warning_limit = ald.upper_warning_limit; + pal->lower_warning_limit = ald.lower_warning_limit; + pal->lower_alarm_limit = ald.lower_alarm_limit; + } else { + memset(pbuffer,'\0',dbr_alDouble_size); + *options = (*options) ^ DBR_AL_DOUBLE; /*Turn off option*/ + } + *ppbuffer = ((char *)*ppbuffer) + dbr_alDouble_size; + } + return; +} + +long dbGet( +DBADDR *paddr, +short dbrType, +void *pbuffer, +long *options, +long *nRequest, +void *pflin +) +{ + db_field_log *pfl= (db_field_log *)pflin; + long no_elements=paddr->no_elements; + long offset; + struct rset *prset; + short field_type=paddr->field_type; + long (*pconvert_routine)(); + dbCommon *pcommon; + long status; + long *perr_status=NULL; + + + prset=dbGetRset(paddr); + + if(!(*options)) goto GET_DATA; + + /* Process options */ + pcommon = (dbCommon *)(paddr->precord); + if( (*options) & DBR_STATUS ) { + if(pfl!=NULL) { + *((unsigned short *)pbuffer)++ = pfl->stat; + *((unsigned short *)pbuffer)++ = pfl->sevr; + } else { + *((unsigned short *)pbuffer)++ = pcommon->stat; + *((unsigned short *)pbuffer)++ = pcommon->sevr; + } + *((unsigned short *)pbuffer)++ = pcommon->acks; + *((unsigned short *)pbuffer)++ = pcommon->ackt; + *perr_status = 0; + } + if( (*options) & DBR_UNITS ) { + if( prset && prset->get_units ){ + char * pchar = (char *)pbuffer; + (*prset->get_units)(paddr,pchar); + pchar[DB_UNITS_SIZE-1] = '\0'; + } else { + memset(pbuffer,'\0',dbr_units_size); + *options = (*options) ^ DBR_UNITS; /*Turn off DBR_UNITS*/ + } + pbuffer = (char *)pbuffer + dbr_units_size; + } + if( (*options) & DBR_PRECISION ) { + struct dbr_precision *pdbr_precision=( struct dbr_precision *)pbuffer; + + if((field_type==DBF_FLOAT || field_type==DBF_DOUBLE) && prset && prset->get_precision ){ + (*prset->get_precision)(paddr,pbuffer); + if(pdbr_precision->field_width<=0) + pdbr_precision->field_width = pdbr_precision->precision + 5; + } else { + memset(pbuffer,'\0',dbr_precision_size); + *options = (*options) ^ DBR_PRECISION; /*Turn off DBR_PRECISION*/ + } + pbuffer = (char *)pbuffer + dbr_precision_size; + } + if( (*options) & DBR_TIME ) { + if(pfl!=NULL) { + *((unsigned long *)pbuffer)++ = pfl->time.secPastEpoch; + *((unsigned long *)pbuffer)++ = pfl->time.nsec; + } else { + *((unsigned long *)pbuffer)++ = pcommon->time.secPastEpoch; + *((unsigned long *)pbuffer)++ = pcommon->time.nsec; + } + } + if( (*options) & DBR_ENUM_STRS ) get_enum_strs(paddr,&pbuffer,prset,options); + if( (*options) & (DBR_GR_LONG|DBR_GR_DOUBLE )) + get_graphics(paddr,&pbuffer,prset,options); + if((*options) & (DBR_CTRL_LONG | DBR_CTRL_DOUBLE )) + get_control(paddr,&pbuffer,prset,options); + if((*options) & (DBR_AL_LONG | DBR_AL_DOUBLE )) + get_alarm(paddr,&pbuffer,prset,options); + + +GET_DATA: + + if(*nRequest==0) return(0); + /* Check for valid request */ + if( INVALID_DB_REQ(dbrType) || (field_type>DBF_DEVICE) ){ + char message[80]; + + sprintf(message,"dbGet - database request type is %d",dbrType); + recGblDbaddrError(S_db_badDbrtype,paddr,message); + if(perr_status) *perr_status = S_db_badDbrtype; + return(S_db_badDbrtype); + } + + /* check for array */ + if( no_elements>1 && prset && (prset->get_array_info) ) { + status = (*prset->get_array_info)(paddr,&no_elements,&offset); + } + else offset=0; + if(no_elements<(*nRequest)) *nRequest = no_elements; + if(!(pconvert_routine=dbGetConvertRoutine[field_type][dbrType])) { + char message[80]; + + sprintf(message,"dbGet - database request type is %d",dbrType); + recGblDbaddrError(S_db_badDbrtype,paddr,message); + if(perr_status) *perr_status = S_db_badDbrtype; + return(S_db_badDbrtype); + } + /* convert database field to buffer type and place it in the buffer */ + if(pfl!=NULL) { + DBADDR localAddr; + + memcpy(&localAddr,paddr,sizeof(localAddr)); + /*Use longest field size*/ + localAddr.pfield = (char *)&pfl->field; + status=(*pconvert_routine)(&localAddr,pbuffer,*nRequest, + no_elements,offset); + } else { + status=(*pconvert_routine)(paddr,pbuffer,*nRequest, + no_elements,offset); + } + if(perr_status) *perr_status = status; + return(status); +} + /* * Put value through fast link * @@ -583,10 +910,7 @@ long dbFastLinkGet( * pl_record stands for pointer to local record. * pr_record stands for pointer to remote record. */ -long dbFastLinkPut( - struct link *plink, - struct dbCommon *pl_record, - void *psource) +long dbFastLinkPut(struct link *plink,dbCommon *pl_record,void *psource) { long status = 0; char pact = pl_record->pact; @@ -603,23 +927,21 @@ long dbFastLinkPut( dbCaPutLink(plink, &options, &nRequest); } else { - struct db_link *pdb_link = &(plink->value.db_link); - struct dbAddr *paddr = (struct dbAddr *) (pdb_link->pdbAddr); - struct dbCommon *pdest = (struct dbCommon *) paddr->precord; - struct fldDes *p_fldDes = (struct fldDes *) (paddr->pfldDes); - long special = paddr->special; - unsigned short acks = pdest->acks; - long *pfield_name; + struct db_link *pdb_link = &(plink->value.db_link); + DBADDR *paddr = (DBADDR *) (pdb_link->pdbAddr); + dbCommon *pdest = (dbCommon *) paddr->precord; + dbFldDes *pfldDes = (dbFldDes *) (paddr->pfldDes); + long special = paddr->special; + struct rset *prset; + int isValueField; long int (*pspecial)() = NULL; - struct rset *prset; - static char val[4] = {'V','A','L',' '}; - long *pval = (long *) &val[0]; - prset = GET_PRSET(pdbBase->precSup, paddr->record_type); + prset = dbGetRset(paddr); if (special) { if (special < 100) { if (special == SPC_NOMOD) { + recGblDbaddrError(S_db_noMod,paddr,"dbPut"); pl_record->pact = pact; return(S_db_noMod); } @@ -663,23 +985,6 @@ long dbFastLinkPut( if (special == SPC_SCAN) { scanAdd(pdest); } - else if (special == SPC_ALARMACK) { - if (paddr->pfield == (void *) &pdest->acks) { - if (acks > 0 && acks <= pdest->acks) { - pdest->acks = 0; - db_post_events(pdest, &pdest->acks, DBE_VALUE); - } - else { /* Undo change */ - pdest->acks = acks; - } - } - else if (paddr->pfield == (void *) &pdest->ackt) { - if (!pdest->ackt && pdest->acks > pdest->sevr) { - pdest->acks = pdest->sevr; - db_post_events(pdest, &pdest->acks, DBE_VALUE); - } - } - } else if (special == SPC_AS) { asChangeGroup((ASMEMBERPVT *)&pdest->asp, pdest->asg); } @@ -699,27 +1004,16 @@ long dbFastLinkPut( * don't propagate. */ - p_fldDes = (struct fldDes *) (paddr->pfldDes); - pfield_name = (long *) &(p_fldDes->fldname[0]); - - /* if field is val set udf FALSE */ - if (*pval == *pfield_name) - pdest->udf = FALSE; - - if (pdest->mlis.count && - ((*pval != *pfield_name) || (!p_fldDes->process_passive))) { - db_post_events(pdest, paddr->pfield, DBE_VALUE); - } + isValueField = dbIsValueField(pfldDes); + if (isValueField) pdest->udf=FALSE; + if(pdest->mlis.count && + (!isValueField || (!pfldDes->process_passive))) + db_post_events(pdest,paddr->pfield,DBE_VALUE); if (pdb_link->maximize_sevr) { recGblSetSevr(pdest, LINK_ALARM, pl_record->sevr); } - if (status) { - pl_record->pact = pact; - return(status); - } - if ((paddr->pfield == (void *) &pdest->proc) || (pdb_link->process_passive && pdest->scan == 0)) { @@ -733,13 +1027,214 @@ long dbFastLinkPut( /* otherwise ask for the record to be processed*/ else status = dbScanLink(pl_record, pdest); } - - if (status) - recGblRecordError(status, (void *) psource, "dbPutLink"); } - pl_record->pact = pact; return(status); } + +long dbPutLink( + struct db_link *pdblink, + dbCommon *psource, + short dbrType, + void *pbuffer, + long nRequest +) +{ + DBADDR *paddr=(DBADDR*)(pdblink->pdbAddr); + dbCommon *pdest=paddr->precord; + long status; + status=dbPut(paddr,dbrType,pbuffer,nRequest); + if(pdblink->maximize_sevr) + recGblSetSevr(pdest,LINK_ALARM,psource->sevr); + if(status) return(status); + if((paddr->pfield==(void *)&pdest->proc) + || (pdblink->process_passive && pdest->scan==0)) { + /*Note: If ppn then dbNotifyCancel will handle reprocessing*/ + /*if dbPutField caused asyn record to process ask for reprocessing*/ + if(!psource->ppn && pdest->putf) pdest->rpro = TRUE; + /* otherwise ask for the record to be processed*/ + else status=dbScanLink(psource,pdest); + } + return(status); +} + +long dbPutField( + DBADDR *paddr, + short dbrType, + void *pbuffer, + long nRequest +) +{ + long status; + dbFldDes *pfldDes=(dbFldDes *)(paddr->pfldDes); + dbCommon *precord = (dbCommon *)(paddr->precord); + + /*check for putField disabled*/ + if(precord->disp) { + if((void *)(&precord->disp) != paddr->pfield) return(0); + } + dbScanLock(precord); + status=dbPut(paddr,dbrType,pbuffer,nRequest); + if(status==0){ + if((paddr->pfield==(void *)&precord->proc) + ||(pfldDes->process_passive && precord->scan==0 + && dbrTypepact) { + if(precord->tpro) + printf("active: %s\n",precord->name); + precord->rpro = TRUE; + } else { + /*indicate that dbPutField called dbProcess*/ + precord->putf = TRUE; + status=dbProcess(precord); + } + } + } + dbScanUnlock(precord); + return(status); +} + +static long putAckt(paddr,pbuffer,nRequest,no_elements,offset) +DBADDR *paddr; +unsigned short *pbuffer; +long nRequest; +long no_elements; +long offset; +{ + dbCommon *precord=(dbCommon *)(paddr->precord); + + if(*pbuffer == precord->ackt) return(0); + precord->ackt = *pbuffer; + db_post_events(precord,&precord->ackt,DBE_VALUE|DBE_ALARM); + if(!precord->ackt && precord->acks>precord->sevr) { + precord->acks = precord->sevr; + db_post_events(precord,&precord->acks,DBE_VALUE|DBE_ALARM); + } + db_post_events(precord,NULL,DBE_ALARM); + return(0); +} + +static long putAcks(paddr,pbuffer,nRequest,no_elements,offset) +DBADDR *paddr; +unsigned short *pbuffer; +long nRequest; +long no_elements; +long offset; +{ + dbCommon *precord=(dbCommon *)(paddr->precord); + + if(*pbuffer >= precord->acks) { + precord->acks = 0; + db_post_events(precord,NULL,DBE_ALARM); + db_post_events(precord,&precord->acks,DBE_VALUE|DBE_ALARM); + } + return(0); +} + +long dbPut( + DBADDR *paddr, + short dbrType, + void *pbuffer, + long nRequest +) +{ + long no_elements=paddr->no_elements; + long dummy; + long offset; + long (*pconvert_routine)(); + long int (*pspecial)()=NULL; + struct rset *prset; + dbCommon *precord=(dbCommon *)(paddr->precord); + long status=0; + dbFldDes *pfldDes; + long special=paddr->special; + short field_type=paddr->field_type; + int isValueField; + + if(dbrType==DBR_PUT_ACKT && field_type<=DBF_DEVICE) { + status=putAckt(paddr,pbuffer,(long)1,(long)1,(long)0); + return(status); + } else if(dbrType==DBR_PUT_ACKS && field_type<=DBF_DEVICE) { + status=putAcks(paddr,pbuffer,(long)1,(long)1,(long)0); + return(status); + /* Check for valid request */ + } else if( INVALID_DB_REQ(dbrType) || (field_type>DBF_DEVICE) + || (!(pconvert_routine=dbPutConvertRoutine[dbrType][field_type])) ) + { + char message[80]; + + sprintf(message,"dbPut - database request type is %d",dbrType); + recGblDbaddrError(S_db_badDbrtype,paddr,message); + return(S_db_badDbrtype); + } + + prset=dbGetRset(paddr); + + /* check for special processing is required */ + if(special) { + if(special<100) { /*global processing*/ + if(special==SPC_NOMOD) { + status = S_db_noMod; + recGblDbaddrError(status,paddr,"dbPut"); + return(status); + }else if(special==SPC_SCAN){ + scanDelete(precord); + } + } + else { + if( prset && (pspecial = (prset->special))) { + status=(*pspecial)(paddr,0); + if(status) return(status); + } else { + recGblRecSupError(S_db_noSupport,paddr,"dbPut", + "special"); + return(S_db_noSupport); + } + } + } + + /* check for array */ + if( no_elements>1 && prset && (prset->get_array_info) ) { + status= (*prset->get_array_info)(paddr,&dummy,&offset); + } + else offset=0; + if(no_elements<(nRequest)) nRequest = no_elements; + + /* convert database field to buffer type and place it in the buffer */ + status=(*pconvert_routine)(paddr,pbuffer,nRequest,no_elements,offset); + + /* update array info */ + if( no_elements>1 && prset && (prset->put_array_info) ) { + status= (*prset->put_array_info)(paddr,nRequest); + } + + if(status) return(status); + + /* check for special processing is required */ + if(special) { + if(special<100) { /*global processing*/ + if(special==SPC_SCAN) { + scanAdd(precord); + } else if(special==SPC_AS) { + asChangeGroup((ASMEMBERPVT *)&precord->asp,precord->asg); + } + } + else { + status=(*pspecial)(paddr,1); + if(status) return(status); + } + } + + /* propagate events for this field */ + /* if the field is VAL and process_passive is true dont propagate*/ + pfldDes = (dbFldDes *)(paddr->pfldDes); + isValueField = dbIsValueField(pfldDes); + if (isValueField) precord->udf=FALSE; + if(precord->mlis.count && + (!isValueField || (!pfldDes->process_passive))) + db_post_events(precord,paddr->pfield,DBE_VALUE); + + return(status); +} diff --git a/src/db/dbBkpt.c b/src/db/dbBkpt.c index 2374056e4..4102128db 100644 --- a/src/db/dbBkpt.c +++ b/src/db/dbBkpt.c @@ -28,6 +28,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.5 1995/02/23 21:45:03 mcn + * Fixed locking error. OOPS. + * */ /* @@ -68,20 +71,17 @@ #include #include -#include #include #include #include #include #include #include -#include -#include -#include #include #include #include #include +#include #include #include diff --git a/src/db/dbCaDblink.c b/src/db/dbCaDblink.c index fcfb5fbaa..5d547132c 100644 --- a/src/db/dbCaDblink.c +++ b/src/db/dbCaDblink.c @@ -51,6 +51,7 @@ /* needed for PVNAME_SZ and FLDNAME_SZ ... must be before dbAccess.h */ #include +#include /* needed for dbNameToAddr() */ #include @@ -88,11 +89,9 @@ ((DBF) == DBF_FLOAT ? DBR_FLOAT : \ ((DBF) == DBF_DOUBLE ? DBR_DOUBLE : \ ((DBF) == DBF_ENUM ? DBR_ENUM : \ - ((DBF) == DBF_GBLCHOICE ? DBR_ENUM : \ - ((DBF) == DBF_CVTCHOICE ? DBR_ENUM : \ - ((DBF) == DBF_RECCHOICE ? DBR_ENUM : \ - ((DBF) == DBF_DEVCHOICE ? DBR_ENUM : \ - INVALID_DBF )))))))))))))) + ((DBF) == DBF_MENU ? DBR_ENUM : \ + ((DBF) == DBF_DEVICE ? DBR_ENUM : \ + INVALID_DBF )))))))))))) /* this macro should be in recSup.h */ /* to hide the fact that the precord */ diff --git a/src/db/dbCaLink.c b/src/db/dbCaLink.c index 185c2beb3..77d74d1ad 100644 --- a/src/db/dbCaLink.c +++ b/src/db/dbCaLink.c @@ -308,14 +308,8 @@ long rc; /* moving source name */ /* into struct input_pvar */ - strncpy(pi->source_name, - plink->value.pv_link.pvname, - PVNAME_SZ); - pi->source_name[PVNAME_SZ] = '\0'; - strcat(pi->source_name, "."); - strncat(pi->source_name, - plink->value.pv_link.fldname, - FLDNAME_SZ); + strcpy(pi->source_name, + plink->value.pv_link.pvname); /* preserving MS/NMS specification */ if (plink->value.pv_link.maximize_sevr) @@ -511,15 +505,8 @@ long rc; /* moving dest name into */ /* struct output_pvar */ - strncpy(po->dest_name, - plink->value.pv_link.pvname, - PVNAME_SZ); - po->dest_name[PVNAME_SZ] = '\0'; - strcat(po->dest_name, "."); - strncat(po->dest_name, - plink->value.pv_link.fldname, - FLDNAME_SZ); - + strcpy(po->dest_name, + plink->value.pv_link.pvname); /* for dbGet() */ po->source_new_dbr_type = dbCaNewDbfToNewDbr( diff --git a/src/db/dbCommon.ascii b/src/db/dbCommon.ascii new file mode 100644 index 000000000..3ce1a5531 --- /dev/null +++ b/src/db/dbCommon.ascii @@ -0,0 +1,243 @@ + field(NAME,DBF_STRING) { + prompt("Record Name") + special(SPC_NOMOD) + size(29) + } + field(DESC,DBF_STRING) { + prompt("Descriptor") + promptgroup(GUI_COMMON) + size(29) + } + field(ASG,DBF_STRING) { + prompt("Access Security Group") + promptgroup(GUI_COMMON) + special(SPC_AS) + size(29) + } + field(SCAN,DBF_MENU) { + prompt("Scan Mechanism") + promptgroup(GUI_SCAN) + special(SPC_SCAN) + interest(1) + menu(menuScan) + } + field(PINI,DBF_MENU) { + prompt("Process at iocInit") + promptgroup(GUI_SCAN) + interest(1) + menu(menuYesNo) + } + field(PHAS,DBF_SHORT) { + prompt("Scan Phase") + promptgroup(GUI_SCAN) + special(SPC_SCAN) + interest(1) + } + field(EVNT,DBF_SHORT) { + prompt("Event Number") + promptgroup(GUI_SCAN) + special(SPC_SCAN) + interest(1) + } + field(TSE,DBF_SHORT) { + prompt("Time Stamp Event") + interest(1) + } + field(TSEL,DBF_INLINK) { + prompt("Time Stamp Link") + promptgroup(GUI_SCAN) + special(SPC_NOMOD) + interest(1) + } + field(DTYP,DBF_DEVICE) { + prompt("Device Type") + promptgroup(GUI_LINKS) + special(SPC_NOMOD) + interest(1) + } + field(DISV,DBF_SHORT) { + prompt("Disable Value") + promptgroup(GUI_SCAN) + initial("1") + } + field(DISA,DBF_SHORT) { + prompt("Disable") + } + field(SDIS,DBF_INLINK) { + prompt("Scanning Disable") + promptgroup(GUI_SCAN) + special(SPC_NOMOD) + interest(1) + } + field(MLOK,DBF_NOACCESS) { + prompt("Monitor fastlock") + special(SPC_NOMOD) + interest(4) + size(8) + extra("FAST_LOCK mlok") + } + field(MLIS,DBF_NOACCESS) { + prompt("Monitor List") + special(SPC_NOMOD) + interest(4) + size(12) + extra("ELLLIST mlis") + } + field(DISP,DBF_UCHAR) { + prompt("Disable putField") + } + field(PROC,DBF_UCHAR) { + prompt("Force Processing") + pp(TRUE) + interest(3) + } + field(STAT,DBF_MENU) { + prompt("Alarm Status") + special(SPC_NOMOD) + menu(menuAlarmStat) + } + field(SEVR,DBF_MENU) { + prompt("Alarm Severity") + special(SPC_NOMOD) + menu(menuAlarmSevr) + } + field(NSTA,DBF_MENU) { + prompt("New Alarm Status") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmStat) + } + field(NSEV,DBF_MENU) { + prompt("New Alarm Severity") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmSevr) + } + field(ACKS,DBF_MENU) { + prompt("Alarm Ack Severity") + special(SPC_NOMOD) + interest(2) + menu(menuAlarmSevr) + } + field(ACKT,DBF_MENU) { + prompt("Alarm Ack Transient") + special(SPC_NOMOD) + interest(2) + menu(menuYesNo) + } + field(DISS,DBF_MENU) { + prompt("Disable Alarm Sevrty") + promptgroup(GUI_SCAN) + interest(1) + menu(menuAlarmSevr) + } + field(LSET,DBF_SHORT) { + prompt("Lock Set") + special(SPC_NOMOD) + interest(4) + } + field(LCNT,DBF_UCHAR) { + prompt("Lock Count") + special(SPC_NOMOD) + interest(2) + } + field(PACT,DBF_UCHAR) { + prompt("Record active") + special(SPC_NOMOD) + interest(1) + } + field(PUTF,DBF_UCHAR) { + prompt("dbPutField process") + special(SPC_NOMOD) + interest(1) + } + field(RPRO,DBF_UCHAR) { + prompt("Reprocess ") + special(SPC_NOMOD) + interest(1) + } + field(ASP,DBF_NOACCESS) { + prompt("Access Security Pvt") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *asp") + } + field(PPN,DBF_NOACCESS) { + prompt("addr of PUTNOTIFY") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *ppn") + } + field(PPNN,DBF_NOACCESS) { + prompt("next record PUTNOTIFY") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *ppnn") + } + field(SPVT,DBF_NOACCESS) { + prompt("Scan Private") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *spvt") + } + field(RSET,DBF_NOACCESS) { + prompt("Address of RSET") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *rset") + } + field(DSET,DBF_NOACCESS) { + prompt("DSET address") + special(SPC_NOMOD) + interest(4) + size(4) + extra("struct dset *dset") + } + field(DPVT,DBF_NOACCESS) { + prompt("Device Private") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void *dpvt") + } + field(PRIO,DBF_MENU) { + prompt("Scheduling Priority") + promptgroup(GUI_SCAN) + special(SPC_SCAN) + interest(1) + menu(menuPriority) + } + field(TPRO,DBF_UCHAR) { + prompt("Trace Processing") + } + field(BKPT,DBF_NOACCESS) { + prompt("Break Point") + special(SPC_NOMOD) + interest(1) + size(1) + extra("char bkpt") + } + field(UDF,DBF_UCHAR) { + prompt("Undefined") + pp(TRUE) + interest(1) + initial("1") + } + field(TIME,DBF_NOACCESS) { + prompt("Time") + special(SPC_NOMOD) + interest(4) + size(8) + extra("TS_STAMP time") + } + field(FLNK,DBF_FWDLINK) { + prompt("Forward Process Link") + promptgroup(GUI_LINKS) + special(SPC_NOMOD) + interest(1) + } diff --git a/src/db/dbCommonRecord.ascii b/src/db/dbCommonRecord.ascii new file mode 100644 index 000000000..7a238fb8f --- /dev/null +++ b/src/db/dbCommonRecord.ascii @@ -0,0 +1,3 @@ +recordtype(dbCommon) { + include "dbCommon.ascii" +} diff --git a/src/db/dbConvert.c b/src/db/dbConvert.c new file mode 100644 index 000000000..b7b2ddb5b --- /dev/null +++ b/src/db/dbConvert.c @@ -0,0 +1,4435 @@ +/* dbConvert.c */ +/* + * Original Author: Bob Dalesio + * Current Author: Marty Kraimer + * Date: 11-7-90 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 11OCT95 mrk Moved from dbLink.c + */ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* DATABASE ACCESS GET CONVERSION SUPPORT */ + +static long getStringString ( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + char *psrc=paddr->pfield; + short size=paddr->field_size; + short sizeto; + + /* always force result string to be null terminated*/ + sizeto = size; + if(sizeto>=MAX_STRING_SIZE) sizeto = MAX_STRING_SIZE-1; + + if(nRequest==1 && offset==0) { + strncpy(pbuffer,psrc,sizeto); + *(pbuffer+sizeto) = 0; + return(0); + } + psrc+= (size*offset); + while (nRequest) { + strncpy(pbuffer,psrc,sizeto); + *(pbuffer+sizeto) = 0; + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += size; + nRequest--; + } + return(0); +} + +static long getStringChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + char *psrc=(char *)paddr->pfield; + short value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%hd",&value) == 1) { + *pbuffer = (char)value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%hd",&value) == 1) { + *pbuffer = (char)value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + char *psrc=(char *)paddr->pfield; + unsigned short value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%hu",&value) == 1) { + *pbuffer = (unsigned char)value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%hu",&value) == 1) { + *pbuffer = (unsigned char)value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + char *psrc=(char *)paddr->pfield; + short value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%hd",&value) == 1) { + *pbuffer = value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%hd",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + char *psrc=(char *)paddr->pfield; + unsigned short value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%hu",&value) == 1) { + *pbuffer = value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%hu",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + char *psrc=(char *)paddr->pfield; + long value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%ld",&value) == 1) { + *pbuffer = value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%ld",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + char *psrc=(char *)paddr->pfield; + unsigned long value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%lu",&value) == 1) { + *pbuffer = value; + return(0); + } + else return(-1); + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%lu",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + char *psrc=(char *)paddr->pfield; + float value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%f",&value) == 1) { + *pbuffer = value; + return(0); + } else { + return(-1); + } + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%f",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + char *psrc=(char *)paddr->pfield; + double value; + + if(nRequest==1 && offset==0) { + if(sscanf(psrc,"%lf",&value) == 1) { + *pbuffer = value; + return(0); + } else { + return(-1); + } + } + psrc += MAX_STRING_SIZE*offset; + while (nRequest) { + if(sscanf(psrc,"%lf",&value) == 1) { + *pbuffer = value; + } else { + return(-1); + } + pbuffer++; + if(++offset==no_elements) + psrc=paddr->pfield; + else + psrc += MAX_STRING_SIZE; + nRequest--; + } + return(0); +} + +static long getStringEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + return(getStringUshort(paddr,pto,nRequest,no_elements,offset)); +} + +static long getCharString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtCharToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtCharToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(char *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getCharChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getCharEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + char *psrc=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtUcharToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtUcharToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(unsigned char *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getUcharChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUcharEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned char *psrc=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtShortToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtShortToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(short *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getShortChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} +static long getShortShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getShortEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + short *psrc=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtUshortToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtUshortToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(unsigned short *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getUshortChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} +static long getUshortShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUshortEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtLongToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtLongToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(long *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getLongChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getLongEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + long *psrc=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + cvtUlongToString(*psrc,pbuffer); + return(0); + } + psrc += offset; + while (nRequest) { + cvtUlongToString(*psrc,pbuffer); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(unsigned long *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getUlongChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getUlongEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned long *psrc=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + float *psrc=(float *)(paddr->pfield); + long status; + int precision; + struct rset *prset; + + if((prset=dbGetRset(paddr)) && (prset->get_precision)) + status = (*prset->get_precision)(paddr,&precision); + else + status=S_db_precision; + if(status) { + recGblRecSupError(status,paddr,"dbGet","get_precision"); + return(status); + } + + if(nRequest==1 && offset==0) { + cvtFloatToString(*psrc,pbuffer,precision); + return(0); + } + psrc += offset; + while (nRequest) { + cvtFloatToString(*psrc,pbuffer,precision); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(float *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getFloatChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + float *psrc=(float *)(paddr->pfield); + long ltemp; /*vxWorks does not support float to unsigned long*/ + + if(nRequest==1 && offset==0) { + ltemp = *psrc; + *pbuffer = ltemp; + return(0); + } + psrc += offset; + while (nRequest) { + ltemp = *psrc++; + *pbuffer++ = ltemp; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getFloatEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + float *psrc=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + double *psrc=(double *)(paddr->pfield); + long status; + int precision; + struct rset *prset; + + if((prset=dbGetRset(paddr)) && (prset->get_precision)) + status = (*prset->get_precision)(paddr,&precision); + else + status=S_db_precision; + if(status) { + recGblRecSupError(status,paddr,"dbGet","get_precision"); + return(status); + } + + if(nRequest==1 && offset==0) { + cvtDoubleToString(*psrc,pbuffer,precision); + return(0); + } + psrc += offset; + while (nRequest) { + cvtDoubleToString(*psrc,pbuffer,precision); + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + psrc=(double *)paddr->pfield; + else + psrc++; + nRequest--; + } + return(0); +} + +static long getDoubleChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + double *psrc=(double *)(paddr->pfield); + long ltemp; /*vxWorks does not support double to unsigned long*/ + + if(nRequest==1 && offset==0) { + ltemp = *psrc; + *pbuffer = ltemp; + return(0); + } + psrc += offset; + while (nRequest) { + ltemp = *psrc++; + *pbuffer++ = ltemp; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getDoubleEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + double *psrc=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumString( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + struct rset *prset; + long status; + + if((prset=dbGetRset(paddr)) && (prset->get_enum_str)) + return( (*prset->get_enum_str)(paddr,pbuffer) ); + status=S_db_noRSET; + recGblRecSupError(status,paddr,"dbGet","get_enum_str"); + return(S_db_badDbrtype); +} + +static long getEnumChar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumUchar( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned char *pbuffer = (unsigned char *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumShort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + short *pbuffer = (short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumUshort( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumLong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + long *pbuffer = (long *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumUlong( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned long *pbuffer = (unsigned long *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumFloat( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + float *pbuffer = (float *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumDouble( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + double *pbuffer = (double *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getEnumEnum( + DBADDR *paddr, void *pto, long nRequest, long no_elements, long offset) +{ + unsigned short *pbuffer = (unsigned short *)pto; + unsigned short *psrc=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pbuffer = *psrc; + return(0); + } + psrc += offset; + while (nRequest) { + *pbuffer++ = *psrc++; + if(++offset==no_elements) psrc=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long getMenuString(DBADDR *paddr, void *pto, + long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbMenu *pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + char **papChoiceValue; + char *pchoice; + unsigned short choice_ind= *((unsigned short*)paddr->pfield); + + if(no_elements!=1){ + recGblDbaddrError(S_db_onlyOne,paddr,"dbGet(getMenuString)"); + return(S_db_onlyOne); + } + if( !pdbMenu || choice_ind>=pdbMenu->nChoice + || !(papChoiceValue = pdbMenu->papChoiceValue) + || !(pchoice=papChoiceValue[choice_ind])) { + recGblDbaddrError(S_db_badChoice,paddr,"dbGet(getMenuString)"); + return(S_db_badChoice); + } + strncpy(pbuffer,pchoice,MAX_STRING_SIZE); + return(0); +} + +static long getDeviceString(DBADDR *paddr, void *pto, + long nRequest, long no_elements, long offset) +{ + char *pbuffer = (char *)pto; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbDeviceMenu *pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + char **papChoice; + char *pchoice; + unsigned short choice_ind= *((unsigned short*)paddr->pfield); + + if(no_elements!=1){ + recGblDbaddrError(S_db_onlyOne,paddr,"dbGet(getDeviceString)"); + return(S_db_onlyOne); + } + if( !pdbDeviceMenu || choice_ind>=pdbDeviceMenu->nChoice + || !(papChoice = pdbDeviceMenu->papChoice) + || !(pchoice=papChoice[choice_ind])) { + recGblDbaddrError(S_db_badChoice,paddr,"dbGet(getDeviceString)"); + return(S_db_badChoice); + } + strncpy(pbuffer,pchoice,MAX_STRING_SIZE); + return(0); +} + +/* DATABASE ACCESS PUT CONVERSION SUPPORT */ + +static long putStringString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + char *pdest=paddr->pfield; + short size=paddr->field_size; + + if(nRequest==1 && offset==0) { + strncpy(pdest,pbuffer,size); + *(pdest+size-1) = 0; + return(0); + } + pdest+= (size*offset); + while (nRequest) { + strncpy(pdest,pbuffer,size); + *(pdest+size-1) = 0; + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putStringChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + char *pdest=(char *)paddr->pfield; + short value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%hd",&value) == 1) { + *pdest = (char)value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%hd",&value) == 1) { + *pdest = (char)value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned char *pdest=(unsigned char *)paddr->pfield; + unsigned short value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%hu",&value) == 1) { + *pdest = (unsigned char)value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%hu",&value) == 1) { + *pdest = (unsigned char)value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + short *pdest=(short *)paddr->pfield; + short value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%hd",&value) == 1) { + *pdest = value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%hd",&value) == 1) { + *pdest = value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned short *pdest=(unsigned short *)paddr->pfield; + float value; + + /*Convert to float first so that numbers like 1.0e3 convert properly*/ + /*Problem was old database access said to get unsigned short as float*/ + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%f",&value) == 1) { + *pdest = (unsigned short)value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%f",&value) == 1) { + *pdest = (unsigned short)value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + long *pdest=(long *)paddr->pfield; + long value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%ld",&value) == 1) { + *pdest = value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%ld",&value) == 1) { + *pdest = value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned long *pdest=(unsigned long *)paddr->pfield; + double value; + + /*Convert to double first so that numbers like 1.0e3 convert properly*/ + /*Problem was old database access said to get unsigned long as double*/ + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%lf",&value) == 1) { + *pdest = (unsigned long)value; + return(0); + } + else return(-1); + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%lf",&value) == 1) { + *pdest = (unsigned long)value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + float *pdest=(float *)paddr->pfield; + float value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%f",&value) == 1) { + *pdest = value; + return(0); + } else { + return(-1); + } + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%f",&value) == 1) { + *pdest = value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + double *pdest=(double *)paddr->pfield; + double value; + + if(nRequest==1 && offset==0) { + if(sscanf(pbuffer,"%lf",&value) == 1) { + *pdest = value; + return(0); + } else { + return(-1); + } + } + pdest += offset; + while (nRequest) { + if(sscanf(pbuffer,"%lf",&value) == 1) { + *pdest = value; + } else { + return(-1); + } + pbuffer += MAX_STRING_SIZE; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest++; + nRequest--; + } + return(0); +} + +static long putStringEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + struct rset *prset; + unsigned short *pfield= (unsigned short*)(paddr->pfield); + long status; + unsigned int nchoices,ind; + int nargs,nchars; + struct dbr_enumStrs enumStrs; + + if((prset=dbGetRset(paddr)) + && (prset->put_enum_str)) { + status = (*prset->put_enum_str)(paddr,pbuffer); + if(!status) return(0); + if(prset->get_enum_strs) { + status = (*prset->get_enum_strs)(paddr,&enumStrs); + if(!status) { + nchoices = enumStrs.no_str; + nargs = sscanf(pbuffer," %u %n",&ind,&nchars); + if(nargs==1 && nchars==strlen(pbuffer) && indpfldDes; + dbMenu *pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + char **papChoiceValue; + char *pchoice; + unsigned short *pfield= (unsigned short*)(paddr->pfield); + unsigned int nChoice,ind; + int nargs,nchars; + + if(no_elements!=1){ + recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringMenu)"); + return(S_db_onlyOne); + } + if( pdbMenu && (papChoiceValue = pdbMenu->papChoiceValue)) { + nChoice = pdbMenu->nChoice; + for(ind=0; indpfldDes; + dbDeviceMenu *pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + char **papChoice; + char *pchoice; + unsigned short *pfield= (unsigned short*)(paddr->pfield); + unsigned int nChoice,ind; + int nargs,nchars; + + if(no_elements!=1){ + recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringDevice)"); + return(S_db_onlyOne); + } + if( pdbDeviceMenu && (papChoice = pdbDeviceMenu->papChoice)) { + nChoice = pdbDeviceMenu->nChoice; + for(ind=0; indpfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtCharToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtCharToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putCharChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putCharEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + char *pbuffer = (char *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtUcharToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtUcharToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putUcharChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUcharEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned char *pbuffer = (unsigned char *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtShortToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtShortToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putShortChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putShortEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + short *pbuffer = (short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtUshortToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtUshortToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putUshortChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUshortEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtLongToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtLongToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putLongChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putLongEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + long *pbuffer = (long *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtUlongToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtUlongToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putUlongChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putUlongEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned long *pbuffer = (unsigned long *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + char *pdest=(char *)(paddr->pfield); + long status; + int precision; + struct rset *prset; + short size=paddr->field_size; + + if((prset=dbGetRset(paddr)) && (prset->get_precision)) + status = (*prset->get_precision)(paddr,&precision); + else + status=S_db_precision; + if(status) { + recGblRecSupError(status,paddr,"dbPutField","get_precision"); + return(status); + } + + if(nRequest==1 && offset==0) { + cvtFloatToString(*pbuffer,pdest,precision); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtFloatToString(*pbuffer,pdest,precision); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putFloatChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + long ltemp;/*vxWorks does not support float to unsigned long*/ + + if(nRequest==1 && offset==0) { + ltemp = *pbuffer; + *pdest = ltemp; + return(0); + } + pdest += offset; + while (nRequest) { + ltemp = *pbuffer++; + *pdest++ = ltemp; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putFloatEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + float *pbuffer = (float *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + char *pdest=(char *)(paddr->pfield); + long status; + int precision; + struct rset *prset; + short size=paddr->field_size; + + if((prset=dbGetRset(paddr)) && (prset->get_precision)) + status = (*prset->get_precision)(paddr,&precision); + else + status=S_db_precision; + if(status) { + recGblRecSupError(status,paddr,"dbPutField","get_precision"); + return(status); + } + + if(nRequest==1 && offset==0) { + cvtDoubleToString(*pbuffer,pdest,precision); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtDoubleToString(*pbuffer,pdest,precision); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putDoubleChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + long ltemp;/*vxWorks does not support double to unsigned long*/ + + if(nRequest==1 && offset==0) { + ltemp = *pbuffer; + *pdest = ltemp; + return(0); + } + pdest += offset; + while (nRequest) { + ltemp = *pbuffer++; + *pdest++ = ltemp; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putDoubleEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + double *pbuffer = (double *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumString( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + char *pdest=(char *)(paddr->pfield); + short size=paddr->field_size; + + + if(nRequest==1 && offset==0) { + cvtUshortToString(*pbuffer,pdest); + return(0); + } + pdest += (size*offset); + while (nRequest) { + cvtUshortToString(*pbuffer,pdest); + pbuffer++; + if(++offset==no_elements) + pdest=(char *)paddr->pfield; + else + pdest += size; + nRequest--; + } + return(0); +} + +static long putEnumChar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + char *pdest=(char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumUchar( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned char *pdest=(unsigned char *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned char *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumShort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + short *pdest=(short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumUshort( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumLong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + long *pdest=(long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumUlong( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned long *pdest=(unsigned long *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumFloat( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + float *pdest=(float *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(float *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumDouble( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + double *pdest=(double *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(double *)paddr->pfield; + nRequest--; + } + return(0); +} + +static long putEnumEnum( + DBADDR *paddr,void *pfrom,long nRequest,long no_elements,long offset) +{ + unsigned short *pbuffer = (unsigned short *)pfrom; + unsigned short *pdest=(unsigned short *)(paddr->pfield); + + if(nRequest==1 && offset==0) { + *pdest = *pbuffer; + return(0); + } + pdest += offset; + while (nRequest) { + *pdest++ = *pbuffer++; + if(++offset==no_elements) pdest=(unsigned short *)paddr->pfield; + nRequest--; + } + return(0); +} + +/* This is the table of routines for converting database fields */ +/* the rows represent the field type of the database field */ +/* the columns represent the types of the buffer in which they are placed */ + +/* buffer types are******************************************************** + DBR_STRING, DBR_CHR, DBR_UCHAR, DBR_SHORT, DBR_USHORT, + DBR_LONG, DBR_ULONG, DBR_FLOAT, DBR_DOUBLE, DBR_ENUM + ***************************************************************************/ + +long (*dbGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])() = { + +/* source is a DBF_STRING */ +{getStringString, getStringChar, getStringUchar, getStringShort, getStringUshort, + getStringLong, getStringUlong, getStringFloat, getStringDouble, getStringEnum}, +/* source is a DBF_CHAR */ +{getCharString, getCharChar, getCharUchar, getCharShort, getCharUshort, + getCharLong, getCharUlong, getCharFloat, getCharDouble, getCharEnum}, +/* source is a DBF_UCHAR */ +{getUcharString, getUcharChar, getUcharUchar, getUcharShort, getUcharUshort, + getUcharLong, getUcharUlong, getUcharFloat, getUcharDouble, getUcharEnum}, +/* source is a DBF_SHORT */ +{getShortString, getShortChar, getShortUchar, getShortShort, getShortUshort, + getShortLong, getShortUlong, getShortFloat, getShortDouble, getShortEnum}, +/* source is a DBF_USHORT */ +{getUshortString, getUshortChar, getUshortUchar, getUshortShort, getUshortUshort, + getUshortLong, getUshortUlong, getUshortFloat, getUshortDouble, getUshortEnum}, +/* source is a DBF_LONG */ +{getLongString, getLongChar, getLongUchar, getLongShort, getLongUshort, + getLongLong, getLongUlong, getLongFloat, getLongDouble, getLongEnum}, +/* source is a DBF_ULONG */ +{getUlongString, getUlongChar, getUlongUchar, getUlongShort, getUlongUshort, + getUlongLong, getUlongUlong, getUlongFloat, getUlongDouble, getUlongEnum}, +/* source is a DBF_FLOAT */ +{getFloatString, getFloatChar, getFloatUchar, getFloatShort, getFloatUshort, + getFloatLong, getFloatUlong, getFloatFloat, getFloatDouble, getFloatEnum}, +/* source is a DBF_DOUBLE */ +{getDoubleString, getDoubleChar, getDoubleUchar, getDoubleShort, getDoubleUshort, + getDoubleLong, getDoubleUlong, getDoubleFloat, getDoubleDouble, getDoubleEnum}, +/* source is a DBF_ENUM */ +{getEnumString, getEnumChar, getEnumUchar, getEnumShort, getEnumUshort, + getEnumLong, getEnumUlong, getEnumFloat, getEnumDouble, getEnumEnum}, +/* source is a DBF_MENU */ +{getMenuString, getEnumChar, getEnumUchar, getEnumShort, getEnumUshort, + getEnumLong, getEnumUlong, getEnumFloat, getEnumDouble, getEnumEnum}, +/* source is a DBF_DEVICE */ +{getDeviceString,getEnumChar, getEnumUchar, getEnumShort, getEnumUshort, + getEnumLong, getEnumUlong, getEnumFloat, getEnumDouble, getEnumEnum}, +}; + +/* This is the table of routines for converting database fields */ +/* the rows represent the buffer types */ +/* the columns represent the field types */ + +/* field types are******************************************************** + DBF_STRING, DBF_CHAR, DBF_UCHAR, DBF_SHORT, DBF_USHORT, + DBF_LONG, DBF_ULONG, DBF_FLOAT, DBF_DOUBLE, DBF_ENUM + DBF_MENU, DBF_DEVICE + ***************************************************************************/ + +long (*dbPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])() = { +/* source is a DBR_STRING */ +{putStringString, putStringChar, putStringUchar, putStringShort, putStringUshort, + putStringLong, putStringUlong, putStringFloat, putStringDouble, putStringEnum, + putStringMenu,putStringDevice}, +/* source is a DBR_CHAR */ +{putCharString, putCharChar, putCharUchar, putCharShort, putCharUshort, + putCharLong, putCharUlong, putCharFloat, putCharDouble, putCharEnum, + putCharEnum, putCharEnum}, +/* source is a DBR_UCHAR */ +{putUcharString, putUcharChar, putUcharUchar, putUcharShort, putUcharUshort, + putUcharLong, putUcharUlong, putUcharFloat, putUcharDouble, putUcharEnum, + putUcharEnum, putUcharEnum}, +/* source is a DBR_SHORT */ +{putShortString, putShortChar, putShortUchar, putShortShort, putShortUshort, + putShortLong, putShortUlong, putShortFloat, putShortDouble, putShortEnum, + putShortEnum, putShortEnum}, +/* source is a DBR_USHORT */ +{putUshortString, putUshortChar, putUshortUchar, putUshortShort, putUshortUshort, + putUshortLong, putUshortUlong, putUshortFloat, putUshortDouble, putUshortEnum, + putUshortEnum, putUshortEnum}, +/* source is a DBR_LONG */ +{putLongString, putLongChar, putLongUchar, putLongShort, putLongUshort, + putLongLong, putLongUlong, putLongFloat, putLongDouble, putLongEnum, + putLongEnum, putLongEnum}, +/* source is a DBR_ULONG */ +{putUlongString, putUlongChar, putUlongUchar, putUlongShort, putUlongUshort, + putUlongLong, putUlongUlong, putUlongFloat, putUlongDouble, putUlongEnum, + putUlongEnum, putUlongEnum}, +/* source is a DBR_FLOAT */ +{putFloatString, putFloatChar, putFloatUchar, putFloatShort, putFloatUshort, + putFloatLong, putFloatUlong, putFloatFloat, putFloatDouble, putFloatEnum, + putFloatEnum, putFloatEnum}, +/* source is a DBR_DOUBLE */ +{putDoubleString, putDoubleChar, putDoubleUchar, putDoubleShort, putDoubleUshort, + putDoubleLong, putDoubleUlong, putDoubleFloat, putDoubleDouble, putDoubleEnum, + putDoubleEnum, putDoubleEnum}, +/* source is a DBR_ENUM */ +{putEnumString, putEnumChar, putEnumUchar, putEnumShort, putEnumUshort, + putEnumLong, putEnumUlong, putEnumFloat, putEnumDouble, putEnumEnum, + putEnumEnum, putEnumEnum} +}; diff --git a/src/db/dbFastLinkConv.c b/src/db/dbFastLinkConv.c index 008e2b66a..ee59395de 100644 --- a/src/db/dbFastLinkConv.c +++ b/src/db/dbFastLinkConv.c @@ -41,19 +41,18 @@ #include #include #include -#include #include #include #include +#include #include #include #include #include -#include -#include #include #include #include +#include #include extern struct dbBase *pdbBase; @@ -261,7 +260,7 @@ static long cvt_st_e( struct rset *prset; long status; - prset = GET_PRSET(pdbBase->precSup, paddr->record_type); + prset = dbGetRset(paddr); if (prset && prset->put_enum_str) return (*prset->put_enum_str)(paddr, from); @@ -271,121 +270,69 @@ static long cvt_st_e( return(S_db_badDbrtype); } -/* Convert String to Global Choice */ -static long cvt_st_gbl( +/* Convert String to Menu */ +static long cvt_st_menu( char *from, unsigned short *to, struct dbAddr *paddr) - { - char *pchoice; - struct choiceSet *pchoiceSet; - unsigned short i; +{ + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbMenu *pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + char **papChoiceValue; + char *pchoice; + unsigned int nChoice,ind; + int nargs,nchars; - pchoiceSet = GET_PCHOICE_SET(pdbBase->pchoiceGbl, paddr->choice_set); + if( pdbMenu && (papChoiceValue = pdbMenu->papChoiceValue)) { + nChoice = pdbMenu->nChoice; + for(ind=0; indnumber; i++) { - pchoice = pchoiceSet->papChoice[i]; - if (!pchoice) - continue; - if (strcmp(pchoice, from) == 0) { - *to = i; - return(0); - } - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbPut(putStringGchoice)"); - return(S_db_badChoice); - } - -/* Convert String to Cvt Choice */ -static long cvt_st_cvt( +/* Convert String to Device */ +static long cvt_st_device( char *from, unsigned short *to, struct dbAddr *paddr) - { - char *pchoice; - struct choiceSet *pchoiceSet; - unsigned short i; +{ + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbDeviceMenu *pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + char **papChoice; + char *pchoice; + unsigned int nChoice,ind; + int nargs,nchars; - pchoiceSet = pdbBase->pchoiceCvt; - - if (pchoiceSet) { - for (i=0; i < pchoiceSet->number; i++) { - pchoice = pchoiceSet->papChoice[i]; - if (!pchoice) - continue; - if (strcmp(pchoice, from) == 0) { - *to = i; - return(0); - } - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbPut(putStringCchoice)"); - return(S_db_badChoice); - } - -/* Convert String to Rec Choice */ -static long cvt_st_rec( - char *from, - unsigned short *to, - struct dbAddr *paddr) - { - char *pchoice; - struct choiceSet *pchoiceSet; - struct arrChoiceSet *parrChoiceSet; - unsigned short i; - - parrChoiceSet = GET_PARR_CHOICE_SET(pdbBase->pchoiceRec, paddr->record_type); - - if (parrChoiceSet) { - pchoiceSet = GET_PCHOICE_SET(parrChoiceSet, paddr->choice_set); - - if (pchoiceSet) { - for (i=0; i < pchoiceSet->number; i++) { - pchoice = pchoiceSet->papChoice[i]; - if (!pchoice) - continue; - if (strcmp(pchoice, from) == 0) { - *to = i; - return(0); - } - } - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbPut(putStringRchoice)"); - return(S_db_badChoice); - } - -/* Convert String to Dev Choice */ -static long cvt_st_dev( - char *from, - unsigned short *to, - struct dbAddr *paddr) - { - char *pchoice; - struct devChoiceSet *pdevChoiceSet; - unsigned short i; - - pdevChoiceSet = GET_PDEV_CHOICE_SET(pdbBase->pchoiceDev, paddr->record_type); - - if (pdevChoiceSet) { - for (i=0; i < pdevChoiceSet->number; i++) { - pchoice = pdevChoiceSet->papDevChoice[i]->pchoice; - if (!pchoice) - continue; - if (strcmp(pchoice, from) == 0) { - *to = i; - return(0); - } - } - } - recGblDbaddrError(S_db_badChoice, paddr, "dbPut(putStringDchoice)"); - return(S_db_badChoice); - } + if( pdbDeviceMenu && (papChoice = pdbDeviceMenu->papChoice)) { + nChoice = pdbDeviceMenu->nChoice; + for(ind=0; indprecSup, paddr->record_type); + prset = dbGetRset(paddr); if (prset && prset->get_precision) (*prset->get_precision)(paddr, &precision); @@ -907,7 +854,7 @@ static long cvt_d_st( long status = 0; long precision = 2; - prset = GET_PRSET(pdbBase->precSup, paddr->record_type); + prset = dbGetRset(paddr); if (prset && prset->get_precision) (*prset->get_precision)(paddr, &precision); @@ -1061,7 +1008,7 @@ static long cvt_e_st_get( struct rset *prset; long status; - prset = GET_PRSET(pdbBase->precSup, paddr->record_type); + prset = dbGetRset(paddr); if (prset && prset->get_enum_str) return (*prset->get_enum_str)(paddr, to); @@ -1079,100 +1026,47 @@ static long cvt_e_st_put( struct dbAddr *paddr) { cvtUshortToString(*from, to); return(0); } -/* Get Gbl Choice to String */ -static long cvt_gbl_st( +/* Get Menu to String */ +static long cvt_menu_st( unsigned short *from, char *to, struct dbAddr *paddr) { - struct choiceSet *pchoiceSet; - char *pchoice; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbMenu *pdbMenu = (dbMenu *)pdbFldDes->ftPvt; + char **papChoiceValue; + char *pchoice; - pchoiceSet = GET_PCHOICE_SET(pdbBase->pchoiceGbl, paddr->choice_set); - - if (pchoiceSet) { - pchoice = GET_CHOICE(pchoiceSet, *from); - - if (pchoice) { - strncpy(to, pchoice, MAX_STRING_SIZE); - return(0); - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbGetField(getGchoiceString)"); - return(S_db_badChoice); + if( !pdbMenu || *from>=pdbMenu->nChoice + || !(papChoiceValue = pdbMenu->papChoiceValue) + || !(pchoice=papChoiceValue[*from])) { + recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_menu_st)"); + return(S_db_badChoice); + } + strncpy(to,pchoice,MAX_STRING_SIZE); + return(0); } -/* Get Cvt Choice to String */ -static long cvt_cvt_st( + +/* Get Device to String */ +static long cvt_device_st( unsigned short *from, char *to, struct dbAddr *paddr) { - char *pchoice; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes; + dbDeviceMenu *pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + char **papChoice; + char *pchoice; - pchoice = GET_CHOICE(pdbBase->pchoiceCvt, *from); - - if (pchoice) { - strncpy(to, pchoice, MAX_STRING_SIZE); - return(0); - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbGetField(getCchoiceString)"); - return(S_db_badChoice); - } - -/* Get Record Choice to String */ -static long cvt_rec_st( - unsigned short *from, - char *to, - struct dbAddr *paddr) - { - struct choiceSet *pchoiceSet; - struct arrChoiceSet *parrChoiceSet; - char *pchoice; - - parrChoiceSet = GET_PARR_CHOICE_SET(pdbBase->pchoiceRec, paddr->record_type); - - if (parrChoiceSet) { - pchoiceSet = GET_PCHOICE_SET(parrChoiceSet, paddr->choice_set); - - if (pchoiceSet) { - pchoice = GET_CHOICE(pchoiceSet, *from); - - if (pchoice) { - strncpy(to, pchoice, MAX_STRING_SIZE); - return(0); - } - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbGetField(getRchoiceString)"); - return(S_db_badChoice); -} - -/* Get Dev Choice to String */ -static long cvt_dev_st( - unsigned short *from, - char *to, - struct dbAddr *paddr) - { - struct devChoiceSet *pdevChoiceSet; - struct devChoice *pdevChoice; - - pdevChoiceSet = GET_PDEV_CHOICE_SET(pdbBase->pchoiceDev, paddr->record_type); - - if (pdevChoiceSet) { - pdevChoice = GET_DEV_CHOICE(pdevChoiceSet, *from); - - if (pdevChoice) { - strncpy(to, pdevChoice->pchoice, MAX_STRING_SIZE); - return(0); - } - } - - recGblDbaddrError(S_db_badChoice, paddr, "dbGetField(getRchoiceString)"); - return(S_db_badChoice); + if( !pdbDeviceMenu || *from>=pdbDeviceMenu->nChoice + || !(papChoice= pdbDeviceMenu->papChoice) + || !(pchoice=papChoice[*from])) { + recGblDbaddrError(S_db_badChoice,paddr,"dbFastLinkConv(cvt_device_st)"); + return(S_db_badChoice); + } + strncpy(to,pchoice,MAX_STRING_SIZE); + return(0); } /* @@ -1186,7 +1080,7 @@ static long cvt_dev_st( * NULL implies the conversion is not supported. */ -long (*get_cvt_table[DBF_DEVCHOICE+1][DBR_ENUM+1])() = { +long (*dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])() = { /* Convert DBF_STRING to ... */ { cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_f, cvt_st_d, cvt_st_e }, @@ -1218,17 +1112,11 @@ long (*get_cvt_table[DBF_DEVCHOICE+1][DBR_ENUM+1])() = { /* Convert DBF_ENUM to ... */ { cvt_e_st_get, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e }, - /* Convert DBF_GBLCHOICE to ... */ -{ cvt_gbl_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e }, + /* Convert DBF_MENU to ... */ +{ cvt_menu_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e }, - /* Convert DBF_CVTCHOICE to ... */ -{ cvt_cvt_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e }, - - /* Convert DBF_RECCHOICE to ... */ -{ cvt_rec_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e }, - - /* Convert DBF_DEVCHOICE to ... */ -{ cvt_dev_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e } }; + /* Convert DBF_DEVICE to ... */ +{ cvt_device_st, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e } }; /* * Put conversion routine lookup table @@ -1237,40 +1125,40 @@ long (*get_cvt_table[DBF_DEVCHOICE+1][DBR_ENUM+1])() = { * * DBF_STRING DBF_CHAR DBF_UCHAR DBF_SHORT DBF_USHORT * DBF_LONG DBF_ULONG DBF_FLOAT DBF_DOUBLE DBF_ENUM - * DBF_GBLCHOICE DBF_CVTCHOICE DBF_RECCHOICE DBF_DEVCHOICE + * DBF_MENU DBF_DEVICE * * NULL implies the conversion is not supported. */ -long (*put_cvt_table[DBR_ENUM+1][DBF_DEVCHOICE+1])() = { +long (*dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])() = { /* Convert DBR_STRING to ... */ -{ cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_f, cvt_st_d, cvt_st_e, cvt_st_gbl, cvt_st_cvt, cvt_st_rec, cvt_st_dev }, +{ cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_f, cvt_st_d, cvt_st_e, cvt_st_menu, cvt_st_device}, /* Convert DBR_CHAR to ... */ -{ cvt_c_st, cvt_c_c, cvt_c_uc, cvt_c_s, cvt_c_us, cvt_c_l, cvt_c_ul, cvt_c_f, cvt_c_d, cvt_c_e, cvt_c_e, cvt_c_e, cvt_c_e, cvt_c_e }, +{ cvt_c_st, cvt_c_c, cvt_c_uc, cvt_c_s, cvt_c_us, cvt_c_l, cvt_c_ul, cvt_c_f, cvt_c_d, cvt_c_e, cvt_c_e, cvt_c_e}, /* Convert DBR_UCHAR to ... */ -{ cvt_uc_st, cvt_uc_c, cvt_uc_uc, cvt_uc_s, cvt_uc_us, cvt_uc_l, cvt_uc_ul, cvt_uc_f, cvt_uc_d, cvt_uc_e, cvt_uc_e, cvt_uc_e, cvt_uc_e, cvt_uc_e }, +{ cvt_uc_st, cvt_uc_c, cvt_uc_uc, cvt_uc_s, cvt_uc_us, cvt_uc_l, cvt_uc_ul, cvt_uc_f, cvt_uc_d, cvt_uc_e, cvt_uc_e, cvt_uc_e}, /* Convert DBR_SHORT to ... */ -{ cvt_s_st, cvt_s_c, cvt_s_uc, cvt_s_s, cvt_s_us, cvt_s_l, cvt_s_ul, cvt_s_f, cvt_s_d, cvt_s_e, cvt_s_e, cvt_s_e, cvt_s_e, cvt_s_e }, +{ cvt_s_st, cvt_s_c, cvt_s_uc, cvt_s_s, cvt_s_us, cvt_s_l, cvt_s_ul, cvt_s_f, cvt_s_d, cvt_s_e, cvt_s_e, cvt_s_e}, /* Convert DBR_USHORT to ... */ -{ cvt_us_st, cvt_us_c, cvt_us_uc, cvt_us_s, cvt_us_us, cvt_us_l, cvt_us_ul, cvt_us_f, cvt_us_d, cvt_us_e, cvt_us_e, cvt_us_e, cvt_us_e, cvt_us_e }, +{ cvt_us_st, cvt_us_c, cvt_us_uc, cvt_us_s, cvt_us_us, cvt_us_l, cvt_us_ul, cvt_us_f, cvt_us_d, cvt_us_e, cvt_us_e, cvt_us_e}, /* Convert DBR_LONG to ... */ -{ cvt_l_st, cvt_l_c, cvt_l_uc, cvt_l_s, cvt_l_us, cvt_l_l, cvt_l_ul, cvt_l_f, cvt_l_d, cvt_l_e, cvt_l_e, cvt_l_e, cvt_l_e, cvt_l_e }, +{ cvt_l_st, cvt_l_c, cvt_l_uc, cvt_l_s, cvt_l_us, cvt_l_l, cvt_l_ul, cvt_l_f, cvt_l_d, cvt_l_e, cvt_l_e, cvt_l_e}, /* Convert DBR_ULONG to ... */ -{ cvt_ul_st, cvt_ul_c, cvt_ul_uc, cvt_ul_s, cvt_ul_us, cvt_ul_l, cvt_ul_ul, cvt_ul_f, cvt_ul_d, cvt_ul_e, cvt_ul_e, cvt_ul_e, cvt_ul_e, cvt_ul_e }, +{ cvt_ul_st, cvt_ul_c, cvt_ul_uc, cvt_ul_s, cvt_ul_us, cvt_ul_l, cvt_ul_ul, cvt_ul_f, cvt_ul_d, cvt_ul_e, cvt_ul_e, cvt_ul_e}, /* Convert DBR_FLOAT to ... */ -{ cvt_f_st, cvt_f_c, cvt_f_uc, cvt_f_s, cvt_f_us, cvt_f_l, cvt_f_ul, cvt_f_f, cvt_f_d, cvt_f_e, cvt_f_e, cvt_f_e, cvt_f_e, cvt_f_e }, +{ cvt_f_st, cvt_f_c, cvt_f_uc, cvt_f_s, cvt_f_us, cvt_f_l, cvt_f_ul, cvt_f_f, cvt_f_d, cvt_f_e, cvt_f_e, cvt_f_e}, /* Convert DBR_DOUBLE to ... */ -{ cvt_d_st, cvt_d_c, cvt_d_uc, cvt_d_s, cvt_d_us, cvt_d_l, cvt_d_ul, cvt_d_f, cvt_d_d, cvt_d_e, cvt_d_e, cvt_d_e, cvt_d_e, cvt_d_e }, +{ cvt_d_st, cvt_d_c, cvt_d_uc, cvt_d_s, cvt_d_us, cvt_d_l, cvt_d_ul, cvt_d_f, cvt_d_d, cvt_d_e, cvt_d_e, cvt_d_e}, /* Convert DBR_ENUM to ... */ -{ cvt_e_st_put, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e, cvt_e_e, cvt_e_e, cvt_e_e, cvt_e_e } }; +{ cvt_e_st_put, cvt_e_c, cvt_e_uc, cvt_e_s, cvt_e_us, cvt_e_l, cvt_e_ul, cvt_e_f, cvt_e_d, cvt_e_e, cvt_e_e, cvt_e_e} }; diff --git a/src/db/dbNotify.c b/src/db/dbNotify.c index b825f9a8a..5041b91a6 100644 --- a/src/db/dbNotify.c +++ b/src/db/dbNotify.c @@ -49,6 +49,7 @@ #include #include #include +#include /*NODE structure attached to ppnn field of each record in list*/ typedef struct { @@ -140,7 +141,7 @@ static long putNotify(PUTNOTIFY *ppn) void *pbuffer = ppn->pbuffer; long nRequest = ppn->nRequest; long status=0; - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pfldDes=(dbFldDes *)(paddr->pfldDes); struct dbCommon *precord = (struct dbCommon *)(paddr->precord); if(precord->ppn == ppn) { diff --git a/src/db/dbScan.c b/src/db/dbScan.c index 0ee9ff893..9c9996be8 100644 --- a/src/db/dbScan.c +++ b/src/db/dbScan.c @@ -41,7 +41,7 @@ * .10 02-22-94 mrk Make init work if 1st record has 28 char name * .11 05-04-94 mrk Call taskwdRemove only if spawing again */ - + #include #include #include @@ -54,14 +54,17 @@ #include #include +#include +#include +#include #include #include #include #include #include #include -#include #include +#include #include #include #include @@ -156,7 +159,8 @@ void post_event(int event) evnt = (unsigned)event; /*multiple writers can exist. Thus if evnt is ever changed to use*/ /*something bigger than a character interrupts will have to be blocked*/ - if(rngBufPut(eventQ,(void *)&evnt,sizeof(unsigned char))!=sizeof(unsigned char)) { + if(rngBufPut(eventQ,(void *)&evnt,sizeof(unsigned char)) + !=sizeof(unsigned char)) { if(newOverflow) errMessage(0,"rngBufPut overflow in post_event"); newOverflow = FALSE; } else { @@ -175,12 +179,14 @@ void scanAdd(struct dbCommon *precord) scan = precord->scan; if(scan==SCAN_PASSIVE) return; if(scan<0 || scan>= nPeriodic+SCAN_1ST_PERIODIC) { - recGblRecordError(-1,(void *)precord,"scanAdd detected illegal SCAN value"); + recGblRecordError(-1,(void *)precord, + "scanAdd detected illegal SCAN value"); }else if(scan==SCAN_EVENT) { unsigned char evnt; if(precord->evnt<0 || precord->evnt>=MAX_EVENTS) { - recGblRecordError(S_db_badField,(void *)precord,"scanAdd detected illegal EVNT value"); + recGblRecordError(S_db_badField,(void *)precord, + "scanAdd detected illegal EVNT value"); precord->scan = SCAN_PASSIVE; return; } @@ -199,13 +205,15 @@ void scanAdd(struct dbCommon *precord) DEVSUPFUN get_ioint_info; if(precord->dset==NULL){ - recGblRecordError(-1,(void *)precord,"scanAdd: I/O Intr not valid (no DSET) "); + recGblRecordError(-1,(void *)precord, + "scanAdd: I/O Intr not valid (no DSET) "); precord->scan = SCAN_PASSIVE; return; } get_ioint_info=precord->dset->get_ioint_info; if(get_ioint_info==NULL) { - recGblRecordError(-1,(void *)precord,"scanAdd: I/O Intr not valid (no get_ioint_info)"); + recGblRecordError(-1,(void *)precord, + "scanAdd: I/O Intr not valid (no get_ioint_info)"); precord->scan = SCAN_PASSIVE; return; } @@ -214,13 +222,15 @@ void scanAdd(struct dbCommon *precord) return; } if(piosl==NULL) { - recGblRecordError(-1,(void *)precord,"scanAdd: I/O Intr not valid"); + recGblRecordError(-1,(void *)precord, + "scanAdd: I/O Intr not valid"); precord->scan = SCAN_PASSIVE; return; } priority = precord->prio; if(priority<0 || priority>=NUM_CALLBACK_PRIORITIES) { - recGblRecordError(-1,(void *)precord,"scanAdd: illegal prio field"); + recGblRecordError(-1,(void *)precord, + "scanAdd: illegal prio field"); precord->scan = SCAN_PASSIVE; return; } @@ -245,18 +255,21 @@ void scanDelete(struct dbCommon *precord) scan = precord->scan; if(scan==SCAN_PASSIVE) return; if(scan<0 || scan>= nPeriodic+SCAN_1ST_PERIODIC) { - recGblRecordError(-1,(void *)precord,"scanDelete detected illegal SCAN value"); + recGblRecordError(-1,(void *)precord, + "scanDelete detected illegal SCAN value"); }else if(scan==SCAN_EVENT) { unsigned char evnt; if(precord->evnt<0 || precord->evnt>=MAX_EVENTS) { - recGblRecordError(S_db_badField,(void *)precord,"scanDelete detected illegal EVNT value"); + recGblRecordError(S_db_badField,(void *)precord, + "scanDelete detected illegal EVNT value"); return; } evnt = (signed)precord->evnt; psl = papEvent[evnt]; if(psl==NULL) - recGblRecordError(-1,(void *)precord,"scanDelete for bad evnt"); + recGblRecordError(-1,(void *)precord, + "scanDelete for bad evnt"); else deleteFromList(precord,psl); } else if(scan==SCAN_IO_EVENT) { @@ -265,22 +278,26 @@ void scanDelete(struct dbCommon *precord) DEVSUPFUN get_ioint_info; if(precord->dset==NULL) { - recGblRecordError(-1,(void *)precord,"scanDelete: I/O Intr not valid (no DSET)"); + recGblRecordError(-1,(void *)precord, + "scanDelete: I/O Intr not valid (no DSET)"); return; } get_ioint_info=precord->dset->get_ioint_info; if(get_ioint_info==NULL) { - recGblRecordError(-1,(void *)precord,"scanDelete: I/O Intr not valid (no get_ioint_info)"); + recGblRecordError(-1,(void *)precord, + "scanDelete: I/O Intr not valid (no get_ioint_info)"); return; } if(get_ioint_info(1,precord,&piosl)) return;/*return if error*/ if(piosl==NULL) { - recGblRecordError(-1,(void *)precord,"scanDelete: I/O Intr not valid"); + recGblRecordError(-1,(void *)precord, + "scanDelete: I/O Intr not valid"); return; } priority = precord->prio; if(priority<0 || priority>=NUM_CALLBACK_PRIORITIES) { - recGblRecordError(-1,(void *)precord,"scanDelete: get_ioint_info returned illegal priority"); + recGblRecordError(-1,(void *)precord, + "scanDelete: get_ioint_info returned illegal priority"); return; } piosl += priority; /*get piosl for correct priority*/ @@ -443,54 +460,17 @@ static void periodicTask(struct scan_list *psl) static void initPeriodic() { - struct { - DBRenumStrs - } scanChoices; - struct scan_list *psl; - struct dbAddr dbAddr; /* database address */ - struct recHeader *precHeader; - struct recLoc *precLoc; - RECNODE *precNode; - struct dbCommon *precord=NULL; /* pointer to record */ - long status,nRequest,options; - void *pfl=NULL; + dbMenu *pmenu; + struct scan_list *psl; + float temp; int i; - char name[PVNAME_SZ+FLDNAME_SZ+2]; - float temp; - if(!(precHeader = pdbBase->precHeader)) { - errMessage(S_record_noRecords, "initPeriodic"); - exit(1); - } - /* look for first record */ - for (i=0; inumber; i++) { - if((precLoc=precHeader->papRecLoc[i])==NULL) continue; - if(!precLoc->preclist) continue; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - if(precord->name[0]!=0) goto got_record; - } - } - errMessage(S_record_noRecords,"initPeriodic"); - return; -got_record: - /* get database address of SCAN field */ - name[PVNAME_SZ] = 0; - strncpy(name,precord->name,PVNAME_SZ); - strcat(name,".SCAN"); - if ((status=dbNameToAddr(name,&dbAddr)) != 0){ - recGblDbaddrError(status,&dbAddr,"initPeriodic"); - exit(1); - } - options = DBR_ENUM_STRS; - nRequest = 0; - status = dbGetField(&dbAddr,DBR_ENUM,&scanChoices,&options,&nRequest,pfl); - nPeriodic = scanChoices.no_str - SCAN_1ST_PERIODIC; - if(status || options!=DBR_ENUM_STRS || nPeriodic<=0) { - recGblDbaddrError(status,&dbAddr,"initPeriodic"); - exit(1); + pmenu = dbFindMenu(pdbBase,"menuScan"); + if(!pmenu) { + epicsPrintf("initPeriodic: menuScan not present\n"); + return; } + nPeriodic = pmenu->nChoice - SCAN_1ST_PERIODIC; papPeriodic = dbCalloc(nPeriodic,sizeof(struct scan_list*)); periodicTaskId = dbCalloc(nPeriodic,sizeof(int)); for(i=0; ilock); ellInit(&psl->list); - sscanf(scanChoices.strs[i+SCAN_1ST_PERIODIC],"%f",&temp); + sscanf(pmenu->papChoiceValue[i+SCAN_1ST_PERIODIC],"%f",&temp); psl->ticks = temp * vxTicksPerSecond; } } @@ -675,27 +655,20 @@ static void scanList(struct scan_list *psl) static void buildScanLists(void) { - struct recHeader *precHeader; - struct recLoc *precLoc; - RECNODE *precNode; - struct dbCommon *precord; /* pointer to record */ - int i; + dbRecDes *pdbRecDes; + dbRecordNode *pdbRecordNode; + dbCommon *precord; - if(!(precHeader = pdbBase->precHeader)) { - errMessage(S_record_noRecords, - "Error detected in build_scan_lists"); - exit(1); - } - /* look through all of the database records and place them on lists */ - for (i=0; inumber; i++) { - if((precLoc=precHeader->papRecLoc[i])==NULL) continue; - if(!precLoc->preclist) continue; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - if(precord->name[0]==0) continue; - scanAdd(precord); - } + /*Look for first record*/ + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; + if(precord->name[0]==0) continue; + scanAdd(precord); + } } } diff --git a/src/db/dbTest.c b/src/db/dbTest.c index ea2cbb1ff..c8d88441e 100644 --- a/src/db/dbTest.c +++ b/src/db/dbTest.c @@ -86,6 +86,8 @@ * dblls(ptypeName) list lock sets * char *ptypeName; Record type. If null all record types * + * int dbllsdblinks(int lset) + * * dbt(record_name) time 100 executions of "record_name" * (includes what records are processed * as a result of that record) @@ -103,15 +105,12 @@ #include #include #include -#include -#include #include #include #include #include -#include +#include #include -#include #include #include #include @@ -133,12 +132,12 @@ typedef struct msgBuff TAB_BUFFER; #define MAX(x,y) ((x > y)?x:y) /* Local Routines */ -static void printDbAddr(long status,struct dbAddr *paddr); +static void printDbAddr(long status,DBADDR *paddr); static void printBuffer( long status,short dbr_type,void *pbuffer,long reqOptions, long retOptions,long no_elements,TAB_BUFFER *pMsgBuff,int tab_size); static int dbpr_report( - char *pname,struct dbAddr *paddr,int interest_level, + char *pname,DBADDR *paddr,int interest_level, TAB_BUFFER *pMsgBuff,int tab_size); static void dbpr_msgOut(TAB_BUFFER *pMsgBuff,int tab_size); static void dbpr_init_msg(TAB_BUFFER *pMsgBuff,int tab_size); @@ -147,24 +146,16 @@ static void dbpr_msg_flush(TAB_BUFFER *pMsgBuff,int tab_size); static void dbprReportLink( TAB_BUFFER *pMsgBuff,char *pfield_name,struct link *plink, short field_type,int tab_size); -static void dbprReportCvtChoice( - TAB_BUFFER *pMsgBuff,char *pfield_name, +static void dbprReportMenu( + TAB_BUFFER *pMsgBuff,struct dbCommon *precord,dbFldDes *pdbFldDes, unsigned short choice_value,int tab_size); -static int dbprReportGblChoice( - TAB_BUFFER *pMsgBuff,struct dbCommon *precord,char *pfield_name, +static void dbprReportDevice( + TAB_BUFFER *pMsgBuff,struct dbCommon *precord,dbFldDes *pdbFldDes, unsigned short choice_value,int tab_size); -static void dbprReportRecChoice( - TAB_BUFFER *pMsgBuff,struct dbCommon *precord,char *pfield_name, - unsigned short choice_value,int tab_size); -static void dbprReportDevChoice( - TAB_BUFFER *pMsgBuff,struct dbAddr *paddr, - char *pfield_name,int tab_size); -static struct fldDes * dbprGetFldRec(short type,short fldNum); -static struct recTypDes *dbprGetRecTypDes(short type); long dba(char*pname) { - struct dbAddr addr; + DBADDR addr; long status; status=dbNameToAddr(pname,&addr); @@ -174,10 +165,10 @@ long dba(char*pname) long dbel(char*pname) { - struct dbAddr addr; + DBADDR addr; long status; struct event_block *peb; - struct fldDes *pfldDes; + dbFldDes *pdbFldDes; status=dbNameToAddr(pname,&addr); if(status) { @@ -190,8 +181,8 @@ long dbel(char*pname) return(0); } while(peb) { - pfldDes = ((struct dbAddr *)peb->paddr)->pfldDes; - printf("%4.4s",&pfldDes->fldname[0]); + pdbFldDes = ((DBADDR *)peb->paddr)->pfldDes; + printf("%4.4s",pdbFldDes->name); if(peb->select&&DBE_VALUE) printf(" VALUE"); if(peb->select&&DBE_LOG) printf(" LOG"); if(peb->select&&DBE_ALARM) printf(" ALARM"); @@ -273,54 +264,26 @@ static int specified_by(char *ptest, char *pspec) } } } - + long dbgrep(char *pmask) { - int rectype, beg, end; - struct recLoc *precLoc; - struct dbCommon *precord; - struct recType *precType; - struct recHeader *precHeader; - RECNODE *precNode; - - if (!pdbBase) { - printf("No database\n"); - return(0); - } - - if (!(precType = pdbBase->precType)) - return(0); - - if (!(precHeader = pdbBase->precHeader)) - return(0); - - beg = 0; - end = precHeader->number - 1; - - for (rectype = beg; rectype <= end; rectype++) { - - if (!(precLoc = GET_PRECLOC(precHeader, rectype))) - continue; - - /* - * Check if there are any record instances defined. - */ - if (precLoc->preclist == NULL) - continue; - - precNode = (RECNODE *) ellFirst(precLoc->preclist); - - for (; precNode != NULL; precNode = (RECNODE *) ellNext(&precNode->node)) { - precord = precNode->precord; - if (precord == NULL) continue; - if (precord->name == NULL) continue; - if (precord->name[0] == 0) continue; /* deleted record */ - - if (specified_by(precord->name, pmask)) { - printf("%s\n", precord->name); - } - } + DBENTRY dbentry; + DBENTRY *pdbentry=&dbentry; + long status; + char *pname; + + dbInitEntry(pdbBase,pdbentry); + status = dbFirstRecdes(pdbentry); + while(!status) { + status = dbFirstRecord(pdbentry); + while(!status) { + pname = dbGetRecordName(pdbentry); + if (specified_by(pname, pmask)) printf("%s\n", pname); + status = dbNextRecord(pdbentry); + } + status = dbNextRecdes(pdbentry); } + dbFinishEntry(pdbentry); return(0); } @@ -329,7 +292,7 @@ long dbgf(char *pname) /* declare buffer long just to ensure correct alignment */ long buffer[100]; long *pbuffer=&buffer[0]; - struct dbAddr addr; + DBADDR addr; long status; long options,no_elements; static TAB_BUFFER msg_Buff; @@ -347,11 +310,14 @@ long dbgf(char *pname) options=0; if(addr.dbr_field_type==DBR_ENUM) { status=dbGetField(&addr,DBR_STRING,pbuffer,&options,&no_elements,NULL); - printBuffer(status,DBR_STRING,pbuffer,0L,0L,no_elements,pMsgBuff,tab_size); + printBuffer(status,DBR_STRING,pbuffer,0L,0L,no_elements, + pMsgBuff,tab_size); } else { - status=dbGetField(&addr,addr.dbr_field_type,pbuffer,&options,&no_elements,NULL); - printBuffer(status,addr.dbr_field_type,pbuffer,0L,0L,no_elements,pMsgBuff,tab_size); + status=dbGetField(&addr,addr.dbr_field_type,pbuffer, + &options,&no_elements,NULL); + printBuffer(status,addr.dbr_field_type,pbuffer,0L,0L, + no_elements,pMsgBuff,tab_size); } pmsg[0] = '\0'; dbpr_msgOut(pMsgBuff, tab_size); @@ -361,7 +327,7 @@ long dbgf(char *pname) long dbpf(char *pname,char *pvalue) { /* declare buffer long just to ensure correct alignment */ - struct dbAddr addr; + DBADDR addr; long status; /* make sure value was passed*/ @@ -397,7 +363,7 @@ long dbpr(char *pname,int interest_level) { static TAB_BUFFER msg_Buff; TAB_BUFFER *pMsgBuff = &msg_Buff; - struct dbAddr addr; + DBADDR addr; long status; char *pmsg; int tab_size; @@ -419,7 +385,7 @@ long dbpr(char *pname,int interest_level) long dbtr(char *pname) { - struct dbAddr addr; + DBADDR addr; long status; struct dbCommon *precord; @@ -449,7 +415,7 @@ long dbtgf(char *pname) /* declare buffer long just to ensure correct alignment */ long buffer[400]; long *pbuffer=&buffer[0]; - struct dbAddr addr; + DBADDR addr; long status; long req_options,ret_options,no_elements; short dbr_type; @@ -524,7 +490,7 @@ long dbtpf(char *pname,char *pvalue) /* declare buffer long just to ensure correct alignment */ long buffer[100]; long *pbuffer=&buffer[0]; - struct dbAddr addr; + DBADDR addr; long status; long options,no_elements; char cvalue; @@ -686,24 +652,19 @@ long dbtpf(char *pname,char *pvalue) long dbior(char *pdrvName,int type) { - int i,j; char *pname; - struct drvSup *pdrvSup; - struct recDevSup *precDevSup; + drvSup *pdrvSup; struct drvet *pdrvet; + dbRecDes *pdbRecDes; + devSup *pdevSup; + struct dset *pdset; - if(!pdbBase) { - printf("No database\n"); - return(0); - } - if(!(pdrvSup= pdbBase->pdrvSup)) { - printf("No drivers\n"); - return(0); - } - for (i=0; inumber; i++) { - if((pname=pdrvSup->papDrvName[i])==NULL) continue; + for(pdrvSup = (drvSup *)ellFirst(&pdbBase->drvList); pdrvSup; + pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) { + pname = pdrvSup->name; if(pdrvName!=NULL && (strcmp(pdrvName,pname)!=0)) continue; - if((pdrvet=pdrvSup->papDrvet[i])==NULL) { + pdrvet = pdrvSup->pdrvet ; + if(pdrvet==NULL) { printf("No driver entry table is present for %s\n",pname); continue; } @@ -715,28 +676,22 @@ long dbior(char *pdrvName,int type) } } /* now check devSup reports */ - if(!(precDevSup=pdbBase->precDevSup)) { - printf("No device support\n"); - return(0); - } - for (i=0; inumber; i++) { - struct devSup *pdevSup; - - if(!(pdevSup=GET_PDEVSUP(precDevSup,i))) continue; - for(j=0; jnumber; j++) { - struct dset *pdset; - - if(!(pdset=GET_PDSET(pdevSup,j))) continue; - if((pname=pdevSup->papDsetName[j])==NULL) continue; + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for(pdevSup = (devSup *)ellFirst(&pdbRecDes->devList); pdevSup; + pdevSup = (devSup *)ellNext(&pdevSup->node)) { + if(!(pdset = pdevSup->pdset)) continue; + if(!(pname = pdevSup->name)) continue; if(pdrvName!=NULL && (strcmp(pdrvName,pname)!=0)) continue; if(pdset->report!=NULL) { printf("Device Support: %s\n",pname); - (*pdset->report)(type); + (*pdset->report)(type); } } } return(0); } + int dbhcr(void) { @@ -782,30 +737,27 @@ long dblls(int lockset) static char *dbf[DBF_NTYPES]={ "STRING","CHAR","UCHAR","SHORT","USHORT","LONG","ULONG", - "FLOAT","DOUBLE","ENUM","GBLCHOICE","CVTCHOICE","RECCHOICE", - "DEVCHOICE","INLINK","OUTLINK","FWDLINK","NOACCESS"}; + "FLOAT","DOUBLE","ENUM","MENU","DEVICE", + "INLINK","OUTLINK","FWDLINK","NOACCESS"}; static char *dbr[DBR_ENUM+2]={ "STRING","CHAR","UCHAR","SHORT","USHORT","LONG","ULONG", "FLOAT","DOUBLE","ENUM","NOACCESS"}; -static void printDbAddr(long status,struct dbAddr *paddr) +static void printDbAddr(long status,DBADDR *paddr) { - char *pstr; short field_type; short dbr_field_type; + dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes;; if(status!=0) { errMessage(status,"dbNameToAddr error"); } printf("Record Address: %p",paddr->precord); printf(" Field Address: %p",paddr->pfield); - printf(" Field Description: %p\n",paddr->pfldDes); + printf(" Field Description: %p\n",pdbFldDes); printf(" No Elements: %ld\n",paddr->no_elements); - if (!(pstr=GET_PRECNAME(pdbBase->precType,paddr->record_type))) - printf(" Record Type: %d\n",paddr->record_type); - else - printf(" Record Type: %s\n",pstr); + printf(" Record Type: %s\n",pdbFldDes->pdbRecDes->name); printf(" FieldType: DBF_"); field_type = paddr->field_type; if(field_type<0 || field_type>DBR_NOACCESS) @@ -815,7 +767,6 @@ static void printDbAddr(long status,struct dbAddr *paddr) printf(" Field Type: %d\n",paddr->field_type); printf(" Field Size: %d\n",paddr->field_size); printf(" Special: %d\n",paddr->special); - printf(" Choice Set: %d\n",paddr->choice_set); printf("DBR Field Type: DBR_"); dbr_field_type = paddr->dbr_field_type; if(dbr_field_type==DBR_NOACCESS)dbr_field_type=DBR_ENUM + 1; @@ -1116,131 +1067,63 @@ static void printBuffer( } static int dbpr_report( - char *pname,struct dbAddr *paddr,int interest_level, + char *pname,DBADDR *paddr,int interest_level, TAB_BUFFER *pMsgBuff,int tab_size) { - char *pmsg; - char *pName; - char *pfname; - struct fldDes *pfldDes; - struct recTypDes *precTypDes; - struct dbAddr *pLaddr; - struct dbAddr Laddr; /* local address */ - short fldNum; /* field number */ - char *pRecordName; - char RecordName[PVNAME_SZ + 2]; /* pv record name */ - char *pfield_name; - char field_name[FLDNAME_SZ + 1]; /* pv field name */ - char *pPvName=NULL; - char PvName[PVNAME_SZ + FLDNAME_SZ + 4]; /* recordname. */ - short n,n2; - long status; - long buffer[100]; - void *pbuffer; - long options; - long nRequest; - int sv_tab_size; + char *pmsg; + dbFldDes *pdbFldDes = paddr->pfldDes; + dbRecDes *pdbRecDes = pdbFldDes->pdbRecDes; + short n2; + void *pfield; + char *pfield_name; + pmsg = pMsgBuff->message; - - /* extract record name */ - pbuffer = (char *) buffer; - pRecordName = &RecordName[0]; - pName = pname; - n = 0; - while (*pName && (*pName != '.') && (n < PVNAME_SZ)) { - *pRecordName = *pName; - pName++; - pRecordName++; - n++; - } - *pRecordName = 0; - /* get ptr to record type descriptor */ - if (!(precTypDes = (struct recTypDes *) - dbprGetRecTypDes(paddr->record_type))) - return (-1); - - for (n2 = 0; n2 <= precTypDes->no_fields - 1; n2++) { - fldNum = precTypDes->sortFldInd[n2]; - - /* get ptr to field descriptor */ - if (!(pfldDes = (struct fldDes *) - dbprGetFldRec(paddr->record_type, fldNum))) { - return (-1); - } - /* extract field name */ - pfield_name = field_name; - /* blank pad the field name */ - pfname = pfldDes->fldname; - n = 0; - while (*(pfname) && (n < FLDNAME_SZ)) { - *pfield_name = *(pfname); - pfield_name++; - pfname++; - n++; - } - while (n < FLDNAME_SZ) { - *pfield_name = ' '; - pfield_name++; - n++; - } - *pfield_name = 0; - - pPvName = PvName; - pRecordName = RecordName; - pfield_name = field_name; - - /* use complete PV name */ - strcpy((char *) pPvName, (char *) pRecordName); - strcat(pPvName, "."); - strcat(pPvName, pfield_name); - - status = dbNameToAddr(pPvName, &Laddr); - if(status) { - printf("dbNameToAddr failed\n"); - return(1); - } - if (pfldDes->interest > interest_level ) + for (n2 = 0; n2 <= pdbRecDes->no_fields - 1; n2++) { + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->sortFldInd[n2]]; + pfield_name = pdbFldDes->name; + pfield = ((char *)paddr->precord) + pdbFldDes->offset; + if (pdbFldDes->interest > interest_level ) continue; - pLaddr = &Laddr; - switch (pfldDes->field_type) { + switch (pdbFldDes->field_type) { case DBF_STRING: - sprintf(pmsg, "%s: %s", pfield_name, (char *)pLaddr->pfield); + sprintf(pmsg, "%s: %s", pfield_name, (char *)pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_USHORT: sprintf(pmsg, "%s: 0x%-8X", pfield_name, - *(unsigned short *) pLaddr->pfield); + *(unsigned short *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_ENUM: sprintf(pmsg, "%s: %d", pfield_name, - *(unsigned short *) pLaddr->pfield); + *(unsigned short *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_FLOAT: sprintf(pmsg, "%s: %-12.4G", pfield_name, - *(float *) pLaddr->pfield); + *(float *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_CHAR: - sprintf(pmsg, "%s: %d", pfield_name, *(char *) pLaddr->pfield); + sprintf(pmsg, "%s: %d", pfield_name, *(char *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_UCHAR: sprintf(pmsg, "%s: %d", pfield_name, - *(unsigned char *) pLaddr->pfield); + *(unsigned char *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_NOACCESS: { /* lets just print field in hex */ - char * pchar = (char *)(pLaddr->pfield); + char * pchar = (char *)(pfield); char temp_buf[42]; char *ptemp_buf = &temp_buf[0]; - short n = pLaddr->field_size; + short n = pdbFldDes->size; short i; unsigned long value; + strcpy(ptemp_buf,"0x"); ptemp_buf+=2; if(n>(sizeof(temp_buf)-2)/2) n = (sizeof(temp_buf)-2)/2; for (i=0; ipfield); + sprintf(pmsg, "%s: %d", pfield_name, *(short *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_LONG: - sprintf(pmsg, "%s: 0x%-8X", pfield_name, *(long *) pLaddr->pfield); + sprintf(pmsg, "%s: 0x%-8X", pfield_name, *(long *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_ULONG: sprintf(pmsg, "%s: 0x%-8X", pfield_name, - *(unsigned long *) pLaddr->pfield); + *(unsigned long *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; case DBF_DOUBLE: sprintf(pmsg, "%s: %-12.4G", pfield_name, - *(double *) pLaddr->pfield); + *(double *) pfield); dbpr_msgOut(pMsgBuff, tab_size); break; + case DBF_MENU: + dbprReportMenu(pMsgBuff, paddr->precord, pdbFldDes, + *(unsigned short *)pfield, tab_size); + break; + case DBF_DEVICE: + dbprReportDevice(pMsgBuff, paddr->precord, pdbFldDes, + *(unsigned short *)pfield, tab_size); + break; case DBF_INLINK: dbprReportLink(pMsgBuff, pfield_name, - (struct link *) pLaddr->pfield, pfldDes->field_type, tab_size); + (struct link *) pfield, pdbFldDes->field_type, tab_size); break; case DBF_OUTLINK: dbprReportLink(pMsgBuff, pfield_name, - (struct link *) pLaddr->pfield, pfldDes->field_type, tab_size); + (struct link *) pfield, pdbFldDes->field_type, tab_size); break; case DBF_FWDLINK: dbprReportLink(pMsgBuff, pfield_name, - (struct link *) pLaddr->pfield, pfldDes->field_type, tab_size); + (struct link *) pfield, pdbFldDes->field_type, tab_size); break; - case DBF_CVTCHOICE: - dbprReportCvtChoice(pMsgBuff, pfield_name, - *(unsigned short *) pLaddr->pfield, tab_size); - break; - case DBF_RECCHOICE: - dbprReportRecChoice(pMsgBuff, pLaddr->precord, pfield_name, - *(unsigned short *) pLaddr->pfield, tab_size); - break; - case DBF_DEVCHOICE: - dbprReportDevChoice(pMsgBuff, pLaddr, pfield_name, tab_size); - break; - case DBF_GBLCHOICE: - if (dbprReportGblChoice(pMsgBuff, pLaddr->precord, pfield_name, - *(short *) pLaddr->pfield, tab_size)) - return (-1); break; default: sprintf(pmsg, "%s: dbpr: Unknown field_type", pfield_name); @@ -1305,29 +1181,6 @@ static int dbpr_report( } pmsg[0] = '\0'; dbpr_msgOut(pMsgBuff, tab_size); - /* flush buffer and change tab size */ - sv_tab_size = tab_size; - tab_size = 10; - strcpy((char *) pPvName, (char *) pRecordName); - strcat(pPvName, ".VAL"); - status = dbNameToAddr(pPvName, &Laddr); - if (status) - return (1); - pLaddr = &Laddr; - pfldDes = (struct fldDes *) Laddr.pfldDes; - if (pLaddr->field_type != pfldDes->field_type - || pLaddr->no_elements > 1) { - options = 0; - nRequest = MIN(pLaddr->no_elements,((sizeof(buffer))/pLaddr->field_size)); - status = dbGetField(&Laddr, Laddr.dbr_field_type, pbuffer, - &options, &nRequest,NULL); - printBuffer(status, Laddr.dbr_field_type, pbuffer, - 0L, 0L, nRequest, pMsgBuff, tab_size); - tab_size = sv_tab_size; - /* flush buffer and restore tab size */ - pmsg[0] = '\0'; - dbpr_msgOut(pMsgBuff, tab_size); - } return (0); } @@ -1381,7 +1234,7 @@ static void dbpr_init_msg(TAB_BUFFER *pMsgBuff,int tab_size) pMsgBuff->pNexTab = pMsgBuff->out_buff + tab_size; return; } - + static void dbpr_insert_msg(TAB_BUFFER *pMsgBuff,int len,int tab_size) { int current_len; @@ -1414,7 +1267,7 @@ static void dbpr_insert_msg(TAB_BUFFER *pMsgBuff,int len,int tab_size) return; } - + static void dbpr_msg_flush(TAB_BUFFER *pMsgBuff,int tab_size) { /* skip print if buffer empty */ @@ -1433,22 +1286,20 @@ static void dbprReportLink( char *pmsg = pMsgBuff->message; switch(plink->type) { case CONSTANT: - sprintf(pmsg,"%4s: %-12.4G", pfield_name, plink->value.value); + sprintf(pmsg,"%4s: %s", pfield_name, plink->value.constantStr); dbpr_msgOut(pMsgBuff,tab_size); break; case PV_LINK: if(field_type != DBF_FWDLINK) { - sprintf(pmsg,"%4s: PV_LINK pp=%1d ms=%1d %s.%.4s", + sprintf(pmsg,"%4s: PV_LINK pp=%1d ms=%1d %s", pfield_name, plink->value.pv_link.process_passive, plink->value.pv_link.maximize_sevr, - plink->value.pv_link.pvname, - plink->value.pv_link.fldname); + plink->value.pv_link.pvname); } else { - sprintf(pmsg,"%4s: PV_LINK %s.%.4s", + sprintf(pmsg,"%4s: PV_LINK %s", pfield_name, - plink->value.pv_link.pvname, - plink->value.pv_link.fldname); + plink->value.pv_link.pvname); } dbpr_msgOut(pMsgBuff,tab_size); break; @@ -1488,11 +1339,11 @@ static void dbprReportLink( dbpr_msgOut(pMsgBuff,tab_size); break; case AB_IO: - sprintf(pmsg,"%4s: ABIO link=%2d adaptor=%2d card=%2d signal=%2d flag=%1d parm=%s", + sprintf(pmsg,"%4s: ABIO link=%2d adaptor=%2d card=%2d signal=%2d parm=%s", pfield_name, plink->value.abio.link,plink->value.abio.adapter, plink->value.abio.card,plink->value.abio.signal, - plink->value.abio.plc_flag,plink->value.abio.parm); + plink->value.abio.parm); dbpr_msgOut(pMsgBuff,tab_size); break; case GPIB_IO: @@ -1526,20 +1377,18 @@ static void dbprReportLink( break; case DB_LINK: if(field_type != DBF_FWDLINK) { - struct dbAddr *paddr = (struct dbAddr *)plink->value.db_link.pdbAddr; - struct fldDes *pfldDes = (struct fldDes *)paddr->pfldDes; + DBADDR *paddr = (DBADDR *)plink->value.db_link.pdbAddr; - sprintf(pmsg,"%4s: DB_LINK pp=%1d ms=%1d %.32s.%.4s", + sprintf(pmsg,"%4s: DB_LINK pp=%1d ms=%1d %s", pfield_name, plink->value.db_link.process_passive, plink->value.db_link.maximize_sevr, - paddr->precord->name, - pfldDes->fldname); + paddr->precord->name); }else{ sprintf(pmsg,"%4s: DB_LINK %.32s", pfield_name, ((struct dbCommon *)( - ((struct dbAddr *)plink->value.db_link.pdbAddr) + ((DBADDR *)plink->value.db_link.pdbAddr) ->precord))->name); } dbpr_msgOut(pMsgBuff,tab_size); @@ -1557,152 +1406,38 @@ static void dbprReportLink( return; } -static void dbprReportCvtChoice( - TAB_BUFFER *pMsgBuff,char *pfield_name, - unsigned short choice_value,int tab_size) +static void dbprReportMenu( + TAB_BUFFER *pMsgBuff,struct dbCommon *precord,dbFldDes *pdbFldDes, + unsigned short value,int tab_size) { - char *pchoice; + dbMenu *pdbMenu = (dbMenu *)pdbFldDes->ftPvt; char *pmsg = pMsgBuff->message; - if(!(pchoice=GET_CHOICE(pdbBase->pchoiceCvt,choice_value))) { - sprintf(pmsg,"%4s Illegal Choice",pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); + if(!pdbMenu) { + sprintf(pmsg,"%s menu not found",pdbFldDes->name); + } else { + sprintf(pmsg,"%4s: %s",pdbFldDes->name,pdbMenu->papChoiceValue[value]); } - else { - sprintf(pmsg,"%4s: %s",pfield_name,pchoice); - dbpr_msgOut(pMsgBuff,tab_size); + dbpr_msgOut(pMsgBuff,tab_size); + return; +} + +static void dbprReportDevice( + TAB_BUFFER *pMsgBuff,struct dbCommon *precord,dbFldDes *pdbFldDes, + unsigned short value,int tab_size) +{ + dbDeviceMenu *pdbDeviceMenu = (dbDeviceMenu *)pdbFldDes->ftPvt; + char *pmsg = pMsgBuff->message; + + if(!pdbDeviceMenu) { + sprintf(pmsg,"%s menu not found",pdbFldDes->name); + } else { + sprintf(pmsg,"%4s: %s",pdbFldDes->name,pdbDeviceMenu->papChoice[value]); } + dbpr_msgOut(pMsgBuff,tab_size); return; } -static int dbprReportGblChoice( - TAB_BUFFER *pMsgBuff,struct dbCommon *precord,char *pfield_name, - unsigned short choice_value,int tab_size) -{ - char name[PVNAME_SZ+1+FLDNAME_SZ+1]; - struct dbAddr dbAddr; - struct choiceSet *pchoiceSet; - char *pchoice; - char *pmsg = pMsgBuff->message; - - strncpy(name,precord->name,PVNAME_SZ); - name[PVNAME_SZ]=0; - strcat(name,"."); - strncat(name,pfield_name,FLDNAME_SZ); - if(dbNameToAddr(name,&dbAddr)) { - sprintf(pmsg,"%4s dbNameToAddr failed?",pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); - return(0); - } - if( !(pchoiceSet=GET_PCHOICE_SET(pdbBase->pchoiceGbl,dbAddr.choice_set)) - || !(pchoice=GET_CHOICE(pchoiceSet,choice_value))) { - sprintf(pmsg,"%4s Cant find Choice",pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); - } - else { - sprintf(pmsg,"%4s: %s",pfield_name,pchoice); - dbpr_msgOut(pMsgBuff,tab_size); - } - return(0); -} - -static void dbprReportRecChoice( - TAB_BUFFER *pMsgBuff,struct dbCommon *precord,char *pfield_name, - unsigned short choice_value,int tab_size) -{ - char name[PVNAME_SZ+1+FLDNAME_SZ+1]; - struct dbAddr dbAddr; - struct arrChoiceSet *parrChoiceSet; - struct choiceSet *pchoiceSet; - char *pchoice; - char *pmsg = pMsgBuff->message; - - strncpy(name,precord->name,PVNAME_SZ); - name[PVNAME_SZ]=0; - strcat(name,"."); - strncat(name,pfield_name,FLDNAME_SZ); - if(dbNameToAddr(name,&dbAddr)) { - sprintf(pmsg,"%4s: dbNameToAddr failed?",pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); - return; - } - if( !(parrChoiceSet=GET_PARR_CHOICE_SET(pdbBase->pchoiceRec,dbAddr.record_type)) - || !(pchoiceSet=GET_PCHOICE_SET(parrChoiceSet,dbAddr.choice_set)) - || !(pchoice=GET_CHOICE(pchoiceSet,choice_value))) { - sprintf(pmsg,"%4s: Cant find Choice",pfield_name); - } - else { - sprintf(pmsg,"%4s: %s",pfield_name,pchoice); - } - dbpr_msgOut(pMsgBuff,tab_size); - return; -} - -static void dbprReportDevChoice( - TAB_BUFFER *pMsgBuff,struct dbAddr *paddr, - char *pfield_name,int tab_size) -{ - short choice_ind= *((short*)paddr->pfield); - struct devChoiceSet *pdevChoiceSet; - struct devChoice *pdevChoice; - long no_elements= paddr->no_elements; - char *pmsg = pMsgBuff->message; - char buff[MAX_STRING_SIZE+1]; - - if(no_elements!=1){ - sprintf(pmsg, - "%4s: Only one element allowed - dbprReportDevChoice", - pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); - return; - } - if((!(pdevChoiceSet=GET_PDEV_CHOICE_SET(pdbBase->pchoiceDev,paddr->record_type))) - || (!(pdevChoice=GET_DEV_CHOICE(pdevChoiceSet,choice_ind))) ) { - sprintf(pmsg, "%4s: NULL", - pfield_name); - dbpr_msgOut(pMsgBuff,tab_size); - return; - } - strncpy(buff,pdevChoice->pchoice,MAX_STRING_SIZE); - buff[MAX_STRING_SIZE] = 0; - sprintf(pmsg,"%4s: %s", - pfield_name, - buff); - dbpr_msgOut(pMsgBuff,tab_size); - return; -} - -static struct fldDes * dbprGetFldRec(short type,short fldNum) -{ - struct fldDes *pfield; - struct recDes *precDes; - struct recTypDes *precTypDes; - - if (!(precDes=pdbBase->precDes)) return (NULL); - if ((type < 0) || (type >= precDes->number)) return (NULL); - /* get and check pointer to this record's field definitions */ - precTypDes = precDes->papRecTypDes[type]; - if (!precTypDes) - return (NULL); - pfield = precTypDes->papFldDes[fldNum]; - return (pfield); -} - - -static struct recTypDes *dbprGetRecTypDes(short type) -{ - struct recDes *precDes; - struct recTypDes *precTypDes; - - if (!(precDes=pdbBase->precDes)) return (NULL); - if ((type < 0) || (type >= precDes->number)) return (NULL); - /* get and check pointer to this record's field definitions */ - precTypDes = precDes->papRecTypDes[type]; - if (!precTypDes) - return (NULL); - return (precTypDes); -} - /* * Call dbProcess() 100 times to make * sure Measurement is accurate, since @@ -1724,7 +1459,7 @@ struct dbCommon *precord; long dbt(record_name) char *record_name; { - struct dbAddr address; + DBADDR address; struct dbCommon *precord; long status = 0; @@ -1755,51 +1490,40 @@ char *record_name; int dbllsdblinks(int lset) { - int i,link; - struct recLoc *precLoc; - struct recDes *precDes; - struct recTypDes *precTypDes; - struct recHeader *precHeader; - RECNODE *precNode; - struct fldDes *pfldDes; - struct dbCommon *precord; - struct link *plink; + int link; + dbRecDes *pdbRecDes; + dbFldDes *pdbFldDes; + dbRecordNode *pdbRecordNode; + dbCommon *precord; + DBLINK *plink; - if(!(precHeader = pdbBase->precHeader)) return(-1); - if(!(precDes = pdbBase->precDes)) return(-1); - for(i=0; i< (precHeader->number); i++) { - if(!(precLoc = precHeader->papRecLoc[i]))continue; - if(!precLoc->preclist) continue; - precTypDes = precDes->papRecTypDes[i]; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - /* If NAME is null then skip this record*/ + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; if(!(precord->name[0])) continue; if(precord->lset != lset) continue; printf("%s\n",precord->name); - for(link=0; (linkno_links) ; link++) { - struct dbAddr *pdbAddr; + for(link=0; (linkno_links) ; link++) { + DBADDR *pdbAddr; - pfldDes = precTypDes->papFldDes[precTypDes->link_ind[link]]; - /* - * Find link structure, which is at an offset in the record - */ - plink = (struct link *)((char *)precord + pfldDes->offset); - /* Ignore link if type is constant, channel access, or hardware specific */ - if(plink->type != DB_LINK) continue; - pdbAddr = (struct dbAddr *)(plink->value.db_link.pdbAddr); - if(pfldDes->field_type==DBF_INLINK) { + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->link_ind[link]]; + plink = (DBLINK *)((char *)precord + pdbFldDes->offset); + if(plink->type != DB_LINK) continue; + pdbAddr = (DBADDR *)(plink->value.db_link.pdbAddr); + if(pdbFldDes->field_type==DBF_INLINK) { printf("\t INLINK"); - } else if(pfldDes->field_type==DBF_OUTLINK) { + } else if(pdbFldDes->field_type==DBF_OUTLINK) { printf("\tOUTLINK"); - } else if(pfldDes->field_type==DBF_FWDLINK) { + } else if(pdbFldDes->field_type==DBF_FWDLINK) { printf("\tFWDLINK"); - } - printf(" %s %s", + } + printf(" %s %s", ((plink->value.db_link.process_passive)?" PP":"NPP"), ((plink->value.db_link.maximize_sevr)?" MS":"NMS")); - printf(" %s\n",pdbAddr->precord->name); + printf(" %s\n",pdbAddr->precord->name); } } } diff --git a/src/db/db_test.c b/src/db/db_test.c index bdaa7d867..4d6068a8d 100644 --- a/src/db/db_test.c +++ b/src/db/db_test.c @@ -67,7 +67,6 @@ short index; return(1); } printf(" Record Name: %s\n",pname); - printf(" Record Type: %d\n",addr.record_type); printf("Record Address: 0x%p\n",addr.precord); printf(" Field Type: %d\n",addr.field_type); printf(" Field Address: 0x%p\n",addr.pfield); @@ -127,7 +126,6 @@ short index; return(1); } printf(" Record Name: %s\n",pname); - printf(" Record Type: %d\n",addr.record_type); printf("Record Address: 0x%p\n",addr.precord); printf(" Field Type: %d\n",addr.field_type); printf(" Field Address: 0x%p\n",addr.pfield); diff --git a/src/db/dbl.c b/src/db/dbl.c deleted file mode 100644 index b055aea81..000000000 --- a/src/db/dbl.c +++ /dev/null @@ -1,222 +0,0 @@ -/* dbl.c - * dbl is a simple unix tool dumps various record names in a database - * - * Original Author: Ben-chin Cha - * Date: 5-12-93 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * Modification Log: - * ----------------- - * .01 mm-dd-yy xxx Comment -*/ -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_TYPE 50 -#define MAX_DEV_NUM 1000 -#define MAX_DEV_NAME_SIZE 30 -#define MAX_REC_NAME_SIZE 15 - -int DBL_OPTION; -int NUM_DEV_ITEMS,NUM_LIST_ITEMS; -char dbType[MAX_TYPE][MAX_REC_NAME_SIZE]; -int rc_type[MAX_DEV_NUM]; -char pvName[MAX_DEV_NUM][MAX_DEV_NAME_SIZE+1]; -char dbl_option[MAX_REC_NAME_SIZE]; -char dbl_search[MAX_DEV_NAME_SIZE]; - -int dbl_dbGetRecNames(); - -main(argc,argv) -int argc; -char **argv; -{ -int i; - dbl_option[0] = '\0'; - dbl_search[0] = '\0'; - if (argc == 1) { - printf("USAGE: dbl [option] [subString]\n\n"); - return(0); - } - - if (argc >= 3) strcpy(dbl_option,argv[2]); - if (argc == 4) strcpy(dbl_search,argv[3]); - - if (strcmp(argv[1],"help") == 0 || strcmp(argv[1],"-help") == 0 - || strcmp(argv[1],"-h") == 0) - { - printf("\nUSAGE: dbl [option] [subString]\n\n"); - printf("dbl - An EPICS database list utility, can be used to dump \n"); - printf(" the process variable names for the specified database\n\n"); - printf("where option can be set as following\n\n"); - printf(" 1 dumps device type and the process variable name in the database\n"); - printf(" 2 dumps database process variable names which contains the \"subString\" \n"); - printf(" ( where \"subString\" can be any alphabetic string )\n"); - printf(" ai dumps database process variable names which are \"ai\" type \n"); - printf(" -1 dumps the header file for currently supported record types\n"); - exit(0); - } - - NUM_LIST_ITEMS = read_database(argv[1]); - - -} - - -int read_database(filename) -char *filename; -{ - DBBASE *pdbbase; - DBENTRY *pdbentry; - int i,ntype; - long status; - char fname[80]; - char *str; - FILE *fp; - - fp = fopen(filename,"r"); - if (!fp) { - printf("ERROR: Database file '%s' not found\n\n",filename); - return(0); - } - - /* load data base record name to pvName */ - str = pvName[0]; - memset(str,0,1000*31); - - pdbbase=dbAllocBase(); - pdbentry=dbAllocEntry(pdbbase); - status=dbRead(pdbbase,fp); - if(status) errMessage(status,"dbRead"); - fclose(fp); -if (strcmp(dbl_option,"-1") == 0) - ntype = dbl_dbGetRecTypes(pdbbase); - -else { - if (strlen(dbl_option) > (size_t)1) DBL_OPTION = 2; - else if (strcmp(dbl_option,"1") == 0) DBL_OPTION = 1; - else if (strcmp(dbl_option,"2") == 0) DBL_OPTION = 3; - else DBL_OPTION = 0; - -switch (DBL_OPTION) { - case 0: /* dump pv name only */ - NUM_LIST_ITEMS = dbl_dbGetRecNames(pdbbase,NULL); - for (i=0;i -#include -#include -#include -#include -#include -#include -DBBASE *pdbbase; - -#ifdef __STDC__ -void parse_command_line_args(int, char **, int *, int *, char **); -#else -void parse_command_line_args(); -#endif /*__STDC__*/ - -#ifdef __STDC__ -int main(int argc,char **argv) -#else -int main(argc,argv) -int argc; -char **argv; -#endif /*__STDC__*/ -{ - DBENTRY *pdbentry; - FILE *fp; - long status; - char *ptime; - time_t timeofday; - char *rectype; - int verbose; - int oldshortform; - char *dbname; - char *sdr_filename; - - parse_command_line_args(argc, argv, &verbose, &oldshortform, &dbname); - - fp = fopen(dbname,"r"); - if(!fp) { - errMessage(0,"Error opening file"); - exit(-1); - } - pdbbase=dbAllocBase(); - pdbentry=dbAllocEntry(pdbbase); - status=dbRead(pdbbase,fp); - if(status) { - errMessage(status,"dbRead"); - exit(-1); - } - fclose(fp); - status = dbFirstRecdes(pdbentry); - if(status) { - printf("No record description\n"); - exit(-1); - } - if(oldshortform) { - printf("$$mono\n"); - timeofday = time((time_t *)0); - ptime = ctime(&timeofday); - printf(" Time: %s\n",ptime); - } - while(!status) { - rectype = dbGetRecdesName(pdbentry); - status = dbFirstRecord(pdbentry); - while(!status) { - int generate_nl; - - printf("\nPV: %s Type: %s",dbGetRecordName(pdbentry),rectype); - printf("\n"); - generate_nl=FALSE; - status = dbFirstFielddes(pdbentry,TRUE); - if(status) printf(" No Fields\n"); - while(!status) { - char *pstr; - int lineout; - - if(verbose || !dbIsDefaultValue(pdbentry)) { - if(generate_nl) printf("\n"); - printf("%4s ",dbGetFieldName(pdbentry)); - pstr = dbGetString(pdbentry); - if(pstr) printf("%s",pstr); - generate_nl=TRUE; - } - status=dbNextFielddes(pdbentry,TRUE); - } - if(oldshortform) - printf("\f\n"); - else - printf("\n$$end\n"); - status = dbNextRecord(pdbentry); - } - status = dbNextRecdes(pdbentry); - } - if(oldshortform) printf("$$end\n"); - dbFreeEntry(pdbentry); - dbFreeBase(pdbbase); - return(0); -} - -#ifdef __STDC__ -void parse_command_line_args(int argc, char **argv,int *verbose, - int *oldshortform, char **dbname) -#else -void parse_command_line_args(argc,argv,verbose,oldshortform,dbname) -int argc; -char **argv; -int *verbose; -int *oldshortform; -char **dbname; -#endif /*__STDC__*/ -{ - extern char *optarg; /* needed for getopt() */ - extern int optind; /* needed for getopt() */ - int i; - int c; - int input_error; - - /* defaults */ - *verbose = FALSE; - *oldshortform = FALSE; - *dbname = (char *) NULL; - - input_error = FALSE; - - while (!input_error && (c = getopt(argc, argv, "vs")) != -1) - { - switch (c) - { - case 'v': *verbose = TRUE; break; - case 's': *oldshortform = TRUE; break; - case '?': input_error = 1; break; - default: input_error = 1; break; - } /* end switch() */ - } /* endwhile */ - - if (!input_error && optind < argc) - { - int gotperiod=FALSE; - int len; - - len = strlen(argv[optind]); - if(strchr(argv[optind],'.')) gotperiod = TRUE; - if(!gotperiod) len = len + strlen(".database"); - *dbname = dbCalloc(1,len); - strcpy(*dbname,argv[optind]); - if(!gotperiod) strcat(*dbname,".database"); - return; - } - fprintf(stderr, "\nusage: dbta [-v] [-s] fn > file.rpt\n"); - fprintf(stderr,"\n\t-v\tVerbose mode, outputs all prompt fields of\n"); - fprintf(stderr,"\t\trecords to standard out. If not specified,\n"); - fprintf(stderr,"\t\tthen only non default fields will be printed\n"); - fprintf(stderr,"\t-s\tGenerate old DCT short form format file\n"); - fprintf(stderr,"\tfn\tNames the .database file.\n"); - exit(1); -} diff --git a/src/db/iocInit.c b/src/db/iocInit.c index 07e0abf8f..0a5de444c 100644 --- a/src/db/iocInit.c +++ b/src/db/iocInit.c @@ -77,9 +77,7 @@ #include #include -#include #include -#include #include #include #include @@ -88,9 +86,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -100,11 +95,14 @@ #include #include #include +#include /*This module will declare and initilize module_type variables*/ #define MODULE_TYPES_INIT 1 #include +#define LOCAL + LOCAL int initialized=FALSE; /* The following is for use by interrupt routines */ @@ -112,10 +110,6 @@ volatile int interruptAccept=FALSE; struct dbBase *pdbBase=NULL; - -/* added for Channel Access Links */ -long dbCommonInit(); - /* define forward references*/ LOCAL long initDrvSup(void); LOCAL long initRecSup(void); @@ -143,40 +137,29 @@ int iocInit(char * pResourceFilename) SYM_TYPE type; if (initialized) { - logMsg("iocInit can only be called once\n",0,0,0,0,0,0); + logMsg("iocInit can only be called once\n", + 0,0,0,0,0,0); return(-1); } if (!pdbBase) { - logMsg("iocInit aborting because No database loaded by dbLoad\n",0,0,0,0,0,0); + logMsg("iocInit aborting because No database loaded by dbAsciiRead\n", + 0,0,0,0,0,0); return(-1); } errInit(); /*Initialize errPrintf task*/ - /* - * Setup initialization hooks, but only if an initHooks routine has been defined. - */ + /* Setup initialization hooks, if initHooks routine has been defined. */ strcpy(name, "_"); strcat(name, "initHooks"); rtnval = symFindByName(sysSymTbl, name, (void *) &pinitHooks, &type); - - - /* Call the user-defined initialization hook before anything else is done */ if (pinitHooks) (*pinitHooks)(INITHOOKatBeginning); - /* - * Print out version of iocCore - */ coreRelease(); - /* - * Read EPICS resources. - */ - status = getResources(pResourceFilename); - /* Call hook for after resources are read. */ + status = getResources(pResourceFilename); if (pinitHooks) (*pinitHooks)(INITHOOKafterGetResources); - /* Initialize log client, and call hook */ status = iocLogInit(); if (status!=0) { logMsg("iocInit Failed to Initialize Ioc Log Client \n",0,0,0,0,0,0); @@ -184,9 +167,7 @@ int iocInit(char * pResourceFilename) if (pinitHooks) (*pinitHooks)(INITHOOKafterLogInit); - /* - * After this point, further calls to iocInit() are disallowed. - */ + /* After this point, further calls to iocInit() are disallowed. */ initialized = TRUE; /* @@ -196,93 +177,55 @@ int iocInit(char * pResourceFilename) */ taskwdInit(); - /* - * Initialize EPICS callback tasks - */ callbackInit(); - /* - * Wait 1/10 second to make sure that the above initializations - * are complete. - */ + /* Wait 1/10 second for above initializations to complete*/ (void)taskDelay(sysClkRateGet()/10); - - /* Hook after callbacks are initialized */ if (pinitHooks) (*pinitHooks)(INITHOOKafterCallbackInit); - /* - * Initialize Channel Access Link mechanism. Pass #1 - * Call hook after CA links are initialized - */ + /* Initialize Channel Access Link mechanism. Pass #1 */ dbCaLinkInit((int) 1); - if (pinitHooks) (*pinitHooks)(INITHOOKafterCaLinkInit1); - /* - * Initialize Driver Support, Record Support, and finally Device Support. - */ if (initDrvSup() != 0) logMsg("iocInit: Drivers Failed during Initialization\n",0,0,0,0,0,0); - if (pinitHooks) (*pinitHooks)(INITHOOKafterInitDrvSup); if (initRecSup() != 0) - logMsg("iocInit: Record Support Failed during Initialization\n",0,0,0,0,0,0); - + logMsg("iocInit: Record Support Failed during Initialization\n", + 0,0,0,0,0,0); if (pinitHooks) (*pinitHooks)(INITHOOKafterInitRecSup); if (initDevSup() != 0) - logMsg("iocInit: Device Support Failed during Initialization\n",0,0,0,0,0,0); - + logMsg("iocInit: Device Support Failed during Initialization\n", + 0,0,0,0,0,0); if (pinitHooks) (*pinitHooks)(INITHOOKafterInitDevSup); - /* - * Initialize the time stamp code. This starts up the time-stamp task. - */ - /* ts_init(); */ /* old time stamp driver (jbk) */ TSinit(); /* new time stamp driver (jbk) */ - if (pinitHooks) (*pinitHooks)(INITHOOKafterTS_init); - /* - * First pass at initializing the database structure - */ + /* initialize database records */ if (initDatabase() != 0) logMsg("iocInit: Database Failed during Initialization\n",0,0,0,0,0,0); createLockSets(); - if (pinitHooks) (*pinitHooks)(INITHOOKafterInitDatabase); - /* added for Channel Access Links */ dbCaLinkInit((int) 2); if (pinitHooks) (*pinitHooks)(INITHOOKafterCaLinkInit2); - /* - * Finish initializing device support - */ if (finishDevSup() != 0) - logMsg("iocInit: Device Support Failed during Finalization\n",0,0,0,0,0,0); - + logMsg("iocInit: Device Support Failed during Finalization\n", + 0,0,0,0,0,0); if (pinitHooks) (*pinitHooks)(INITHOOKafterFinishDevSup); - /* - * Initialize Scan tasks - */ scanInit(); - - /* wait 1/2 second to make sure all tasks are started*/ - - /* initialize access security */ asInit(); - (void)taskDelay(sysClkRateGet()/2); if (pinitHooks) (*pinitHooks)(INITHOOKafterScanInit); - /* - * Enable scan tasks and some driver support functions. - */ + /* Enable scan tasks and some driver support functions. */ interruptAccept=TRUE; if (pinitHooks) (*pinitHooks)(INITHOOKafterInterruptAccept); @@ -296,9 +239,7 @@ int iocInit(char * pResourceFilename) if (pinitHooks) (*pinitHooks)(INITHOOKafterInitialProcess); - /* - * Start up CA server - */ + /* Start up CA server */ rsrv_init(); logMsg("iocInit: All initialization complete\n",0,0,0,0,0,0); @@ -316,26 +257,13 @@ int iocInit(char * pResourceFilename) */ LOCAL long initDrvSup(void) /* Locate all driver support entry tables */ { - char *pname; char name[40]; - int i; SYM_TYPE type; - char message[100]; long status=0; long rtnval; STATUS vxstatus; - struct drvSup *pdrvSup; - - /* - * Make sure at least one device driver is defined in - * the ASCII file. - */ - - if (!(pdrvSup=pdbBase->pdrvSup)) { - status = S_drv_noDrvSup; - errMessage(status,""); - return(status); - } + drvSup *pdrvSup; + struct drvet *pdrvet; /* * For every driver support module, look up the name @@ -343,32 +271,25 @@ LOCAL long initDrvSup(void) /* Locate all driver support entry tables */ * a driver entry table doesn't exist, report that * fact. */ - for(i=0; i< (pdrvSup->number); i++) { - if (!(pname = pdrvSup->papDrvName[i])) continue; - + for(pdrvSup = (drvSup *)ellFirst(&pdbBase->drvList); pdrvSup; + pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) { strcpy(name,"_"); - strcat(name,pname); - - vxstatus = symFindByName(sysSymTbl, name, (void *) &(pdrvSup->papDrvet[i]), &type); - + strcat(name,pdrvSup->name); + vxstatus = symFindByName(sysSymTbl, name, + (void *) &pdrvet, &type); if (vxstatus != OK) { - strcpy(message,": "); - strcat(message,pname); status = S_drv_noDrvet; - errMessage(status,message); + errPrintf(status,__FILE__,__LINE__,"%s",pdrvSup->name); continue; } - + pdrvSup->pdrvet = pdrvet; /* * If an initialization routine is defined (not NULL), * for the driver support call it. */ - if (!(pdrvSup->papDrvet[i]->init)) - continue; - rtnval = (*(pdrvSup->papDrvet[i]->init))(); - - if (status == 0) - status = rtnval; + if (!pdrvet->init) continue; + rtnval = (*(pdrvet->init))(); + if (status == 0) status = rtnval; } return(status); } @@ -383,87 +304,40 @@ LOCAL long initDrvSup(void) /* Locate all driver support entry tables */ */ LOCAL long initRecSup(void) { - char name[40]; - int i; + char name[60]; SYM_TYPE type; - char message[100]; long status=0; long rtnval; STATUS vxstatus; - int nbytes; - struct recType *precType; - struct recSup *precSup; + dbRecDes *pdbRecDes; + struct rset *prset; - if(!(precType=pdbBase->precType)) { - status = S_rectype_noRecs; - errMessage(status,""); - return(status); - } - - /* - * Allocate record support structure, and a list of pointers - * after it to point to the Record Support Entry Tables (RSETs) - * of individual record types. - */ - nbytes = sizeof(struct recSup) + precType->number * sizeof(void *); - precSup = dbCalloc(1,nbytes); - pdbBase->precSup = precSup; - - /* The number of record support entry tables equals the number of record types */ - precSup->number = precType->number; - - /* - * The pointer to the array of pointers of Record Support Entry Tables - * exists at the end of the record support structure. - */ - precSup->papRset = (void *)((long)precSup + (long)sizeof(struct recSup)); - - /* - * For every record support module, look up the name - * for that function in the vxWorks symbol table. If - * a record support entry table doesn't exist, report - * that fact. - */ - for(i=0; i< (precSup->number); i++) { - if (precType->papName[i] == NULL) - continue; - - /* - * Create string that is the name of the RSET - * (record support entry table) structure for - * each record type. - */ + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { strcpy(name,"_"); - strcat(name,precType->papName[i]); + strcat(name,pdbRecDes->name); strcat(name,"RSET"); - - /* Lookup name in vxWorks symbol table - and make sure it is program text */ vxstatus = symFindByName(sysSymTbl, name, - (void *) (&precSup->papRset[i]), &type); - + (void *)&pdbRecDes->prset, &type); if (vxstatus != OK) { - strcpy(message,": "); - strcat(message,name); status = S_rec_noRSET; - errMessage(status,message); + errPrintf(status,__FILE__,__LINE__,"%s",pdbRecDes->name); continue; } - + prset = pdbRecDes->prset; /* If an initialization routine exists for a record type, execute it */ - if (!(precSup->papRset[i]->init)) + if(!prset->init) { continue; - else { - rtnval = (*(precSup->papRset[i]->init))(); + } else { + rtnval = (*prset->init)(); if (status==0) status = rtnval; } } - return(status); } -/* - * Initialize Device Support +/* Initialize Device Support * Locate all device support entry tables. * Call the initialization routine (init) for each * device type (First Pass). @@ -472,101 +346,54 @@ LOCAL long initDevSup(void) { char *pname; char name[40]; - int i,j; SYM_TYPE type; - char message[100]; long status=0; - long rtnval; + long rtnval = 0; STATUS vxstatus; - struct recDevSup *precDevSup; - struct devSup *pdevSup; + dbRecDes *pdbRecDes; + devSup *pdevSup; + struct dset *pdset; - if (!(precDevSup = pdbBase->precDevSup)) { - status = S_dev_noDevSup; - errMessage(status,""); - return(status); - } - - /* - * For all possible records, initialize their device support - * routines. There is usually more than one device support - * routine defined for every record type, this accounts for - * the doubly nested for() loops. precDevSup->number = number - * of record types. - */ - for (i=0; i< (precDevSup->number); i++) { - /* - * Find the device support routine in the array of pointers - */ - if ((pdevSup = precDevSup->papDevSup[i]) == NULL) - continue; - - /* For every device support module defined for a record type... */ - for(j=0; j < (pdevSup->number); j++) { - /* Create the name */ - if (!(pname = pdevSup->papDsetName[j])) - continue; + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for(pdevSup = (devSup *)ellFirst(&pdbRecDes->devList); pdevSup; + pdevSup = (devSup *)ellNext(&pdevSup->node)) { + if(!(pname = pdevSup->name)) continue; strcpy(name, "_"); strcat(name, pname); - - /* Lookup name in vxWorks symbol table - make sure it is program text */ vxstatus = (long) symFindByName(sysSymTbl, name, - (void *) &(pdevSup->papDset[j]), &type); - + (void *) &pdset, &type); if (vxstatus != OK) { - pdevSup->papDset[j]=NULL; - strcpy(message, ": "); - strcat(message, pname); status = S_dev_noDSET; - errMessage(status, message); + errPrintf(status,__FILE__,__LINE__,"%s",pdevSup->name); continue; } - - /* If an init routine exists for the device support module, execute it */ - if (!(pdevSup->papDset[j]->init)) - continue; - - rtnval = (*(pdevSup->papDset[j]->init))(0); - - if (status == 0) - status = rtnval; + pdevSup->pdset = pdset; + if(!(pdset->init)) continue; + rtnval = (*pdset->init)(0); + if (status == 0) status = rtnval; } } return(status); } -/* - * Calls the second pass for each device support +/* Calls the second pass for each device support * initialization routine. The second pass is made * after the database records have been initialized and * placed into lock sets. */ LOCAL long finishDevSup(void) { - int i,j; - struct recDevSup *precDevSup; - struct devSup *pdevSup; + dbRecDes *pdbRecDes; + devSup *pdevSup; + struct dset *pdset; - /* Find pointer to device support for all record types */ - if (!(precDevSup=pdbBase->precDevSup)) - return(0); - - /* For every record type... */ - for(i=0; i< (precDevSup->number); i++) { - /* Find pointer to device support for an individual record type */ - if ((pdevSup = precDevSup->papDevSup[i]) == NULL) - continue; - - /* For every device support module defined for a record type */ - for(j=0; j < (pdevSup->number); j++) { - if (!(pdevSup->papDset[j])) - continue; - - /* Call the second pass of the initialization, if the routine exists */ - if (!(pdevSup->papDset[j]->init)) - continue; - - (*(pdevSup->papDset[j]->init))(1); + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for(pdevSup = (devSup *)ellFirst(&pdbRecDes->devList); pdevSup; + pdevSup = (devSup *)ellNext(&pdevSup->node)) { + if(!(pdset = pdevSup->pdset)) continue; + if(pdset->init) (*pdset->init)(1); } } @@ -575,104 +402,30 @@ LOCAL long finishDevSup(void) LOCAL long initDatabase(void) { - char name[PVNAME_SZ+FLDNAME_SZ+2]; - short i,j; - char message[120]; long status=0; long rtnval=0; - struct recLoc *precLoc; + dbRecDes *pdbRecDes; + dbFldDes *pdbFldDes; + dbRecordNode *pdbRecordNode; + devSup *pdevSup; struct rset *prset; - struct recDes *precDes; - struct recTypDes *precTypDes; - struct recHeader *precHeader; - RECNODE *precNode; - struct fldDes *pfldDes; - struct dbCommon *precord; - struct dbAddr dbAddr; - struct link *plink; - struct devSup *pdevSup; - struct recSup *precSup; - struct recType *precType; + struct dset *pdset; + dbCommon *precord; + DBADDR dbaddr; + DBLINK *plink; + int j; - /* Find the record type and record support structures */ - if(!(precType=pdbBase->precType)) return(0); - if(!(precSup=pdbBase->precSup)) return(0); - - /* - * Locate database record header - * This structure contains a pointer to an array of pointers to - * record location structures. A record location structure - * exists for every record type. It contains a pointer to a - * linked list of all instances of records with that type. - */ - if (!(precHeader = pdbBase->precHeader)) { - status = S_record_noRecords; - errMessage(status,""); - return(status); - } - - /* - * Find record descriptions - * The record descriptions contain every piece of information - * you ever wanted to know about the individual fields in a - * particular record type. See header file for more information. - */ - if (!(precDes = pdbBase->precDes)) { - status = S_record_noRecords; - errMessage(status,"Database record descriptions were not defined"); - return(status); - } - - /* For every record type ... */ - for(i=0; i< (precHeader->number); i++) { - /* Get pointer to location structure for instances of record type 'i' */ - if (!(precLoc = precHeader->papRecLoc[i]))continue; - - if (!precLoc->preclist) continue; - - /* - * Find record support entry table, record description, and device - * support associated with record type 'i' - */ - prset = GET_PRSET(precSup,i); - precTypDes = precDes->papRecTypDes[i]; - pdevSup = GET_PDEVSUP(pdbBase->precDevSup,i); - - /* - * For all instances of record type 'i '... - * These records are contained in the linked list - */ - for (precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - - /* - * If there is not record support entry table for record - * type 'i', report message, and break from for loop. - */ - if (!prset) { - strcpy(name,precType->papName[i]); - strcat(name,"RSET"); - strcpy(message,": "); - strcat(message,name); - status = S_rec_noRSET; - errMessage(status,message); - break; - } + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + prset = pdbRecDes->prset; + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + if(!prset) break; /* Find pointer to record instance */ - precord = precNode->precord; - - /* If NAME is null then skip this record*/ + precord = pdbRecordNode->precord; if(!(precord->name[0])) continue; - - /* Initialize record's record support entry table field */ precord->rset = prset; - - /* - * Initialize mlok and mlis. - * (The monitor lock - basically a semaphore) and the - * monitor list field. The list of "applications" - * observing changes in a database field. - */ FASTLOCKINIT(&precord->mlok); ellInit(&(precord->mlis)); @@ -680,145 +433,93 @@ LOCAL long initDatabase(void) precord->pact=FALSE; /* Init DSET NOTE that result may be NULL */ - precord->dset=(struct dset *)GET_PDSET(pdevSup,precord->dtyp); - - /* Initialize dbCommon structure of the record - First pass (pass=0) */ + pdevSup = (devSup *)ellNth(&pdbRecDes->devList,precord->dtyp+1); + pdset = (pdevSup ? pdevSup->pdset : 0); + precord->dset = pdset; + /* Initialize dbCommon - First pass (pass=0) */ rtnval = dbCommonInit(precord,0); - - /* - * Call record support init_record routine - First pass - * (pass=0). (only if init_record is defined...) - */ - if (!(precSup->papRset[i]->init_record)) continue; - - rtnval = (*(precSup->papRset[i]->init_record))(precord,0); - - if (status==0) - status = rtnval; + if(!prset->init_record) continue; + rtnval = (*prset->init_record)(precord,0); + if (status==0) status = rtnval; } } /* * Second pass to resolve links */ - /* For all record types */ - for(i=0; i< (precHeader->number); i++) { - /* Find record instances */ - if (!(precLoc = precHeader->papRecLoc[i]))continue; + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + prset = pdbRecDes->prset; + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; + if(!(precord->name[0])) continue; + /* + * Convert all PV_LINKs to DB_LINKs or CA_LINKs + * Figures out what type of link to use. A + * database link local to the IOC, or a channel + * access link across the network. + */ + /* For all the links in the record type... */ + for(j=0; jno_links; j++) { + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->link_ind[j]]; + plink = (DBLINK *)((char *)precord + pdbFldDes->offset); + if (plink->type == PV_LINK) { + /* + * Lookup record name in database + * If a record is _not_ local to the IOC, it is a + * channel access link, otherwise it is a + * database link. + */ + if(dbNameToAddr(plink->value.pv_link.pvname,&dbaddr) == 0) { + DBADDR *pdbAddr; - if (!precLoc->preclist) continue; - - /* Find record field descriptions */ - precTypDes = precDes->papRecTypDes[i]; - - /* For all record instances of type 'i' in the linked list... */ - for (precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - - /* If NAME is null then skip this record*/ - if (!(precord->name[0])) continue; - - /* - * Convert all PV_LINKs to DB_LINKs or CA_LINKs - * Figures out what type of link to use. A - * database link local to the IOC, or a channel - * access link across the network. - */ - /* For all the links in the record type... */ - for(j=0; jno_links; j++) { - pfldDes = precTypDes->papFldDes[precTypDes->link_ind[j]]; - - /* - * The actual link structure is located at this offset - * within the link structure. - */ - plink = (struct link *)((char *)precord + pfldDes->offset); - - /* - * Link type should be PV_LINK, unless it is - * constant or hardware-specific - */ - if (plink->type == PV_LINK) { - strncpy(name,plink->value.pv_link.pvname,PVNAME_SZ); - - /* create record name */ - name[PVNAME_SZ]=0; - strcat(name,"."); - strncat(name,plink->value.pv_link.fldname,FLDNAME_SZ); - - /* - * Lookup record name in database - * If a record is _not_ local to the IOC, it is a - * channel access link, otherwise it is a - * database link. + plink->type = DB_LINK; + pdbAddr = dbCalloc(1,sizeof(struct dbAddr)); + *pdbAddr = dbaddr; /*structure copy*/; + plink->value.db_link.pdbAddr = pdbAddr; + /*Initialize conversion to "uninitialized" conversion */ + plink->value.db_link.conversion = cvt_uninit; + } else { + /* + * Not a local process variable ... assuming a CA_LINK + * Only supporting Non Process Passive links, + * Input Maximize Severity/No Maximize Severity(MS/NMS) + * , and output NMS + * links ... The following code checks for this. */ - if (dbNameToAddr(name,&dbAddr) == 0) { - plink->type = DB_LINK; - plink->value.db_link.pdbAddr = - dbCalloc(1,sizeof(struct dbAddr)); - *((struct dbAddr *)(plink->value.db_link.pdbAddr))=dbAddr; - /* - * Initialize conversion to "uninitialized" conversion - */ - plink->value.db_link.conversion = cvt_uninit; - } - else { - /* - * Not a local process variable ... assuming a CA_LINK - * Only supporting Non Process Passive links, Input Maximize - * Severity/No Maximize Severity(MS/NMS), and output NMS - * links ... The following code checks for this. - */ - if (errVerbose && - (plink->value.db_link.process_passive - || (pfldDes->field_type == DBF_OUTLINK - && plink->value.db_link.maximize_sevr))) - { - /* - * Link PP and/or Outlink MS ... - * neither supported under CA_LINKs - */ - strncpy(message,precord->name,PVNAME_SZ); - message[PVNAME_SZ]=0; - strcat(message,"."); - strncat(message,pfldDes->fldname,FLDNAME_SZ); - strcat(message,": link process variable ="); - strcat(message,name); - strcat(message," PP and/or MS illegal"); - status = S_db_badField; - errMessage(status,message); - status = 0; - } - } + if (errVerbose && + (plink->value.db_link.process_passive + || (pdbFldDes->field_type == DBF_OUTLINK + && plink->value.db_link.maximize_sevr))) { + status = S_db_badField; + errPrintf(status,__FILE__,__LINE__,"%s.%s %s", + precord->name,pdbFldDes->name, + " PP and/or MS illegal"); + status = 0; + } } } + } } } - /* - * Call record support init_record routine - Second pass - */ - /* For all record types... */ - for(i=0; i< (precHeader->number); i++) { - if (!(precLoc = precHeader->papRecLoc[i])) continue; - if (!precLoc->preclist) continue; - if (!(prset=GET_PRSET(precSup,i))) continue; - precTypDes = precDes->papRecTypDes[i]; - - /* For all record instances of type 'i' */ - for (precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - /* Locate name of record */ - precord = precNode->precord; - /* If NAME is null then skip this record*/ - if (!(precord->name[0])) continue; - rtnval = dbCommonInit(precord,1); - if (status==0) status = rtnval; - /* call record support init_record routine - Second pass (pass = 1) */ - if (!(precSup->papRset[i]->init_record)) continue; - rtnval = (*(precSup->papRset[i]->init_record))(precord, 1); - if (status == 0) status = rtnval; + /* Call record support init_record routine - Second pass */ + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + prset = pdbRecDes->prset; + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + if(!prset) break; + /* Find pointer to record instance */ + precord = pdbRecordNode->precord; + if(!(precord->name[0])) continue; + precord->rset = prset; + if(!prset->init_record) continue; + rtnval = (*prset->init_record)(precord,1); + if (status==0) status = rtnval; } } return(status); @@ -826,33 +527,25 @@ LOCAL long initDatabase(void) LOCAL void createLockSets(void) { - int i,link; - struct recLoc *precLoc; - struct recDes *precDes; - struct recTypDes *precTypDes; - struct recHeader *precHeader; - RECNODE *precNode; - struct fldDes *pfldDes; - struct dbCommon *precord; - struct link *plink; + int link; + dbRecDes *pdbRecDes; + dbFldDes *pdbFldDes; + dbRecordNode *pdbRecordNode; + dbCommon *precord; + DBLINK *plink; short nset,maxnset,newset; int again; int anyChange; nset = 0; - if(!(precHeader = pdbBase->precHeader)) return; - if(!(precDes = pdbBase->precDes)) return; - for(i=0; i< (precHeader->number); i++) { - if(!(precLoc = precHeader->papRecLoc[i]))continue; - if(!precLoc->preclist) continue; - precTypDes = precDes->papRecTypDes[i]; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - /* If NAME is null then skip this record*/ + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; if(!(precord->name[0])) continue; if(precord->lset) continue; /*already in a lock set*/ - /* * At First, assume record is in a different lockset * We shall see later if this assumption is incorrect. @@ -865,19 +558,14 @@ LOCAL void createLockSets(void) precord->pact = TRUE; again = TRUE; while(again) { again = FALSE; - for(link=0; (linkno_links&&!again) ; link++) { - struct dbAddr *pdbAddr; + for(link=0; (linkno_links&&!again) ; link++) { + DBADDR *pdbAddr; - pfldDes = precTypDes->papFldDes[precTypDes->link_ind[link]]; - - /* - * Find link structure, which is at an offset in the record - */ - plink = (struct link *)((char *)precord + pfldDes->offset); - /* Ignore link if type is constant, channel access, or hardware specific */ + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->link_ind[link]]; + plink = (DBLINK *)((char *)precord + pdbFldDes->offset); if(plink->type != DB_LINK) continue; - pdbAddr = (struct dbAddr *)(plink->value.db_link.pdbAddr); + pdbAddr = (DBADDR *)(plink->value.db_link.pdbAddr); /* The current record is in a different lockset -IF- * 1. Input link @@ -885,7 +573,7 @@ LOCAL void createLockSets(void) * 3. Not Maximize Severity * 4. Not An Array Operation - single element only */ - if (pfldDes->field_type==DBF_INLINK + if (pdbFldDes->field_type==DBF_INLINK && ( !(plink->value.db_link.process_passive) && !(plink->value.db_link.maximize_sevr)) && pdbAddr->no_elements<=1) continue; @@ -924,26 +612,20 @@ LOCAL void createLockSets(void) LOCAL void createLockSetsExtraPass(int *anyChange) { - int i,link; - struct recLoc *precLoc; - struct recDes *precDes; - struct recTypDes *precTypDes; - struct recHeader *precHeader; - RECNODE *precNode; - struct fldDes *pfldDes; - struct dbCommon *precord; - struct link *plink; + int link; + dbRecDes *pdbRecDes; + dbFldDes *pdbFldDes; + dbRecordNode *pdbRecordNode; + dbCommon *precord; + DBLINK *plink; int again; - if(!(precHeader = pdbBase->precHeader)) return; - if(!(precDes = pdbBase->precDes)) return; - for(i=0; i< (precHeader->number); i++) { - if(!(precLoc = precHeader->papRecLoc[i]))continue; - if(!precLoc->preclist) continue; - precTypDes = precDes->papRecTypDes[i]; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; if(!(precord->name[0])) continue; /*Prevent cycles in database graph*/ precord->pact = TRUE; again = TRUE; @@ -951,14 +633,14 @@ LOCAL void createLockSetsExtraPass(int *anyChange) short newset; again = FALSE; - for(link=0; (linkno_links&&!again) ; link++) { - struct dbAddr *pdbAddr; + for(link=0; (linkno_links&&!again) ; link++) { + DBADDR *pdbAddr; - pfldDes = precTypDes->papFldDes[precTypDes->link_ind[link]]; - plink = (struct link *)((char *)precord + pfldDes->offset); + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->link_ind[link]]; + plink = (DBLINK *)((char *)precord + pdbFldDes->offset); if(plink->type != DB_LINK) continue; - pdbAddr = (struct dbAddr *)(plink->value.db_link.pdbAddr); - if (pfldDes->field_type==DBF_INLINK + pdbAddr = (DBADDR *)(plink->value.db_link.pdbAddr); + if(pdbFldDes->field_type==DBF_INLINK && ( !(plink->value.db_link.process_passive) && !(plink->value.db_link.maximize_sevr)) && pdbAddr->no_elements<=1) continue; @@ -979,12 +661,11 @@ LOCAL void createLockSetsExtraPass(int *anyChange) LOCAL short makeSameSet(struct dbAddr *paddr, short lset,int *anyChange) { - struct dbCommon *precord = paddr->precord; + dbCommon *precord = paddr->precord; short link; - struct fldDes *pfldDes; - struct link *plink; - struct recTypDes *precTypDes; - struct recDes *precDes; + dbRecDes *pdbRecDes; + dbFldDes *pdbFldDes; + DBLINK *plink; int again; /*Prevent cycles in database graph*/ @@ -1007,23 +688,20 @@ LOCAL short makeSameSet(struct dbAddr *paddr, short lset,int *anyChange) * return that lock set. */ if(precord->lset < lset) return(precord->lset); - - if(!(precDes = pdbBase->precDes)) return(0); - /* set pact to prevent cycles */ precord->lset = lset; precord->pact = TRUE; again = TRUE; while(again) { again = FALSE; - precTypDes = precDes->papRecTypDes[paddr->record_type]; - for(link=0; linkno_links; link++) { - struct dbAddr *pdbAddr; - short newset; + pdbRecDes = ((dbFldDes *)paddr->pfldDes)->pdbRecDes; + for(link=0; linkno_links; link++) { + DBADDR *pdbAddr; + short newset; - pfldDes = precTypDes->papFldDes[precTypDes->link_ind[link]]; - plink = (struct link *)((char *)precord + pfldDes->offset); + pdbFldDes = pdbRecDes->papFldDes[pdbRecDes->link_ind[link]]; + plink = (DBLINK *)((char *)precord + pdbFldDes->offset); if(plink->type != DB_LINK) continue; - pdbAddr = (struct dbAddr *)(plink->value.db_link.pdbAddr); - if( pfldDes->field_type==DBF_INLINK + pdbAddr = (DBADDR *)(plink->value.db_link.pdbAddr); + if( pdbFldDes->field_type==DBF_INLINK && ( !(plink->value.db_link.process_passive) && !(plink->value.db_link.maximize_sevr) ) && pdbAddr->no_elements<=1) continue; @@ -1046,23 +724,19 @@ LOCAL short makeSameSet(struct dbAddr *paddr, short lset,int *anyChange) */ LOCAL long initialProcess(void) { - short i; - struct recHeader *precHeader; - struct recLoc *precLoc; - RECNODE *precNode; - struct dbCommon *precord; + dbRecDes *pdbRecDes; + dbRecordNode *pdbRecordNode; + dbCommon *precord; - if(!(precHeader = pdbBase->precHeader)) return(0); - for(i=0; i< (precHeader->number); i++) { - if(!(precLoc = precHeader->papRecLoc[i]))continue; - if(!precLoc->preclist) continue; - for(precNode=(RECNODE *)ellFirst(precLoc->preclist); - precNode; precNode = (RECNODE *)ellNext(&precNode->node)) { - precord = precNode->precord; - /* If NAME is null then skip this record*/ - if(!(precord->name[0])) continue; - if(!precord->pini) continue; - (void)dbProcess(precord); + for(pdbRecDes = (dbRecDes *)ellFirst(&pdbBase->recDesList); pdbRecDes; + pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) { + for (pdbRecordNode=(dbRecordNode *)ellFirst(&pdbRecDes->recList); + pdbRecordNode; + pdbRecordNode = (dbRecordNode *)ellNext(&pdbRecordNode->node)) { + precord = pdbRecordNode->precord; + if(!(precord->name[0])) continue; + if(!precord->pini) continue; + (void)dbProcess(precord); } } return(0); @@ -1420,41 +1094,12 @@ LOCAL int getResourceTokenInternal(FILE *fp, char *pToken, unsigned maxToken) } return 0; } - -LOCAL int gotSdrSum=FALSE; -LOCAL struct sdrSum sdrSum; -int dbLoad(char * pfilename) +int dbLoadAscii(char *filename) { - long status; - FILE *fp; - - fp = fopen(pfilename,"r"); - if(!fp) { - errMessage(-1,"dbLoad: Error opening file"); + if(pdbBase) { + epicsPrintf("Ascii file was already loaded\n"); return(-1); } - if(pdbBase==NULL) pdbBase = dbAllocBase(); - status=dbRead(pdbBase, fp); - fclose(fp); - if(status!=0) { - errMessage(status,"dbLoad aborting because dbRead failed"); - return(-1); - } - if(!gotSdrSum) { - fp = fopen("default.sdrSum","r"); - if(!fp) { - errMessage(-1,"dbLoad: Error opening default.sdrSum"); - return(-1); - } - fgets(sdrSum.allSdrSums,sizeof(sdrSum.allSdrSums),fp); - fclose(fp); - gotSdrSum = TRUE; - } - if(strncmp(pdbBase->psdrSum->allSdrSums,sdrSum.allSdrSums, - strlen(pdbBase->psdrSum->allSdrSums))!=0) { - errMessage(-1,"dbLoad: check sdrSum Error: Database out of date"); - return(-1); - } - return (0); + return(dbAsciiRead(&pdbBase,filename)); } diff --git a/src/db/menuAlarmSevr.ascii b/src/db/menuAlarmSevr.ascii new file mode 100644 index 000000000..b53313fd0 --- /dev/null +++ b/src/db/menuAlarmSevr.ascii @@ -0,0 +1,6 @@ +menu(menuAlarmSevr) { + choice(menuAlarmSevrNO_ALARM,"NO_ALARM") + choice(menuAlarmSevrMINOR,"MINOR") + choice(menuAlarmSevrMAJOR,"MAJOR") + choice(menuAlarmSevrINVALID,"INVALID") +} diff --git a/src/db/menuAlarmStat.ascii b/src/db/menuAlarmStat.ascii new file mode 100644 index 000000000..c7d3037af --- /dev/null +++ b/src/db/menuAlarmStat.ascii @@ -0,0 +1,24 @@ +menu(menuAlarmStat) { + choice(menuAlarmStat,"") + choice(menuAlarmStatREAD,"READ") + choice(menuAlarmStatWRITE,"WRITE") + choice(menuAlarmStatHIHI,"HIHI") + choice(menuAlarmStatHIGH,"HIGH") + choice(menuAlarmStatLOLO,"LOLO") + choice(menuAlarmStatLOW,"LOW") + choice(menuAlarmStatSTATE,"STATE") + choice(menuAlarmStatCOS,"COS") + choice(menuAlarmStatCOMM,"COMM") + choice(menuAlarmStatTIMEOUT,"TIMEOUT") + choice(menuAlarmStatHWLIMIT,"HWLIMIT") + choice(menuAlarmStatCALC,"CALC") + choice(menuAlarmStatSCAN,"SCAN") + choice(menuAlarmStatLINK,"LINK") + choice(menuAlarmStatSOFT,"SOFT") + choice(menuAlarmStatBAD_SUB,"BAD_SUB") + choice(menuAlarmStatUDF,"UDF") + choice(menuAlarmStatDISABLE,"DISABLE") + choice(menuAlarmStatSIMM,"SIMM") + choice(menuAlarmStatREAD_ACCESS,"READ_ACCESS") + choice(menuAlarmStatWRITE_ACCESS,"WRITE_ACCESS") +} diff --git a/src/db/menuArrType.ascii b/src/db/menuArrType.ascii new file mode 100644 index 000000000..765bd8108 --- /dev/null +++ b/src/db/menuArrType.ascii @@ -0,0 +1,6 @@ +menu(menuArrType) { + choice(menuArrType8_bit_integers,"8 bit integers") + choice(menuArrType16_bit_integers,"16 bit integers") + choice(menuArrType32_bit_integers,"32 bit integers") + choice(menuArrTypeIEEE_floating_point,"IEEE floating point") +} diff --git a/src/db/menuCompress.ascii b/src/db/menuCompress.ascii new file mode 100644 index 000000000..f2fc14573 --- /dev/null +++ b/src/db/menuCompress.ascii @@ -0,0 +1,6 @@ +menu(menuCompress) { + choice(menuCompressN_to_1_First_Value,"N to 1 First Value") + choice(menuCompressN_to_1_Low_Value,"N to 1 Low Value") + choice(menuCompressN_to_1_High_Value,"N to 1 High Value") + choice(menuCompressN_to_1_Average,"N to 1 Average") +} diff --git a/src/db/menuFtype.ascii b/src/db/menuFtype.ascii new file mode 100644 index 000000000..28c87861c --- /dev/null +++ b/src/db/menuFtype.ascii @@ -0,0 +1,12 @@ +menu(menuFtype) { + choice(menuFtypeSTRING,"STRING") + choice(menuFtypeCHAR,"CHAR") + choice(menuFtypeUCHAR,"UCHAR") + choice(menuFtypeSHORT,"SHORT") + choice(menuFtypeUSHORT,"USHORT") + choice(menuFtypeLONG,"LONG") + choice(menuFtypeULONG,"ULONG") + choice(menuFtypeFLOAT,"FLOAT") + choice(menuFtypeDOUBLE,"DOUBLE") + choice(menuFtypeENUM,"ENUM") +} diff --git a/src/db/menuGlobal.ascii b/src/db/menuGlobal.ascii new file mode 100644 index 000000000..083349b11 --- /dev/null +++ b/src/db/menuGlobal.ascii @@ -0,0 +1,11 @@ +include "menuAlarmSevr.ascii" +include "menuAlarmStat.ascii" +include "menuArrType.ascii" +include "menuCompress.ascii" +include "menuFtype.ascii" +include "menuIvoa.ascii" +include "menuLinr.ascii" +include "menuOmsl.ascii" +include "menuPriority.ascii" +include "menuScan.ascii" +include "menuYesNo.ascii" diff --git a/src/db/menuIvoa.ascii b/src/db/menuIvoa.ascii new file mode 100644 index 000000000..4916e9a39 --- /dev/null +++ b/src/db/menuIvoa.ascii @@ -0,0 +1,5 @@ +menu(menuIvoa) { + choice(menuIvoaContinue_normally,"Continue normally") + choice(menuIvoaDon_t_drive_outputs,"Don't drive outputs") + choice(menuIvoaSet_output_to_IVOV,"Set output to IVOV") +} diff --git a/src/db/menuLinr.ascii b/src/db/menuLinr.ascii new file mode 100644 index 000000000..5132fb933 --- /dev/null +++ b/src/db/menuLinr.ascii @@ -0,0 +1,4 @@ +menu(menuLinr) { + choice(menuLinrNO_CONVERSION,"NO CONVERSION") + choice(menuLinrLINEAR,"LINEAR") +} diff --git a/src/db/menuOmsl.ascii b/src/db/menuOmsl.ascii new file mode 100644 index 000000000..a25e889bb --- /dev/null +++ b/src/db/menuOmsl.ascii @@ -0,0 +1,4 @@ +menu(menuOmsl) { + choice(menuOmslsupervisory,"supervisory") + choice(menuOmslclosed_loop,"closed_loop") +} diff --git a/src/db/menuPriority.ascii b/src/db/menuPriority.ascii new file mode 100644 index 000000000..c7b05cb54 --- /dev/null +++ b/src/db/menuPriority.ascii @@ -0,0 +1,5 @@ +menu(menuPriority) { + choice(menuPriorityLOW,"LOW") + choice(menuPriorityMEDIUM,"MEDIUM") + choice(menuPriorityHIGH,"HIGH") +} diff --git a/src/db/menuScan.ascii b/src/db/menuScan.ascii new file mode 100644 index 000000000..9ca3fb143 --- /dev/null +++ b/src/db/menuScan.ascii @@ -0,0 +1,12 @@ +menu(menuScan) { + choice(menuScanPassive,"Passive") + choice(menuScanEvent,"Event") + choice(menuScanI_O_Intr,"I/O Intr") + choice(menuScan10_second,"10 second") + choice(menuScan5_second,"5 second") + choice(menuScan2_second,"2 second") + choice(menuScan1_second,"1 second") + choice(menuScan_5_second,".5 second") + choice(menuScan_2_second,".2 second") + choice(menuScan_1_second,".1 second") +} diff --git a/src/db/menuYesNo.ascii b/src/db/menuYesNo.ascii new file mode 100644 index 000000000..bb42f1a52 --- /dev/null +++ b/src/db/menuYesNo.ascii @@ -0,0 +1,4 @@ +menu(menuYesNo) { + choice(menuYesNoNO,"NO") + choice(menuYesNoYES,"YES") +} diff --git a/src/db/recGbl.c b/src/db/recGbl.c index 3215975b4..06c9f8be0 100644 --- a/src/db/recGbl.c +++ b/src/db/recGbl.c @@ -47,24 +47,21 @@ #include #include -#include #include #include -#include -#include +#include #include #include +#include #include #include +#include #include -#include #include extern struct dbBase *pdbBase; /* local routines */ -static void getVarRangeValue(); -static void getConRangeValue(); static void getMaxRangeValues(); @@ -73,18 +70,15 @@ void recGblDbaddrError(long status,struct dbAddr *paddr,char *pcaller_name) { char buffer[200]; struct dbCommon *precord; - int i,n; - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pdbFldDes=(dbFldDes *)(paddr->pfldDes); buffer[0]=0; if(paddr) { /* print process variable name */ precord=(struct dbCommon *)(paddr->precord); strcat(buffer,"PV: "); - strncat(buffer,precord->name,PVNAME_SZ); - n=strlen(buffer); - for(i=n; (i>0 && buffer[i]==' '); i--) buffer[i]=0; + strcat(buffer,precord->name); strcat(buffer,"."); - strncat(buffer,pfldDes->fldname,FLDNAME_SZ); + strcat(buffer,pdbFldDes->name); strcat(buffer," "); } if(pcaller_name) { @@ -99,14 +93,11 @@ void recGblRecordError(long status,void *pdbc,char *pcaller_name) { struct dbCommon *precord = pdbc; char buffer[200]; - int i,n; buffer[0]=0; if(precord) { /* print process variable name */ strcat(buffer,"PV: "); - strncat(buffer,precord->name,PVNAME_SZ); - n=strlen(buffer); - for(i=n; (i>0 && buffer[i]==' '); i--) buffer[i]=0; + strcat(buffer,precord->name); strcat(buffer," "); } if(pcaller_name) { @@ -119,11 +110,10 @@ void recGblRecordError(long status,void *pdbc,char *pcaller_name) void recGblRecSupError(long status,struct dbAddr *paddr,char *pcaller_name, char *psupport_name) { - char buffer[200]; - char *pstr; + char buffer[200]; struct dbCommon *precord; - int i,n; - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pdbFldDes=(dbFldDes *)(paddr->pfldDes); + dbRecDes *pdbRecDes = pdbFldDes->pdbRecDes; buffer[0]=0; strcat(buffer,"Record Support Routine ("); @@ -132,18 +122,13 @@ void recGblRecSupError(long status,struct dbAddr *paddr,char *pcaller_name, else strcat(buffer,"Unknown"); strcat(buffer,") not available.\nRecord Type is "); - if(pstr=GET_PRECNAME(pdbBase->precType,paddr->record_type)) - strcat(buffer,pstr); - else - strcat(buffer,"BAD"); + strcat(buffer,pdbRecDes->name); if(paddr) { /* print process variable name */ precord=(struct dbCommon *)(paddr->precord); strcat(buffer,", PV is "); - strncat(buffer,precord->name,PVNAME_SZ); - n=strlen(buffer); - for(i=n; (i>0 && buffer[i]==' '); i--) buffer[i]=0; + strcat(buffer,precord->name); strcat(buffer,"."); - strncat(buffer,pfldDes->fldname,FLDNAME_SZ); + strcat(buffer,pdbFldDes->name); strcat(buffer," "); } if(pcaller_name) { @@ -156,9 +141,9 @@ void recGblRecSupError(long status,struct dbAddr *paddr,char *pcaller_name, void recGblGetPrec(struct dbAddr *paddr,long *precision) { - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pdbFldDes=(dbFldDes *)(paddr->pfldDes); - switch(pfldDes->field_type){ + switch(pdbFldDes->field_type){ case(DBF_SHORT): *precision = 0; break; @@ -183,18 +168,10 @@ void recGblGetPrec(struct dbAddr *paddr,long *precision) void recGblGetGraphicDouble(struct dbAddr *paddr,struct dbr_grDouble *pgd) { - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pdbFldDes=(dbFldDes *)(paddr->pfldDes); - /* get upper display limit */ - if(pfldDes->highfl==VAR) getVarRangeValue(paddr,pfldDes->range2.fldnum,&pgd->upper_disp_limit); - else getConRangeValue(pfldDes->field_type,pfldDes->range2,&pgd->upper_disp_limit); - - /* get lower display limit */ - if(pfldDes->lowfl==VAR) getVarRangeValue(paddr,pfldDes->range1.fldnum,&pgd->lower_disp_limit); - else getConRangeValue(pfldDes->field_type,pfldDes->range1,&pgd->lower_disp_limit); - - if(pgd->lower_disp_limit>=pgd->upper_disp_limit) - getMaxRangeValues(pfldDes->field_type,&pgd->upper_disp_limit,&pgd->lower_disp_limit); + getMaxRangeValues(pdbFldDes->field_type,&pgd->upper_disp_limit, + &pgd->lower_disp_limit); return; } @@ -211,22 +188,65 @@ void recGblGetAlarmDouble(struct dbAddr *paddr,struct dbr_alDouble *pad) void recGblGetControlDouble(struct dbAddr *paddr,struct dbr_ctrlDouble *pcd) { - struct fldDes *pfldDes=(struct fldDes *)(paddr->pfldDes); + dbFldDes *pdbFldDes=(dbFldDes *)(paddr->pfldDes); - /* get upper control limit */ - if(pfldDes->highfl==VAR) getVarRangeValue(paddr,pfldDes->range2.fldnum,&pcd->upper_ctrl_limit); - else getConRangeValue(pfldDes->field_type,pfldDes->range2,&pcd->upper_ctrl_limit); - - /* get lower control limit */ - if(pfldDes->lowfl==VAR) getVarRangeValue(paddr,pfldDes->range1.fldnum,&pcd->lower_ctrl_limit); - else getConRangeValue(pfldDes->field_type,pfldDes->range1,&pcd->lower_ctrl_limit); - - if(pcd->lower_ctrl_limit>=pcd->upper_ctrl_limit) - getMaxRangeValues(pfldDes->field_type,&pcd->upper_ctrl_limit,&pcd->lower_ctrl_limit); + getMaxRangeValues(pdbFldDes->field_type,&pcd->upper_ctrl_limit, + &pcd->lower_ctrl_limit); return; } +int recGblInitConstantLink(struct link *plink,short dbftype,void *pdest) +{ + if(!plink->value.constantStr) return(FALSE); + switch(dbftype) { + case DBF_STRING: + strcpy((char *)pdest,plink->value.constantStr); + break; + case DBF_CHAR : { + short value; + char *pvalue = (char *)pdest; + + sscanf(plink->value.constantStr,"%hd",&value); + *pvalue = value; + } + break; + case DBF_UCHAR : { + unsigned short value; + unsigned char *pvalue = (unsigned char *)pdest; + + sscanf(plink->value.constantStr,"%hu",&value); + *pvalue = value; + } + break; + case DBF_SHORT : + sscanf(plink->value.constantStr,"%hd",(short *)pdest); + break; + case DBF_USHORT : + case DBF_ENUM : + case DBF_MENU : + case DBF_DEVICE : + sscanf(plink->value.constantStr,"%hu",(unsigned short *)pdest); + break; + case DBF_LONG : + sscanf(plink->value.constantStr,"%d",(long *)pdest); + break; + case DBF_ULONG : + sscanf(plink->value.constantStr,"%u",(unsigned long *)pdest); + break; + case DBF_FLOAT : + sscanf(plink->value.constantStr,"%f",(float *)pdest); + break; + case DBF_DOUBLE : + sscanf(plink->value.constantStr,"%lf",(double *)pdest); + break; + default: + epicsPrintf("Error in recGblInitConstantLink: Illegal DBF type\n"); + return(FALSE); + } + return(TRUE); +} + long recGblGetLinkValue(struct link *plink,void *pdbc,short dbrType, void *pdest,long *poptions,long *pnRequest) { @@ -357,36 +377,6 @@ void recGblGetTimeStamp(void* prec) TSgetTimeStamp((int)pr->tse,(struct timespec*)&pr->time); } - -static void getConRangeValue(field_type,range,plimit) - short field_type; - struct range range; - double *plimit; -{ - *plimit=0.0; - switch(field_type){ - case(DBF_SHORT): - *plimit = (double)range.value.short_value; - break; - case(DBF_ENUM): - case(DBF_USHORT): - *plimit = (double)range.value.ushort_value; - break; - case(DBF_LONG): - *plimit = (double)range.value.long_value; - break; - case(DBF_ULONG): - *plimit = (double)range.value.ulong_value; - break; - case(DBF_FLOAT): - *plimit = (double)range.value.float_value; - break; - case(DBF_DOUBLE): - *plimit = (double)range.value.double_value; - break; - } - return; -} static void getMaxRangeValues(field_type,pupper_limit,plower_limit) short field_type; @@ -424,63 +414,7 @@ static void getMaxRangeValues(field_type,pupper_limit,plower_limit) return; } -static void getVarRangeValue(paddr,fldnum,prangeValue) -struct dbAddr *paddr; -long fldnum; -double *prangeValue; -{ - short recType; - struct recTypDes *precTypDes; - struct dbAddr dbAddr; - long nRequest,options; - void *pfl=NULL; - char name[PVNAME_SZ+FLDNAME_SZ+2]; - struct dbCommon *precord; - int i,n; - struct fldDes *pfldDes; - long status; - - *prangeValue=0; - precord=(struct dbCommon *)(paddr->precord); - recType=paddr->record_type; - - if(!(precTypDes=GET_PRECTYPDES(pdbBase->precDes,recType))){ - recGblRecordError(S_sdr_noSdrType,(void *)precord,"getVarRangeValue(GET_PRECTYPDES)"); - return; - } - if(!(pfldDes=GET_PFLDDES(precTypDes,fldnum))){ - recGblRecordError(S_sdr_noSdrType,(void *)precord,"getVarRangeValue(GET_PFLDDES)"); - return; - } - /* get &dbAddr for range VAR field */ - name[PVNAME_SZ] = 0; - strncpy(name,precord->name,PVNAME_SZ); - n=strlen(name); - for(i=n; (i>0 && name[i]==' '); i--) name[i]=0; - strcat(name,"."); - strncat(name,pfldDes->fldname,FLDNAME_SZ); - strcat(name,"\0"); - if (status=dbNameToAddr(name,&dbAddr)){ - recGblRecordError(status,(void *)precord,"getVarRangeValue(dbNameToAddr)"); - return; - } - - /* get value of range VAR field */ - options = 0; - nRequest = 1; - if(status=dbGet(&dbAddr,DBR_DOUBLE,prangeValue,&options,&nRequest,pfl)){ - recGblRecordError(status,(void *)precord,"getVarRangeValue(dbGet)"); - return; - } - return; -} - /* Fast link initialization routines */ -/* - * Get and Put conversion routine lookup tables - */ -extern long (*get_cvt_table[DBF_DEVCHOICE+1][DBR_ENUM+1])(); -extern long (*put_cvt_table[DBR_ENUM+1][DBF_DEVCHOICE+1])(); /* * String if bad database request type chosen @@ -520,7 +454,7 @@ long recGblInitFastInLink( * Check for legal conversion range... */ if ((pdb_addr->field_type < DBF_STRING) || - (pdb_addr->field_type > DBF_DEVCHOICE) || + (pdb_addr->field_type > DBF_DEVICE) || ( dbrType < DBR_STRING) || ( dbrType > DBR_ENUM)) { @@ -532,7 +466,7 @@ long recGblInitFastInLink( /* * Lookup conversion function */ - cvt_func = get_cvt_table[pdb_addr->field_type][dbrType]; + cvt_func = dbFastGetConvertRoutine[pdb_addr->field_type][dbrType]; if (cvt_func == NULL) { pdb_link->conversion = cvt_dummy; @@ -580,7 +514,7 @@ long recGblInitFastOutLink( * Check for legal conversion range... */ if ((pdb_addr->field_type < DBF_STRING) || - (pdb_addr->field_type > DBF_DEVCHOICE) || + (pdb_addr->field_type > DBF_DEVICE) || ( dbrType < DBR_STRING) || ( dbrType > DBR_ENUM)) { @@ -591,7 +525,7 @@ long recGblInitFastOutLink( /* * Lookup conversion function */ - cvt_func = put_cvt_table[dbrType][pdb_addr->field_type]; + cvt_func = dbFastPutConvertRoutine[dbrType][pdb_addr->field_type]; if (cvt_func == NULL) { pdb_link->conversion = cvt_dummy;