Move the PCM/audio playback part of SDL into the target tree.
[kugel-rb.git] / apps / plugins / shortcuts / shortcuts.h
blobbfe3540c4d33a8652ea167f2deebccea99a9278c
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Bryan Childs
11 * Copyright (c) 2007 Alexander Levin
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 #ifndef _SHORTCUTS_H
24 #define _SHORTCUTS_H
26 #include "plugin.h"
28 #define PATH_SEPARATOR "/"
29 #define PATH_SEPARATOR_LEN 1 /* strlen(PATH_SEPARATOR) */
31 #if defined(DEBUG) || defined(SIMULATOR)
32 #define SC_DEBUG
33 #endif
35 #define SHORTCUTS_FILENAME "/shortcuts.link"
37 typedef struct sc_entry_s
39 char path[MAX_PATH+1];
40 char disp[MAX_PATH+1];
41 bool explicit_disp;
42 } sc_entry_t;
44 typedef struct sc_file_s
46 sc_entry_t *entries;
47 int max_entries; /* Max allowed number of entries */
48 int entry_cnt; /* Current number of entries */
49 int show_last_segments;
50 } sc_file_t;
53 extern void *memory_buf;
54 extern long memory_bufsize;
57 extern sc_file_t sc_file;
60 /* Allocates a chunk of memory (as much as possible) */
61 void allocate_memory(void **buf, size_t *bufsize);
63 /* Initializes the file */
64 void init_sc_file(sc_file_t *file, void *buf, size_t bufsize);
66 /* Loads shortcuts from the file. Returns true iff succeeded */
67 bool load_sc_file(sc_file_t *file, char* filename, bool must_exist,
68 void *entry_buf, size_t entry_bufsize);
70 /* Writes contents to the file. File is overwritten. */
71 bool dump_sc_file(sc_file_t *file, char *filename);
73 /* Appends the entry to the file. Entry is copied. Returns true iff succeded. */
74 bool append_entry(sc_file_t *file, sc_entry_t *entry);
76 /* Removes the specified entry (0-based index). Returns true iff succeded. */
77 bool remove_entry(sc_file_t *file, int entry_idx);
79 /* Checks whether the index is a valid one for the file. */
80 bool is_valid_index(sc_file_t *file, int entry_idx);
83 #ifdef SC_DEBUG
84 void print_file(sc_file_t *file);
85 #endif
87 #endif