Skip to content

Commit

Permalink
(spotiqueue base): Rename from (spotiqueue init).
Browse files Browse the repository at this point in the history
Avoid some confusion and hopefully better express what's going on.
  • Loading branch information
toothbrush committed Jan 1, 2022
1 parent 7284a8d commit 85d9f3a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Spotiqueue.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
DA19341726E9A06F00BEC661 /* RBGuileBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA19341626E9A06F00BEC661 /* RBGuileBridge.swift */; };
DA2E89A026E9E779003BF91C /* GuileHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2E899F26E9E779003BF91C /* GuileHelpers.m */; };
DA2E8A1C26ED9578003BF91C /* init.scm in CopyFiles */ = {isa = PBXBuildFile; fileRef = DAE88E2F26E8AAA300125A3F /* init.scm */; };
DA2E8A1C26ED9578003BF91C /* base.scm in CopyFiles */ = {isa = PBXBuildFile; fileRef = DAE88E2F26E8AAA300125A3F /* base.scm */; };
DA2E8A1D26ED957A003BF91C /* records.scm in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA2E89D326EC3ADF003BF91C /* records.scm */; };
DA2E8A1E26ED957D003BF91C /* keybindings.scm in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA2E89F226EC6741003BF91C /* keybindings.scm */; };
DA2E8A1F26ED9580003BF91C /* key-constants.scm in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA2E89FA26EC8929003BF91C /* key-constants.scm */; };
Expand Down Expand Up @@ -69,7 +69,7 @@
dstPath = spotiqueue;
dstSubfolderSpec = 7;
files = (
DA2E8A1C26ED9578003BF91C /* init.scm in CopyFiles */,
DA2E8A1C26ED9578003BF91C /* base.scm in CopyFiles */,
EC67297A277BDE8F003CF0AC /* exceptions.scm in CopyFiles */,
DA2E8A1F26ED9580003BF91C /* key-constants.scm in CopyFiles */,
DA2E8A1E26ED957D003BF91C /* keybindings.scm in CopyFiles */,
Expand Down Expand Up @@ -125,7 +125,7 @@
DAE1F18926534D670013704F /* Spotiqueue.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Spotiqueue.entitlements; sourceTree = "<group>"; };
DAE88E2A26E8AA6700125A3F /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; };
DAE88E2C26E8AA6C00125A3F /* libffi.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libffi.tbd; path = usr/lib/libffi.tbd; sourceTree = SDKROOT; };
DAE88E2F26E8AAA300125A3F /* init.scm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.scm; sourceTree = "<group>"; };
DAE88E2F26E8AAA300125A3F /* base.scm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = base.scm; sourceTree = "<group>"; };
DAFAB406265D1BE90096810C /* NSImageViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImageViewExtensions.swift; sourceTree = "<group>"; };
EC34C8A22664D92300786C78 /* OptionSetExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionSetExtensions.swift; sourceTree = "<group>"; };
EC34C8B72665C17C00786C78 /* ComparableExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComparableExtensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -164,7 +164,7 @@
isa = PBXGroup;
children = (
EC672973277BDE17003CF0AC /* exceptions.scm */,
DAE88E2F26E8AAA300125A3F /* init.scm */,
DAE88E2F26E8AAA300125A3F /* base.scm */,
DA2E89FA26EC8929003BF91C /* key-constants.scm */,
DA2E89F226EC6741003BF91C /* keybindings.scm */,
DA2E89D326EC3ADF003BF91C /* records.scm */,
Expand Down
4 changes: 2 additions & 2 deletions Spotiqueue/Classes/RBGuileBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public func track_to_scm_record(track: RBSpotifyItem) -> SCM {

// HMMM big TODO here. We actually shouldn't run user hooks on the Main thread, because the user may sleep(4), but we can't simply use DispatchQueue.global(qos: .userInitiated).async {}, either, since even after scm_init_guile() we aren't able to do the scm_c_lookup. Unsure how to share state!

let hook = scm_c_public_ref("spotiqueue init", hook_name)
let hook = scm_c_public_ref("spotiqueue base", hook_name)

if _scm_is_true(scm_hook_p(hook)) {
scm_call_2(scm_c_public_ref("spotiqueue exceptions", "spot:safe-run-hook"),
Expand Down Expand Up @@ -172,7 +172,7 @@ public func track_to_scm_record(track: RBSpotifyItem) -> SCM {

static func guile_handle_key(map: KeyMap, keycode: UInt16, control: Bool, command: Bool, alt: Bool, shift: Bool) -> Bool {
let guile_key = key_to_guile_struct(keycode, control, command, alt, shift)
let action: SCM = scm_hash_ref(scm_c_public_ref("spotiqueue init", map.rawValue),
let action: SCM = scm_hash_ref(scm_c_public_ref("spotiqueue base", map.rawValue),
guile_key,
_scm_false())

Expand Down
2 changes: 1 addition & 1 deletion Spotiqueue/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, const char * argv[]) {
scm_c_define_module("spotiqueue functions", &register_functions, NULL);

// Note that there are DRAGONS here. We use a separate "Copy Files" Xcode build phase to put Scheme files into a "spotiqueue" subfolder inside the App bundle's Resources folder. We do this so that the module names match up. However, there doesn't seem to be an obvious way to get a direct pointer to the Resources folder, so we use this hack.
scm_c_primitive_load_path("spotiqueue/init");
scm_c_primitive_load_path("spotiqueue/base");

// This just sets up logging and stuff in the Rust library:
spotiqueue_initialize_worker();
Expand Down
2 changes: 1 addition & 1 deletion examples/paul-config.scm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#:use-module (ice-9 format)
#:use-module (ice-9 popen)
#:use-module (ice-9 receive)
#:use-module (spotiqueue init)
#:use-module (spotiqueue base)
#:use-module (spotiqueue keybindings)
#:use-module (spotiqueue records)
#:use-module (srfi srfi-9 gnu)
Expand Down
10 changes: 5 additions & 5 deletions guile/spotiqueue/init.scm → guile/spotiqueue/base.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; BEGIN init.scm
;;; BEGIN base.scm
;;;
;;; Copyright © 2021 paul at denknerd dot org
;;;
Expand All @@ -11,7 +11,7 @@
;; `spotiqueue'. Grr, there are already so many of those i'll just nest the Scheme files in
;; guile/spotiqueue i guess. The Copy Files phase in Xcode can sort that out.

(define-module (spotiqueue init)
(define-module (spotiqueue base)
#:use-module (ice-9 format)
#:use-module (spotiqueue exceptions)
#:use-module (spotiqueue functions)
Expand All @@ -20,7 +20,7 @@
#:declarative? #f)
(module-export-all! (current-module))

;; What i want is, whenever someone imports (spotiqueue init), they should get whatever has been
;; What i want is, whenever someone imports (spotiqueue base), they should get whatever has been
;; defined in (spotiqueue functions), too. The latter is the "phantom module" created in Swift-land
;; when Spotiqueue boots, exporting a few functions which are needed to sensibly be able to interact
;; with the music player.
Expand All @@ -30,7 +30,7 @@
;; the docstring of `module-use!`, which simply states, "Add interface [the second arg] to the front
;; of the use-list of module [the first arg]. Both arguments should be module objects, and interface
;; should very likely be a module returned by resolve-interface." Also, (current-module) always
;; resolves to (spotiqueue init), and not whatever is importing it...
;; resolves to (spotiqueue base), and not whatever is importing it...

(eval-when (expand load eval)
(module-use! (module-public-interface (current-module))
Expand Down Expand Up @@ -95,4 +95,4 @@

(define-key global-map (kbd 'ANSI_S #:ctrl #t #:alt #t) queue:shuffle)

;;; END init.scm
;;; END base.scm

0 comments on commit 85d9f3a

Please # to comment.