aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/cursor/gtrdelete.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/gio/cursor/gtrdelete.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/cursor/gtrdelete.x')
-rw-r--r--sys/gio/cursor/gtrdelete.x45
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/gio/cursor/gtrdelete.x b/sys/gio/cursor/gtrdelete.x
new file mode 100644
index 00000000..97f418a0
--- /dev/null
+++ b/sys/gio/cursor/gtrdelete.x
@@ -0,0 +1,45 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <gio.h>
+include <gki.h>
+include "gtr.h"
+
+# GTR_DELETE -- Delete an instruction from the frame buffer. This prevents
+# the instruction from being executed if the frame is redrawn.
+
+procedure gtr_delete (tr, gki)
+
+pointer tr #I giotr descriptor
+pointer gki #I instruction to be deleted
+
+pointer inext
+int nwords, shift, ilen
+
+begin
+ ilen = Mems[gki+GKI_HDR_LENGTH-1]
+ inext = gki + ilen
+
+ if (inext >= TR_OP(tr)) {
+ # Instruction is the last one in the buffer.
+ TR_OP(tr) = gki
+ TR_LASTOP(tr) = TR_OP(tr)
+ if (TR_IP(tr) >= gki)
+ TR_IP(tr) = gki
+
+ } else {
+ # If the instruction is small and would be expensive to delete
+ # just change the opcode to disable it, otherwise shift the
+ # buffer contents back to overwrite the deleted instruction.
+
+ nwords = TR_OP(tr) - inext
+ if (ilen < 32 && nwords > 2048)
+ Mems[gki+GKI_HDR_OPCODE-1] = GKI_UNKNOWN
+ else {
+ call amovs (Mems[inext], Mems[gki], nwords)
+ shift = inext - gki
+ TR_IP(tr) = TR_IP(tr) - shift
+ TR_OP(tr) = TR_OP(tr) - shift
+ TR_LASTOP(tr) = TR_OP(tr)
+ }
+ }
+end