Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
2.6 KiB

  1. /* asmcref.c -- microsoft 80x86 assembler
  2. **
  3. ** microsoft (r) macro assembler
  4. ** copyright (c) microsoft corp 1986. all rights reserved
  5. **
  6. ** randy nevin
  7. */
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include "asm86.h"
  11. #include "asmfcn.h"
  12. static SYMBOL FARSYM *crefsym;
  13. /*** crefout - output a cref reference/define
  14. *
  15. * crefout();
  16. *
  17. * Entry (creftype) = cross reference type
  18. * *crefsym = symbol to cross reference
  19. * (crefing) = cross-reference type
  20. * Exit cross reference information written to cref file
  21. * Returns none
  22. * Calls printf
  23. */
  24. VOID PASCAL
  25. crefout (
  26. ){
  27. USHORT L_iProc;
  28. char szline[LINEMAX];
  29. if (crefing && pass2 && xcreflag > 0) {
  30. L_iProc = (crefsym->symkind == EQU)? crefsym->symu.equ.iProc:
  31. ((crefsym->symkind == CLABEL)? crefsym->symu.clabel.iProc: 0);
  32. if (creftype != CREFEND) {
  33. STRNFCPY( szline, crefsym->nampnt->id );
  34. if (creftype == DEF)
  35. fprintf( crf.fil, "\x2%c%c%c%c%c%c%s",
  36. *((UCHAR FAR *)&crefsym->symtype),
  37. *((UCHAR FAR *)&crefsym->symtype + 1),
  38. crefsym->attr, (UCHAR) crefsym->symkind,
  39. L_iProc, *((char *)&L_iProc+1),
  40. szline );
  41. else
  42. fprintf(crf.fil, "%c%c%c%c%s", (UCHAR) crefnum[creftype],
  43. (fSecondArg)? opcref & 0xf: opcref >> 4,
  44. L_iProc, *((char *)&L_iProc+1), szline );
  45. creftype = CREFEND;
  46. }
  47. }
  48. }
  49. /*** crefline - emit end-of-line to cross-reference file
  50. *
  51. * crefline ();
  52. *
  53. * Entry errorlineno = current line in source
  54. * crefcount = current line in listing file
  55. * Exit
  56. * Returns
  57. * Calls
  58. */
  59. VOID PASCAL
  60. crefline (
  61. ){
  62. register SHORT i;
  63. if (pass2 && fCrefline && (crefing == CREF_SINGLE)) {
  64. /* Output cref info */
  65. if (creftype != CREFEND)
  66. /* Force out last symbol */
  67. crefout ();
  68. /** Show this was line * */
  69. i = (crefopt || !lsting)? pFCBCur->line: crefcount;
  70. fprintf (crf.fil, "\4%c%c", (char)i, (char)(i>>8));
  71. }
  72. }
  73. /*** crefnew - set up new cross reference item
  74. *
  75. * crefnew(crefkind);
  76. *
  77. * Entry crefkind = cross reference type (REF/DEF)
  78. * *symptr = symbol to cross reference
  79. * Exit
  80. * Returns
  81. * Calls
  82. */
  83. VOID PASCAL
  84. crefnew (
  85. UCHAR crefkind
  86. ){
  87. if (xcreflag > 0 && !(symptr->attr & M_NOCREF)) {
  88. creftype = crefkind;
  89. crefsym = symptr;
  90. }
  91. }
  92. /*** crefdef - output a reference definition
  93. *
  94. * crefdef();
  95. *
  96. * Entry *symptr = symbol to output definition for
  97. * Exit none
  98. * Returns none
  99. * Calls crefnew, crefout
  100. */
  101. VOID PASCAL
  102. crefdef (
  103. ){
  104. if (crefing && !(symptr->attr & M_NOCREF)) {
  105. crefnew( DEF );
  106. crefout();
  107. }
  108. }