diff options
| author | Jim Blandy | 1991-01-14 23:38:10 +0000 |
|---|---|---|
| committer | Jim Blandy | 1991-01-14 23:38:10 +0000 |
| commit | a8a7afbecb2262f3841e05b2f54def6c33ac86cf (patch) | |
| tree | d85716831435ac5e60238847ac6350a27e54c941 | |
| parent | 8489eb6781563a09a2a275e6cb4c4fe30dae5b7c (diff) | |
| download | emacs-a8a7afbecb2262f3841e05b2f54def6c33ac86cf.tar.gz emacs-a8a7afbecb2262f3841e05b2f54def6c33ac86cf.zip | |
*** empty log message ***
| -rw-r--r-- | lib-src/make-docfile.c | 164 |
1 files changed, 162 insertions, 2 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 32da3e60420..1ccb84dc290 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -64,7 +64,7 @@ main (argc, argv) | |||
| 64 | #endif VMS | 64 | #endif VMS |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | /* Read file FILENAME and output its doc strings to stdout. */ | 67 | /* Read file FILENAME and output its doc strings to outfile. */ |
| 68 | /* Return 1 if file is not found, 0 if it is found. */ | 68 | /* Return 1 if file is not found, 0 if it is found. */ |
| 69 | 69 | ||
| 70 | scan_file (filename) | 70 | scan_file (filename) |
| @@ -83,7 +83,7 @@ char buf[128]; | |||
| 83 | 83 | ||
| 84 | /* Skip a C string from INFILE, | 84 | /* Skip a C string from INFILE, |
| 85 | and return the character that follows the closing ". | 85 | and return the character that follows the closing ". |
| 86 | If printflag is positive, output string contents to stdout. | 86 | If printflag is positive, output string contents to outfile. |
| 87 | If it is negative, store contents in buf. | 87 | If it is negative, store contents in buf. |
| 88 | Convert escape sequences \n and \t to newline and tab; | 88 | Convert escape sequences \n and \t to newline and tab; |
| 89 | discard \ followed by newline. */ | 89 | discard \ followed by newline. */ |
| @@ -341,6 +341,7 @@ scan_c_file (filename) | |||
| 341 | (defvar NAME VALUE DOCSTRING) | 341 | (defvar NAME VALUE DOCSTRING) |
| 342 | (defconst NAME VALUE DOCSTRING) | 342 | (defconst NAME VALUE DOCSTRING) |
| 343 | (fset (quote NAME) (make-byte-code (quote ARGS) ... "\ | 343 | (fset (quote NAME) (make-byte-code (quote ARGS) ... "\ |
| 344 | DOCSTRING") | ||
| 344 | starting in column zero. | 345 | starting in column zero. |
| 345 | ARGS, FILE or VALUE is ignored. We do not know how to parse Lisp code | 346 | ARGS, FILE or VALUE is ignored. We do not know how to parse Lisp code |
| 346 | so we use a kludge to skip them: | 347 | so we use a kludge to skip them: |
| @@ -384,6 +385,8 @@ scan_lisp_file (filename) | |||
| 384 | c = getc (infile); | 385 | c = getc (infile); |
| 385 | if (c != '(') | 386 | if (c != '(') |
| 386 | continue; | 387 | continue; |
| 388 | |||
| 389 | /* Handle an autoload. */ | ||
| 387 | c = getc (infile); | 390 | c = getc (infile); |
| 388 | if (c == 'a') | 391 | if (c == 'a') |
| 389 | { | 392 | { |
| @@ -463,6 +466,8 @@ scan_lisp_file (filename) | |||
| 463 | } | 466 | } |
| 464 | c = read_c_string (infile, 0); | 467 | c = read_c_string (infile, 0); |
| 465 | } | 468 | } |
| 469 | |||
| 470 | /* Handle def* clauses. */ | ||
| 466 | else if (c == 'd') | 471 | else if (c == 'd') |
| 467 | { | 472 | { |
| 468 | c = getc (infile); | 473 | c = getc (infile); |
| @@ -472,6 +477,8 @@ scan_lisp_file (filename) | |||
| 472 | if (c != 'f') | 477 | if (c != 'f') |
| 473 | continue; | 478 | continue; |
| 474 | c = getc (infile); | 479 | c = getc (infile); |
| 480 | |||
| 481 | /* Is this a defun? */ | ||
| 475 | if (c == 'u') | 482 | if (c == 'u') |
| 476 | { | 483 | { |
| 477 | c = getc (infile); | 484 | c = getc (infile); |
| @@ -479,6 +486,8 @@ scan_lisp_file (filename) | |||
| 479 | continue; | 486 | continue; |
| 480 | defvarflag = 0; | 487 | defvarflag = 0; |
| 481 | } | 488 | } |
| 489 | |||
| 490 | /* Or a defvar? */ | ||
| 482 | else if (c == 'v') | 491 | else if (c == 'v') |
| 483 | { | 492 | { |
| 484 | c = getc (infile); | 493 | c = getc (infile); |
| @@ -489,6 +498,8 @@ scan_lisp_file (filename) | |||
| 489 | continue; | 498 | continue; |
| 490 | defvarflag = 1; | 499 | defvarflag = 1; |
| 491 | } | 500 | } |
| 501 | |||
| 502 | /* Or a defconst? */ | ||
| 492 | else if (c == 'c') | 503 | else if (c == 'c') |
| 493 | { | 504 | { |
| 494 | c = getc (infile); | 505 | c = getc (infile); |
| @@ -576,6 +587,155 @@ scan_lisp_file (filename) | |||
| 576 | continue; | 587 | continue; |
| 577 | } | 588 | } |
| 578 | } | 589 | } |
| 590 | |||
| 591 | /* Handle an fset clause. */ | ||
| 592 | else if (c == 'f') | ||
| 593 | { | ||
| 594 | c = getc (infile); | ||
| 595 | if (c != 's') | ||
| 596 | continue; | ||
| 597 | c = getc (infile); | ||
| 598 | if (c != 'e') | ||
| 599 | continue; | ||
| 600 | c = getc (infile); | ||
| 601 | if (c != 't') | ||
| 602 | continue; | ||
| 603 | |||
| 604 | /* Skip white space */ | ||
| 605 | do | ||
| 606 | c = getc (infile); | ||
| 607 | while (c == ' ' || c == '\n' || c == '\t'); | ||
| 608 | |||
| 609 | /* Recognize "(quote". */ | ||
| 610 | if (c != '(') | ||
| 611 | continue; | ||
| 612 | c = getc (infile); | ||
| 613 | if (c != 'q') | ||
| 614 | continue; | ||
| 615 | c = getc (infile); | ||
| 616 | if (c != 'u') | ||
| 617 | continue; | ||
| 618 | c = getc (infile); | ||
| 619 | if (c != 'o') | ||
| 620 | continue; | ||
| 621 | c = getc (infile); | ||
| 622 | if (c != 't') | ||
| 623 | continue; | ||
| 624 | c = getc (infile); | ||
| 625 | if (c != 'e') | ||
| 626 | continue; | ||
| 627 | |||
| 628 | /* Skip white space */ | ||
| 629 | do | ||
| 630 | c = getc (infile); | ||
| 631 | while (c == ' ' || c == '\n' || c == '\t'); | ||
| 632 | |||
| 633 | /* Read and store name of function or variable being defined | ||
| 634 | Discard backslashes that are for quoting. */ | ||
| 635 | p = buf; | ||
| 636 | while (c != ')' && c != ' ' && c != '\n' && c != '\t') | ||
| 637 | { | ||
| 638 | if (c == '\\') | ||
| 639 | c = getc (infile); | ||
| 640 | *p++ = c; | ||
| 641 | c = getc (infile); | ||
| 642 | } | ||
| 643 | *p = '\0'; | ||
| 644 | |||
| 645 | /* Skip white space */ | ||
| 646 | do | ||
| 647 | c = getc (infile); | ||
| 648 | while (c == ' ' || c == '\n' || c == '\t'); | ||
| 649 | |||
| 650 | /* Recognize "(make-byte-code". */ | ||
| 651 | if (c != '(') | ||
| 652 | continue; | ||
| 653 | c = getc (infile); | ||
| 654 | if (c != 'm') | ||
| 655 | continue; | ||
| 656 | c = getc (infile); | ||
| 657 | if (c != 'a') | ||
| 658 | continue; | ||
| 659 | c = getc (infile); | ||
| 660 | if (c != 'k') | ||
| 661 | continue; | ||
| 662 | c = getc (infile); | ||
| 663 | if (c != 'e') | ||
| 664 | continue; | ||
| 665 | c = getc (infile); | ||
| 666 | if (c != '-') | ||
| 667 | continue; | ||
| 668 | c = getc (infile); | ||
| 669 | if (c != 'b') | ||
| 670 | continue; | ||
| 671 | c = getc (infile); | ||
| 672 | if (c != 'y') | ||
| 673 | continue; | ||
| 674 | c = getc (infile); | ||
| 675 | if (c != 't') | ||
| 676 | continue; | ||
| 677 | c = getc (infile); | ||
| 678 | if (c != 'e') | ||
| 679 | continue; | ||
| 680 | c = getc (infile); | ||
| 681 | if (c != '-') | ||
| 682 | continue; | ||
| 683 | c = getc (infile); | ||
| 684 | if (c != 'c') | ||
| 685 | continue; | ||
| 686 | c = getc (infile); | ||
| 687 | if (c != 'o') | ||
| 688 | continue; | ||
| 689 | c = getc (infile); | ||
| 690 | if (c != 'd') | ||
| 691 | continue; | ||
| 692 | c = getc (infile); | ||
| 693 | if (c != 'e') | ||
| 694 | continue; | ||
| 695 | |||
| 696 | /* Scan for a \" followed by a newline, or for )) followed by | ||
| 697 | a newline. If we find the latter first, this function has | ||
| 698 | no docstring. */ | ||
| 699 | { | ||
| 700 | char c1 = 0, c2 = 0; | ||
| 701 | |||
| 702 | for (;;) | ||
| 703 | { | ||
| 704 | |||
| 705 | /* Find newlines, and remember the two previous characters. */ | ||
| 706 | for (;;) | ||
| 707 | { | ||
| 708 | c = getc (infile); | ||
| 709 | |||
| 710 | if (c == '\n' || c < 0) | ||
| 711 | break; | ||
| 712 | |||
| 713 | c2 = c1; | ||
| 714 | c1 = c; | ||
| 715 | } | ||
| 716 | |||
| 717 | /* If we've hit eof, quit. */ | ||
| 718 | if (c == EOF) | ||
| 719 | break; | ||
| 720 | |||
| 721 | /* If the last two characters were \", this is a docstring. */ | ||
| 722 | else if (c2 == '"' && c1 == '\\') | ||
| 723 | { | ||
| 724 | putc (037, outfile); | ||
| 725 | putc ('F', outfile); | ||
| 726 | fprintf (outfile, "%s\n", buf); | ||
| 727 | read_c_string (infile, 1); | ||
| 728 | break; | ||
| 729 | } | ||
| 730 | |||
| 731 | /* If the last two characters were )), there is no | ||
| 732 | docstring. */ | ||
| 733 | else if (c2 == ')' && c1 == ')') | ||
| 734 | break; | ||
| 735 | } | ||
| 736 | continue; | ||
| 737 | } | ||
| 738 | } | ||
| 579 | else | 739 | else |
| 580 | continue; | 740 | continue; |
| 581 | 741 | ||