diff options
author | John Ankarström <john@ankarstrom.se> | 2022-03-30 20:15:52 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-03-30 20:15:52 +0200 |
commit | c9b8d278883a90f534f30f0830bb003460310823 (patch) | |
tree | 009344dc7955e0c971d1c5bac102f7805ea363aa /c | |
parent | d1bfa9c377b63ee051e668e8bb60f6051c65787d (diff) | |
download | EpisodeBrowser-c9b8d278883a90f534f30f0830bb003460310823.tar.gz |
Disregard foreign frames.
I don't think they're necessary.
Diffstat (limited to 'c')
-rw-r--r-- | c/common.c | 10 | ||||
-rw-r--r-- | c/datalistview.c | 8 | ||||
-rw-r--r-- | c/defs.h | 2 | ||||
-rw-r--r-- | c/episodelistview.c | 46 | ||||
-rw-r--r-- | c/listview.c | 1 | ||||
-rw-r--r-- | c/main.c | 18 |
6 files changed, 20 insertions, 65 deletions
@@ -31,15 +31,9 @@ TszFromSz(const char *sz, int iCp) int Watched(int iEpisode) { - fid_t f; term_t t; - - F(f); t = T(1); - PI(t,iEpisode) goto f; - P("track_episodes","watched",1,t) goto f; - Fd(f); + PI(t,iEpisode) return 0; + P("track_episodes","watched",1,t) return 0; return 1; -f: Fd(f); - return 0; } diff --git a/c/datalistview.c b/c/datalistview.c index 9911887..99c3eed 100644 --- a/c/datalistview.c +++ b/c/datalistview.c @@ -32,7 +32,6 @@ DlvCreate() void DlvShowEpisode(int iEpisode) { - fid_t f; LVITEM lviKey, lviValue; term_t t; @@ -41,10 +40,9 @@ DlvShowEpisode(int iEpisode) lviKey.mask = LVIF_TEXT; lviValue.mask = LVIF_TEXT; - F(f); t = T(3); - PI(t,iEpisode) goto e; - P("episode_data","lookup_episode_local",3,t) goto e; + PI(t,iEpisode) return; + P("episode_data","lookup_episode_local",3,t) return; /* The episode data is a list of unary compounds, * whose functor is the key and whose argument is the value. @@ -95,6 +93,4 @@ n: free(tszKey); } UpdateLayout(); - -e: Fd(f); } @@ -33,8 +33,6 @@ void DlvShowEpisode(int); #define Q(m,p,a,t) PL_open_query(NULL, PL_Q_NORMAL, PL_predicate(p,a,m), t) #define Qn(q) PL_next_solution(q) #define Qc(q) PL_cut_query(q) -#define F(f) f = PL_open_foreign_frame() -#define Fd(f) PL_discard_foreign_frame(f) #define T(a) PL_new_term_refs(a) #define PI(t,x) if (!PL_put_integer(t,x)) #define GI(t,x) if (!PL_get_integer(t,x)) diff --git a/c/episodelistview.c b/c/episodelistview.c index 37962b1..5dc0eeb 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -72,13 +72,10 @@ ElvHandleNotify(LPARAM lParam) case NM_DBLCLK: case NM_RETURN: { - fid_t f; term_t t; - F(f); t = T(1); - PI(t+0, LpLviElvSelection->lParam) goto b; + PI(t+0, LpLviElvSelection->lParam) break; P("local_episodes","open_episode",1,t); -b: Fd(f); break; } case NM_RCLICK: @@ -115,21 +112,19 @@ ElvSetTop(int iItem) void ElvSelectRecent() { - fid_t f; int iEpisode, iItem; LVFINDINFO lvfi; term_t t; - F(f); t = T(1); - P("track_episodes","most_recently_watched",1,t) goto e; - GI(t,&iEpisode) goto e; + P("track_episodes","most_recently_watched",1,t) return; + GI(t,&iEpisode) return; lvfi.flags = LVFI_PARAM; lvfi.lParam = iEpisode; iItem = ListView_FindItem(HElv, -1, &lvfi); - if (iItem == -1) goto e; + if (iItem == -1) return; if (iItem > 5) ElvSetTop(iItem-5); @@ -139,15 +134,12 @@ ElvSelectRecent() LpLviElvSelection->lParam = iEpisode; ElvUpdateName(LpLviElvSelection); DlvShowEpisode(iEpisode); - -e: Fd(f); } /* Update episode list. */ void ElvUpdate() { - fid_t f; int iLast, iTop; LVITEM lviEpisode, lviName; term_t t; @@ -159,34 +151,31 @@ ElvUpdate() lviEpisode.mask = LVIF_TEXT|LVIF_PARAM; lviName.mask = LVIF_TEXT; - F(f); t = T(1); - P("episode_data","last_episode",1,t) goto f; - GI(t,&iLast) goto f; + P("episode_data","last_episode",1,t) return; + GI(t,&iLast) return; for (int i = 0; i < iLast; i++) { char *szName; - fid_t f2; int cb; TCHAR *tszEpisode, *tszName; term_t t2; /* Format name string. */ - F(f2); t2 = T(3); - PI(t2,i+1) goto e; + PI(t2,i+1) return; tszName = NULL; P("episode_data","lookup_episode_local",3,t2) goto skipname; GAC(t2+1,&szName) goto skipname; tszName = TszFromSz(szName, CP_UTF8); - if (!tszName) goto e; + if (!tszName) return; /* Format episode string. */ skipname: cb = 100; tszEpisode = malloc(cb*sizeof(TCHAR)); - if (!tszEpisode) goto e1; + if (!tszEpisode) goto e; _stprintf_s(tszEpisode, cb, TEXT("%d"), i+1); /* Insert item. */ @@ -205,8 +194,7 @@ skipname: } free(tszEpisode); -e1: if (tszName) free(tszName); -e: Fd(f2); +e: if (tszName) free(tszName); } /* Reset selection and scrolling position. */ @@ -218,7 +206,6 @@ e: Fd(f2); SendMessage(HElv, WM_SETREDRAW, TRUE, 0); ElvRedraw(); -f: Fd(f); } /* Update episode name. */ @@ -226,21 +213,16 @@ void ElvUpdateName(LPLVITEM lpLvi) { char *szName; - fid_t f; TCHAR *tszName; term_t t; - F(f); t = T(3); - PI(t,lpLvi->lParam) goto e; - P("episode_data","lookup_episode",3,t) goto e; - GAC(t+1,&szName) goto e; + PI(t,lpLvi->lParam) return; + P("episode_data","lookup_episode",3,t) return; + GAC(t+1,&szName) return; tszName = TszFromSz(szName, CP_UTF8); - if (!tszName) goto e; + if (!tszName) return; ListView_SetItemText(HElv, lpLvi->iItem, 1, tszName); - -e: Fd(f); - return; } diff --git a/c/listview.c b/c/listview.c index 971c4e9..82c6459 100644 --- a/c/listview.c +++ b/c/listview.c @@ -50,7 +50,6 @@ LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT lResult; extern HWND HElv; - extern LPLVITEM LpLviElvSelection; /* For the episode list view, the Enter key should not * be handled by the dialog manager, but instead be sent @@ -112,7 +112,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_ACTIVATE: switch (wParam) { - fid_t f; term_t t; extern HWND HElv; case WA_INACTIVE: @@ -121,11 +120,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SetFocus(HElv); /* FALLTHROUGH */ case WA_CLICKACTIVE: - F(f); t = T(0); P("track_episodes","update_tracked_episodes",0,t); ElvRedraw(); - Fd(f); } break; case WM_NOTIFY: @@ -155,11 +152,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case ID_FORGET: case ID_LOOKUP: { - fid_t f; term_t t; extern LPLVITEM LpLviElvSelection; - F(f); t = T(1); PI(t,LpLviElvSelection->lParam) break; @@ -183,8 +178,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DlvShowEpisode(LpLviElvSelection->lParam); break; } - - Fd(f); break; } } @@ -223,18 +216,11 @@ AboutDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) int Attach() { - fid_t f; term_t t; - - F(f); t = T(0); - P("track_episodes","attach",0,t) goto f; - P("episode_data","attach",0,t) goto f; - - Fd(f); + P("track_episodes","attach",0,t) return 0; + P("episode_data","attach",0,t) return 0; return 1; -f: Fd(f); - return 0; } void |