[49] | 1 | #include "seq.hpp" |
---|
| 2 | #include "macs.hpp" |
---|
| 3 | #include "parse.hpp" |
---|
| 4 | #include "lisp.hpp" |
---|
| 5 | |
---|
| 6 | int sequence::size() |
---|
| 7 | { |
---|
| 8 | int t=0; |
---|
| 9 | for (int i=0;i<total;i++) |
---|
| 10 | { |
---|
| 11 | if (cash.loaded(seq[i])) |
---|
| 12 | t+=cash.fig(seq[i])->size(); |
---|
| 13 | } |
---|
| 14 | return t; |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | int sequence::cache_in() |
---|
| 18 | { |
---|
| 19 | int i; |
---|
| 20 | for (i=0;i<total;i++) |
---|
| 21 | { |
---|
| 22 | cash.note_need(seq[i]); |
---|
| 23 | } |
---|
| 24 | return 1; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | sequence::sequence(char *filename, void *pict_list, void *advance_list) |
---|
| 28 | { |
---|
| 29 | if (item_type(pict_list)==L_STRING) |
---|
| 30 | total=1; |
---|
| 31 | else |
---|
| 32 | total=list_length(pict_list); |
---|
| 33 | |
---|
| 34 | seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array"); |
---|
| 35 | if (item_type(pict_list)==L_STRING) |
---|
| 36 | seq[0]=cash.reg_object(filename,pict_list,SPEC_CHARACTER2,1); |
---|
| 37 | else |
---|
| 38 | { |
---|
| 39 | int i; |
---|
| 40 | for (i=0;i<total;i++) |
---|
| 41 | { |
---|
| 42 | seq[i]=cash.reg_object(filename,lcar(pict_list),SPEC_CHARACTER2,1); |
---|
| 43 | pict_list=lcdr(pict_list); |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | sequence::~sequence() |
---|
| 49 | { |
---|
| 50 | jfree(seq); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | /*sequence::sequence(char *filename, char *picts) |
---|
| 54 | { |
---|
| 55 | char t[100],*s=picts,imname[100]; |
---|
| 56 | int i,j; |
---|
| 57 | total=0; |
---|
| 58 | |
---|
| 59 | // first count the images |
---|
| 60 | while (token_type(s)!=sRIGHT_PAREN) |
---|
| 61 | { |
---|
| 62 | if (token_type(s)==sLEFT_PAREN) |
---|
| 63 | { |
---|
| 64 | get_token(s,t); // left paren |
---|
| 65 | get_token(s,t); // seq |
---|
| 66 | get_token(s,t); // name |
---|
| 67 | i=get_number(s); |
---|
| 68 | total+=get_number(s)-i+1; |
---|
| 69 | get_token(s,t); // right paren |
---|
| 70 | } |
---|
| 71 | else |
---|
| 72 | { get_token(s,t); |
---|
| 73 | total++; |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | s=picts; |
---|
| 79 | seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array"); |
---|
| 80 | |
---|
| 81 | for (i=0;i<total;) |
---|
| 82 | { |
---|
| 83 | if (get_token(s,t)==sLEFT_PAREN) |
---|
| 84 | { |
---|
| 85 | get_token(s,t); // left paren |
---|
| 86 | if (strcmp(t,"seq")) |
---|
| 87 | { |
---|
| 88 | dprintf("Expected seq at %s\n",s); |
---|
| 89 | exit(0); |
---|
| 90 | } |
---|
| 91 | get_token(s,t); |
---|
| 92 | int start,end; |
---|
| 93 | start=get_number(s); |
---|
| 94 | end=get_number(s); |
---|
| 95 | for (j=start;j<=end;j++) |
---|
| 96 | { |
---|
| 97 | sprintf(imname,"%s%04d.pcx",t,j); |
---|
| 98 | seq[i++]=cash.reg(filename,imname,SPEC_CHARACTER,1); |
---|
| 99 | } |
---|
| 100 | get_token(s,t); // right paren |
---|
| 101 | } |
---|
| 102 | else |
---|
| 103 | seq[i++]=cash.reg(filename,t,SPEC_CHARACTER,1); |
---|
| 104 | } |
---|
| 105 | }*/ |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | |
---|