* Generic stack I can use in C core?
@ 2022-09-23 19:20 Yuan Fu
2022-09-23 19:24 ` Yuan Fu
0 siblings, 1 reply; 11+ messages in thread
From: Yuan Fu @ 2022-09-23 19:20 UTC (permalink / raw)
To: emacs-devel
Is there a generic stack data structure that I use in the C core? Something that automatically grows and shrinks?
Yuan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-23 19:20 Generic stack I can use in C core? Yuan Fu
@ 2022-09-23 19:24 ` Yuan Fu
2022-09-23 20:12 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Yuan Fu @ 2022-09-23 19:24 UTC (permalink / raw)
To: emacs-devel
> On Sep 23, 2022, at 12:20 PM, Yuan Fu <casouri@gmail.com> wrote:
>
> Is there a generic stack data structure that I use in the C core? Something that automatically grows and shrinks?
*Something that allocates a chunk of memory to store the nodes and automatically grows and shrinks and copies stuff over.
Yuan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-23 19:24 ` Yuan Fu
@ 2022-09-23 20:12 ` Eli Zaretskii
2022-09-23 21:56 ` Yuan Fu
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2022-09-23 20:12 UTC (permalink / raw)
To: Yuan Fu; +Cc: emacs-devel
> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 23 Sep 2022 12:24:45 -0700
>
>
>
> > On Sep 23, 2022, at 12:20 PM, Yuan Fu <casouri@gmail.com> wrote:
> >
> > Is there a generic stack data structure that I use in the C core? Something that automatically grows and shrinks?
>
> *Something that allocates a chunk of memory to store the nodes and automatically grows and shrinks and copies stuff over.
What kind of stuff do you want to store there?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-23 20:12 ` Eli Zaretskii
@ 2022-09-23 21:56 ` Yuan Fu
2022-09-24 6:11 ` Eli Zaretskii
2022-09-25 2:45 ` Richard Stallman
0 siblings, 2 replies; 11+ messages in thread
From: Yuan Fu @ 2022-09-23 21:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
> On Sep 23, 2022, at 1:12 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 23 Sep 2022 12:24:45 -0700
>>
>>
>>
>>> On Sep 23, 2022, at 12:20 PM, Yuan Fu <casouri@gmail.com> wrote:
>>>
>>> Is there a generic stack data structure that I use in the C core? Something that automatically grows and shrinks?
>>
>> *Something that allocates a chunk of memory to store the nodes and automatically grows and shrinks and copies stuff over.
>
> What kind of stuff do you want to store there?
I want to traverse a tree depth-first using stacks. If there is a generic stack I’ll use that, if not I’ll just use
struct stack_node {
TSNode node;
TSNode *next;
};
Yuan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-23 21:56 ` Yuan Fu
@ 2022-09-24 6:11 ` Eli Zaretskii
2022-09-24 6:18 ` Po Lu
2022-09-24 16:51 ` Yuan Fu
2022-09-25 2:45 ` Richard Stallman
1 sibling, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2022-09-24 6:11 UTC (permalink / raw)
To: Yuan Fu; +Cc: emacs-devel
> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 23 Sep 2022 14:56:23 -0700
> Cc: emacs-devel@gnu.org
>
> >> *Something that allocates a chunk of memory to store the nodes and automatically grows and shrinks and copies stuff over.
> >
> > What kind of stuff do you want to store there?
>
> I want to traverse a tree depth-first using stacks. If there is a generic stack I’ll use that, if not I’ll just use
>
> struct stack_node {
> TSNode node;
> TSNode *next;
> };
Then I don't think we have anything ready for that, no. In the couple
of places where we traverse a tree in depth-first order, we just
recurse.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-24 6:11 ` Eli Zaretskii
@ 2022-09-24 6:18 ` Po Lu
2022-09-24 16:52 ` Yuan Fu
2022-09-24 16:51 ` Yuan Fu
1 sibling, 1 reply; 11+ messages in thread
From: Po Lu @ 2022-09-24 6:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Yuan Fu, emacs-devel
>> struct stack_node {
>> TSNode node;
>> TSNode *next;
>> };
BTW, Yuan Fu, in Emacs source code the opening brace of a struct is
typically put on a new line.
That should be fixed here and elsewhere in the tree sitter branch code
before it is merged, I think.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-24 6:18 ` Po Lu
@ 2022-09-24 16:52 ` Yuan Fu
2022-09-25 0:20 ` Po Lu
0 siblings, 1 reply; 11+ messages in thread
From: Yuan Fu @ 2022-09-24 16:52 UTC (permalink / raw)
To: Po Lu; +Cc: Eli Zaretskii, emacs-devel
> On Sep 23, 2022, at 11:18 PM, Po Lu <luangruo@yahoo.com> wrote:
>
>
>>> struct stack_node {
>>> TSNode node;
>>> TSNode *next;
>>> };
>
> BTW, Yuan Fu, in Emacs source code the opening brace of a struct is
> typically put on a new line.
>
> That should be fixed here and elsewhere in the tree sitter branch code
> before it is merged, I think.
I’ve always used bracket on-the-newline, but I could have fumbled here and there. Do you see any place where I used bracket-at-eol?
Yuan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-24 6:11 ` Eli Zaretskii
2022-09-24 6:18 ` Po Lu
@ 2022-09-24 16:51 ` Yuan Fu
1 sibling, 0 replies; 11+ messages in thread
From: Yuan Fu @ 2022-09-24 16:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
> On Sep 23, 2022, at 11:11 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 23 Sep 2022 14:56:23 -0700
>> Cc: emacs-devel@gnu.org
>>
>>>> *Something that allocates a chunk of memory to store the nodes and automatically grows and shrinks and copies stuff over.
>>>
>>> What kind of stuff do you want to store there?
>>
>> I want to traverse a tree depth-first using stacks. If there is a generic stack I’ll use that, if not I’ll just use
>>
>> struct stack_node {
>> TSNode node;
>> TSNode *next;
>> };
>
> Then I don't think we have anything ready for that, no. In the couple
> of places where we traverse a tree in depth-first order, we just
> recurse.
Cool, thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Generic stack I can use in C core?
2022-09-23 21:56 ` Yuan Fu
2022-09-24 6:11 ` Eli Zaretskii
@ 2022-09-25 2:45 ` Richard Stallman
2022-09-25 5:01 ` Eli Zaretskii
1 sibling, 1 reply; 11+ messages in thread
From: Richard Stallman @ 2022-09-25 2:45 UTC (permalink / raw)
To: Yuan Fu; +Cc: eliz, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Do Obstacks do what you want?
GCC version 1 used Obstacks -- I don't know whether it still does.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-09-25 5:01 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 19:20 Generic stack I can use in C core? Yuan Fu
2022-09-23 19:24 ` Yuan Fu
2022-09-23 20:12 ` Eli Zaretskii
2022-09-23 21:56 ` Yuan Fu
2022-09-24 6:11 ` Eli Zaretskii
2022-09-24 6:18 ` Po Lu
2022-09-24 16:52 ` Yuan Fu
2022-09-25 0:20 ` Po Lu
2022-09-24 16:51 ` Yuan Fu
2022-09-25 2:45 ` Richard Stallman
2022-09-25 5:01 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.