Author: kjs
Date: Tue Jan  6 05:36:23 2009
New Revision: 35031

Modified:
   trunk/compilers/pirc/src/main.c
   trunk/compilers/pirc/src/pircompunit.c

Log:
[pirc] no tempnam() function anymore; fix this later in a proper way.
+ fix a bug: .annotate can be first statement, in which case there's no 
instruction object in place. Just take the offset from lexer->codesize, which 
keeps track of this (and from which instructions take their offset as well).

Modified: trunk/compilers/pirc/src/main.c
==============================================================================
--- trunk/compilers/pirc/src/main.c     (original)
+++ trunk/compilers/pirc/src/main.c     Tue Jan  6 05:36:23 2009
@@ -310,7 +310,7 @@
         return 0;
     }
     else {
-        hdocoutfile = tmpnam("hdoc");
+        hdocoutfile = "hdoctemp";
         file = open_file(hdocoutfile, "w");
         process_heredocs(interp, argv[0], file);
         fclose(file);

Modified: trunk/compilers/pirc/src/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/src/pircompunit.c      (original)
+++ trunk/compilers/pirc/src/pircompunit.c      Tue Jan  6 05:36:23 2009
@@ -2483,9 +2483,7 @@
 =item C<void
 annotate(lexer_state * const lexer, char const * const key, constant * const 
value)>
 
-Add a new annotation with key C<key> and value C<value>. This function assumes
-that there's an instruction in place, as it will store a pointer to the current
-instruction.
+Add a new annotation with key C<key> and value C<value>.
 
 =cut
 
@@ -2499,7 +2497,7 @@
     ++lexer->num_annotations; /* keep track of number of annotations */
 
 
-    ann->offset = CURRENT_INSTRUCTION(lexer)->offset;
+    ann->offset = lexer->codesize;
 
     /* store the annotation in a list, managed by the lexer
      * the list is circular linked, so that the order of annotations is 
preserved.

Reply via email to