From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Question about code generation Date: Fri, 10 May 2024 14:57:17 +0200 Message-ID: <877cg1hljm.fsf@gmail.com> References: <86r0ea3qf4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31994"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 10 14:58:08 2024 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 1s5PpA-0008En-E8 for ged-emacs-devel@m.gmane-mx.org; Fri, 10 May 2024 14:58:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5Poa-0007eM-DQ; Fri, 10 May 2024 08:57:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5PoT-0007dd-3s for emacs-devel@gnu.org; Fri, 10 May 2024 08:57:25 -0400 Original-Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5PoR-00059m-KW; Fri, 10 May 2024 08:57:24 -0400 Original-Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a59a0168c75so523824866b.1; Fri, 10 May 2024 05:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715345839; x=1715950639; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HL7Y+kaPR8Qv6SseObsdAB6R6vE28KCKWp9+NfwtGiI=; b=D1527/0nvGn97cW3YjhxTkh+wJYL3awaV9pswMYvJZFaiDrG5PbvohGCDQgYbabvkL TZsQ152A1MzYkYsNxinkHqF+bQos12MnHDIuzWgplR+jWHwafgmEnZId+3jMq8bVM5I5 nZxSzlq6ygfBWUEquk9ImTML5Osa2qaps48nSDb1glX0tMtp/u4dEj2hUl6S5uux/kbp DYLN9Aaw7ZbpQCOJAWJmtKtEDJwE2ZlAfntj//NyGhYsIUMJxvKZVb1pixUuhID/M1Ey eLpnCmvke+OwlQlUltJxVd2SqaMQlAUKjBpdS+/4uQubRODuVsChosGsSjFVtD5HsZzJ eesQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715345839; x=1715950639; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HL7Y+kaPR8Qv6SseObsdAB6R6vE28KCKWp9+NfwtGiI=; b=JTIqaHPhgCr7RRPRMX4mSirGDeA722JdUv2+7udPbLA69iZmB6Kng7jVV9TqfR5Vho z2zW1g0pXs3T5Dp1ltkV55dlKXhfahrMV9OVVIS+5bdTye9QEHXtQSjc2uMMsp1vKbVR 4ZKUN4j+6DzhR8HVdzsvYhD1O1sVdj8dqSRofn9K1ft72UUhCUDHzLRkXNtJ7hYVS9Bg IQZob4UhwZgogP7JOrsTCtc7stctS17G7SKqbX56AFRg5VtuU16U8R0GQuo3raS/pdPD ZWXcG+uYjN5eU9YXExxkJhwsWZdnOFxEyAmg5hCgZugX09gnIJeQD3CjwMU03RgKQ+nj ss0w== X-Forwarded-Encrypted: i=1; AJvYcCVY2lO83nsdxc3U3uURsWFFX3XkQHZzlgEKatiy7IVb1WHXvYBn8efODeb3HOnI/PPWRn58o+t1l4Uz+8il8Eir1XTL X-Gm-Message-State: AOJu0Yz26pf1ePGTnTCWpaG7l+jCmO3MdNiXGj9UqqiSW5UjvYbf9Yer HRSXfIB4iQCGlEm4xaLeqlgmBMknUAOHuoVM1LlQvXT9hUgScdlpOF4eIg== X-Google-Smtp-Source: AGHT+IFJJu79cyKA/sxmetjBnsb6go5AWa3Ytu86kDWXaJ+08+6/1OLyk4lQD0wzE3CJgbWg74sbdg== X-Received: by 2002:a50:c089:0:b0:571:c0e6:233c with SMTP id 4fb4d7f45d1cf-5734d6b19bbmr1497701a12.37.1715345838568; Fri, 10 May 2024 05:57:18 -0700 (PDT) Original-Received: from caladan (dial-184253.pool.broadband44.net. [212.46.184.253]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733beb89e7sm1864428a12.21.2024.05.10.05.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:57:18 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Fri, 10 May 2024 13:38:55 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x62c.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, 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.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319134 Archived-At: On Fri, May 10 2024, Gerd M=C3=B6llmann wrote: >> But I guess I'm misunderstanding what you are asking about. > > I was thinking of (making my life easier and) generating the fix_ > functions in igc.c, as an example, from knowledge that a C parser has > which members are in a given struct, what's their type, Lisp_Object, > pointer to something interesting, ... > > Together with meta infos passed to a code generator this could be used > for all sorts of things, I guess. Would be nice to write things like: struct foo { void* bar [[emacs::igc_fix_obj]]; } and then run a gcc or clang plugin over it and generate the needed code. Can libgccjit be used to parse C code and could we write the plugin in Emacs Lisp? That would be fun.