version 1.24, 2010/09/29 21:39:52
|
version 1.25, 2010/09/29 21:41:40
|
Line 68 static struct {
|
Line 68 static struct {
|
#define TABLEID_FIRST 0x40 |
#define TABLEID_FIRST 0x40 |
#define TABLEID_LAST 0x7F |
#define TABLEID_LAST 0x7F |
|
|
static unsigned char nextversion[TABLEID_LAST-TABLEID_FIRST+1]; |
|
|
|
#define TS_PACKET_SIZE 188 |
#define TS_PACKET_SIZE 188 |
#define TS_HEADSLEN 3 |
#define TS_HEADSLEN 3 |
#define TS_PACKET_HEADSIZE 4 |
#define TS_PACKET_HEADSIZE 4 |
Line 242 struct sitab {
|
Line 240 struct sitab {
|
|
|
static struct sitab *newtab = NULL; |
static struct sitab *newtab = NULL; |
static struct sitab *runtab = NULL; |
static struct sitab *runtab = NULL; |
|
static struct sitab *oldtab = NULL; |
|
|
#define SYNTAX_END 0 |
#define SYNTAX_END 0 |
#define SYNTAX_LOOPEND 1 |
#define SYNTAX_LOOPEND 1 |
Line 1564 static enum enumsi alloctab(long pid, lo
|
Line 1563 static enum enumsi alloctab(long pid, lo
|
return e; |
return e; |
} |
} |
|
|
|
static unsigned char nextversion(struct sitab *nt) |
|
{ |
|
struct sitab **pst; |
|
struct sitab *st; |
|
pst = &oldtab; |
|
while ((st = *pst)) { |
|
if ((st->pid == nt->pid) && (st->tableid == nt->tableid) |
|
&& (st->tableid_ext == nt->tableid_ext)) { |
|
unsigned char v = st->version + 1; |
|
*pst = st->next; |
|
free(st->tab); |
|
free(st); |
|
return v; |
|
} else { |
|
pst = &st->next; |
|
} |
|
} |
|
return 0; |
|
} |
|
|
static void droptab(long pid, long tableid, long tableid_ext) |
static void droptab(long pid, long tableid, long tableid_ext) |
{ |
{ |
struct sitab **pst; |
struct sitab **pst; |
Line 1573 static void droptab(long pid, long table
|
Line 1592 static void droptab(long pid, long table
|
if ((st->pid == pid) && (st->tableid == tableid) |
if ((st->pid == pid) && (st->tableid == tableid) |
&& ((tableid_ext < 0) || (st->tableid_ext == tableid_ext))) { |
&& ((tableid_ext < 0) || (st->tableid_ext == tableid_ext))) { |
*pst = st->next; |
*pst = st->next; |
nextversion[st->tableid - TABLEID_FIRST] = (st->version + 1) & 0x1F; |
st->next = oldtab; |
free(st->tab); |
oldtab = st; |
free(st); |
|
} else { |
} else { |
pst = &st->next; |
pst = &st->next; |
} |
} |
Line 2153 static void argloop(int f0)
|
Line 2171 static void argloop(int f0)
|
gentab(st, &tv); |
gentab(st, &tv); |
if (st->freqmsec <= 0) { |
if (st->freqmsec <= 0) { |
*pst = st->next; |
*pst = st->next; |
nextversion[st->tableid - TABLEID_FIRST] = (st->version + 1) & 0x1F; |
st->next = oldtab; |
free(st->tab); |
oldtab = st; |
free(st); |
|
} else { |
} else { |
pst = &st->next; |
pst = &st->next; |
} |
} |
Line 2208 static void argloop(int f0)
|
Line 2225 static void argloop(int f0)
|
newtab->tableid_ext = newtab->tab[0]; |
newtab->tableid_ext = newtab->tab[0]; |
} |
} |
droptab(newtab->pid, newtab->tableid, newtab->tableid_ext); |
droptab(newtab->pid, newtab->tableid, newtab->tableid_ext); |
newtab->version = nextversion[newtab->tableid - TABLEID_FIRST]; |
newtab->version = nextversion(newtab); |
newtab->soon = tv; |
newtab->soon = tv; |
newtab->next = runtab; |
newtab->next = runtab; |
runtab = newtab; |
runtab = newtab; |
Line 2264 int main(int argc, char *argv[])
|
Line 2281 int main(int argc, char *argv[])
|
system_init(); |
system_init(); |
unblockf(STDIN_FILENO); |
unblockf(STDIN_FILENO); |
unblockf(STDOUT_FILENO); |
unblockf(STDOUT_FILENO); |
memset(&nextversion[0], 0, sizeof(nextversion)); |
|
memset(&perpid[0], 0, sizeof(perpid)); |
memset(&perpid[0], 0, sizeof(perpid)); |
a = 1; |
a = 1; |
do { |
do { |