You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(12) |
Nov
(35) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(48) |
Feb
(28) |
Mar
(6) |
Apr
(14) |
May
|
Jun
(1) |
Jul
|
Aug
(36) |
Sep
(34) |
Oct
(146) |
Nov
(32) |
Dec
(3) |
| 2003 |
Jan
(2) |
Feb
(9) |
Mar
(28) |
Apr
(34) |
May
(9) |
Jun
(31) |
Jul
(46) |
Aug
(55) |
Sep
(61) |
Oct
(41) |
Nov
(40) |
Dec
(58) |
| 2004 |
Jan
(32) |
Feb
(1) |
Mar
(11) |
Apr
(2) |
May
(3) |
Jun
(3) |
Jul
(2) |
Aug
(3) |
Sep
|
Oct
(1) |
Nov
|
Dec
(3) |
| 2005 |
Jan
|
Feb
|
Mar
(4) |
Apr
(5) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <mr...@mr...> - 2005-05-30 19:10:22
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/05/30 21:09:38+02:00 mr...@fo... =
# allow modules to import own symbols
# fix aliased symbol loading
# =
# kernel/module.c
# 2005/05/30 21:09:38+02:00 mr...@fo... +19 -12
# allow modules to import own symbols
# fix aliased symbol loading
# =
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c 2005-05-30 21:10:08 +02:00
+++ b/kernel/module.c 2005-05-30 21:10:08 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2001, 2002, 2003 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -122,7 +122,7 @@
/* Open module */
module->handle =3D dlopen(module->filename, RTLD_NOW);
if(!module->handle){
- fputs(dlerror(), stderr);
+ tc2_print("module", TC2_PRINT_ERROR, "%s\n", dlerror());
return -1;
}
=
@@ -397,7 +397,7 @@
tc2_module *module;
tc2_symbol_t *sym;
=
- kprint("get_symbol", TC2_PRINT_DEBUG + 2, "%s: Getting symbol: %s\n",
+ kprint("get_symbol", TC2_PRINT_DEBUG, "%s: getting symbol: %s\n",
cmod->module->name, csym);
=
if(tchash_find(avail_syms, csym, -1, &module) !=3D 0){
@@ -405,14 +405,16 @@
return NULL;
}
=
- pthread_mutex_lock(&module->mut);
- if(!module->loaded){
- _tc2_request(TC2_LOAD_MODULE, cmod, 0, interface, NULL);
- while(!module->loaded)
- pthread_cond_wait(&module->cond, &module->mut);
- module->autoclean =3D 1;
+ if(cmod !=3D module){
+ pthread_mutex_lock(&module->mut);
+ if(!module->loaded){
+ _tc2_request(TC2_LOAD_MODULE, cmod, 0, interface, NULL);
+ while(!module->loaded)
+ pthread_cond_wait(&module->cond, &module->mut);
+ module->autoclean =3D 1;
+ }
+ pthread_mutex_unlock(&module->mut);
}
- pthread_mutex_unlock(&module->mut);
=
if(tchash_find(loaded_syms, csym, -1, &sym)){
kprint("module", TC2_PRINT_ERROR,
@@ -422,15 +424,20 @@
}
=
if(sym->type =3D=3D TC2_TYPE_ALIAS){
- if(!(sym =3D get_symbol(cmod, interface, sym->sym)))
+ char *ai =3D strdup(sym->sym);
+ kprint("get_symbol", TC2_PRINT_DEBUG, "%s is an alias for %s\n",
+ csym, sym->sym);
+ *strchr(ai, ':') =3D 0;
+ if(!(sym =3D get_symbol(cmod, ai, sym->sym)))
return NULL;
+ free(ai);
}
=
/* Update dependency table */
if(cmod)
tc2_add_dep(cmod, module);
=
- kprint("get_symbol", TC2_PRINT_DEBUG + 2, "%s: Got symbol: %s -> %p\n",
+ kprint("get_symbol", TC2_PRINT_DEBUG, "%s: got symbol: %s -> %p\n",
cmod->module->name, csym, sym->sym);
=
return sym;
|
|
From: <mr...@mr...> - 2005-05-30 17:39:01
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/05/30 19:38:29+02:00 mr...@fo... =
# fix race in get_symbol
# =
# kernel/module.c
# 2005/05/30 19:38:15+02:00 mr...@fo... +8 -4
# proper locking around module loaded check in get_symbol
# =
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c 2005-05-30 19:38:51 +02:00
+++ b/kernel/module.c 2005-05-30 19:38:51 +02:00
@@ -397,7 +397,7 @@
tc2_module *module;
tc2_symbol_t *sym;
=
- kprint("module", TC2_PRINT_DEBUG + 2, "%s: Getting symbol: %s\n",
+ kprint("get_symbol", TC2_PRINT_DEBUG + 2, "%s: Getting symbol: %s\n",
cmod->module->name, csym);
=
if(tchash_find(avail_syms, csym, -1, &module) !=3D 0){
@@ -405,10 +405,14 @@
return NULL;
}
=
- if(module->handle =3D=3D NULL){
- _tc2_request(TC2_LOAD_MODULE, cmod, 1, interface, NULL);
+ pthread_mutex_lock(&module->mut);
+ if(!module->loaded){
+ _tc2_request(TC2_LOAD_MODULE, cmod, 0, interface, NULL);
+ while(!module->loaded)
+ pthread_cond_wait(&module->cond, &module->mut);
module->autoclean =3D 1;
}
+ pthread_mutex_unlock(&module->mut);
=
if(tchash_find(loaded_syms, csym, -1, &sym)){
kprint("module", TC2_PRINT_ERROR,
@@ -426,7 +430,7 @@
if(cmod)
tc2_add_dep(cmod, module);
=
- kprint("module", TC2_PRINT_DEBUG + 2, "%s: Got symbol: %s -> %p\n",
+ kprint("get_symbol", TC2_PRINT_DEBUG + 2, "%s: Got symbol: %s -> %p\n",
cmod->module->name, csym, sym->sym);
=
return sym;
|
|
From: <mr...@mr...> - 2005-05-16 22:17:56
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/05/16 14:01:00+02:00 mr...@fo... =
# call module setup function during init scan
# =
# tools/tc2make
# 2005/05/16 14:01:00+02:00 mr...@fo... +6 -0
# new TC2Module keyword 'setup'
# =
# kernel/request.c
# 2005/05/16 14:01:00+02:00 mr...@fo... +2 -2
# update tc2_add_module() usage
# =
# kernel/kernel.h
# 2005/05/16 14:01:00+02:00 mr...@fo... +2 -2
# pass dlopen handle to tc2_add_module
# =
# kernel/init.c
# 2005/05/16 14:01:00+02:00 mr...@fo... +60 -12
# new function tc2_add_export()
# call module setup function
# =
# kernel/free.c
# 2005/05/16 14:01:00+02:00 mr...@fo... +4 -4
# free everything
# =
# include/tc2.h
# 2005/05/16 14:01:00+02:00 mr...@fo... +4 -1
# add tc2_add_export()
# =
diff -Nru a/include/tc2.h b/include/tc2.h
--- a/include/tc2.h 2005-05-16 14:01:07 +02:00
+++ b/include/tc2.h 2005-05-16 14:01:07 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2001, 2002, 2003, 2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2001-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -87,6 +87,9 @@
=
/* Initialize most things, returns 0 on success. */
extern int tc2_init(void);
+
+/* Add to the module export list */
+extern int tc2_add_export(tc2_module *, char *intf, char *xname, char *iname);
=
/* Run the main loop. */
extern int tc2_run(void);
diff -Nru a/kernel/free.c b/kernel/free.c
--- a/kernel/free.c 2005-05-16 14:01:07 +02:00
+++ b/kernel/free.c 2005-05-16 14:01:07 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2003 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2003-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -41,9 +41,7 @@
tc2_module *m =3D p;
int i;
=
- if(m->filename)
- free(m->filename);
-
+ free(m->filename);
free(m->module->name);
free(m->module->description);
=
@@ -52,6 +50,8 @@
free(m->module->exports[i].xname);
free(m->module->exports[i].iname);
}
+ for(i =3D 0; m->module->interfaces[i]; i++)
+ free(m->module->interfaces[i]);
free(m->module->exports);
free(m->module->interfaces);
free(m->module);
diff -Nru a/kernel/init.c b/kernel/init.c
--- a/kernel/init.c 2005-05-16 14:01:07 +02:00
+++ b/kernel/init.c 2005-05-16 14:01:07 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2001, 2002, 2003, 2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2001-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -90,19 +90,52 @@
}
=
extern int
-tc2_add_module(char *file, tc2_module_info *md)
+tc2_add_export(tc2_module *mod, char *intf, char *xname, char *iname)
+{
+ tc2_module_info *mi =3D mod->module;
+ int j;
+
+ for(j =3D 0; mi->exports[j].xname; j++);
+ mi->exports =3D realloc(mi->exports, (j + 2) * sizeof(*mi->exports));
+
+ mi->exports[j].interface =3D strdup(intf);
+ mi->exports[j].xname =3D strdup(xname);
+ mi->exports[j].iname =3D strdup(iname);
+
+ mi->exports[j+1].xname =3D NULL;
+ mi->exports[j+1].iname =3D NULL;
+
+ for(j =3D 0; mi->interfaces[j] && strcmp(intf, mi->interfaces[j]); j++);
+ if(!mi->interfaces[j]){
+ mi->interfaces =3D
+ realloc(mi->interfaces, (j + 2) * sizeof(*mi->interfaces));
+ mi->interfaces[j] =3D strdup(intf);
+ mi->interfaces[j+1] =3D NULL;
+ }
+
+ return 0;
+}
+
+extern int
+tc2_add_module(void *handle, char *file, tc2_module_info *md)
{
int j, k;
tc2_module *mod =3D calloc(1, sizeof(tc2_module));
tc2_module *tmp_mod;
+ tc2_module_info *mi;
+ char *setupname =3D NULL;
+ int (*setup)(void);
=
mod->filename =3D file;
=
- mod->module =3D calloc(1, sizeof(tc2_module_info));
+ mi =3D calloc(1, sizeof(*mi));
+ mod->module =3D mi;
mod->module->name =3D strdup(md->name);
mod->module->version =3D md->version;
mod->module->description =3D strdup(md->description);
=
+ md->this_module =3D mod;
+
/* Count elements in exportlist */
for(j =3D 0; md->exports[j].xname !=3D NULL; j++);
=
@@ -116,6 +149,8 @@
mod->module->exports[j].interface =3D strdup(md->exports[j].interface);
mod->module->exports[j].xname =3D strdup(md->exports[j].xname);
mod->module->exports[j].iname =3D strdup(md->exports[j].iname);
+ if(!strcmp(md->exports[j].xname, "tc2_setup"))
+ setupname =3D md->exports[j].iname;
}
=
/* Terminate export tclist_t */
@@ -123,10 +158,24 @@
mod->module->exports[j].iname =3D NULL;
=
for(j =3D 0; md->interfaces[j]; j++);
- mod->interfaces =3D calloc(j + 1, sizeof(tc2_interface *));
mod->module->interfaces =3D calloc(j + 1, sizeof(char *));
- for(j =3D 0; md->interfaces[j]; j++){
- char *i =3D md->interfaces[j];
+ for(j =3D 0; md->interfaces[j]; j++)
+ mod->module->interfaces[j] =3D strdup(md->interfaces[j]);
+ mod->module->interfaces[j] =3D NULL;
+
+ if(setupname){
+ setup =3D dlsym(handle, setupname);
+ if(setup)
+ setup();
+ else
+ kprint("init", TC2_PRINT_ERROR, "%s\n", dlerror());
+ }
+
+ for(j =3D 0; mi->interfaces[j]; j++);
+ mod->interfaces =3D calloc(j + 1, sizeof(*mod->interfaces));
+
+ for(j =3D 0; mi->interfaces[j]; j++){
+ char *i =3D mi->interfaces[j];
int replace;
=
for(k =3D 0; interfaces[k] && strcmp(interfaces[k]->name, i); k++);
@@ -148,7 +197,6 @@
tclist_push(interfaces[k]->modules, mod);
=
mod->interfaces[j] =3D interfaces[k];
- mod->module->interfaces[j] =3D interfaces[k]->name;
=
if(!(replace =3D tchash_search(modules, i, -1, mod, &tmp_mod))){
if(!strcmp(mod->module->name, tmp_mod->module->name)){
@@ -175,10 +223,10 @@
if(replace){
int l;
tchash_replace(modules, i, -1, mod, NULL);
- for(l =3D 0; md->exports[l].xname !=3D NULL; l++) {
- if(!strcmp(md->exports[l].interface, i)){
- char *s =3D MKSYM(md->exports[l].interface,
- md->exports[l].xname);
+ for(l =3D 0; mi->exports[l].xname !=3D NULL; l++) {
+ if(!strcmp(mi->exports[l].interface, i)){
+ char *s =3D MKSYM(mi->exports[l].interface,
+ mi->exports[l].xname);
tchash_replace(avail_syms, s, -1, mod, NULL);
free(s);
}
@@ -321,7 +369,7 @@
continue;
}
=
- tc2_add_module(buf, mod_info);
+ tc2_add_module(handle, buf, mod_info);
=
dlclose(handle);
free(modlist[k]);
diff -Nru a/kernel/kernel.h b/kernel/kernel.h
--- a/kernel/kernel.h 2005-05-16 14:01:07 +02:00
+++ b/kernel/kernel.h 2005-05-16 14:01:07 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2001, 2002, 2003, 2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2001-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -38,7 +38,7 @@
extern tchash_table_t *avail_syms, *loaded_syms, *modules, *module_names;
extern int unload_modules;
=
-extern int tc2_add_module(char *file, tc2_module_info *md);
+extern int tc2_add_module(void *handle, char *file, tc2_module_info *md);
=
/* Loads a module */
extern int tc2_load_module(tc2_module *module, char *opt);
diff -Nru a/kernel/request.c b/kernel/request.c
--- a/kernel/request.c 2005-05-16 14:01:07 +02:00
+++ b/kernel/request.c 2005-05-16 14:01:07 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2001, 2002, 2003 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2001-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -209,7 +209,7 @@
break;
=
case TC2_ADD_MODULE:
- tc2_add_module(rq->data[0], rq->data[1]);
+ tc2_add_module(NULL, rq->data[0], rq->data[1]);
break;
=
default:
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2005-05-16 14:01:07 +02:00
+++ b/tools/tc2make 2005-05-16 14:01:07 +02:00
@@ -84,6 +84,7 @@
my $shutdown; # cleanup function
my $init; # generated init function
my $ashutdown; # generated shutdown function
+my $setup; # setup function
my $cmod; # generated C source file
my $hmod; # private generated C header file
my $version; # version of module
@@ -118,6 +119,7 @@
undef $shutdown;
undef $init;
undef $ashutdown;
+ undef $setup;
undef $cmod;
undef $hmod;
undef $version;
@@ -273,6 +275,8 @@
$postinit =3D $1;
} elsif (/^shutdown\s+(.+)$/) {
$shutdown =3D $1;
+ } elsif (/^setup\s+(.+)$/) {
+ $setup =3D $1;
} elsif (/^sources\s+(.+)$/) {
push @sources, split /\s+/, $1;
} elsif (/^require\s+\"(.+)\"$/) {
@@ -540,6 +544,7 @@
push @exports,
([$name, '_tc2_init', $init],
[$name, '_tc2_shutdown', $ashutdown]);
+ $setup and push @exports, [$name, 'tc2_setup', $setup];
=
qprint "tc2make: creating $file... ";
open C, ">$file.tc2" or die "Cannot open '$file'\n";
@@ -888,6 +893,7 @@
$preinit and print H qq/extern int $preinit(char *);\n/;
$postinit and print H qq/extern int $postinit(char *);\n/;
$shutdown and print H qq/extern int $shutdown(void);\n/;
+ $setup and print H qq/extern int $setup(void);\n/;
=
print_imports \*H, 'extern ';
=
|
|
From: <mi...@mr...> - 2005-04-22 18:17:07
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/22 20:16:10+02:00 mi...@go... =
# draw:new symbol: draw figure
# =
# src/draw/draw.c
# 2005/04/22 20:16:10+02:00 mi...@go... +19 -0
# draw figure
# =
# src/draw/TC2Module
# 2005/04/22 20:16:10+02:00 mi...@go... +4 -0
# draw figure
# =
# interfaces/draw.tc2
# 2005/04/22 20:16:09+02:00 mi...@go... +2 -0
# draw figure
# =
diff -Nru a/interfaces/draw.tc2 b/interfaces/draw.tc2
--- a/interfaces/draw.tc2 2005-04-22 20:16:52 +02:00
+++ b/interfaces/draw.tc2 2005-04-22 20:16:52 +02:00
@@ -1,4 +1,6 @@
symbol "line" int (*%s)(image_t *img, int x1, int y1, int x2, int y2, int width, uint64_t *color)
symbol "filled_rectangle" int (*%s)(image_t *img, int x1, int y1, int x2, int y2, uint64_t *color)
+symbol "rectangle" int (*%s)(image_t *img, int x1, int y1, int x2, int y2, uint64_t *color)
+symbol "figure" image_t *(*%s)(tcconf_section_t *fig)
=
require "image"
diff -Nru a/src/draw/TC2Module b/src/draw/TC2Module
--- a/src/draw/TC2Module 2005-04-22 20:16:52 +02:00
+++ b/src/draw/TC2Module 2005-04-22 20:16:52 +02:00
@@ -4,4 +4,8 @@
tc2version 0.4.0
description "drawing of geometric shapes"
sources draw.c
+
implement "draw" "filled_rectangle" i_draw_fillrect
+implement "draw" "figure" i_draw_figure
+
+import "image" "new"
diff -Nru a/src/draw/draw.c b/src/draw/draw.c
--- a/src/draw/draw.c 2005-04-22 20:16:52 +02:00
+++ b/src/draw/draw.c 2005-04-22 20:16:52 +02:00
@@ -74,3 +74,22 @@
=
return 0;
}
+
+extern image_t *
+i_draw_figure(tcconf_section_t *fig)
+{
+ uint64_t bg[1] =3D {0};
+ image_params_t ip;
+ int i =3D 0;
+
+ i +=3D tcconf_getvalue(fig, "size", "%d %d", &ip.width[0], &ip.height[0]);
+ if(i !=3D 2) return NULL;
+
+ tcconf_getvalue(fig, "background", "%d", &bg);
+ ip.pixel_type =3D IMAGE_COLOR_RGB_ALPHA;
+ image_t *img =3D image_new(&ip, bg);
+
+
+
+ return img;
+}
|
|
From: <mi...@mr...> - 2005-04-12 21:33:42
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/12 23:33:29+02:00 mi...@go... =
# New module draw
# =
# BitKeeper/etc/logging_ok
# 2005/04/12 23:33:29+02:00 mi...@go... +1 -0
# Logging to lo...@op... accepted
# =
# src/draw/draw.c
# 2005/04/12 23:33:26+02:00 mi...@go... +76 -0
# =
# src/draw/TC2Module
# 2005/04/12 23:33:26+02:00 mi...@go... +7 -0
# =
# interfaces/draw.tc2
# 2005/04/12 23:33:26+02:00 mi...@go... +4 -0
# =
# src/draw/draw.c
# 2005/04/12 23:33:26+02:00 mi...@go... +0 -0
# BitKeeper file /home/michael/RALPH/tc2-modules/src/draw/draw.c
# =
# src/draw/TC2Module
# 2005/04/12 23:33:26+02:00 mi...@go... +0 -0
# BitKeeper file /home/michael/RALPH/tc2-modules/src/draw/TC2Module
# =
# interfaces/draw.tc2
# 2005/04/12 23:33:26+02:00 mi...@go... +0 -0
# BitKeeper file /home/michael/RALPH/tc2-modules/interfaces/draw.tc2
# =
# TC2Package
# 2005/04/12 23:33:26+02:00 mi...@go... +1 -0
# New module draw
# =
diff -Nru a/TC2Package b/TC2Package
--- a/TC2Package 2005-04-12 23:33:30 +02:00
+++ b/TC2Package 2005-04-12 23:33:30 +02:00
@@ -1,5 +1,6 @@
name "TC2 Modules"
version 0.6.0
+module src/draw
module src/eventq
module src/file
module src/gif
diff -Nru a/interfaces/draw.tc2 b/interfaces/draw.tc2
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/interfaces/draw.tc2 2005-04-12 23:33:30 +02:00
@@ -0,0 +1,4 @@
+symbol "line" int (*%s)(image_t *img, int x1, int y1, int x2, int y2, int width, uint64_t *color)
+symbol "filled_rectangle" int (*%s)(image_t *img, int x1, int y1, int x2, int y2, uint64_t *color)
+
+require "image"
diff -Nru a/src/draw/TC2Module b/src/draw/TC2Module
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/src/draw/TC2Module 2005-04-12 23:33:30 +02:00
@@ -0,0 +1,7 @@
+module draw
+name "TC2/draw"
+version 0.1.0
+tc2version 0.4.0
+description "drawing of geometric shapes"
+sources draw.c
+implement "draw" "filled_rectangle" i_draw_fillrect
diff -Nru a/src/draw/draw.c b/src/draw/draw.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/src/draw/draw.c 2005-04-12 23:33:30 +02:00
@@ -0,0 +1,76 @@
+/**
+ Copyright (C) 2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use, copy,
+ modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+**/
+
+#include <stdio.h>
+#include <string.h>
+#include <tcalloc.h>
+#include <draw_tc2.h>
+
+
+static void
+alpha_pixel(uint8_t *dest, uint8_t *src)
+{
+ int a =3D src[3];
+ int b =3D 255-src[3];
+ int d;
+
+ dest[0] =3D (dest[0]*b + src[0]*a)/255;
+ dest[1] =3D (dest[1]*b + src[1]*a)/255;
+ dest[2] =3D (dest[2]*b + src[2]*a)/255;
+
+ d =3D dest[3] + (src[3]*a)/255;
+ dest[3] =3D (d>255)?255:d;
+}
+
+static int
+draw_horizontal_line(image_t *img, int x1, int x2, int y, int width,
+ uint64_t *color)
+{
+ if(width =3D=3D 1) {
+ uint32_t *imgdata =3D (uint32_t *)img->data[0];
+ int i;
+ int start =3D x1 + y*img->params.width[0];
+ int end =3D x2 + y*img->params.width[0];
+
+ for(i =3D start; i < end; i++){
+ alpha_pixel((uint8_t *) &imgdata[i], (uint8_t *) &color[0]);
+ }
+ }
+
+ return 0;
+}
+
+
+extern int
+i_draw_fillrect(image_t *img, int x1, int y1, int x2, int y2, uint64_t *color)
+{
+ int i;
+
+ if(img->params.pixel_type !=3D IMAGE_COLOR_RGB_ALPHA) return -1;
+
+ for(i=3Dy1; i<=3Dy2; i++) =
+ draw_horizontal_line(img, x1, x2, i, 1, color);
+
+ return 0;
+}
|
|
From: <mr...@mr...> - 2005-04-12 11:04:18
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/12 13:03:30+02:00 mr...@fo... =
# image: new() function to create blank image
# =
# src/image/image.c
# 2005/04/12 13:03:30+02:00 mr...@fo... +83 -2
# implement image:new
# =
# src/image/TC2Module
# 2005/04/12 13:03:30+02:00 mr...@fo... +1 -0
# implement image:new
# =
# interfaces/image.tc2
# 2005/04/12 13:03:30+02:00 mr...@fo... +1 -0
# add new() function
# =
diff -Nru a/interfaces/image.tc2 b/interfaces/image.tc2
--- a/interfaces/image.tc2 2005-04-12 13:03:48 +02:00
+++ b/interfaces/image.tc2 2005-04-12 13:03:48 +02:00
@@ -1,4 +1,5 @@
symbol "read" image_t *(*%s)(url_t *u, image_params_t *)
+symbol "new" image_t *(*%s)(image_params_t *, uint64_t *bg)
require "URL"
include
#include <tctypes.h>
diff -Nru a/src/image/TC2Module b/src/image/TC2Module
--- a/src/image/TC2Module 2005-04-12 13:03:48 +02:00
+++ b/src/image/TC2Module 2005-04-12 13:03:48 +02:00
@@ -5,5 +5,6 @@
description "Image"
sources image.c
implement "image" "read" read_img
+implement "image" "new" img_new
postinit img_init
shutdown img_shdn
diff -Nru a/src/image/image.c b/src/image/image.c
--- a/src/image/image.c 2005-04-12 13:03:48 +02:00
+++ b/src/image/image.c 2005-04-12 13:03:48 +02:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2004-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -24,7 +24,7 @@
=
#include <stdio.h>
#include <string.h>
-#include <image.h>
+#include <tcalloc.h>
#include <image_tc2.h>
=
#ifdef HAVE_LIBMAGIC
@@ -95,4 +95,85 @@
magic_close(file_magic);
#endif
return 0;
+}
+
+static void
+img_free(void *p)
+{
+ image_t *img =3D p;
+ free(img->data[0]);
+}
+
+static void
+img_fill(u_char *d, int s, uint64_t c, int bpp)
+{
+ int i, j;
+
+ while(s--){
+ for(i =3D 0; i < bpp; i++){
+#if TCENDIAN =3D=3D TCENDIAN_LITTLE
+ j =3D i;
+#else
+ j =3D bpp - i - 1;
+#endif
+ d[j] =3D (c >> 8 * i) & 0xff;
+ }
+ d +=3D bpp;
+ }
+}
+
+extern image_t *
+img_new(image_params_t *pm, uint64_t *bg)
+{
+ image_t *img;
+ int planes;
+ int size;
+ int bpp;
+ int i;
+
+ switch(pm->pixel_type & IMAGE_COLOR_TYPEMASK){
+ case IMAGE_COLOR_GRAY:
+ bpp =3D 1;
+ break;
+ case IMAGE_COLOR_RGB:
+ case IMAGE_COLOR_YUV:
+ bpp =3D 3;
+ break;
+ case IMAGE_COLOR_CMYK:
+ bpp =3D 4;
+ break;
+ default:
+ tc2_print("IMAGE", TC2_PRINT_ERROR, "unknown image format %i\n",
+ pm->pixel_type);
+ return NULL;
+ }
+
+ if(pm->pixel_type & IMAGE_COLOR_ALPHA)
+ bpp++;
+ if(pm->pixel_type & IMAGE_COLOR_PLANAR){
+ planes =3D bpp;
+ bpp =3D 1;
+ } else {
+ planes =3D 1;
+ }
+
+ img =3D tcallocdz(sizeof(*img), NULL, img_free);
+ img->params =3D *pm;
+
+ size =3D 0;
+ for(i =3D 0; i < planes; i++)
+ size +=3D pm->width[i] * pm->height[i] * bpp;
+ img->data[0] =3D malloc(size);
+
+ size =3D 0;
+ for(i =3D 0; i < planes; i++){
+ img->data[i] =3D img->data[0] + size;
+ size +=3D pm->width[i] * pm->height[i] * bpp;
+ img_fill(img->data[i], pm->width[i] * pm->height[i], bg[i], bpp);
+ img->linesize[i] =3D pm->width[i] * bpp;
+ }
+
+ img->params.pixelsize =3D bpp;
+
+ return img;
}
|
|
From: <mr...@mr...> - 2005-04-11 20:44:13
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/11 22:43:41+02:00 mr...@fo... =
# tc2make: package private symbols
# =
# tools/tc2make
# 2005/04/11 22:43:41+02:00 mr...@fo... +4 -1
# package private symbols
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2005-04-11 22:44:02 +02:00
+++ b/tools/tc2make 2005-04-11 22:44:02 +02:00
@@ -1,5 +1,5 @@
#! /usr/bin/env perl
-# Copyright (C) 2001-2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+# Copyright (C) 2001-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -659,6 +659,7 @@
my(@preinc, @postinc);
my $doc =3D \$int{'doc'}{'main'};
my($ext, $bc);
+ my $localif =3D $file =3D~ /^$topsrc/;
=
open $ifh, $file or print STDERR "$file: $!\n" and return;
=
@@ -675,6 +676,8 @@
} elsif(/^\s*symbol\s+\"(.*?)\"\s+(.*)/){
$int{'symbols'}{$1} =3D $2;
$doc =3D \$int{'doc'}{'symbols'}{$1};
+ } elsif(/^psymbol\s+\"(.*?)\"\s+(.*)/){
+ $int{'symbols'}{$1} =3D $2 if $localif;
} elsif(/^\s*((post|pre)?include)\s*(?:<<(.*))?$/){
my $inc =3D $1;
my $end =3D $3;
|
|
From: <mr...@mr...> - 2005-04-02 19:54:34
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/02 21:54:05+02:00 mr...@fo... =
# allow extensions in interface definitions
# =
# tools/tc2make
# 2005/04/02 21:54:05+02:00 mr...@fo... +37 -17
# allow extensions in interface definitions
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2005-04-02 21:54:18 +02:00
+++ b/tools/tc2make 2005-04-02 21:54:18 +02:00
@@ -100,7 +100,7 @@
my @confs; # Conf options
my %types; # Types of exported symbols
my %doc;
-my @extensions;
+my %extensions;
my %extfiles;
my %extdata;
=
@@ -132,7 +132,7 @@
undef @confs;
undef %types;
undef %doc;
- undef @extensions;
+ undef %extensions;
undef %extdata;
}
=
@@ -154,6 +154,23 @@
return 0;
}
=
+sub load_ext {
+ my($ext) =3D @_;
+ return if $extensions{$ext};
+
+ if (exist_scm "$topsrc/tc2ext/$ext.pm", 1) {
+ $extfiles{"tc2ext/$ext.pm"} =3D 1;
+ eval qq,require "$topsrc/tc2ext/$ext.pm", or
+ die "tc2make: error loading $ext\n";
+ } else {
+ eval "require $ext" or
+ die "tc2make: extension $ext not found\n";
+ }
+
+ $extensions{$ext} =3D $ext;
+ &{"${ext}::init"};
+}
+
# Convert an interface and symbol name into its canonical C name. If
# called in list context a list with the C type and the symbol name is
# returned.
@@ -272,16 +289,7 @@
push @confs, \@cf;
} elsif (/([[:alpha:]_]\w*)\s*{/) {
$ext =3D $1;
- if (exist_scm "$topsrc/tc2ext/$ext.pm", 1) {
- $extfiles{"tc2ext/$ext.pm"} =3D 1;
- eval qq,require "$topsrc/tc2ext/$ext.pm", or
- die "tc2make: error loading $ext\n";
- } else {
- eval "require $ext" or
- die "tc2make: extension $ext not found\n";
- }
- &{"${ext}::init"};
- push @extensions, $ext;
+ load_ext $ext;
} elsif ($doc) {
$$doc .=3D "$_\n";
} else {
@@ -544,7 +552,7 @@
#include <string.h>
END_C
=
- &{"${_}::cmod"}(\*C) for(@extensions);
+ &{"${_}::cmod"}(\*C) for(keys %extensions);
=
print C <<END_C;
typedef char *_char_p;
@@ -614,7 +622,7 @@
printf C qq/ tc2_add_hook(\"%s\", %s);\n/, $$_[0], $$_[1];
}
=
- &{"${_}::postinit"}(\*C) for(@extensions);
+ &{"${_}::postinit"}(\*C) for(keys %extensions);
=
print C qq/ $postinit(opt);\n/ if $postinit;
print C <<END_C;
@@ -630,7 +638,7 @@
\{
END_C
=
- &{"${_}::unload"}(\*C) for(@extensions);
+ &{"${_}::unload"}(\*C) for(keys %extensions);
=
# unregister hooks in kernel
for (@hooks) {
@@ -650,13 +658,21 @@
my %int;
my(@preinc, @postinc);
my $doc =3D \$int{'doc'}{'main'};
+ my($ext, $bc);
=
open $ifh, $file or print STDERR "$file: $!\n" and return;
=
while(<$ifh>){
s/#.*//;
next if (/^\s*$/);
- if(/^\s*symbol\s+\"(.*?)\"\s+(.*)/){
+ s/^\s*|\s*$//g;
+ /{$/ and $bc++;
+ if (/^}/ and --$bc =3D=3D 0) {
+ $ext =3D undef;
+ } elsif ($ext) {
+ &{"${ext}::interface"}(\%int, $_) or
+ die "$file:$.: Syntax error\n";
+ } elsif(/^\s*symbol\s+\"(.*?)\"\s+(.*)/){
$int{'symbols'}{$1} =3D $2;
$doc =3D \$int{'doc'}{'symbols'}{$1};
} elsif(/^\s*((post|pre)?include)\s*(?:<<(.*))?$/){
@@ -679,6 +695,10 @@
$doc =3D \$int{'doc'}{'options'}{$1};
push @cf, $1 while $p =3D~ /([^\s\"]+(=3D\"[^\"]*\")?)(?=3D\s+\w|$)/g;
push @{$int{'options'}}, \@cf;
+ } elsif (/([[:alpha:]_]\w*)\s*{/) {
+ $ext =3D $1;
+ load_ext $ext;
+ undef $doc;
} elsif($doc){
$$doc .=3D $_;
} else {
@@ -874,7 +894,7 @@
printf H qq/extern int %s(void *);\n/, $$_[1];
}
=
- &{"${_}::hmod"}(\*H) for(@extensions);
+ &{"${_}::hmod"}(\*H) for(keys %extensions);
=
print H "\n#endif\n";
close H;
|
|
From: <mr...@mr...> - 2005-03-26 03:33:08
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/03/26 00:56:47+01:00 mr...@fo... =
# sub tc2_require for use by extensions
# =
# tools/tc2make
# 2005/03/26 00:56:47+01:00 mr...@fo... +9 -4
# sub tc2_require for use by extensions
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2005-03-26 04:32:55 +01:00
+++ b/tools/tc2make 2005-03-26 04:32:55 +01:00
@@ -94,7 +94,7 @@
my @imports; # imported interface-symbol pairs
my %imports;
my @sources; # source files
-my @requires; # required interfaces
+my %requires; # required interfaces
my @tc2version; # TC2 version required
my @hooks;
my @confs; # Conf options
@@ -126,7 +126,7 @@
undef @imports;
undef %imports;
undef @sources;
- undef @requires;
+ undef %requires;
undef @tc2version;
undef @hooks;
undef @confs;
@@ -208,6 +208,10 @@
}
}
=
+sub tc2_require {
+ @requires{@_} =3D @_;
+}
+
sub tc2_extdata {
my($name, $data);
$extdata{$name} =3D $data;
@@ -255,7 +259,7 @@
} elsif (/^sources\s+(.+)$/) {
push @sources, split /\s+/, $1;
} elsif (/^require\s+\"(.+)\"$/) {
- push @requires, $1;
+ tc2_require $1;
} elsif (/^tc2version\s+(\d+)\.(\d+)\.(\d+)$/) {
@tc2version =3D ($1, $2, $3);
} elsif (/^add_hook\s+\"(.+)\"\s+(.+)$/) {
@@ -650,6 +654,7 @@
open $ifh, $file or print STDERR "$file: $!\n" and return;
=
while(<$ifh>){
+ s/#.*//;
next if (/^\s*$/);
if(/^\s*symbol\s+\"(.*?)\"\s+(.*)/){
$int{'symbols'}{$1} =3D $2;
@@ -801,7 +806,7 @@
my($hf) =3D @_;
=
my %h;
- for (map($$_[0], @imports), @requires, keys %interfaces) {
+ for (map($$_[0], @imports), keys %requires, keys %interfaces) {
my $h =3D symbol $_;
if(!exists $h{$h}){
print $hf "#include <$h.h>\n";
|
|
From: <mr...@mr...> - 2005-03-09 17:16:21
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/03/09 18:15:53+01:00 mr...@fo... =
# file: do what I mean
# =
# src/file/file.c
# 2005/03/09 18:15:52+01:00 mr...@fo... +8 -10
# do what I mean
# =
diff -Nru a/src/file/file.c b/src/file/file.c
--- a/src/file/file.c 2005-03-09 18:16:10 +01:00
+++ b/src/file/file.c 2005-03-09 18:16:10 +01:00
@@ -89,20 +89,18 @@
url +=3D 5;
=
if(stat64(url, &st)){
- char *d, *e;
-
if(*mode =3D=3D 'r' && mode[1] !=3D '+')
return NULL;
- if(errno !=3D ENOENT || !tc2_url_file_conf_create_dirs)
- return NULL;
=
- d =3D strdup(url);
- e =3D strrchr(d, '/');
- if(e > d){
- *e =3D 0;
- tcmkpath(d, 0777);
+ if(tc2_url_file_conf_create_dirs){
+ char *d =3D strdup(url);
+ char *e =3D strrchr(d, '/');
+ if(e > d){
+ *e =3D 0;
+ tcmkpath(d, 0777);
+ }
+ free(d);
}
- free(d);
} else if(S_ISDIR(st.st_mode)){
return dir_open(url, mode);
}
|
|
From: <mr...@mr...> - 2005-03-09 12:34:03
|
# This is a BitKeeper generated diff -Nru style patch.
#
# src/tcp/tcp.c
# 2005/03/09 13:32:35+01:00 mr...@fo... +211 -0
# =
# src/tcp/TC2Module
# 2005/03/09 13:32:35+01:00 mr...@fo... +6 -0
# =
# ChangeSet
# 2005/03/09 13:32:35+01:00 mr...@fo... =
# new url handler tcp:
# tcp:addr:port attempts to connect
# tcp::port listens on any interface
# tcp:addr:port?listen listens on addr only
# =
# src/tcp/tcp.c
# 2005/03/09 13:32:35+01:00 mr...@fo... +0 -0
# BitKeeper file /home/mru/src/tc2-modules/src/tcp/tcp.c
# =
# src/tcp/TC2Module
# 2005/03/09 13:32:35+01:00 mr...@fo... +0 -0
# BitKeeper file /home/mru/src/tc2-modules/src/tcp/TC2Module
# =
# TC2Package
# 2005/03/09 13:32:34+01:00 mr...@fo... +1 -0
# add tcp: url handler
# =
diff -Nru a/TC2Package b/TC2Package
--- a/TC2Package 2005-03-09 13:33:52 +01:00
+++ b/TC2Package 2005-03-09 13:33:52 +01:00
@@ -11,4 +11,5 @@
module src/perl
module src/png
module src/shell
+module src/tcp
module src/url
diff -Nru a/src/tcp/TC2Module b/src/tcp/TC2Module
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/src/tcp/TC2Module 2005-03-09 13:33:52 +01:00
@@ -0,0 +1,6 @@
+module tcp
+name "TC2/URL/tcp"
+version 0.1.0
+tc2version 0.6.0
+implement "URL/tcp" "open" tcp_open
+sources tcp.c
diff -Nru a/src/tcp/tcp.c b/src/tcp/tcp.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/src/tcp/tcp.c 2005-03-09 13:33:52 +01:00
@@ -0,0 +1,211 @@
+/**
+ Copyright (C) 2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use, copy,
+ modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+**/
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <tctypes.h>
+#include <tcstring.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <errno.h>
+#include <tcalloc.h>
+#include <tcp_tc2.h>
+
+typedef struct tcp_stream {
+ int socket;
+ uint64_t pos;
+} tcp_stream_t;
+
+extern int
+tcp_read(void *buf, size_t size, size_t count, url_t *u)
+{
+ tcp_stream_t *tcp =3D u->private;
+ size_t s =3D size * count;
+ ssize_t r;
+
+ r =3D read(tcp->socket, buf, s);
+ if(r < 0)
+ return -1;
+
+ tcp->pos +=3D r;
+
+ return r / size;
+}
+
+extern int
+tcp_write(void *buf, size_t size, size_t count, url_t *u)
+{
+ tcp_stream_t *tcp =3D u->private;
+ int s;
+
+ s =3D write(tcp->socket, buf, size * count);
+ if(s < 0)
+ return s;
+
+ tcp->pos +=3D s;
+
+ return s / size;
+}
+
+extern int
+tcp_seek(url_t *u, int64_t offset, int how)
+{
+ return -1;
+}
+
+extern uint64_t
+tcp_tell(url_t *u)
+{
+ tcp_stream_t *tcp =3D u->private;
+ return tcp->pos;
+}
+
+extern int
+tcp_close(url_t *u)
+{
+ tcfree(u);
+ return 0;
+}
+
+static void
+tcp_free(void *p)
+{
+ url_t *u =3D p;
+ tcp_stream_t *tcp =3D u->private;
+ close(tcp->socket);
+}
+
+extern url_t *
+tcp_open(char *url, char *mode)
+{
+ struct sockaddr_in sa;
+ struct hostent *hn;
+ tcp_stream_t *tcp;
+ uint32_t addr;
+ char *host;
+ url_t *u;
+ int srv =3D 0;
+ char *pp;
+ int port;
+ int sock;
+ int i;
+
+ host =3D strdupa(url);
+
+ if(!strncmp(host, "tcp:", 4))
+ host +=3D 4;
+
+ while(*host =3D=3D '/')
+ host++;
+
+ if(!(pp =3D strchr(host, ':')))
+ return NULL;
+
+ *pp++ =3D 0;
+ port =3D strtol(pp, &pp, 0);
+
+ if(*pp++ =3D=3D '?'){
+ while(pp && *pp){
+ char *np =3D strchr(pp, '&');
+ char *v =3D strchr(pp, '=3D');
+ if(np)
+ *np++ =3D 0;
+ if(v)
+ *v++ =3D 0;
+ if(!strcmp(pp, "listen"))
+ srv =3D 1;
+ pp =3D np;
+ }
+ }
+
+ if(*host){
+ if(!(hn =3D gethostbyname(host)))
+ return NULL;
+ addr =3D *(uint32_t *) hn->h_addr;
+ } else {
+ addr =3D htonl(INADDR_ANY);
+ srv =3D 1;
+ }
+
+ if((sock =3D socket(PF_INET, SOCK_STREAM, 0)) < 0)
+ return NULL;
+
+ i =3D 1;
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
+
+ sa.sin_family =3D AF_INET;
+ sa.sin_port =3D htons(port);
+ sa.sin_addr.s_addr =3D addr;
+
+ if(!srv){
+ if(connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0){
+ tc2_print("TCP", TC2_PRINT_VERBOSE, "connect(%s:%i): %s\n",
+ host, port, strerror(errno));
+ goto err;
+ }
+ } else {
+ int asock;
+
+ if(bind(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0){
+ tc2_print("TCP", TC2_PRINT_VERBOSE, "bind(%s:%i): %s\n",
+ host, port, strerror(errno));
+ goto err;
+ }
+ if(listen(sock, 4) < 0){
+ tc2_print("TCP", TC2_PRINT_VERBOSE, "listen(%s:%i): %s\n",
+ host, port, strerror(errno));
+ goto err;
+ }
+
+ asock =3D accept(sock, (struct sockaddr *) &sa, &i);
+ if(asock < 0){
+ tc2_print("TCP", TC2_PRINT_VERBOSE, "accept(%s:%i): %s\n",
+ host, port, strerror(errno));
+ goto err;
+ }
+
+ close(sock);
+ sock =3D asock;
+ }
+
+ tcp =3D calloc(1, sizeof(*tcp));
+ tcp->socket =3D sock;
+
+ u =3D tcallocdz(sizeof(*u), NULL, tcp_free);
+ if(*mode =3D=3D 'r' || mode[1] =3D=3D '+')
+ u->read =3D tcp_read;
+ if(*mode =3D=3D 'w' || mode[1] =3D=3D '+')
+ u->write =3D tcp_write;
+ u->seek =3D tcp_seek;
+ u->tell =3D tcp_tell;
+ u->close =3D tcp_close;
+ u->private =3D tcp;
+
+ return u;
+
+err:
+ close(sock);
+ return NULL;
+}
|
|
From: <mr...@mr...> - 2005-03-09 11:08:56
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/03/09 12:08:29+01:00 mr...@fo... =
# file: create missing directories in path
# =
# src/file/file.c
# 2005/03/09 12:08:29+01:00 mr...@fo... +22 -6
# create missing directories in path
# =
# src/file/TC2Module
# 2005/03/09 12:08:29+01:00 mr...@fo... +2 -0
# option create_dirs
# =
diff -Nru a/src/file/TC2Module b/src/file/TC2Module
--- a/src/file/TC2Module 2005-03-09 12:08:46 +01:00
+++ b/src/file/TC2Module 2005-03-09 12:08:47 +01:00
@@ -13,3 +13,5 @@
implement "URL/dir" "read" dir_read
implement "URL/dir" "seek" dir_seek
implement "URL/dir" "close" dir_close
+
+option create_dirs%i=3D0
diff -Nru a/src/file/file.c b/src/file/file.c
--- a/src/file/file.c 2005-03-09 12:08:46 +01:00
+++ b/src/file/file.c 2005-03-09 12:08:46 +01:00
@@ -1,5 +1,5 @@
/**
- Copyright (C) 2003 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+ Copyright (C) 2003-2005 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
=
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -28,9 +28,11 @@
#include <stdio.h>
#include <unistd.h>
#include <alloca.h>
+#include <errno.h>
#include <tctypes.h>
#include <tcstring.h>
#include <tcalloc.h>
+#include <tcdirent.h>
#include <sys/stat.h>
#include <file_tc2.h>
=
@@ -87,8 +89,20 @@
url +=3D 5;
=
if(stat64(url, &st)){
- if(*mode =3D=3D 'r')
+ char *d, *e;
+
+ if(*mode =3D=3D 'r' && mode[1] !=3D '+')
+ return NULL;
+ if(errno !=3D ENOENT || !tc2_url_file_conf_create_dirs)
return NULL;
+
+ d =3D strdup(url);
+ e =3D strrchr(d, '/');
+ if(e > d){
+ *e =3D 0;
+ tcmkpath(d, 0777);
+ }
+ free(d);
} else if(S_ISDIR(st.st_mode)){
return dir_open(url, mode);
}
@@ -97,16 +111,18 @@
return NULL;
=
u =3D tcallocdz(sizeof(*u), NULL, file_free);
- if(strchr(mode, 'r'))
+ if(*mode =3D=3D 'r' || mode[1] =3D=3D '+'){
u->read =3D file_read;
- if(strchr(mode, 'w'))
+ u->size =3D st.st_size;
+ }
+ if(*mode =3D=3D 'w' || *mode =3D=3D 'a' || mode[1] =3D=3D '+'){
u->write =3D file_write;
+ u->size =3D 0;
+ }
u->seek =3D file_seek;
u->tell =3D file_tell;
u->close =3D file_close;
u->private =3D f;
-
- u->size =3D st.st_size;
=
return u;
}
|
|
From: <mr...@mr...> - 2004-12-17 14:20:43
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/17 15:20:18+01:00 mr...@fo... =
# tc2make: fix auto-inherit
# =
# tools/tc2make
# 2004/12/17 15:20:18+01:00 mr...@fo... +20 -6
# fix auto-inherit
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2004-12-17 15:20:33 +01:00
+++ b/tools/tc2make 2004-12-17 15:20:33 +01:00
@@ -699,10 +699,6 @@
}
}
=
- if(!$ifd and $if =3D~ /(.*)\//){
- $ifd =3D find_if($1);
- }
-
return $ifd;
}
=
@@ -717,12 +713,30 @@
my($ifd, %syms, $inc, @inh);
my($ifh, $hh);
my(@preinc, @inc, @postinc);
+ my $if;
=
return $hints{$int} if exists $hints{$int};
=
- $ifd =3D find_if $int or die "Interface $int not found.\n";
+ $ifd =3D find_if $int;
+
+ if($ifd){
+ $if =3D parse_interface $int, $ifd;
+ } else {
+ my $iif =3D $int;
+ my $iifd;
+
+ while($iif =3D~ /(.*)\//){
+ $iif =3D $1;
+ $iifd =3D find_if($iif) and last;
+ }
+ if($iifd){
+ my %int =3D (inherit =3D> [$iif]);
+ $if =3D \%int;
+ } else {
+ die "Interface $int not found.\n";
+ }
+ }
=
- my $if =3D parse_interface $int, $ifd;
=
%syms =3D %{$$if{'symbols'}} if $$if{'symbols'};
$hints{$int} =3D \%syms;
|
|
From: <mr...@mr...> - 2004-12-16 18:46:56
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/16 19:46:29+01:00 mr...@fo... =
# tc2make: auto-inherit interfaces
# if foo/bar.tc2 is not found, use foo.tc2
# =
# BitKeeper/etc/logging_ok
# 2004/12/16 19:46:29+01:00 mr...@fo... +1 -0
# Logging to lo...@op... accepted
# =
# tools/tc2make
# 2004/12/16 19:46:26+01:00 mr...@fo... +8 -4
# auto-inherit interfaces
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2004-12-16 19:46:46 +01:00
+++ b/tools/tc2make 2004-12-16 19:46:46 +01:00
@@ -348,10 +348,10 @@
}
=
# libtc conf format specifiers
-my %conftypes =3D ('i' =3D> 'int',
- 'd' =3D> 'int',
- 'li' =3D> 'long',
- 'ld' =3D> 'long',
+my %conftypes =3D ('i' =3D> 'int32_t',
+ 'd' =3D> 'int32_t',
+ 'li' =3D> 'int64_t',
+ 'ld' =3D> 'int64_t',
'f' =3D> 'float',
'lf' =3D> 'double',
's' =3D> 'char *');
@@ -697,6 +697,10 @@
$ifd =3D $n;
last;
}
+ }
+
+ if(!$ifd and $if =3D~ /(.*)\//){
+ $ifd =3D find_if($1);
}
=
return $ifd;
|
|
From: <mr...@mr...> - 2004-12-12 14:03:06
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/12 15:02:32+01:00 mr...@fo... =
# udp: shorthand for 0.0.0.0
# =
# BitKeeper/etc/logging_ok
# 2004/12/12 15:02:32+01:00 mr...@fo... +1 -0
# Logging to lo...@op... accepted
# =
# src/multicast/mc.c
# 2004/12/12 15:02:28+01:00 mr...@fo... +7 -3
# empty hostname as INADDR_ANY
# =
diff -Nru a/src/multicast/mc.c b/src/multicast/mc.c
--- a/src/multicast/mc.c 2004-12-12 15:02:59 +01:00
+++ b/src/multicast/mc.c 2004-12-12 15:02:59 +01:00
@@ -139,8 +139,13 @@
}
}
=
- if(!(hn =3D gethostbyname(url)))
- return NULL;
+ if(*url){
+ if(!(hn =3D gethostbyname(url)))
+ return NULL;
+ addr =3D *(uint32_t *) hn->h_addr;
+ } else {
+ addr =3D htonl(INADDR_ANY);
+ }
=
if((sock =3D socket(PF_INET, SOCK_DGRAM, 0)) < 0)
return NULL;
@@ -151,7 +156,6 @@
sa.sin_family =3D AF_INET;
sa.sin_port =3D htons(port);
=
- addr =3D *(uint32_t *) hn->h_addr;
if(IN_MULTICAST(ntohl(addr))){
struct ip_mreq mrq;
uint32_t ifaddr =3D htonl(INADDR_ANY);
|
|
From: <mr...@mr...> - 2004-10-07 19:03:26
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/07 20:58:49+02:00 mru@ford.(none) =
# image: plug leak
# =
# BitKeeper/etc/logging_ok
# 2004/10/07 20:58:49+02:00 mru@ford.(none) +1 -0
# Logging to lo...@op... accepted
# =
# src/image/image.c
# 2004/10/07 20:58:47+02:00 mru@ford.(none) +2 -0
# fix leak
# =
diff -Nru a/src/image/image.c b/src/image/image.c
--- a/src/image/image.c 2004-10-07 21:03:15 +02:00
+++ b/src/image/image.c 2004-10-07 21:03:15 +02:00
@@ -72,6 +72,8 @@
if(!(iread =3D tc2_get_symbol(m, "read")))
return NULL;
=
+ free(m);
+
return iread(u, params);
}
=
|
|
From: <mr...@mr...> - 2004-08-25 12:46:26
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/25 14:46:01+02:00 mr...@fo... =
# udp: allow selection of interface for multicast
# =
# src/multicast/mc.c
# 2004/08/25 14:46:00+02:00 mr...@fo... +30 -2
# select interface for multicast using ?if=3Daddr syntax
# =
diff -Nru a/src/multicast/mc.c b/src/multicast/mc.c
--- a/src/multicast/mc.c 2004-08-25 14:46:16 +02:00
+++ b/src/multicast/mc.c 2004-08-25 14:46:16 +02:00
@@ -103,6 +103,7 @@
mc_stream_t *mcs;
uint32_t addr;
url_t *u;
+ char *iface =3D NULL;
char *pp;
int port;
int sock;
@@ -122,7 +123,21 @@
return NULL;
=
*pp++ =3D 0;
- port =3D strtol(pp, NULL, 0);
+ port =3D strtol(pp, &pp, 0);
+
+ if(*pp++ =3D=3D '?'){
+ while(pp && *pp){
+ char *np =3D strchr(pp, '&');
+ char *v =3D strchr(pp, '=3D');
+ if(np)
+ *np++ =3D 0;
+ if(v)
+ *v++ =3D 0;
+ if(!strcmp(pp, "if"))
+ iface =3D v;
+ pp =3D np;
+ }
+ }
=
if(!(hn =3D gethostbyname(url)))
return NULL;
@@ -139,8 +154,21 @@
addr =3D *(uint32_t *) hn->h_addr;
if(IN_MULTICAST(ntohl(addr))){
struct ip_mreq mrq;
+ uint32_t ifaddr =3D htonl(INADDR_ANY);
+
+ if(iface){
+ hn =3D gethostbyname(iface);
+ if(hn){
+ ifaddr =3D *(uint32_t *) hn->h_addr;
+ tc2_print("UDP", TC2_PRINT_DEBUG, "using interface %s\n",
+ iface);
+ } else {
+ tc2_print("UDP", TC2_PRINT_WARNING, "bad interface address\n");
+ }
+ }
+
mrq.imr_multiaddr.s_addr =3D addr;
- mrq.imr_interface.s_addr =3D htonl(INADDR_ANY);
+ mrq.imr_interface.s_addr =3D ifaddr;
if(setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mrq,
sizeof(mrq)) < 0)
return NULL;
|
|
From: <mr...@mr...> - 2004-08-19 13:18:04
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/19 15:17:42+02:00 mr...@fo... =
# new function tc2_printv()
# =
# kernel/print.c
# 2004/08/19 15:17:41+02:00 mr...@fo... +11 -4
# add tc2_printv()
# =
# include/tc2.h
# 2004/08/19 15:17:41+02:00 mr...@fo... +1 -0
# add tc2_printv()
# =
diff -Nru a/include/tc2.h b/include/tc2.h
--- a/include/tc2.h 2004-08-19 15:17:52 +02:00
+++ b/include/tc2.h 2004-08-19 15:17:52 +02:00
@@ -95,6 +95,7 @@
extern int tc2_free(void);
=
extern int tc2_print(char *tag, int level, const char *, ...);
+extern int tc2_printv(char *tag, int level, const char *fmt, va_list args);
=
#define TC2_PRINT_ERROR 0
#define TC2_PRINT_WARNING 1
diff -Nru a/kernel/print.c b/kernel/print.c
--- a/kernel/print.c 2004-08-19 15:17:52 +02:00
+++ b/kernel/print.c 2004-08-19 15:17:52 +02:00
@@ -95,11 +95,9 @@
}
=
extern int
-tc2_print(char *tag, int lv, const char *fmt, ...)
+tc2_printv(char *tag, int lv, const char *fmt, va_list args)
{
- va_list args;
tc2_logtag_t *lt;
- int ret;
=
if(lv > MAX_LEVEL)
lv =3D MAX_LEVEL;
@@ -125,8 +123,17 @@
if(!lt->levels[lv].print)
return 0;
=
+ return lt->levels[lv].print(tag, lv, fmt, args);
+}
+
+extern int
+tc2_print(char *tag, int lv, const char *fmt, ...)
+{
+ va_list args;
+ int ret;
+
va_start(args, fmt);
- ret =3D lt->levels[lv].print(tag, lv, fmt, args);
+ ret =3D tc2_printv(tag, lv, fmt, args);
va_end(args);
=
return ret;
|
|
From: <mr...@mr...> - 2004-08-10 00:48:01
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 02:47:38+02:00 mr...@fo... =
# simplify udp reading
# users must now read entire udp packets
# =
# src/multicast/mc.c
# 2004/08/10 02:47:37+02:00 mr...@fo... +32 -63
# remove buffering
# =
# src/multicast/TC2Module
# 2004/08/10 02:47:36+02:00 mr...@fo... +0 -1
# remove option buffer_size
# =
diff -Nru a/src/multicast/TC2Module b/src/multicast/TC2Module
--- a/src/multicast/TC2Module 2004-08-10 02:47:51 +02:00
+++ b/src/multicast/TC2Module 2004-08-10 02:47:51 +02:00
@@ -9,4 +9,3 @@
implement "URL/multicast" "close" mc_close
implement "URL/udp" "open" mc_open
sources mc.c
-option buffer_size%i=3D65536
diff -Nru a/src/multicast/mc.c b/src/multicast/mc.c
--- a/src/multicast/mc.c 2004-08-10 02:47:51 +02:00
+++ b/src/multicast/mc.c 2004-08-10 02:47:51 +02:00
@@ -1,3 +1,27 @@
+/**
+ Copyright (C) 2003-2004 Michael Ahlberg, M=C3=A5ns Rullg=C3=A5rd
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use, copy,
+ modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+**/
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -9,53 +33,26 @@
#include <tcalloc.h>
#include <udp_tc2.h>
=
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)>(b)?(a):(b))
-
-#define buffer_size tc2_url_udp_conf_buffer_size
-
typedef struct mc_stream {
int socket;
struct sockaddr_in addr;
uint64_t pos;
- char *buf;
- int bpos, bsize;
} mc_stream_t;
=
extern int
mc_read(void *buf, size_t size, size_t count, url_t *u)
{
mc_stream_t *mcs =3D u->private;
- int s =3D size * count;
+ size_t s =3D size * count;
+ ssize_t r;
=
- while(s){
- int ss;
+ r =3D read(mcs->socket, buf, s);
+ if(r < 0)
+ return -1;
=
- if(mcs->bsize =3D=3D 0){
- struct sockaddr a;
- int r, l =3D sizeof(a);
- mcs->bpos =3D 0;
- r =3D recvfrom(mcs->socket, mcs->buf, 65536, 0, &a, &l);
- if(r < 0)
- break;
- mcs->bsize +=3D r;
- }
-
- ss =3D min(s, mcs->bsize);
- ss =3D min(ss, buffer_size - mcs->bpos);
- memcpy(buf, mcs->buf + mcs->bpos, ss);
- buf +=3D ss;
- mcs->bpos +=3D ss;
- mcs->bsize -=3D ss;
- mcs->pos +=3D ss;
- s -=3D ss;
+ mcs->pos +=3D r;
=
- if(mcs->bpos =3D=3D buffer_size)
- mcs->bpos =3D 0;
- }
-
- s =3D size * count - s;
- return s / size;
+ return r / size;
}
=
extern int
@@ -77,32 +74,7 @@
extern int
mc_seek(url_t *u, int64_t offset, int how)
{
- mc_stream_t *mcs =3D u->private;
- uint64_t p, dp;
-
- switch(how){
- case SEEK_SET:
- p =3D offset;
- break;
- case SEEK_CUR:
- p =3D mcs->pos + offset;
- break;
- default:
- return -1;
- }
-
- dp =3D p - mcs->pos;
-
- if(dp > mcs->bsize)
- return -1;
-
- if(dp < - mcs->bpos)
- return -1;
-
- mcs->bpos +=3D dp;
- mcs->bsize -=3D dp;
-
- return 0;
+ return -1;
}
=
extern uint64_t
@@ -118,7 +90,6 @@
mc_stream_t *mcs =3D u->private;
=
close(mcs->socket);
- free(mcs->buf);
tcfree(u);
=
return 0;
@@ -190,8 +161,6 @@
mcs =3D calloc(1, sizeof(*mcs));
mcs->socket =3D sock;
mcs->addr =3D sa;
-
- mcs->buf =3D malloc(max(buffer_size, 65536));
=
u =3D tcallocz(sizeof(*u));
if(strchr(mode, 'r'))
|
|
From: <mi...@mr...> - 2004-07-28 18:23:20
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/06/10 23:50:43+02:00 mr...@fo... =
# find interfaces more easily
# packages installed with the same prefix should not require TC2_INTERFACE_PATH
# =
# tools/tc2make
# 2004/06/10 23:50:43+02:00 mr...@fo... +1 -0
# search for interfaces in all promising directories with our prefix
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2004-07-28 20:23:13 +02:00
+++ b/tools/tc2make 2004-07-28 20:23:13 +02:00
@@ -65,6 +65,7 @@
=
push @ifpath, split (/:/, $ENV{TC2_INTERFACE_PATH}), $options{srcdir};
push @ifpath, "$prefix/share/tc2/interfaces";
+push @ifpath, grep -d, glob "$prefix/share/*/interfaces";
=
my @dirs;
my $package;
|
|
From: <mi...@mr...> - 2004-07-28 18:23:20
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/06/10 23:48:58+02:00 mr...@fo... =
# plug minor memory leak
# =
# kernel/print.c
# 2004/06/10 23:48:57+02:00 mr...@fo... +3 -1
# free memory associated with the default logger
# =
diff -Nru a/kernel/print.c b/kernel/print.c
--- a/kernel/print.c 2004-07-28 20:23:12 +02:00
+++ b/kernel/print.c 2004-07-28 20:23:12 +02:00
@@ -179,7 +179,8 @@
free(l->levels[i].name);
free(l->levels);
}
- free(l);
+ if(l !=3D &tag_default)
+ free(l);
}
=
extern void
@@ -187,6 +188,7 @@
{
tchash_destroy(tags, free_tag);
tchash_destroy(loggers, NULL);
+ free_tag(&tag_default);
}
=
extern void
|
|
From: <mr...@mr...> - 2004-06-10 22:14:35
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/06/10 23:50:43+02:00 mr...@fo... =
# find interfaces more easily
# packages installed with the same prefix should not require TC2_INTERFACE_PATH
# =
# tools/tc2make
# 2004/06/10 23:50:43+02:00 mr...@fo... +1 -0
# search for interfaces in all promising directories with our prefix
# =
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make 2004-06-11 00:14:24 +02:00
+++ b/tools/tc2make 2004-06-11 00:14:24 +02:00
@@ -65,6 +65,7 @@
=
push @ifpath, split (/:/, $ENV{TC2_INTERFACE_PATH}), $options{srcdir};
push @ifpath, "$prefix/share/tc2/interfaces";
+push @ifpath, grep -d, glob "$prefix/share/*/interfaces";
=
my @dirs;
my $package;
|
|
From: <mr...@mr...> - 2004-06-10 22:14:33
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/06/10 23:48:58+02:00 mr...@fo... =
# plug minor memory leak
# =
# kernel/print.c
# 2004/06/10 23:48:57+02:00 mr...@fo... +3 -1
# free memory associated with the default logger
# =
diff -Nru a/kernel/print.c b/kernel/print.c
--- a/kernel/print.c 2004-06-11 00:14:24 +02:00
+++ b/kernel/print.c 2004-06-11 00:14:24 +02:00
@@ -179,7 +179,8 @@
free(l->levels[i].name);
free(l->levels);
}
- free(l);
+ if(l !=3D &tag_default)
+ free(l);
}
=
extern void
@@ -187,6 +188,7 @@
{
tchash_destroy(tags, free_tag);
tchash_destroy(loggers, NULL);
+ free_tag(&tag_default);
}
=
extern void
|
|
From: <mr...@mr...> - 2004-06-04 23:28:44
|
# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/06/05 01:27:39+02:00 mr...@fo... = # image: add -lz for to linker flags # apparently some broken distributions have miscompiled libmagic so this # is required here # = # src/image/configure.ac.in # 2004/06/05 01:27:39+02:00 mr...@fo... +1 -1 # add -lz to linker flags # = diff -Nru a/src/image/configure.ac.in b/src/image/configure.ac.in --- a/src/image/configure.ac.in Sat Jun 5 01:28:34 2004 +++ b/src/image/configure.ac.in Sat Jun 5 01:28:34 2004 @@ -1,2 +1,2 @@ -TC2_CHECK_LIB(file, magic, magic_open,, magic.h) +TC2_CHECK_LIB(file, magic, magic_open, -lz, magic.h) TC2_ENABLE_MODULE |
|
From: <mr...@mr...> - 2004-05-15 22:48:34
|
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/05/15 12:56:09+02:00 mr...@fo... =
# fix pretty-printing in generated makefiles
# compatibility fix in generated C code
# =
# tools/tc2make
# 2004/05/15 12:56:08+02:00 mr...@fo... +29 -11
# pretty-printing in generated makefiles always works
# no mixing declarations with code in generated files
# =
# tc2.m4
# 2004/05/15 12:56:08+02:00 mr...@fo... +3 -4
# check whether depcomp will be used
# =
diff -Nru a/tc2.m4 b/tc2.m4
--- a/tc2.m4 Sun May 16 00:48:25 2004
+++ b/tc2.m4 Sun May 16 00:48:25 2004
@@ -48,10 +48,9 @@
AC_ERROR(TC2 not found.)
fi
AC_SUBST([TC2MAKE_FLAGS],["-I\$(top_srcdir)/interfaces -I$ac_aux_dir/interfaces"])
-AC_ARG_ENABLE([verbose], [AC_HELP_STRING([--enable-verbose],[verbose build])],
- [silent=3Dno],
- [silent=3Dyes])
-AM_CONDITIONAL([silent], [test $silent =3D yes])
+
+AM_CONDITIONAL(nodepcomp, test x$AMDEP_TRUE$am__fastdepCC_FALSE !=3D x)
+
patch -N <<\END
--- libtool~ Sat Jan 17 04:16:27 2004
+++ libtool Sat Jan 17 04:23:37 2004
diff -Nru a/tools/tc2make b/tools/tc2make
--- a/tools/tc2make Sun May 16 00:48:25 2004
+++ b/tools/tc2make Sun May 16 00:48:25 2004
@@ -360,6 +360,7 @@
my($fh, $what) =3D @_;
my $lsec;
=
+ print $fh " {\n" if $what eq 'get' or $what eq 'free';
if(grep $$_[1] =3D~ /\*/, @confs){
print $fh <<END_C if $what eq 'get';
void *cfs;
@@ -513,6 +514,7 @@
print $fh qq/ tcfree(sec);\n/;
print $fh qq/ }\n/;
}
+ print $fh " }\n" if $what eq 'get' or $what eq 'free';
}
=
# Generate a C file containing module information and init/shutdown
@@ -1054,16 +1056,34 @@
$extradist .=3D " Makefile.am.in" if exist_scm "Makefile.am.in";
my @interfaces =3D find_interfaces '.';
=
+ print AM <<'END_MAKEFILE';
+INSTALL_SCRIPT =3D echo " INSTALL $$p" && true " >/dev/null " && @INSTALL_SCRIPT@
+INSTALL_DATA =3D echo " INSTALL $$p" && true " >/dev/null " && @INSTALL_DATA@
+install_sh_DATA =3D echo " INSTALL $$p" && true " >/dev/null " && $(install_sh) -c -m 644
+TC2MAKE =3D echo ' TC2MAKE $@' && @TC2MAKE@ --quiet
+
+if nodepcomp
+TC2DEPCOMP =3D $(SHELL) $(top_srcdir)/depcomp
+TC2LIBTOOL =3D case $@ in \
+ *.o|*.lo) echo " CC $<";; \
+ install*) echo " INSTALL $$p";; \
+ esac; true " >/dev/null " && @LIBTOOL@ --quiet
+else
+TC2DEPCOMP =3D $(SHELL) -c 'echo " CC $<" && $(SHELL) $(top_srcdir)/depcomp "$$@"' depcomp
+TC2LIBTOOL =3D @LIBTOOL@ --quiet
+endif
+
+depcomp =3D $(TC2DEPCOMP)
+LINK =3D echo ' LD $@' && $(LIBTOOL) --mode=3Dlink $(CCLD) $(AM_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LIBTOOL =3D $(TC2LIBTOOL)
+
+TCCONF =3D $(PACKAGE).conf
+TC2MAKE_CMD =3D $(TC2MAKE) $(TC2MAKE_FLAGS) --top-srcdir=3D$(top_srcdir)
+CLEANFILES =3D $(BUILT_SOURCES) $(TCCONF)
+END_MAKEFILE
+
print AM <<END_MAKEFILE;
-INSTALL_SCRIPT =3D echo " INSTALL \$\$p" && true " >/dev/null " && \@INSTALL_SCRIPT@
-INSTALL_DATA =3D echo " INSTALL \$\$p" && true " >/dev/null " && \@INSTALL_DATA@
-install_sh_DATA =3D echo " INSTALL \$\$p" && true " >/dev/null " && \$(install_sh) -c -m 644
-TC2MAKE =3D echo ' TC2MAKE \$\@' && \@TC2MAKE@ --quiet
-LIBTOOL =3D case \$@ in *.lo) echo ' CC \$<';; src/*) echo ' LD \$\@';; install*) echo \" INSTALL \$\$p\";; esac; true \" >/dev/null \" && \@LIBTOOL@ --quiet
-
-TCCONF =3D \$(PACKAGE).conf
-TC2MAKE_CMD =3D \$(TC2MAKE) \$(TC2MAKE_FLAGS) --top-srcdir=3D\$(top_srcdir)
-CLEANFILES =3D \$(BUILT_SOURCES) \$(TCCONF)
EXTRA_DIST =3D $extradist
BUILT_SOURCES =3D
module_LTLIBRARIES =3D
@@ -1146,9 +1166,7 @@
\$(TC2MAKE) --top-srcdir=3D\$(top_srcdir) --package=3D\$(PACKAGE) --prefix=3D\$(prefix) --conf
=
.PHONY: \$(TCCONF)
-if silent
.SILENT:
-endif
END_MAKEFILE
cat 'Makefile.am.in', \*AM;
maybe_replace '_tc2_Makefile.am', 'Makefile.am';
|