[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users 01329] Re: Memory leaks revisited...
- To: Michael Banck <mbanck@gmx.net>
- Subject: [mgp-users 01329] Re: Memory leaks revisited...
- From: Jonathan Nicholson <jjn@sanger.ac.uk>
- Date: Mon, 9 Aug 2004 20:10:40 +0100 (BST)
- Cc: mgp-users@mew.org
- Delivered-to: mailing list mgp-users@mew.org
- In-reply-to: <>
- Mailing-list: contact mgp-users-help@mew.org; run by ezmlm
- References: <> <>
On Mon, 9 Aug 2004, Michael Banck wrote:
> Date: Mon, 9 Aug 2004 19:14:53 +0200
> From: Michael Banck <mbanck@gmx.net>
> To: mgp-users@mew.org
> Subject: [mgp-users 01327] Re: Memory leaks revisited...
>
> On Mon, Aug 09, 2004 at 04:33:00PM +0100, Jonathan Nicholson wrote:
> > I'm going to be using magicpoint to run a display in our reception which
> > wants to be constantly online. I've added a '-r' option (repeating demo)
> > which cycles endlessly through the provided slides,
>
> I'd be interested in such an option. Did you post your code somewhere?
> If not, could you point me/us to it?
Here's the patch, but as the code memory leaks it's a little dangerous!
Once compiled use the '-r' option in the same way as the '-d' option but
it will repeat. It'll also reload the presentation if it sees an update.
Regards,
Jonathan
diff -Naur magicpoint-1.10a.orig/mgp.c magicpoint-1.10a.jjn/mgp.c
--- magicpoint-1.10a.orig/mgp.c 2003-06-24 06:26:33.000000000 +0100
+++ magicpoint-1.10a.jjn/mgp.c 2004-08-09 14:33:34.000000000 +0100
@@ -221,7 +221,7 @@
mgpwdir = p;
}
-#define ACCEPTOPTS "Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:"
+#define ACCEPTOPTS "Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:r:"
while ((opt = getopt(argc, argv, ACCEPTOPTS)) != -1) {
#undef ACCEPTOPTS
switch (opt) {
@@ -229,6 +229,11 @@
mgp_flag |= FL_BIMAGE;
break;
+ case 'r':
+ mgp_flag |= FL_DEMO | FL_CONTDEMO;
+ if (isdigit(optarg[0])) demointerval = atoi(optarg);
+ else optind--;
+ break;
case 'd':
mgp_flag |= FL_DEMO;
if (isdigit(optarg[0])) demointerval = atoi(optarg);
@@ -424,16 +429,32 @@
genhtml(start_page);
else if (mgp_flag & FL_DEMO) {
struct render_state state;
+ int real_start_page;
+
+ real_start_page = start_page;
memset(&state, 0, sizeof(struct render_state));
state.target = window; /*XXX*/
state.width = window_width;
state.height = window_height;
- while (start_page <= maxpage) {
- state_goto(&state, start_page, 0);
- draw_page(&state, NULL);
- start_page++;
- sleep(demointerval); /*XXX*/
+ while(1) {
+ while (start_page <= maxpage) {
+ state_goto(&state, start_page, 0);
+ draw_page(&state, NULL);
+ start_page++;
+ sleep(demointerval); /*XXX*/
+ }
+ start_page = real_start_page;
+ if (mgp_flag & FL_CONTDEMO) {
+ if(wantreload()) {
+ draw_reinit(&state);
+ cleanup_file();
+ load_file(mgp_fname);
+ }
+ }
+ else {
+ break;
+ }
}
} else {
init_win3();
diff -Naur magicpoint-1.10a.orig/mgp.h magicpoint-1.10a.jjn/mgp.h
--- magicpoint-1.10a.orig/mgp.h 2003-06-06 08:18:25.000000000 +0100
+++ magicpoint-1.10a.jjn/mgp.h 2004-08-09 14:36:10.000000000 +0100
@@ -178,7 +178,7 @@
#define FL_GLYPHEDGE 0x4000
#define FL_FRDCACHE 0x8000
#define FL_NOXFT 0x10000
-
+#define FL_CONTDEMO 0x20000
/* page attribute flags */
#define PGFLAG_NODEF 0x01 /* nodefault */
>
>
> thanks,
>
> Michael
>
>
>
!---------------------------------------------------------------------------
= Jonathan Nicholson - Team Leader : System Support "Special Projects" =
= The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs, CB10 1SA =
= Email: jjn@sanger.ac.uk -=- Tel: 01223 834244 x4987 -=- Fax: 01223 494919 =
----------------------------------------------------------------------------