1 /* TUI display registers in window.
3 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
6 Contributed by Hewlett-Packard Company.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
27 #include "tui/tui-data.h"
35 #include "tui/tui-layout.h"
36 #include "tui/tui-win.h"
37 #include "tui/tui-windata.h"
38 #include "tui/tui-wingeneral.h"
39 #include "tui/tui-file.h"
49 /*****************************************
50 ** LOCAL DEFINITIONS **
51 ******************************************/
52 #define DOUBLE_FLOAT_LABEL_WIDTH 6
53 #define DOUBLE_FLOAT_LABEL_FMT "%6.6s: "
54 #define DOUBLE_FLOAT_VALUE_WIDTH 30 /*min of 16 but may be in sci notation */
56 #define SINGLE_FLOAT_LABEL_WIDTH 6
57 #define SINGLE_FLOAT_LABEL_FMT "%6.6s: "
58 #define SINGLE_FLOAT_VALUE_WIDTH 25 /* min of 8 but may be in sci notation */
60 #define SINGLE_LABEL_WIDTH 16
61 #define SINGLE_LABEL_FMT "%10.10s: "
62 #define SINGLE_VALUE_WIDTH 20 /* minimum of 8 but may be in sci notation */
64 /* In the code HP gave Cygnus, this was actually a function call to a
65 PA-specific function, which was supposed to determine whether the
66 target was a 64-bit or 32-bit processor. However, the 64-bit
67 support wasn't complete, so we didn't merge that in, so we leave
68 this here as a stub. */
71 /*****************************************
73 ******************************************/
76 /*****************************************
77 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
78 ******************************************/
79 static TuiStatus _tuiSetRegsContent
80 (int, int, struct frame_info *, TuiRegisterDisplayType, int);
81 static const char *_tuiRegisterName (int);
82 static TuiStatus _tuiGetRegisterRawValue (int, char *, struct frame_info *);
83 static void _tuiSetRegisterElement
84 (int, struct frame_info *, TuiDataElementPtr, int);
85 static void _tuiDisplayRegister (int, TuiGenWinInfoPtr, enum precision_type);
86 static void _tuiRegisterFormat
87 (char *, int, int, TuiDataElementPtr, enum precision_type);
88 static TuiStatus _tuiSetGeneralRegsContent (int);
89 static TuiStatus _tuiSetSpecialRegsContent (int);
90 static TuiStatus _tuiSetGeneralAndSpecialRegsContent (int);
91 static TuiStatus _tuiSetFloatRegsContent (TuiRegisterDisplayType, int);
92 static int _tuiRegValueHasChanged
93 (TuiDataElementPtr, struct frame_info *, char *);
94 static void _tuiShowFloat_command (char *, int);
95 static void _tuiShowGeneral_command (char *, int);
96 static void _tuiShowSpecial_command (char *, int);
97 static void _tui_vShowRegisters_commandSupport (TuiRegisterDisplayType);
98 static void _tuiToggleFloatRegs_command (char *, int);
99 static void _tuiScrollRegsForward_command (char *, int);
100 static void _tuiScrollRegsBackward_command (char *, int);
104 /*****************************************
105 ** PUBLIC FUNCTIONS **
106 ******************************************/
108 /* Answer the number of the last line in the regs display. If there
109 are no registers (-1) is returned. */
111 tui_last_regs_line_no (void)
113 register int numLines = (-1);
115 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
117 numLines = (dataWin->detail.dataDisplayInfo.regsContentCount /
118 dataWin->detail.dataDisplayInfo.regsColumnCount);
119 if (dataWin->detail.dataDisplayInfo.regsContentCount %
120 dataWin->detail.dataDisplayInfo.regsColumnCount)
127 /* Answer the line number that the register element at elementNo is
128 on. If elementNo is greater than the number of register elements
129 there are, -1 is returned. */
131 tui_line_from_reg_element_no (int elementNo)
133 if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
141 (dataWin->detail.dataDisplayInfo.regsColumnCount * i))
154 /* Answer the index of the first element in lineNo. If lineNo is past
155 the register area (-1) is returned. */
157 tui_first_reg_element_no_inline (int lineNo)
159 if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount)
160 <= dataWin->detail.dataDisplayInfo.regsContentCount)
161 return ((lineNo + 1) *
162 dataWin->detail.dataDisplayInfo.regsColumnCount) -
163 dataWin->detail.dataDisplayInfo.regsColumnCount;
170 ** tuiLastRegElementNoInLine()
171 ** Answer the index of the last element in lineNo. If lineNo is past
172 ** the register area (-1) is returned.
175 tuiLastRegElementNoInLine (int lineNo)
177 if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount) <=
178 dataWin->detail.dataDisplayInfo.regsContentCount)
179 return ((lineNo + 1) *
180 dataWin->detail.dataDisplayInfo.regsColumnCount) - 1;
183 } /* tuiLastRegElementNoInLine */
186 /* Calculate the number of columns that should be used to display the
189 tui_calculate_regs_column_count (TuiRegisterDisplayType dpyType)
191 int colCount, colWidth;
193 if (IS_64BIT || dpyType == TUI_DFLOAT_REGS)
194 colWidth = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH;
197 if (dpyType == TUI_SFLOAT_REGS)
198 colWidth = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH;
200 colWidth = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH;
202 colCount = (dataWin->generic.width - 2) / colWidth;
205 } /* tuiCalulateRegsColumnCount */
208 /* Show the registers int the data window as indicated by dpyType. If
209 there is any other registers being displayed, then they are
210 cleared. What registers are displayed is dependent upon dpyType. */
212 tui_show_registers (TuiRegisterDisplayType dpyType)
214 TuiStatus ret = TUI_FAILURE;
215 int refreshValuesOnly = FALSE;
217 /* Say that registers should be displayed, even if there is a problem */
218 dataWin->detail.dataDisplayInfo.displayRegs = TRUE;
220 if (target_has_registers)
223 (dpyType == dataWin->detail.dataDisplayInfo.regsDisplayType);
226 case TUI_GENERAL_REGS:
227 ret = _tuiSetGeneralRegsContent (refreshValuesOnly);
229 case TUI_SFLOAT_REGS:
230 case TUI_DFLOAT_REGS:
231 ret = _tuiSetFloatRegsContent (dpyType, refreshValuesOnly);
234 /* could ifdef out */
236 case TUI_SPECIAL_REGS:
237 ret = _tuiSetSpecialRegsContent (refreshValuesOnly);
239 case TUI_GENERAL_AND_SPECIAL_REGS:
240 ret = _tuiSetGeneralAndSpecialRegsContent (refreshValuesOnly);
243 /* end of potential if def */
249 if (ret == TUI_FAILURE)
251 dataWin->detail.dataDisplayInfo.regsDisplayType = TUI_UNDEFINED_REGS;
252 tuiEraseDataContent (NO_REGS_STRING);
258 /* Clear all notation of changed values */
259 for (i = 0; (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
261 TuiGenWinInfoPtr dataItemWin;
263 dataItemWin = &dataWin->detail.dataDisplayInfo.
264 regsContent[i]->whichElement.dataWindow;
265 (&((TuiWinElementPtr)
266 dataItemWin->content[0])->whichElement.data)->highlight = FALSE;
268 dataWin->detail.dataDisplayInfo.regsDisplayType = dpyType;
269 tuiDisplayAllData ();
271 (tuiLayoutDef ())->regsDisplayType = dpyType;
277 /* Function to display the registers in the content from
278 'startElementNo' until the end of the register content or the end
279 of the display height. No checking for displaying past the end of
280 the registers is done here. */
282 tui_display_registers_from (int startElementNo)
284 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
285 dataWin->detail.dataDisplayInfo.regsContentCount > 0)
287 register int i = startElementNo;
288 int j, valueCharsWide, itemWinWidth, curY, labelWidth;
289 enum precision_type precision;
291 precision = (dataWin->detail.dataDisplayInfo.regsDisplayType
292 == TUI_DFLOAT_REGS) ?
293 double_precision : unspecified_precision;
295 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
297 valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
298 labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
302 if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
305 valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
306 labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
310 valueCharsWide = SINGLE_VALUE_WIDTH;
311 labelWidth = SINGLE_LABEL_WIDTH;
314 itemWinWidth = valueCharsWide + labelWidth;
316 ** Now create each data "sub" window, and write the display into it.
319 while (i < dataWin->detail.dataDisplayInfo.regsContentCount &&
320 curY <= dataWin->generic.viewportHeight)
323 (j < dataWin->detail.dataDisplayInfo.regsColumnCount &&
324 i < dataWin->detail.dataDisplayInfo.regsContentCount); j++)
326 TuiGenWinInfoPtr dataItemWin;
327 TuiDataElementPtr dataElementPtr;
329 /* create the window if necessary */
330 dataItemWin = &dataWin->detail.dataDisplayInfo.
331 regsContent[i]->whichElement.dataWindow;
332 dataElementPtr = &((TuiWinElementPtr)
333 dataItemWin->content[0])->whichElement.data;
334 if (dataItemWin->handle == (WINDOW *) NULL)
336 dataItemWin->height = 1;
337 dataItemWin->width = (precision == double_precision) ?
338 itemWinWidth + 2 : itemWinWidth + 1;
339 dataItemWin->origin.x = (itemWinWidth * j) + 1;
340 dataItemWin->origin.y = curY;
341 makeWindow (dataItemWin, DONT_BOX_WINDOW);
342 scrollok (dataItemWin->handle, FALSE);
344 touchwin (dataItemWin->handle);
347 ** Get the printable representation of the register
350 _tuiDisplayRegister (
351 dataElementPtr->itemNo, dataItemWin, precision);
352 i++; /* next register */
354 curY++; /* next row; */
363 ** tuiDisplayRegElementAtLine().
364 ** Function to display the registers in the content from
365 ** 'startElementNo' on 'startLineNo' until the end of the
366 ** register content or the end of the display height.
367 ** This function checks that we won't display off the end
368 ** of the register display.
371 tuiDisplayRegElementAtLine (int startElementNo, int startLineNo)
373 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
374 dataWin->detail.dataDisplayInfo.regsContentCount > 0)
376 register int elementNo = startElementNo;
378 if (startElementNo != 0 && startLineNo != 0)
380 register int lastLineNo, firstLineOnLastPage;
382 lastLineNo = tui_last_regs_line_no ();
383 firstLineOnLastPage = lastLineNo - (dataWin->generic.height - 2);
384 if (firstLineOnLastPage < 0)
385 firstLineOnLastPage = 0;
387 ** If there is no other data displayed except registers,
388 ** and the elementNo causes us to scroll past the end of the
389 ** registers, adjust what element to really start the display at.
391 if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0 &&
392 startLineNo > firstLineOnLastPage)
393 elementNo = tui_first_reg_element_no_inline (firstLineOnLastPage);
395 tui_display_registers_from (elementNo);
399 } /* tuiDisplayRegElementAtLine */
403 /* Function to display the registers starting at line lineNo in the
404 data window. Answers the line number that the display actually
405 started from. If nothing is displayed (-1) is returned. */
407 tui_display_registers_from_line (int lineNo, int forceDisplay)
409 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
415 else if (forceDisplay)
417 ** If we must display regs (forceDisplay is true), then make
418 ** sure that we don't display off the end of the registers.
420 if (lineNo >= tui_last_regs_line_no ())
422 if ((line = tui_line_from_reg_element_no (
423 dataWin->detail.dataDisplayInfo.regsContentCount - 1)) < 0)
432 elementNo = tui_first_reg_element_no_inline (line);
433 if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
434 tuiDisplayRegElementAtLine (elementNo, line);
441 return (-1); /* nothing was displayed */
445 /* This function check all displayed registers for changes in values,
446 given a particular frame. If the values have changed, they are
447 updated with the new value and highlighted. */
449 tui_check_register_values (struct frame_info *frame)
451 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
453 if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0 &&
454 dataWin->detail.dataDisplayInfo.displayRegs)
455 tui_show_registers ((tuiLayoutDef ())->regsDisplayType);
459 char rawBuf[MAX_REGISTER_SIZE];
462 (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
464 TuiDataElementPtr dataElementPtr;
465 TuiGenWinInfoPtr dataItemWinPtr;
468 dataItemWinPtr = &dataWin->detail.dataDisplayInfo.
469 regsContent[i]->whichElement.dataWindow;
470 dataElementPtr = &((TuiWinElementPtr)
471 dataItemWinPtr->content[0])->whichElement.data;
472 wasHilighted = dataElementPtr->highlight;
473 dataElementPtr->highlight =
474 _tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]);
475 if (dataElementPtr->highlight)
479 size = DEPRECATED_REGISTER_RAW_SIZE (dataElementPtr->itemNo);
480 for (j = 0; j < size; j++)
481 ((char *) dataElementPtr->value)[j] = rawBuf[j];
482 _tuiDisplayRegister (
483 dataElementPtr->itemNo,
485 ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
487 double_precision : unspecified_precision));
489 else if (wasHilighted)
491 dataElementPtr->highlight = FALSE;
492 _tuiDisplayRegister (
493 dataElementPtr->itemNo,
495 ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
497 double_precision : unspecified_precision));
507 ** tuiToggleFloatRegs().
510 tuiToggleFloatRegs (void)
512 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
514 if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
515 layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
517 layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
519 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible &&
520 (dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_SFLOAT_REGS ||
521 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS))
522 tui_show_registers (layoutDef->floatRegsDisplayType);
525 } /* tuiToggleFloatRegs */
529 _initialize_tuiRegs (void)
533 add_com ("fr", class_tui, _tuiShowFloat_command,
534 "Display only floating point registers\n");
535 add_com ("gr", class_tui, _tuiShowGeneral_command,
536 "Display only general registers\n");
537 add_com ("sr", class_tui, _tuiShowSpecial_command,
538 "Display only special registers\n");
539 add_com ("+r", class_tui, _tuiScrollRegsForward_command,
540 "Scroll the registers window forward\n");
541 add_com ("-r", class_tui, _tuiScrollRegsBackward_command,
542 "Scroll the register window backward\n");
543 add_com ("tf", class_tui, _tuiToggleFloatRegs_command,
544 "Toggle between single and double precision floating point registers.\n");
545 add_cmd (TUI_FLOAT_REGS_NAME_LOWER,
547 _tuiToggleFloatRegs_command,
548 "Toggle between single and double precision floating point \
555 /*****************************************
556 ** STATIC LOCAL FUNCTIONS **
557 ******************************************/
561 ** _tuiRegisterName().
562 ** Return the register name.
565 _tuiRegisterName (int regNum)
567 return REGISTER_NAME (regNum);
569 extern int pagination_enabled;
572 tui_restore_gdbout (void *ui)
574 ui_file_delete (gdb_stdout);
575 gdb_stdout = (struct ui_file*) ui;
576 pagination_enabled = 1;
580 ** _tuiRegisterFormat
581 ** Function to format the register name and value into a buffer,
582 ** suitable for printing or display
585 _tuiRegisterFormat (char *buf, int bufLen, int regNum,
586 TuiDataElementPtr dataElement,
587 enum precision_type precision)
589 struct ui_file *stream;
590 struct ui_file *old_stdout;
592 struct cleanup *cleanups;
596 name = REGISTER_NAME (regNum);
603 pagination_enabled = 0;
604 old_stdout = gdb_stdout;
605 stream = tui_sfileopen (bufLen);
607 cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
608 gdbarch_print_registers_info (current_gdbarch, stream, deprecated_selected_frame,
611 /* Save formatted output in the buffer. */
612 p = tui_file_get_strbuf (stream);
614 while (*p && *p == *name++ && bufLen)
622 while (pos < 8 && bufLen)
628 strncpy (buf, p, bufLen);
630 /* Remove the possible \n. */
631 p = strchr (buf, '\n');
635 do_cleanups (cleanups);
639 #define NUM_GENERAL_REGS 32
641 ** _tuiSetGeneralRegsContent().
642 ** Set the content of the data window to consist of the general registers.
645 _tuiSetGeneralRegsContent (int refreshValuesOnly)
647 return (_tuiSetRegsContent (0,
648 NUM_GENERAL_REGS - 1,
649 deprecated_selected_frame,
653 } /* _tuiSetGeneralRegsContent */
656 #ifndef PCOQ_HEAD_REGNUM
657 #define START_SPECIAL_REGS 0
659 #define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
663 ** _tuiSetSpecialRegsContent().
664 ** Set the content of the data window to consist of the special registers.
667 _tuiSetSpecialRegsContent (int refreshValuesOnly)
669 TuiStatus ret = TUI_FAILURE;
672 endRegNum = FP0_REGNUM - 1;
673 ret = _tuiSetRegsContent (START_SPECIAL_REGS,
675 deprecated_selected_frame,
680 } /* _tuiSetSpecialRegsContent */
684 ** _tuiSetGeneralAndSpecialRegsContent().
685 ** Set the content of the data window to consist of the special registers.
688 _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly)
690 TuiStatus ret = TUI_FAILURE;
691 int endRegNum = (-1);
693 endRegNum = FP0_REGNUM - 1;
694 ret = _tuiSetRegsContent (
695 0, endRegNum, deprecated_selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly);
698 } /* _tuiSetGeneralAndSpecialRegsContent */
701 ** _tuiSetFloatRegsContent().
702 ** Set the content of the data window to consist of the float registers.
705 _tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly)
707 TuiStatus ret = TUI_FAILURE;
710 startRegNum = FP0_REGNUM;
711 ret = _tuiSetRegsContent (startRegNum,
713 deprecated_selected_frame,
718 } /* _tuiSetFloatRegsContent */
722 ** _tuiRegValueHasChanged().
723 ** Answer TRUE if the register's value has changed, FALSE otherwise.
724 ** If TRUE, newValue is filled in with the new value.
727 _tuiRegValueHasChanged (TuiDataElementPtr dataElement,
728 struct frame_info *frame,
731 int hasChanged = FALSE;
733 if (dataElement->itemNo != UNDEFINED_ITEM &&
734 _tuiRegisterName (dataElement->itemNo) != (char *) NULL)
736 char rawBuf[MAX_REGISTER_SIZE];
739 if (_tuiGetRegisterRawValue (
740 dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS)
742 int size = DEPRECATED_REGISTER_RAW_SIZE (dataElement->itemNo);
744 for (i = 0; (i < size && !hasChanged); i++)
745 hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]);
746 if (hasChanged && newValue != (char *) NULL)
748 for (i = 0; i < size; i++)
749 newValue[i] = rawBuf[i];
754 } /* _tuiRegValueHasChanged */
759 ** _tuiGetRegisterRawValue().
760 ** Get the register raw value. The raw value is returned in regValue.
763 _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
765 TuiStatus ret = TUI_FAILURE;
767 if (target_has_registers)
769 get_frame_register (frame, regNum, regValue);
770 /* NOTE: cagney/2003-03-13: This is bogus. It is refering to
771 the register cache and not the frame which could have pulled
772 the register value off the stack. */
773 if (register_cached (regNum) >= 0)
777 } /* _tuiGetRegisterRawValue */
782 ** _tuiSetRegisterElement().
783 ** Function to initialize a data element with the input and
784 ** the register value.
787 _tuiSetRegisterElement (int regNum, struct frame_info *frame,
788 TuiDataElementPtr dataElement,
789 int refreshValueOnly)
791 if (dataElement != (TuiDataElementPtr) NULL)
793 if (!refreshValueOnly)
795 dataElement->itemNo = regNum;
796 dataElement->name = _tuiRegisterName (regNum);
797 dataElement->highlight = FALSE;
799 if (dataElement->value == (Opaque) NULL)
800 dataElement->value = (Opaque) xmalloc (MAX_REGISTER_SIZE);
801 if (dataElement->value != (Opaque) NULL)
802 _tuiGetRegisterRawValue (regNum, dataElement->value, frame);
806 } /* _tuiSetRegisterElement */
810 ** _tuiSetRegsContent().
811 ** Set the content of the data window to consist of the registers
812 ** numbered from startRegNum to endRegNum. Note that if
813 ** refreshValuesOnly is TRUE, startRegNum and endRegNum are ignored.
816 _tuiSetRegsContent (int startRegNum, int endRegNum,
817 struct frame_info *frame,
818 TuiRegisterDisplayType dpyType,
819 int refreshValuesOnly)
821 TuiStatus ret = TUI_FAILURE;
822 int numRegs = endRegNum - startRegNum + 1;
823 int allocatedHere = FALSE;
825 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0 &&
828 freeDataContent (dataWin->detail.dataDisplayInfo.regsContent,
829 dataWin->detail.dataDisplayInfo.regsContentCount);
830 dataWin->detail.dataDisplayInfo.regsContentCount = 0;
832 if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0)
834 dataWin->detail.dataDisplayInfo.regsContent =
835 allocContent (numRegs, DATA_WIN);
836 allocatedHere = TRUE;
839 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL)
843 if (!refreshValuesOnly || allocatedHere)
845 dataWin->generic.content = (OpaquePtr) NULL;
846 dataWin->generic.contentSize = 0;
847 addContentElements (&dataWin->generic, numRegs);
848 dataWin->detail.dataDisplayInfo.regsContent =
849 (TuiWinContent) dataWin->generic.content;
850 dataWin->detail.dataDisplayInfo.regsContentCount = numRegs;
853 ** Now set the register names and values
855 for (i = startRegNum; (i <= endRegNum); i++)
857 TuiGenWinInfoPtr dataItemWin;
859 dataItemWin = &dataWin->detail.dataDisplayInfo.
860 regsContent[i - startRegNum]->whichElement.dataWindow;
861 _tuiSetRegisterElement (
864 &((TuiWinElementPtr) dataItemWin->content[0])->whichElement.data,
865 !allocatedHere && refreshValuesOnly);
867 dataWin->detail.dataDisplayInfo.regsColumnCount =
868 tui_calculate_regs_column_count (dpyType);
870 if (dataWin->detail.dataDisplayInfo.dataContentCount > 0)
872 /* delete all the windows? */
873 /* realloc content equal to dataContentCount + regsContentCount */
874 /* append dataWin->detail.dataDisplayInfo.dataContent to content */
877 dataWin->generic.contentSize =
878 dataWin->detail.dataDisplayInfo.regsContentCount +
879 dataWin->detail.dataDisplayInfo.dataContentCount;
884 } /* _tuiSetRegsContent */
888 ** _tuiDisplayRegister().
889 ** Function to display a register in a window. If hilite is TRUE,
890 ** than the value will be displayed in reverse video
893 _tuiDisplayRegister (int regNum,
894 TuiGenWinInfoPtr winInfo, /* the data item window */
895 enum precision_type precision)
897 if (winInfo->handle != (WINDOW *) NULL)
901 int valueCharsWide, labelWidth;
902 TuiDataElementPtr dataElementPtr = &((TuiWinContent)
903 winInfo->content)[0]->whichElement.data;
906 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
908 valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
909 labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
913 if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
916 valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
917 labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
921 valueCharsWide = SINGLE_VALUE_WIDTH;
922 labelWidth = SINGLE_LABEL_WIDTH;
927 _tuiRegisterFormat (buf,
928 valueCharsWide + labelWidth,
933 if (dataElementPtr->highlight)
934 wstandout (winInfo->handle);
936 wmove (winInfo->handle, 0, 0);
937 for (i = 1; i < winInfo->width; i++)
938 waddch (winInfo->handle, ' ');
939 wmove (winInfo->handle, 0, 0);
940 waddstr (winInfo->handle, buf);
942 if (dataElementPtr->highlight)
943 wstandend (winInfo->handle);
944 tuiRefreshWin (winInfo);
947 } /* _tuiDisplayRegister */
951 _tui_vShowRegisters_commandSupport (TuiRegisterDisplayType dpyType)
954 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
955 { /* Data window already displayed, show the registers */
956 if (dataWin->detail.dataDisplayInfo.regsDisplayType != dpyType)
957 tui_show_registers (dpyType);
960 (tuiLayoutDef ())->regsDisplayType = dpyType;
963 } /* _tui_vShowRegisters_commandSupport */
967 _tuiShowFloat_command (char *arg, int fromTTY)
969 if (m_winPtrIsNull (dataWin) || !dataWin->generic.isVisible ||
970 (dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_SFLOAT_REGS &&
971 dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_DFLOAT_REGS))
972 _tui_vShowRegisters_commandSupport ((tuiLayoutDef ())->floatRegsDisplayType);
975 } /* _tuiShowFloat_command */
979 _tuiShowGeneral_command (char *arg, int fromTTY)
981 _tui_vShowRegisters_commandSupport (TUI_GENERAL_REGS);
986 _tuiShowSpecial_command (char *arg, int fromTTY)
988 _tui_vShowRegisters_commandSupport (TUI_SPECIAL_REGS);
993 _tuiToggleFloatRegs_command (char *arg, int fromTTY)
995 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
996 tuiToggleFloatRegs ();
999 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
1001 if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
1002 layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
1004 layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
1009 } /* _tuiToggleFloatRegs_command */
1013 _tuiScrollRegsForward_command (char *arg, int fromTTY)
1015 tui_scroll (FORWARD_SCROLL, dataWin, 1);
1020 _tuiScrollRegsBackward_command (char *arg, int fromTTY)
1022 tui_scroll (BACKWARD_SCROLL, dataWin, 1);