From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Sat, 24 Jul 2021 13:14:50 -0400 Message-ID: References: <83h7gw6pyj.fsf@gnu.org> <45EBF16A-C953-42C7-97D1-3A2BFEF7DD01@gmail.com> <83y2a764oy.fsf@gnu.org> <83v95b60fn.fsf@gnu.org> <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> <83r1fz5xr9.fsf@gnu.org> <1AAB1BCC-362B-4249-B785-4E0530E15C60@gmail.com> <83czri67h0.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <8335s64v10.fsf@gnu.org> <5380C92B-6C15-4490-A1E0-1C3132DBB16A@gmail.com> <83k0li2shw.fsf@gnu.org> <83eebq2mpy.fsf@gnu.org> <83lf5w26e3.fsf@gnu.org> <838s1vzp9i.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_72A5EBC3-D22B-494F-A698-423D3F49B67F" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32594"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 24 19:16:06 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7LFs-0008K4-Jp for ged-emacs-devel@m.gmane-mx.org; Sat, 24 Jul 2021 19:16:04 +0200 Original-Received: from localhost ([::1]:33540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7LFr-0006GJ-L3 for ged-emacs-devel@m.gmane-mx.org; Sat, 24 Jul 2021 13:16:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7LEl-0005ZG-0g for emacs-devel@gnu.org; Sat, 24 Jul 2021 13:14:55 -0400 Original-Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:41688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7LEj-00055k-Hn; Sat, 24 Jul 2021 13:14:54 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id t68so4628548qkf.8; Sat, 24 Jul 2021 10:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=GGcDkrhqKNbDoyMwh6QV3RpINkv8LOBQ+hfV7ChsEuo=; b=bsDFCo3PgJ9//1qnrzbxI2hMr4ymDNWObA3vPDJlbbqcB7EZpcuXxLoz9KxuHNWb7d 9MZRRR1RCzZMumYUQ405YenLKKXhQpkdZjmlyoS1VfDcRbJG2nuxaUh/RZ75UqHYCbis 6f7WtCW2yOMHxvjVSAS7SMF8q4wIcSEL8PV12ETyGhZw9ed4hvNyGerN3WYrE6HaqbKA /7VVZwPS8ewOaj4FxHRS5i7XltCsAX4N2VXyAyw+cWR8LC4rqX0KuJAU7rKQMMHMEEkE whWbcoc5qvZohpue8qs8c/VrfAEWzG9XJtPUemvGqcdk/xfLjzgU4BYrB5vFVNk72WLK Z4ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=GGcDkrhqKNbDoyMwh6QV3RpINkv8LOBQ+hfV7ChsEuo=; b=ik4H0QYYvKyRcIUBNRO6qfgmAviFyYknDBVCX8A5XGrSfuxsExrS/fWJNfqNouq7Cy tWtRSJomWHFCHNt6XKyOXhxaR3cJlKHqULNh0iwt/zz2dcb/9glpJXYFRvvN/pySFDaz +pqPEa542q9eYrA8GrtPYNyQkkLb4Bs8Zvumq2rvN1OUICDCYZxBgMOIH8IKNIh+vV9K 5cJW/nL0Te3aa7AP2LVF9klOVfkSCsLo11PTX3ctHU1kKNVfkM7Iy4GgFOYsw2zzxBP0 gDGcXjtdwzf1WD6R9HT1m0oKAUM+daei06A8kRO4YlrKXNRRAXY4+yTj7DxOuTcRpVmS Gf+Q== X-Gm-Message-State: AOAM530rR/m7iYMEakjpMXp0HVqSfXCX06sSXSU87qxpRlJjUWWAspB0 3zbU93C6qhUHPcqTaZ9SiouJdRj9KoBTsQ== X-Google-Smtp-Source: ABdhPJyZtIWSe9RQOerQZfX9oR5c7IHOaMZqNk+7rmOCVhyw1aFZ4sZoq6qJyJyuNam+i/3MrLQ8zA== X-Received: by 2002:a05:620a:b1b:: with SMTP id t27mr10195198qkg.460.1627146891940; Sat, 24 Jul 2021 10:14:51 -0700 (PDT) Original-Received: from 2603-7080-0302-635e-d969-6d23-8e5f-2ec1.res6.spectrum.com (2603-7080-0302-635e-d969-6d23-8e5f-2ec1.res6.spectrum.com. [2603:7080:302:635e:d969:6d23:8e5f:2ec1]) by smtp.gmail.com with ESMTPSA id j16sm4216598qkk.132.2021.07.24.10.14.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Jul 2021 10:14:51 -0700 (PDT) In-Reply-To: <838s1vzp9i.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=casouri@gmail.com; helo=mail-qk1-x729.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271563 Archived-At: --Apple-Mail=_72A5EBC3-D22B-494F-A698-423D3F49B67F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 >> IIUC if we want tree-sitter to use our malloc, we need to build it = with Emacs, where should I put the source of tree-sitter? >=20 > tree-sitter itself should be a library we link against. If you meant > the tree-sitter support code, then it should go on a separate file in > src/. Or did I misunderstand your question? If we link against libtree-sitter, how do we change its malloc behavior? = Tree-sitter has these kind of things: #ifndef ts_malloc #define ts_malloc ts_malloc_default #endif So I assume we need to define ts_malloc to, say, xmalloc when compiling = libtree-sitter. And if we only link to it, we can=E2=80=99t redefine = ts_malloc. Yuan= --Apple-Mail=_72A5EBC3-D22B-494F-A698-423D3F49B67F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

IIUC = if we want tree-sitter to use our malloc, we need to build it with = Emacs, where should I put the source of tree-sitter?

tree-sitter itself should be a library we link against. =  If you meant
the tree-sitter support code, then it should go on a separate = file in
src/. =  Or did I misunderstand your question?

If we link against libtree-sitter, how do we change its = malloc behavior? Tree-sitter has these kind of things:

#ifndef = ts_malloc
#define ts_malloc =  ts_malloc_default
#endif

So I assume we need to = define ts_malloc to, say, xmalloc when compiling libtree-sitter. And if = we only link to it, we can=E2=80=99t redefine ts_malloc.

Yuan
= --Apple-Mail=_72A5EBC3-D22B-494F-A698-423D3F49B67F--