/[pengfork]/pengfork/src/fdo/bytecode.c
ViewVC logotype

Diff of /pengfork/src/fdo/bytecode.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by chupa, Sat Feb 8 00:00:13 2003 UTC revision 1.4 by chupa, Fri May 16 15:28:44 2003 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2002-2003  Jean-Charles Salzeber <jc@varspool.net>   * Copyright (C) 2002-2003  Jean-Charles Salzeber <chupa@penggy.org>
3   *   *
4   * This file is part of penggy.   * This file is part of penggy.
5   *   *
# Line 56  Line 56 
56  #include "fdo/stream.h"  #include "fdo/stream.h"
57  #include "fdo/atoms.h"  #include "fdo/atoms.h"
58    
59    #include "log.h"
60    
61  int  int
62  fdo_lookup_atom(pid, aid, def)  fdo_lookup_atom(pid, aid, def)
63       int pid;       int pid;
# Line 77  fdo_lookup_atom(pid, aid, def) Line 79  fdo_lookup_atom(pid, aid, def)
79    return 0;    return 0;
80  }  }
81    
82  /*  
83  void  void
84  display_raw_arg(arg,length)  display_raw_arg(arg,length)
85       unsigned char *arg;       unsigned char *arg;
# Line 85  display_raw_arg(arg,length) Line 87  display_raw_arg(arg,length)
87  {  {
88    int i;    int i;
89    
90    printf("#x");    debug(9, "#x");
91    for(i=0;i<length;i++)    for(i=0;i<length;i++)
92      printf("%02x", arg[i]);      debug(9, "%02x", arg[i]);
93  }  }
94    
95  void  void
# Line 97  display_dword_arg(arg, length) Line 99  display_dword_arg(arg, length)
99  {  {
100    u_int32_t dword = 0;    u_int32_t dword = 0;
101    memcpy( ((char *)&dword) + (sizeof(dword)-length), arg, length);    memcpy( ((char *)&dword) + (sizeof(dword)-length), arg, length);
102    printf("%d", ntohl(dword));    debug(9, "%d", ntohl(dword));
103  }  }
104    
105  void  void
# Line 108  display_string_arg(arg, length) Line 110  display_string_arg(arg, length)
110    char str[length+1];    char str[length+1];
111    memcpy(str,arg,length);    memcpy(str,arg,length);
112    str[length]=0;    str[length]=0;
113    printf("\"%s\"", str);    debug(9, "\"%s\"", str);
114  }  }
115    
116  void  void
# Line 119  display_atom(atom) Line 121  display_atom(atom)
121    
122    if(fdo_lookup_atom(atom.protid, atom.atomid, &def))    if(fdo_lookup_atom(atom.protid, atom.atomid, &def))
123      {      {
124        printf("\t(%s", def->name);        debug(9, "\t(%s", def->name);
125        if(atom.arg_length > 0)        if(atom.arg_length > 0)
126          {          {
127          printf(" ");          debug(9, " ");
128          switch(def->arg)          switch(def->arg)
129            {            {
130            default:            default:
# Line 138  display_atom(atom) Line 140  display_atom(atom)
140              break;              break;
141            }            }
142          }          }
143        printf(")\n");        debug(9, ")\n");
144      }      }
145    else    else
146      {      {
147        printf("\tunknown_atom(p%d,a%d)", atom.protid, atom.atomid);        debug(9, "\tunknown_atom(p%d,a%d)", atom.protid, atom.atomid);
148        if(atom.arg_length > 0)        if(atom.arg_length > 0)
149          {          {
150          printf(" ");          debug(9, " ");
151          display_raw_arg(atom.arg, atom.arg_length);          display_raw_arg(atom.arg, atom.arg_length);
152          }          }
153        printf("\n");        debug(9, "\n");
154      }      }
155  }  }
156  */  
157    
158  void  void
159  extract_atoms(id, length, stream)  extract_atoms(id, length, stream)
# Line 167  extract_atoms(id, length, stream) Line 169  extract_atoms(id, length, stream)
169    char data;    char data;
170    fdo_stream_t *f;    fdo_stream_t *f;
171    
172      debug(9, "Atom stream (id=%d):\n", id);
173    while( nread < length )    while( nread < length )
174      {      {
175        f = get_stream(id);        f = get_stream(id);
# Line 243  extract_atoms(id, length, stream) Line 246  extract_atoms(id, length, stream)
246        atom.protid += prot_add;        atom.protid += prot_add;
247        atom.atomid += atom_add;        atom.atomid += atom_add;
248        f->last_pid = atom.protid;        f->last_pid = atom.protid;
249        if(is_eos_atom(atom.protid, atom.atomid))        /*if(is_eos_atom(atom.protid, atom.atomid))
250          close_stream(id);          close_stream(id);*/
251        /*display_atom(atom);*/        display_atom(atom);
252      }      }
253      debug(9, "\n");
254  }  }
255    
256  void  void

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26