Windows NT 4.0 source code leak
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.

137 lines
2.4 KiB

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