Mercurial > octave
comparison src/variables.cc @ 244:d66cc97f77a9
[project @ 1993-12-03 01:30:19 by jwe]
author | jwe |
---|---|
date | Fri, 03 Dec 1993 01:30:19 +0000 |
parents | 5b2f4a58254b |
children | c64f870ac8d9 |
comparison
equal
deleted
inserted
replaced
243:5b2f4a58254b | 244:d66cc97f77a9 |
---|---|
692 char **glb = (char **) NULL; | 692 char **glb = (char **) NULL; |
693 char **top = (char **) NULL; | 693 char **top = (char **) NULL; |
694 char **lcl = (char **) NULL; | 694 char **lcl = (char **) NULL; |
695 char **mfl = (char **) NULL; | 695 char **mfl = (char **) NULL; |
696 | 696 |
697 // Each of these functions returns a new vector of pointers to new | |
698 // strings. | |
699 | |
697 key = names (keyword_help (), key_len); | 700 key = names (keyword_help (), key_len); |
698 glb = global_sym_tab->list (glb_len); | 701 glb = global_sym_tab->list (glb_len); |
699 top = top_level_sym_tab->list (top_len); | 702 top = top_level_sym_tab->list (top_len); |
700 if (top_level_sym_tab != curr_sym_tab) | 703 if (top_level_sym_tab != curr_sym_tab) |
701 lcl = curr_sym_tab->list (lcl_len); | 704 lcl = curr_sym_tab->list (lcl_len); |
703 | 706 |
704 int total_len = key_len + glb_len + top_len + lcl_len + mfl_len; | 707 int total_len = key_len + glb_len + top_len + lcl_len + mfl_len; |
705 | 708 |
706 char **list = new char * [total_len+1]; | 709 char **list = new char * [total_len+1]; |
707 | 710 |
711 // Put all the symbols in one big list. Only copy pointers, not the | |
712 // strings they point to, then only delete the original array of | |
713 // pointers, and not the strings they point to. | |
714 | |
708 int j = 0; | 715 int j = 0; |
709 int i = 0; | 716 int i = 0; |
710 for (i = 0; i < key_len; i++) | 717 for (i = 0; i < key_len; i++) |
711 list[j++] = strsave (key[i]); | 718 list[j++] = key[i]; |
712 | 719 |
713 for (i = 0; i < glb_len; i++) | 720 for (i = 0; i < glb_len; i++) |
714 list[j++] = strsave (glb[i]); | 721 list[j++] = glb[i]; |
715 | 722 |
716 for (i = 0; i < top_len; i++) | 723 for (i = 0; i < top_len; i++) |
717 list[j++] = strsave (top[i]); | 724 list[j++] = top[i]; |
718 | 725 |
719 for (i = 0; i < lcl_len; i++) | 726 for (i = 0; i < lcl_len; i++) |
720 list[j++] = strsave (lcl[i]); | 727 list[j++] = lcl[i]; |
721 | 728 |
722 for (i = 0; i < mfl_len; i++) | 729 for (i = 0; i < mfl_len; i++) |
723 list[j++] = strsave (mfl[i]); | 730 list[j++] = mfl[i]; |
724 | 731 |
725 list[j] = (char *) NULL; | 732 list[j] = (char *) NULL; |
726 | 733 |
727 delete [] key; | 734 delete [] key; |
728 delete [] glb; | 735 delete [] glb; |