Changeset 2707


Ignore:
Timestamp:
Apr 18, 2007, 12:23:09 AM (14 years ago)
Author:
yura
Message:
Location:
to-imperative/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/compiler/Makefile.bat

    r2693 r2707  
    22set JAVA_BIN=C:\Progra~1\Java\jdk1.5.0_11\bin
    33del *.java *.class
    4 start /b /wait /belownormal java -Xss10000000 -classpath ..\java;C:\Progra~1\Java\asm-3.0\lib\asm-3.0.jar org.refal.plus.compiler.rfpc -B ..\lib -I ..\java -I . -java *.rf
    5 start /b /wait /belownormal %JAVA_BIN%\javac -classpath ..\java *.java
     4start /b /wait /belownormal java -Xss10000000 -classpath ..\java;C:\Progra~1\Java\asm-3.0\lib\asm-3.0.jar org.refal.plus.compiler.rfpc -I . -java *.rf
     5start /b /wait /belownormal %JAVA_BIN%\javac -classpath .;..\java *.java
  • to-imperative/trunk/compiler/rfp_src.rf

    r2674 r2707  
    66$use "org.refal.plus.wrappers.java.io.BufferedReader";
    77$use "org.refal.plus.wrappers.java.io.InputStreamReader";
     8$use "org.refal.plus.wrappers.java.lang.ClassLoader";
    89$use "org.refal.plus.wrappers.org.refal.plus.comp.CompilerEnvironment";
    9 $use "org.refal.plus.wrappers.java.lang.ClassLoader";
     10$use "org.refal.plus.wrappers.org.refal.plus.comp.FormatReader.";
    1011
    1112$func  Arg_GetImplementationReader t.fileId = (e.qname) (e.inter_reader) (e.implem_reader) ;
     
    2223  s.srctype :
    2324  {
    24     FILE = e.src : s.channel, {
    25       <IsChannel s.channel> = <CloseChannel s.channel>;
    26       <BRclose s.channel>;
     25    FILE = e.src : {
     26      s.channel, {
     27        <IsChannel s.channel> = <CloseChannel s.channel>;
     28        <BRclose s.channel>;
     29      };
     30      /*empty*/;
    2731    };
    2832    STDIN = ;
     
    4549$func? Get_Line_From_File e.source = e.line ;
    4650$func? Get_Line_From_Reader s.reader = e.line;
    47 
     51$func? ReadFormatsFromBox e = e.line;
    4852
    4953RFP_Src_InitFromArgs e.files =
     
    7276  (e.qname) (e.inter_reader) (e.implem_reader);
    7377
     78$box FormatsFromClass;
     79
    7480Arg_GetInterfaceReader e.qname =
     81  <Store &FormatsFromClass>,
    7582  //<WriteLn "Arg_GetInterfaceReader: " e.qname>,
    7683  <Get &DirSeparator> : s.dir_separator,
    77   <Intersperse (s.dir_separator) e.qname> :: e.fname,
    7884  \{
    79     <Get &RFP_Include_Path> : e (e.dirname) e,
     85    <Intersperse (s.dir_separator) e.qname> :: e.fname,
     86      <Get &RFP_Include_Path> : e (e.dirname) e,
    8087      <Try_Open e.dirname e.fname '.rfi'>;
    8188    $trap
    8289      <Intersperse ('/') e.qname> '.rfi' :: e.fname,
    83       <GetSystemResourceAsStream <ToWord e.fname>> <Null> : {
    84       s.null s.null = $fail;
    85       s.is   s.null = FILE &Get_Line_From_Reader (e.fname) (<BufferedReader <InputStreamReader s.is>>);
    86     } $with \{
    87       e "Not available" =
     90      <GetSystemResourceAsStream <ToWord e.fname>> <Null> : \{
     91        s.null s.null, $fail;
     92        s.is   s.null = FILE &Get_Line_From_Reader (e.fname) (<BufferedReader <InputStreamReader s.is>>);
     93      }
     94    $with \{
     95      e "Not available",
    8896        e.qname : "refal" "plus" e.lib,
    8997        <Intersperse (s.dir_separator) e.lib> :: e.lib,
     
    9199        <Try_Open e.dirname e.lib '.rfi'>;
    92100    };
     101    <Intersperse (s.dir_separator) e.qname> :: e.fname,
     102      <Get &RFP_Include_Path> : e (e.dirname) e,
     103      <ReadFormatsFromFile <ToWord e.dirname e.fname '.class'>> <Null> : \{
     104        s.null s.null, $fail;
     105        s.str  s.null = <Store &FormatsFromClass <ToChars s.str>>,
     106          FILE &ReadFormatsFromBox (e.dirname e.fname '.class') ();
     107      };
     108    <Intersperse ('/') e.qname> '.class' :: e.fname,
     109      <ReadFormatsFromClass <ToWord e.fname>> <Null> : \{
     110        s.null s.null, $fail;
     111        s.str  s.null = <Store &FormatsFromClass <ToChars s.str>>,
     112          FILE &ReadFormatsFromBox (e.fname) ();
     113      };
    93114  };
    94115
     
    127148  <ReadLineCh s.channel>;
    128149
     150ReadFormatsFromBox e,
     151  <Get &FormatsFromClass> : v.formats,
     152  <Store &FormatsFromClass>,
     153  v.formats;
     154
    129155
    130156RFP_Src_InitFromEnv s.env =
  • to-imperative/trunk/java/org/refal/plus/comp/FormatReader.java

    r2706 r2707  
    55
    66import org.objectweb.asm.*;
     7import java.io.FileInputStream;
    78
    89public class FormatReader implements ClassVisitor
     
    1617      {
    1718        if (! formats.equals(""))
    18           formats += "";
     19          formats += " ";
    1920        formats += ((String) value);
    2021      }
     
    7778  public void visitSource (String source, String debug) {}
    7879
    79   public static String ReadFormats (String classname) {
     80  public static String ReadFormatsFromClass (String classname) {
    8081    try {
    8182      ClassReader cr = new ClassReader(classname);
     
    8384      cr.accept(cv, 0);
    8485      return cv.formats;
    85     } catch (java.io.IOException ioe) {
     86    } catch (java.lang.Exception exc) {
     87      return null;
     88    }
     89  }
     90
     91  public static String ReadFormatsFromFile (String filename) {
     92    try {
     93      ClassReader cr = new ClassReader(new FileInputStream(filename));
     94      FormatReader cv = new FormatReader();
     95      cr.accept(cv, 0);
     96      return cv.formats;
     97    } catch (java.lang.Exception exc) {
    8698      return null;
    8799    }
     
    91103    for (int i = 0; i < args.length; i++) {
    92104      System.out.println(args[i]);
    93       System.out.println(ReadFormats(args[i]));
     105      System.out.println(ReadFormatsFromClass(args[i]));
    94106    }
    95107  }
  • to-imperative/trunk/java/org/refal/plus/wrappers/org/refal/plus/comp/FormatReader.rfi

    r2706 r2707  
    1 $func ReadFormats s = s; // static java.lang.String ReadFormats (java.lang.String)
     1$func ReadFormatsFromClass s = s; // static java.lang.String ReadFormatsFromClass (java.lang.String)
     2$func ReadFormatsFromFile s = s; // static java.lang.String ReadFormatsFromFile (java.lang.String)
Note: See TracChangeset for help on using the changeset viewer.