hello.spec:
Name:     hello
Version:  2.10
Release:  %autorelease
Summary:  Produces a familiar, friendly greeting
License:  GPL-3.0-or-later
URL:      https://www.gnu.org/software/hello/| ;;; gpt.el -*- lexical-binding: t; -*- | |
| (defgroup ollama nil | |
| "Ollama client for Emacs." | |
| :group 'ollama) | |
| (defcustom ollama:endpoint "http://192.168.68.108:11434/api/generate" | |
| "Ollama http service endpoint." | |
| :group 'ollama | |
| :type 'string) | 
| #include <stdio.h> | |
| #include <glib.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| /* Linked List demo */ | |
| GList *list = NULL; | |
| list = g_list_append(list, "Hello world!"); | |
| list = g_list_append(list, "Bye world!"); | 
| (set-macro-character | |
| #\~ | |
| (lambda (stream char) | |
| (declare (ignore char)) | |
| `(list ,@(read stream t)))) | |
| ;; USAGE: | |
| (macroexpand (quote ~(1 2 3))) | |
| ;; => (LIST 1 2 3) | 
| (cffi:defcfun ("fnmatch" fnmatch) :int | |
| (pattern :string) | |
| (string :string) | |
| (flags :int)) | |
| (defun glob-match (pattern string &optional (flags 4)) | |
| (= 0 (fnmatch pattern string flags))) | 
| #!/bin/bash | |
| set -x | |
| ### Packages | |
| dnf update -y | |
| dnf install -y sbcl git make gcc ncurses-devel redhat-rpm-config curl rlwrap | |
| ### Config | |
| curl https://raw.githubusercontent.com/garlic0x1/dotfiles/master/.bashrc > ~/.bashrc | 
| (set-macro-character | |
| #\$ | |
| (lambda (stream char) | |
| (declare (ignore char)) | |
| (let ((*readtable* (copy-readtable nil))) | |
| (setf (readtable-case *readtable*) :preserve) | |
| (read stream)))) | |
| $:CaseSensitiveKeyword | |
| ;; => :|CaseSensitiveKeyword| | 
| (defpackage :hooks | |
| (:use :cl) | |
| (:import-from :alexandria :if-let) | |
| (:export :register-hook :run-hook)) | |
| (in-package :hooks) | |
| (defvar *hooks* (make-hash-table) | |
| "Global hook table. | |
| Use `register-hook` and `clear-hook` to modify this.") | 
I am trying to return a struct by value from a C function, and then pass it by value to another C function using cffi-libffi.
Here are the relevant functions and structure with links to the definitions in the header file:
(use-foreign-library "libtree-sitter.so")
;; https://github.com/tree-sitter/tree-sitter/blob/master/lib/include/tree_sitter/api.h#L99
(defcstruct ts-node
  (context :uint32 :count 4)
  (id :pointer)| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <tree_sitter/api.h> | |
| #include <tree_sitter/tree-sitter-c.h> | |
| int main() { | |
| // Create a Tree-sitter parser | |
| const TSLanguage *language = tree_sitter_c(); | |
| TSParser *parser = ts_parser_new(); | |
| ts_parser_set_language(parser, language); |