Mercurial > emacs
comparison lib-src/make-docfile.c @ 39976:fa2e20b1440c
(scan_c_file): Handle `new style' doc strings in comments [with `doc:'
keyword prefix].
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 16 Oct 2001 13:05:28 +0000 |
parents | f169b10c8e00 |
children | c9411c9fab91 |
comparison
equal
deleted
inserted
replaced
39975:d8c67e075687 | 39976:fa2e20b1440c |
---|---|
399 filename[strlen (filename) - 1] = extension; | 399 filename[strlen (filename) - 1] = extension; |
400 | 400 |
401 c = '\n'; | 401 c = '\n'; |
402 while (!feof (infile)) | 402 while (!feof (infile)) |
403 { | 403 { |
404 int doc_keyword = 0; | |
405 | |
404 if (c != '\n' && c != '\r') | 406 if (c != '\n' && c != '\r') |
405 { | 407 { |
406 c = getc (infile); | 408 c = getc (infile); |
407 continue; | 409 continue; |
408 } | 410 } |
465 c = getc (infile); | 467 c = getc (infile); |
466 if (c != '"') | 468 if (c != '"') |
467 continue; | 469 continue; |
468 c = read_c_string_or_comment (infile, -1, 0); | 470 c = read_c_string_or_comment (infile, -1, 0); |
469 | 471 |
470 /* DEFVAR_LISP ("name", addr /\* doc *\/) | 472 /* DEFVAR_LISP ("name", addr, "doc") |
471 DEFVAR_LISP ("name", addr, doc) */ | 473 DEFVAR_LISP ("name", addr /\* doc *\/) |
474 DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */ | |
472 | 475 |
473 if (defunflag) | 476 if (defunflag) |
474 commas = 5; | 477 commas = 5; |
475 else if (defvarperbufferflag) | 478 else if (defvarperbufferflag) |
476 commas = 2; | 479 commas = 2; |
505 | 508 |
506 if (c == EOF) | 509 if (c == EOF) |
507 goto eof; | 510 goto eof; |
508 c = getc (infile); | 511 c = getc (infile); |
509 } | 512 } |
510 | 513 |
511 while (c == ' ' || c == '\n' || c == '\r' || c == '\t') | 514 while (c == ' ' || c == '\n' || c == '\r' || c == '\t') |
512 c = getc (infile); | 515 c = getc (infile); |
513 | 516 |
514 if (c == '"') | 517 if (c == '"') |
515 c = read_c_string_or_comment (infile, 0, 0); | 518 c = read_c_string_or_comment (infile, 0, 0); |
516 | 519 |
517 while (c != EOF && c != ',' && c != '/') | 520 while (c != EOF && c != ',' && c != '/') |
518 c = getc (infile); | 521 c = getc (infile); |
519 if (c == ',') | 522 if (c == ',') |
520 { | 523 { |
521 c = getc (infile); | 524 c = getc (infile); |
522 while (c == ' ' || c == '\n' || c == '\r' || c == '\t') | 525 while (c == ' ' || c == '\n' || c == '\r' || c == '\t') |
523 c = getc (infile); | 526 c = getc (infile); |
527 while ((c >= 'a' && c <= 'z') || (c >= 'Z' && c <= 'Z')) | |
528 c = getc (infile); | |
529 if (c == ':') | |
530 { | |
531 doc_keyword = 1; | |
532 c = getc (infile); | |
533 while (c == ' ' || c == '\n' || c == '\r' || c == '\t') | |
534 c = getc (infile); | |
535 } | |
524 } | 536 } |
525 | 537 |
526 if (c == '"' | 538 if (c == '"' |
527 || (c == '/' | 539 || (c == '/' |
528 && (c = getc (infile), | 540 && (c = getc (infile), |
542 /* If this is a defun, find the arguments and print them. If | 554 /* If this is a defun, find the arguments and print them. If |
543 this function takes MANY or UNEVALLED args, then the C source | 555 this function takes MANY or UNEVALLED args, then the C source |
544 won't give the names of the arguments, so we shouldn't bother | 556 won't give the names of the arguments, so we shouldn't bother |
545 trying to find them. | 557 trying to find them. |
546 | 558 |
547 Old: DEFUN (..., "DOC") (args) | 559 Various doc-string styles: |
548 New: DEFUN (..., /\* DOC *\/ (args)) */ | 560 0: DEFUN (..., "DOC") (args) [!comment] |
561 1: DEFUN (..., /\* DOC *\/ (args)) [comment && !doc_keyword] | |
562 2: DEFUN (..., doc: /\* DOC *\/) (args) [comment && doc_keyword] | |
563 */ | |
549 if (defunflag && maxargs != -1) | 564 if (defunflag && maxargs != -1) |
550 { | 565 { |
551 char argbuf[1024], *p = argbuf; | 566 char argbuf[1024], *p = argbuf; |
552 | 567 |
553 if (!comment) | 568 if (!comment || doc_keyword) |
554 while (c != ')') | 569 while (c != ')') |
555 { | 570 { |
556 if (c < 0) | 571 if (c < 0) |
557 goto eof; | 572 goto eof; |
558 c = getc (infile); | 573 c = getc (infile); |