Examples of Doc


Examples of anvil.doc.Doc

      Doc[] defines = document.find(Doc.T_DEFINE, null);
      int n = defines.length;
      if (n>0) {
        _define = new HashMap();
        for(int i=0; i<n; i++) {
          Doc doc = defines[i];
          _define.put(doc.getIdent(), Any.create(doc.getText()));
        }
      }
    }
  }
View Full Code Here

Examples of anvil.doc.Doc

      _base = new ResolvedClassRef(base);
    }
   
    FunctionBase function;
    Object[] parameters;
    Doc doc;
    int n;
    boolean declare = true;
   
    try {
View Full Code Here

Examples of anvil.doc.Doc

          code.astring(type.getName());
          code.aastore();

          code.dup();
          code.iconst(i++);
          Doc doc = type.getDocument();
          if (doc != null) {
            doc.compile(code);
          } else {
            code.aconst_null();
          }
          code.aastore();     
View Full Code Here

Examples of anvil.doc.Doc

          break;
        }
       
        int    type = ((Integer)members[i]).intValue();
        String name = (String)members[i+1];
        Doc    doc  = (Doc)members[i+2];
        Object data = members[i+3];
       
        switch(type) {
        case Type.MODULE:
          {
View Full Code Here

Examples of anvil.doc.Doc

      int min = function.getMinimumParameterCount();
      Array list = new Array();
      Any value;
      int count = 0;
      boolean required;
      Doc doc;
      for(int i=0; i<max; i++) {
        switch(function.getParameterType(i)) {
        case CompilableFunction.PARAMETER_CONTEXT:
          break;
        case CompilableFunction.PARAMETER_ANY:
        case CompilableFunction.PARAMETER_STRING:
        case CompilableFunction.PARAMETER_OBJECT:
        case CompilableFunction.PARAMETER_DOUBLE:
        case CompilableFunction.PARAMETER_INT:
        case CompilableFunction.PARAMETER_LONG:
        case CompilableFunction.PARAMETER_BOOLEAN:
          required = (count < min);
          if (count >= min) {
            value = function.getParameterDefault(i);
            if (value == null) {
              value = UNDEFINED;
            }
          } else {
            value = UNDEFINED;
          }
          doc = function.getParameterDoc(i);
          list.append(new AnyString(function.getParameterName(i)),
            new AnyTuple(new Any[] {
              required ? Any.TRUE : Any.FALSE,
              value,
              Any.create((doc != null) ? doc.getText() : null),
              Any.create((doc != null) ? doc.getChildText(doc.T_TYPE, null) : null)
            }));
          count++;
          break;
         
        case CompilableFunction.PARAMETER_ARRAY:
        case CompilableFunction.PARAMETER_ANYLIST:
        case CompilableFunction.PARAMETER_LIST:
          doc = function.getParameterDoc(i);
          list.append(DOTDOT, new AnyTuple(new Any[] {
              new AnyString(function.getParameterName(i)),
              Any.create((doc != null) ? doc.getText() : null),
              Any.create((doc != null) ? doc.getChildText(doc.T_TYPE, null) : null)
            }));
          break;
        }
      }     
      return list;
View Full Code Here

Examples of anvil.doc.Doc

  /// @method getDoc
  /// Returns a document for this type.
  /// @synopsis Doc getDoc()
  public Any m_getDoc()
  {
    Doc doc = _type.getDocument();
    return new AnyDoc((doc != null) ? doc : Doc.EMPTY_DOC);
  }
View Full Code Here

Examples of anvil.doc.Doc

          Method method = methods[i];
          String name = method.getName();
          int mod = method.getModifiers();
          if (Modifier.isPublic(mod) && Modifier.isStatic(mod)) {
            if (method.getReturnType().equals(Any.class)) {
              Doc doc = _document.findFirst(Doc.T_FUNCTION, name);
              parameters = (Object[])Compiled.getstatic(module, "p_"+name);
              function = new NativeFunction(this, method, name, parameters, doc);
              _types.put(function.getName(), function);
            }
          }
        }
      }

      /* fields */ {
        Field[] fields = module.getDeclaredFields();
        int n = fields.length;
        for(int i=0; i<n; i++) {
          Field field = fields[i];
          String name = field.getName();
          int mod = field.getModifiers();
          if (name.startsWith("p_")) {
            continue;
          }
          if (name.startsWith("_")) {
            continue;
          }
          if (Modifier.isPublic(mod) && Modifier.isStatic(mod) && Modifier.isFinal(mod)) {
            try {
              Object obj = field.get(null);
              if (obj instanceof Any) {
                Doc doc = _document.findFirst(Doc.T_CONST, name);
                Any value = (Any)obj;
                _types.put(name, new NativeConstantVariable(this, name, field, doc));
              }
            } catch (Exception e) {
              anvil.Log.log().error("Couldn't get field '"+field+"' from "+module.getName());
View Full Code Here

Examples of anvil.doc.Doc

  }


  public Any getAttribute(Context context, String name)
  {
    Doc doc = _doc.findFirst(name, null);
    return (doc != null) ? new AnyDoc(doc) : UNDEFINED;
  }
View Full Code Here

Examples of anvil.doc.Doc

  }

 
  public Any getReference(Context context, Any index)
  {
    Doc doc = _doc.getChild(index.toInt());
    return (doc != null) ? new AnyDoc(doc) : UNDEFINED;
 
View Full Code Here

Examples of anvil.doc.Doc

      for (int i=0; i<size; i++) {
        unserializer.consume('H');
        childs[i] = unserializeDoc(unserializer);
      }
    }
    return new Doc(type, ident, text, childs);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.