4 ** This module contains functions to support display of registers
18 #include "tuiLayout.h"
22 /*****************************************
23 ** LOCAL DEFINITIONS **
24 ******************************************/
25 #define DOUBLE_FLOAT_LABEL_WIDTH 6
26 #define DOUBLE_FLOAT_LABEL_FMT "%6.6s: "
27 #define DOUBLE_FLOAT_VALUE_WIDTH 30 /*min of 16 but may be in sci notation */
29 #define SINGLE_FLOAT_LABEL_WIDTH 6
30 #define SINGLE_FLOAT_LABEL_FMT "%6.6s: "
31 #define SINGLE_FLOAT_VALUE_WIDTH 25 /* min of 8 but may be in sci notation */
33 #define SINGLE_LABEL_WIDTH 10
34 #define SINGLE_LABEL_FMT "%10.10s: "
35 #define SINGLE_VALUE_WIDTH 14/* minimum of 8 but may be in sci notation */
37 /* In the code HP gave Cygnus, this was actually a function call to a
38 PA-specific function, which was supposed to determine whether the
39 target was a 64-bit or 32-bit processor. However, the 64-bit
40 support wasn't complete, so we didn't merge that in, so we leave
41 this here as a stub. */
44 /*****************************************
46 ******************************************/
49 /*****************************************
50 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
51 ******************************************/
52 static TuiStatus _tuiSetRegsContent
53 PARAMS ((int, int, struct frame_info *,
54 TuiRegisterDisplayType, int));
55 static char *_tuiRegisterName PARAMS ((int));
56 static TuiStatus _tuiGetRegisterRawValue
57 PARAMS ((int, char *, struct frame_info *));
58 static void _tuiSetRegisterElement
59 PARAMS ((int, struct frame_info *,
60 TuiDataElementPtr, int));
61 static void _tuiDisplayRegister
62 PARAMS ((int, TuiGenWinInfoPtr, enum precision_type));
63 static void _tuiRegisterFormat
64 PARAMS ((char *, int, int, TuiDataElementPtr,
65 enum precision_type));
66 static TuiStatus _tuiSetGeneralRegsContent PARAMS ((int));
67 static TuiStatus _tuiSetSpecialRegsContent PARAMS ((int));
68 static TuiStatus _tuiSetGeneralAndSpecialRegsContent PARAMS ((int));
69 static TuiStatus _tuiSetFloatRegsContent PARAMS ((TuiRegisterDisplayType, int));
70 static int _tuiRegValueHasChanged
71 PARAMS ((TuiDataElementPtr, struct frame_info *,
73 static void _tuiShowFloat_command PARAMS ((char *, int));
74 static void _tuiShowGeneral_command PARAMS ((char *, int));
75 static void _tuiShowSpecial_command PARAMS ((char *, int));
76 static void _tui_vShowRegisters_commandSupport PARAMS ((va_list));
77 static void _tuiToggleFloatRegs_command PARAMS ((char *, int));
78 static void _tuiScrollRegsForward_command PARAMS ((char *, int));
79 static void _tuiScrollRegsBackward_command PARAMS ((char *, int));
80 static void _tui_vShowRegisters_commandSupport PARAMS ((va_list));
84 /*****************************************
85 ** PUBLIC FUNCTIONS **
86 ******************************************/
89 ** tuiLastRegsLineNo()
90 ** Answer the number of the last line in the regs display.
91 ** If there are no registers (-1) is returned.
95 tuiLastRegsLineNo (void)
100 register int numLines = (-1);
102 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
104 numLines = (dataWin->detail.dataDisplayInfo.regsContentCount /
105 dataWin->detail.dataDisplayInfo.regsColumnCount);
106 if (dataWin->detail.dataDisplayInfo.regsContentCount %
107 dataWin->detail.dataDisplayInfo.regsColumnCount)
111 } /* tuiLastRegsLineNo */
115 ** tuiLineFromRegElementNo()
116 ** Answer the line number that the register element at elementNo is
117 ** on. If elementNo is greater than the number of register elements
118 ** there are, -1 is returned.
122 tuiLineFromRegElementNo (
125 tuiLineFromRegElementNo (elementNo)
129 if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
137 (dataWin->detail.dataDisplayInfo.regsColumnCount * i))
147 } /* tuiLineFromRegElementNo */
151 ** tuiFirstRegElementNoInLine()
152 ** Answer the index of the first element in lineNo. If lineNo is
153 ** past the register area (-1) is returned.
157 tuiFirstRegElementNoInLine (
160 tuiFirstRegElementNoInLine (lineNo)
164 if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount)
165 <= dataWin->detail.dataDisplayInfo.regsContentCount)
166 return ((lineNo + 1) *
167 dataWin->detail.dataDisplayInfo.regsColumnCount) -
168 dataWin->detail.dataDisplayInfo.regsColumnCount;
171 } /* tuiFirstRegElementNoInLine */
175 ** tuiLastRegElementNoInLine()
176 ** Answer the index of the last element in lineNo. If lineNo is past
177 ** the register area (-1) is returned.
181 tuiLastRegElementNoInLine (
184 tuiLastRegElementNoInLine (lineNo)
188 if ((lineNo * dataWin->detail.dataDisplayInfo.regsColumnCount) <=
189 dataWin->detail.dataDisplayInfo.regsContentCount)
190 return ((lineNo + 1) *
191 dataWin->detail.dataDisplayInfo.regsColumnCount) - 1;
194 } /* tuiLastRegElementNoInLine */
198 ** tuiCalculateRegsColumnCount
199 ** Calculate the number of columns that should be used to display
204 tuiCalculateRegsColumnCount (
205 TuiRegisterDisplayType dpyType)
207 tuiCalculateRegsColumnCount (dpyType)
208 TuiRegisterDisplayType dpyType;
211 int colCount, colWidth;
213 if (IS_64BIT || dpyType == TUI_DFLOAT_REGS)
214 colWidth = DOUBLE_FLOAT_VALUE_WIDTH + DOUBLE_FLOAT_LABEL_WIDTH;
217 if (dpyType == TUI_SFLOAT_REGS)
218 colWidth = SINGLE_FLOAT_VALUE_WIDTH + SINGLE_FLOAT_LABEL_WIDTH;
220 colWidth = SINGLE_VALUE_WIDTH + SINGLE_LABEL_WIDTH;
222 colCount = (dataWin->generic.width - 2) / colWidth;
225 } /* tuiCalulateRegsColumnCount */
229 ** tuiShowRegisters().
230 ** Show the registers int the data window as indicated by dpyType.
231 ** If there is any other registers being displayed, then they are
232 ** cleared. What registers are displayed is dependent upon dpyType.
237 TuiRegisterDisplayType dpyType)
239 tuiShowRegisters (dpyType)
240 TuiRegisterDisplayType dpyType;
243 TuiStatus ret = TUI_FAILURE;
244 int refreshValuesOnly = FALSE;
246 /* Say that registers should be displayed, even if there is a problem */
247 dataWin->detail.dataDisplayInfo.displayRegs = TRUE;
249 if (target_has_registers)
252 (dpyType == dataWin->detail.dataDisplayInfo.regsDisplayType);
255 case TUI_GENERAL_REGS:
256 ret = _tuiSetGeneralRegsContent (refreshValuesOnly);
258 case TUI_SFLOAT_REGS:
259 case TUI_DFLOAT_REGS:
260 ret = _tuiSetFloatRegsContent (dpyType, refreshValuesOnly);
263 /* could ifdef out */
265 case TUI_SPECIAL_REGS:
266 ret = _tuiSetSpecialRegsContent (refreshValuesOnly);
268 case TUI_GENERAL_AND_SPECIAL_REGS:
269 ret = _tuiSetGeneralAndSpecialRegsContent (refreshValuesOnly);
272 /* end of potential if def */
278 if (ret == TUI_FAILURE)
280 dataWin->detail.dataDisplayInfo.regsDisplayType = TUI_UNDEFINED_REGS;
281 tuiEraseDataContent (NO_REGS_STRING);
287 /* Clear all notation of changed values */
288 for (i = 0; (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
290 TuiGenWinInfoPtr dataItemWin;
292 dataItemWin = &dataWin->detail.dataDisplayInfo.
293 regsContent[i]->whichElement.dataWindow;
294 (&((TuiWinElementPtr)
295 dataItemWin->content[0])->whichElement.data)->highlight = FALSE;
297 dataWin->detail.dataDisplayInfo.regsDisplayType = dpyType;
298 tuiDisplayAllData ();
300 (tuiLayoutDef ())->regsDisplayType = dpyType;
303 } /* tuiShowRegisters */
307 ** tuiDisplayRegistersFrom().
308 ** Function to display the registers in the content from
309 ** 'startElementNo' until the end of the register content or the
310 ** end of the display height. No checking for displaying past
311 ** the end of the registers is done here.
315 tuiDisplayRegistersFrom (
318 tuiDisplayRegistersFrom (startElementNo)
322 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
323 dataWin->detail.dataDisplayInfo.regsContentCount > 0)
325 register int i = startElementNo;
326 int j, valueCharsWide, charsWide, itemWinWidth, curY, labelWidth;
327 enum precision_type precision;
329 precision = (dataWin->detail.dataDisplayInfo.regsDisplayType
330 == TUI_DFLOAT_REGS) ?
331 double_precision : unspecified_precision;
333 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
335 valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
336 labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
340 if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
343 valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
344 labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
348 valueCharsWide = SINGLE_VALUE_WIDTH;
349 labelWidth = SINGLE_LABEL_WIDTH;
352 itemWinWidth = valueCharsWide + labelWidth;
354 ** Now create each data "sub" window, and write the display into it.
357 while (i < dataWin->detail.dataDisplayInfo.regsContentCount &&
358 curY <= dataWin->generic.viewportHeight)
361 (j < dataWin->detail.dataDisplayInfo.regsColumnCount &&
362 i < dataWin->detail.dataDisplayInfo.regsContentCount); j++)
364 TuiGenWinInfoPtr dataItemWin;
365 TuiDataElementPtr dataElementPtr;
367 /* create the window if necessary*/
368 dataItemWin = &dataWin->detail.dataDisplayInfo.
369 regsContent[i]->whichElement.dataWindow;
370 dataElementPtr = &((TuiWinElementPtr)
371 dataItemWin->content[0])->whichElement.data;
372 if (dataItemWin->handle == (WINDOW *) NULL)
374 dataItemWin->height = 1;
375 dataItemWin->width = (precision == double_precision) ?
376 itemWinWidth + 2 : itemWinWidth + 1;
377 dataItemWin->origin.x = (itemWinWidth * j) + 1;
378 dataItemWin->origin.y = curY;
379 makeWindow (dataItemWin, DONT_BOX_WINDOW);
382 ** Get the printable representation of the register
385 _tuiDisplayRegister (
386 dataElementPtr->itemNo, dataItemWin, precision);
387 i++; /* next register */
389 curY++; /* next row; */
394 } /* tuiDisplayRegistersFrom */
398 ** tuiDisplayRegElementAtLine().
399 ** Function to display the registers in the content from
400 ** 'startElementNo' on 'startLineNo' until the end of the
401 ** register content or the end of the display height.
402 ** This function checks that we won't display off the end
403 ** of the register display.
407 tuiDisplayRegElementAtLine (
411 tuiDisplayRegElementAtLine (startElementNo, startLineNo)
416 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL &&
417 dataWin->detail.dataDisplayInfo.regsContentCount > 0)
419 register int elementNo = startElementNo;
421 if (startElementNo != 0 && startLineNo != 0)
423 register int lastLineNo, firstLineOnLastPage;
425 lastLineNo = tuiLastRegsLineNo ();
426 firstLineOnLastPage = lastLineNo - (dataWin->generic.height - 2);
427 if (firstLineOnLastPage < 0)
428 firstLineOnLastPage = 0;
430 ** If there is no other data displayed except registers,
431 ** and the elementNo causes us to scroll past the end of the
432 ** registers, adjust what element to really start the display at.
434 if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0 &&
435 startLineNo > firstLineOnLastPage)
436 elementNo = tuiFirstRegElementNoInLine (firstLineOnLastPage);
438 tuiDisplayRegistersFrom (elementNo);
442 } /* tuiDisplayRegElementAtLine */
447 ** tuiDisplayRegistersFromLine().
448 ** Function to display the registers starting at line lineNo in
449 ** the data window. Answers the line number that the display
450 ** actually started from. If nothing is displayed (-1) is returned.
454 tuiDisplayRegistersFromLine (
458 tuiDisplayRegistersFromLine (lineNo, forceDisplay)
465 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0)
471 else if (forceDisplay)
473 ** If we must display regs (forceDisplay is true), then make
474 ** sure that we don't display off the end of the registers.
476 if (lineNo >= tuiLastRegsLineNo ())
478 if ((line = tuiLineFromRegElementNo (
479 dataWin->detail.dataDisplayInfo.regsContentCount - 1)) < 0)
488 elementNo = tuiFirstRegElementNoInLine (line);
489 if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
490 tuiDisplayRegElementAtLine (elementNo, line);
497 return (-1); /* nothing was displayed */
498 } /* tuiDisplayRegistersFromLine */
502 ** tuiCheckRegisterValues()
503 ** This function check all displayed registers for changes in
504 ** values, given a particular frame. If the values have changed,
505 ** they are updated with the new value and highlighted.
509 tuiCheckRegisterValues (
510 struct frame_info *frame)
512 tuiCheckRegisterValues (frame)
513 struct frame_info *frame;
516 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
518 if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0 &&
519 dataWin->detail.dataDisplayInfo.displayRegs)
520 tuiShowRegisters ((tuiLayoutDef ())->regsDisplayType);
524 char rawBuf[MAX_REGISTER_RAW_SIZE];
527 (i < dataWin->detail.dataDisplayInfo.regsContentCount); i++)
529 TuiDataElementPtr dataElementPtr;
530 TuiGenWinInfoPtr dataItemWinPtr;
533 dataItemWinPtr = &dataWin->detail.dataDisplayInfo.
534 regsContent[i]->whichElement.dataWindow;
535 dataElementPtr = &((TuiWinElementPtr)
536 dataItemWinPtr->content[0])->whichElement.data;
537 wasHilighted = dataElementPtr->highlight;
538 dataElementPtr->highlight =
539 _tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]);
540 if (dataElementPtr->highlight)
542 for (j = 0; j < MAX_REGISTER_RAW_SIZE; j++)
543 ((char *) dataElementPtr->value)[j] = rawBuf[j];
544 _tuiDisplayRegister (
545 dataElementPtr->itemNo,
547 ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
549 double_precision : unspecified_precision));
551 else if (wasHilighted)
553 dataElementPtr->highlight = FALSE;
554 _tuiDisplayRegister (
555 dataElementPtr->itemNo,
557 ((dataWin->detail.dataDisplayInfo.regsDisplayType ==
559 double_precision : unspecified_precision));
565 } /* tuiCheckRegisterValues */
569 ** tuiToggleFloatRegs().
573 tuiToggleFloatRegs (void)
575 tuiToggleFloatRegs ()
578 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
580 if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
581 layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
583 layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
585 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible &&
586 (dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_SFLOAT_REGS ||
587 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS))
588 tuiShowRegisters (layoutDef->floatRegsDisplayType);
591 } /* tuiToggleFloatRegs */
595 _initialize_tuiRegs ()
597 if (tui_version && xdb_commands)
599 add_com ("fr", class_tui, _tuiShowFloat_command,
600 "Display only floating point registers\n");
601 add_com ("gr", class_tui, _tuiShowGeneral_command,
602 "Display only general registers\n");
603 add_com ("sr", class_tui, _tuiShowSpecial_command,
604 "Display only special registers\n");
605 add_com ("+r", class_tui, _tuiScrollRegsForward_command,
606 "Scroll the registers window forward\n");
607 add_com ("-r", class_tui, _tuiScrollRegsBackward_command,
608 "Scroll the register window backward\n");
609 add_com ("tf", class_tui, _tuiToggleFloatRegs_command,
610 "Toggle between single and double precision floating point registers.\n");
611 add_cmd (TUI_FLOAT_REGS_NAME_LOWER,
613 _tuiToggleFloatRegs_command,
614 "Toggle between single and double precision floating point \
620 } /* _initialize_tuiRegs */
623 /*****************************************
624 ** STATIC LOCAL FUNCTIONS **
625 ******************************************/
629 ** _tuiRegisterName().
630 ** Return the register name.
637 _tuiRegisterName (regNum)
641 if (reg_names[regNum] != (char *) NULL && *(reg_names[regNum]) != (char) 0)
642 return reg_names[regNum];
644 return ((char *) NULL);
645 } /* tuiGetRegisterName */
649 ** _tuiRegisterFormat
650 ** Function to format the register name and value into a buffer,
651 ** suitable for printing or display
659 TuiDataElementPtr dataElement,
660 enum precision_type precision)
662 _tuiRegisterFormat (buf, bufLen, regNum, dataElement, precision)
666 TuiDataElementPtr dataElement;
667 enum precision_type precision;
674 stream = gdb_file_init_astring(bufLen);
675 pa_do_strcat_registers_info (regNum, 0, stream, precision);
676 strcpy (buf, gdb_file_get_strbuf(stream));
677 gdb_file_deallocate(&stream);
680 } /* _tuiRegisterFormat */
683 #define NUM_GENERAL_REGS 32
685 ** _tuiSetGeneralRegsContent().
686 ** Set the content of the data window to consist of the general registers.
690 _tuiSetGeneralRegsContent (
691 int refreshValuesOnly)
693 _tuiSetGeneralRegsContent (refreshValuesOnly)
694 int refreshValuesOnly;
697 return (_tuiSetRegsContent (0,
698 NUM_GENERAL_REGS - 1,
703 } /* _tuiSetGeneralRegsContent */
706 #define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
708 ** _tuiSetSpecialRegsContent().
709 ** Set the content of the data window to consist of the special registers.
713 _tuiSetSpecialRegsContent (
714 int refreshValuesOnly)
716 _tuiSetSpecialRegsContent (refreshValuesOnly)
717 int refreshValuesOnly;
720 TuiStatus ret = TUI_FAILURE;
723 endRegNum = FP0_REGNUM - 1;
726 for (i = START_SPECIAL_REGS; (i < ARCH_NUM_REGS && endRegNum < 0); i++)
727 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
730 ret = _tuiSetRegsContent (START_SPECIAL_REGS,
737 } /* _tuiSetSpecialRegsContent */
741 ** _tuiSetGeneralAndSpecialRegsContent().
742 ** Set the content of the data window to consist of the special registers.
746 _tuiSetGeneralAndSpecialRegsContent (
747 int refreshValuesOnly)
749 _tuiSetGeneralAndSpecialRegsContent (refreshValuesOnly)
750 int refreshValuesOnly;
753 TuiStatus ret = TUI_FAILURE;
754 int i, endRegNum = (-1);
756 endRegNum = FP0_REGNUM - 1;
759 for (i = 0; (i < ARCH_NUM_REGS && endRegNum < 0); i++)
760 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
763 ret = _tuiSetRegsContent (
764 0, endRegNum, selected_frame, TUI_SPECIAL_REGS, refreshValuesOnly);
767 } /* _tuiSetGeneralAndSpecialRegsContent */
770 ** _tuiSetFloatRegsContent().
771 ** Set the content of the data window to consist of the float registers.
775 _tuiSetFloatRegsContent (
776 TuiRegisterDisplayType dpyType,
777 int refreshValuesOnly)
779 _tuiSetFloatRegsContent (dpyType, refreshValuesOnly)
780 TuiRegisterDisplayType dpyType;
781 int refreshValuesOnly;
784 TuiStatus ret = TUI_FAILURE;
787 startRegNum = FP0_REGNUM;
790 for (i = ARCH_NUM_REGS - 1; (i >= 0 && startRegNum < 0); i--)
791 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) != TYPE_CODE_FLT)
794 ret = _tuiSetRegsContent (startRegNum,
801 } /* _tuiSetFloatRegsContent */
805 ** _tuiRegValueHasChanged().
806 ** Answer TRUE if the register's value has changed, FALSE otherwise.
807 ** If TRUE, newValue is filled in with the new value.
811 _tuiRegValueHasChanged (
812 TuiDataElementPtr dataElement,
813 struct frame_info *frame,
816 _tuiRegValueHasChanged (dataElement, frame, newValue)
817 TuiDataElementPtr dataElement;
818 struct frame_info *frame;
822 int hasChanged = FALSE;
824 if (dataElement->itemNo != UNDEFINED_ITEM &&
825 _tuiRegisterName (dataElement->itemNo) != (char *) NULL)
827 char rawBuf[MAX_REGISTER_RAW_SIZE];
830 if (_tuiGetRegisterRawValue (
831 dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS)
833 for (i = 0; (i < MAX_REGISTER_RAW_SIZE && !hasChanged); i++)
834 hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]);
835 if (hasChanged && newValue != (char *) NULL)
837 for (i = 0; (i < MAX_REGISTER_RAW_SIZE); i++)
838 newValue[i] = rawBuf[i];
843 } /* _tuiRegValueHasChanged */
848 ** _tuiGetRegisterRawValue().
849 ** Get the register raw value. The raw value is returned in regValue.
853 _tuiGetRegisterRawValue (
856 struct frame_info *frame)
858 _tuiGetRegisterRawValue (regNum, regValue, frame)
861 struct frame_info *frame;
864 TuiStatus ret = TUI_FAILURE;
866 if (target_has_registers)
868 read_relative_register_raw_bytes_for_frame (regNum, regValue, frame);
873 } /* _tuiGetRegisterRawValue */
878 ** _tuiSetRegisterElement().
879 ** Function to initialize a data element with the input and
880 ** the register value.
884 _tuiSetRegisterElement (
886 struct frame_info *frame,
887 TuiDataElementPtr dataElement,
888 int refreshValueOnly)
890 _tuiSetRegisterElement (regNum, frame, dataElement, refreshValueOnly)
892 struct frame_info *frame;
893 TuiDataElementPtr dataElement;
894 int refreshValueOnly;
897 if (dataElement != (TuiDataElementPtr) NULL)
899 if (!refreshValueOnly)
901 dataElement->itemNo = regNum;
902 dataElement->name = _tuiRegisterName (regNum);
903 dataElement->highlight = FALSE;
905 if (dataElement->value == (Opaque) NULL)
906 dataElement->value = (Opaque) xmalloc (MAX_REGISTER_RAW_SIZE);
907 if (dataElement->value != (Opaque) NULL)
908 _tuiGetRegisterRawValue (regNum, dataElement->value, frame);
912 } /* _tuiSetRegisterElement */
916 ** _tuiSetRegsContent().
917 ** Set the content of the data window to consist of the registers
918 ** numbered from startRegNum to endRegNum. Note that if
919 ** refreshValuesOnly is TRUE, startRegNum and endRegNum are ignored.
926 struct frame_info *frame,
927 TuiRegisterDisplayType dpyType,
928 int refreshValuesOnly)
930 _tuiSetRegsContent (startRegNum, endRegNum, frame, dpyType, refreshValuesOnly)
933 struct frame_info *frame;
934 TuiRegisterDisplayType dpyType;
935 int refreshValuesOnly;
938 TuiStatus ret = TUI_FAILURE;
939 int numRegs = endRegNum - startRegNum + 1;
940 int allocatedHere = FALSE;
942 if (dataWin->detail.dataDisplayInfo.regsContentCount > 0 &&
945 freeDataContent (dataWin->detail.dataDisplayInfo.regsContent,
946 dataWin->detail.dataDisplayInfo.regsContentCount);
947 dataWin->detail.dataDisplayInfo.regsContentCount = 0;
949 if (dataWin->detail.dataDisplayInfo.regsContentCount <= 0)
951 dataWin->detail.dataDisplayInfo.regsContent =
952 allocContent (numRegs, DATA_WIN);
953 allocatedHere = TRUE;
956 if (dataWin->detail.dataDisplayInfo.regsContent != (TuiWinContent) NULL)
960 if (!refreshValuesOnly || allocatedHere)
962 dataWin->generic.content = (OpaquePtr) NULL;
963 dataWin->generic.contentSize = 0;
964 addContentElements (&dataWin->generic, numRegs);
965 dataWin->detail.dataDisplayInfo.regsContent =
966 (TuiWinContent) dataWin->generic.content;
967 dataWin->detail.dataDisplayInfo.regsContentCount = numRegs;
970 ** Now set the register names and values
972 for (i = startRegNum; (i <= endRegNum); i++)
974 TuiGenWinInfoPtr dataItemWin;
976 dataItemWin = &dataWin->detail.dataDisplayInfo.
977 regsContent[i - startRegNum]->whichElement.dataWindow;
978 _tuiSetRegisterElement (
981 &((TuiWinElementPtr) dataItemWin->content[0])->whichElement.data,
982 !allocatedHere && refreshValuesOnly);
984 dataWin->detail.dataDisplayInfo.regsColumnCount =
985 tuiCalculateRegsColumnCount (dpyType);
987 if (dataWin->detail.dataDisplayInfo.dataContentCount > 0)
989 /* delete all the windows? */
990 /* realloc content equal to dataContentCount + regsContentCount */
991 /* append dataWin->detail.dataDisplayInfo.dataContent to content */
994 dataWin->generic.contentSize =
995 dataWin->detail.dataDisplayInfo.regsContentCount +
996 dataWin->detail.dataDisplayInfo.dataContentCount;
1001 } /* _tuiSetRegsContent */
1005 ** _tuiDisplayRegister().
1006 ** Function to display a register in a window. If hilite is TRUE,
1007 ** than the value will be displayed in reverse video
1011 _tuiDisplayRegister (
1013 TuiGenWinInfoPtr winInfo, /* the data item window */
1014 enum precision_type precision)
1016 _tuiDisplayRegister (regNum, winInfo, precision)
1018 TuiGenWinInfoPtr winInfo; /* the data item window */
1019 enum precision_type precision;
1022 if (winInfo->handle != (WINDOW *) NULL)
1025 int valueCharsWide, labelWidth;
1026 TuiDataElementPtr dataElementPtr = &((TuiWinContent)
1027 winInfo->content)[0]->whichElement.data;
1030 dataWin->detail.dataDisplayInfo.regsDisplayType == TUI_DFLOAT_REGS)
1032 valueCharsWide = DOUBLE_FLOAT_VALUE_WIDTH;
1033 labelWidth = DOUBLE_FLOAT_LABEL_WIDTH;
1037 if (dataWin->detail.dataDisplayInfo.regsDisplayType ==
1040 valueCharsWide = SINGLE_FLOAT_VALUE_WIDTH;
1041 labelWidth = SINGLE_FLOAT_LABEL_WIDTH;
1045 valueCharsWide = SINGLE_VALUE_WIDTH;
1046 labelWidth = SINGLE_LABEL_WIDTH;
1051 _tuiRegisterFormat (buf,
1052 valueCharsWide + labelWidth,
1056 if (dataElementPtr->highlight)
1057 wstandout (winInfo->handle);
1059 werase (winInfo->handle);
1060 wmove (winInfo->handle, 0, 0);
1061 waddstr (winInfo->handle, buf);
1063 if (dataElementPtr->highlight)
1064 wstandend (winInfo->handle);
1065 tuiRefreshWin (winInfo);
1068 } /* _tuiDisplayRegister */
1073 _tui_vShowRegisters_commandSupport (
1076 _tui_vShowRegisters_commandSupport (args)
1080 TuiRegisterDisplayType dpyType = va_arg (args, TuiRegisterDisplayType);
1082 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
1083 { /* Data window already displayed, show the registers */
1084 if (dataWin->detail.dataDisplayInfo.regsDisplayType != dpyType)
1085 tuiShowRegisters (dpyType);
1088 (tuiLayoutDef ())->regsDisplayType = dpyType;
1091 } /* _tui_vShowRegisters_commandSupport */
1096 _tuiShowFloat_command (
1100 _tuiShowFloat_command (arg, fromTTY)
1105 if (m_winPtrIsNull (dataWin) || !dataWin->generic.isVisible ||
1106 (dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_SFLOAT_REGS &&
1107 dataWin->detail.dataDisplayInfo.regsDisplayType != TUI_DFLOAT_REGS))
1108 tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
1109 (tuiLayoutDef ())->floatRegsDisplayType);
1112 } /* _tuiShowFloat_command */
1117 _tuiShowGeneral_command (
1121 _tuiShowGeneral_command (arg, fromTTY)
1126 tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
1130 } /* _tuiShowGeneral_command */
1135 _tuiShowSpecial_command (
1139 _tuiShowSpecial_command (arg, fromTTY)
1144 tuiDo ((TuiOpaqueFuncPtr) _tui_vShowRegisters_commandSupport,
1148 } /* _tuiShowSpecial_command */
1153 _tuiToggleFloatRegs_command (
1157 _tuiToggleFloatRegs_command (arg, fromTTY)
1162 if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
1163 tuiDo ((TuiOpaqueFuncPtr) tuiToggleFloatRegs);
1166 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
1168 if (layoutDef->floatRegsDisplayType == TUI_SFLOAT_REGS)
1169 layoutDef->floatRegsDisplayType = TUI_DFLOAT_REGS;
1171 layoutDef->floatRegsDisplayType = TUI_SFLOAT_REGS;
1176 } /* _tuiToggleFloatRegs_command */
1181 _tuiScrollRegsForward_command (
1185 _tuiScrollRegsForward_command (arg, fromTTY)
1190 tuiDo ((TuiOpaqueFuncPtr) tui_vScroll, FORWARD_SCROLL, dataWin, 1);
1193 } /* _tuiScrollRegsForward_command */
1198 _tuiScrollRegsBackward_command (
1202 _tuiScrollRegsBackward_command (arg, fromTTY)
1207 tuiDo ((TuiOpaqueFuncPtr) tui_vScroll, BACKWARD_SCROLL, dataWin, 1);
1210 } /* _tuiScrollRegsBackward_command */