From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Brad Medeiros Newsgroups: gmane.lisp.guile.user Subject: Passing in data to a function defined with scm_c_define_gsubr Date: Thu, 12 Aug 2021 22:26:47 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5762"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Aug 13 07:27:23 2021 Return-path: Envelope-to: guile-user@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 1mEPj1-0001Hj-CF for guile-user@m.gmane-mx.org; Fri, 13 Aug 2021 07:27:23 +0200 Original-Received: from localhost ([::1]:50770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEPiz-0004h9-SG for guile-user@m.gmane-mx.org; Fri, 13 Aug 2021 01:27:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEPig-0004g8-BL for guile-user@gnu.org; Fri, 13 Aug 2021 01:27:02 -0400 Original-Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]:38423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEPid-0004qI-Qq for guile-user@gnu.org; Fri, 13 Aug 2021 01:27:02 -0400 Original-Received: by mail-oi1-x232.google.com with SMTP id u25so14348279oiv.5 for ; Thu, 12 Aug 2021 22:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=YvJoiC/tfpIdu27BHyKpGatTOSIg7KzOTv/WfpCboxc=; b=uhjGjY1FYYKRvOMXYPm002tdQmJwAT9MVR2bxt8KHMImlkO8hyvOJGOSbEJjWJ4OYk t5nE694mSH5WQ9/lma6IgW+npt05aXaSHWW787ueT7uGbO82kVzZdt9THyTxi12WhVoN etWm8fu0IxkQkRNGXMEjgSzoyC4tnENs4Ai4JUybZH8WIWkoWh+/4WD99oyNaqF8lLbr IPQ2M6QbL5nqXp02u9mMxLHytPgURdIFHh0hDUvNIARRDWwlkF+hCPdjAzwnSSqlBC+s gvSmw5FHEBTFpn2feyjKIeONMxMw2XFzuQg8Otsh2/r353eQj/8DasxYIRFAi0NOCenv rYCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YvJoiC/tfpIdu27BHyKpGatTOSIg7KzOTv/WfpCboxc=; b=fksI/2el6gCvmq/9Eh+/iGvxyTXzY8oAPBlRPgD/r9wDpGJEBwe6wIgqfgU9FtLHIz DFUXte7znbD17a2Z5zW9emZ7d96BPQig0PG0ZuI/s8eJJFFn3sVk2JdHa8kzCHQyVUIU 5gsVn4pbAcycDSkMY/y1zUdB668VFGzsCbifDOoiqSs69518vUeO+5enJaYVcPE3gGUq yMkWdeD8FFbbx3k5qm2GnQct78H2e/ikwqM+7ZntVyuX6HLyKbKNuglSAMX12wj0gOhg +qmu0nj30NCTelC9Hx1e8ooi25ZJg6BatrlymJ0UIJDxEcZt//0eevePGNPEpSoiXVA9 fB/Q== X-Gm-Message-State: AOAM532jcz/U2Hy+nXPpLg0q9g7fG+8fcGMIb8qhRPogorq5juTvqXm9 4hVx/s8YB+j5DO+Dhr5DU6hGIqYyqwZ9TVEVx0sVAx6ncJI= X-Google-Smtp-Source: ABdhPJyxlbg0mHsAUu2B0CMH0z3i+WSJKB2/Se6MnmLSniw92cE9HJVOjcq5kk4lttQ9Nqegy7w/VPJ3Z2ZCnky/qSY= X-Received: by 2002:a05:6808:5:: with SMTP id u5mr765673oic.35.1628832417820; Thu, 12 Aug 2021 22:26:57 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=bradmedeiros0@gmail.com; helo=mail-oi1-x232.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17681 Archived-At: Hello everyone! In short, I'm asking if there is a way to pass some sort of additional void* to a function defined with scm_c_define_gsubr (or another equivalent fn call that has the same behavior) so I can retrieve data that will resolve a unique id, but more context below. I am currently using guile in a game engine as a way to script different objects. In doing so, I end up dynamically creating modules, and defining functions with scm_c_define_gsubr. I need a way to determine a unique id associated with the gameobject to which the function is associated with. Currently what I'm doing to resolve this is by calling scm_current_module. This had been working for me, but I realized my implementation is wrong. While in practice this has been ok because I had been calling these functions after I had set the module (in the body of a callback). However, I realize that this does not generally work, because in practice I sometimes will call these functions in other contexts when the current module is not currently bound. I have some links to my actual usage of source code if this is helpful. Binding for fns: https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scheme_bindings.cpp#L737 Conceptual usage of trying to associate the fn call with a scene id: https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scheme_bindings.cpp#L87 Currently flawed way I'm resolving the id of that scene: https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scriptmanager.cpp#L18