public DeclareDeclaration(string name, Modifier modifier, TypeReference returnType, ArrayList parameters, ArrayList attributes, string library, string alias, CharsetModifier charset)
 {
     this.name = name;
     this.modifier = modifier;
     this.returnType = returnType;
     this.parameters = parameters;
     this.attributes = attributes;
     this.library = library;
     this.alias = alias;
     this.charset = charset;
 }
示例#2
0
文件: Parser.cs 项目: Altaxo/Altaxo
	void Charset(
//#line  1584 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

//#line  1585 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 127 || la.kind == 210) {
		} else if (la.kind == 62) {
			lexer.NextToken();

//#line  1586 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Ansi; 
		} else if (la.kind == 66) {
			lexer.NextToken();

//#line  1587 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 223) {
			lexer.NextToken();

//#line  1588 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(267);
	}
示例#3
0
 public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List <ParameterDeclarationExpression> parameters, List <AttributeSection> attributes, string library, string alias, CharsetModifier charset)
     : base(modifier, attributes, name, parameters)
 {
 }
示例#4
0
	void Charset(
#line  1530 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

#line  1531 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 114 || la.kind == 195) {
		} else if (la.kind == 49) {
			lexer.NextToken();

#line  1532 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Ansi; 
		} else if (la.kind == 53) {
			lexer.NextToken();

#line  1533 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 208) {
			lexer.NextToken();

#line  1534 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(248);
	}
示例#5
0
文件: Parser.cs 项目: almazik/ILSpy
	void Charset(
#line  1487 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

#line  1488 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 100 || la.kind == 167) {
		} else if (la.kind == 47) {
			lexer.NextToken();

#line  1489 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Ansi; 
		} else if (la.kind == 50) {
			lexer.NextToken();

#line  1490 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 176) {
			lexer.NextToken();

#line  1491 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(231);
	}
示例#6
0
		public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset)
			: base(modifier, attributes, name, parameters)
		{}
示例#7
0
	void Charset(
#line  1591 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

#line  1592 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 129 || la.kind == 213) {
		} else if (la.kind == 62) {
			lexer.NextToken();

#line  1593 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Ansi; 
		} else if (la.kind == 67) {
			lexer.NextToken();

#line  1594 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 226) {
			lexer.NextToken();

#line  1595 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(271);
	}
示例#8
0
	void Charset(
#line  1375 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

#line  1376 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 101 || la.kind == 169) {
		} else if (la.kind == 48) {
			lexer.NextToken();

#line  1377 "VBNET.ATG" 
			charsetModifier = CharsetModifier.ANSI; 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1378 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 178) {
			lexer.NextToken();

#line  1379 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(210);
	}
示例#9
0
		public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset) {
			Name = name;
			Modifier = modifier;
			TypeReference = typeReference;
			Parameters = parameters;
			Attributes = attributes;
			Library = library;
			Alias = alias;
			Charset = charset;
		}
        bool ConvertPInvoke(MethodDeclaration method, ICSharpCode.NRefactory.Ast.Attribute att)
        {
            if (att.PositionalArguments.Count != 1)
            {
                return(false);
            }
            PrimitiveExpression pe = att.PositionalArguments[0] as PrimitiveExpression;

            if (pe == null || !(pe.Value is string))
            {
                return(false);
            }
            string          libraryName   = (string)pe.Value;
            string          alias         = null;
            bool            setLastError  = false;
            bool            exactSpelling = false;
            CharsetModifier charSet       = CharsetModifier.Auto;

            foreach (NamedArgumentExpression arg in att.NamedArguments)
            {
                switch (arg.Name)
                {
                case "SetLastError":
                    pe = arg.Expression as PrimitiveExpression;
                    if (pe != null && pe.Value is bool)
                    {
                        setLastError = (bool)pe.Value;
                    }
                    else
                    {
                        return(false);
                    }
                    break;

                case "ExactSpelling":
                    pe = arg.Expression as PrimitiveExpression;
                    if (pe != null && pe.Value is bool)
                    {
                        exactSpelling = (bool)pe.Value;
                    }
                    else
                    {
                        return(false);
                    }
                    break;

                case "CharSet":
                {
                    MemberReferenceExpression fre = arg.Expression as MemberReferenceExpression;
                    if (fre == null || !(fre.TargetObject is IdentifierExpression))
                    {
                        return(false);
                    }
                    if ((fre.TargetObject as IdentifierExpression).Identifier != "CharSet")
                    {
                        return(false);
                    }
                    switch (fre.MemberName)
                    {
                    case "Unicode":
                        charSet = CharsetModifier.Unicode;
                        break;

                    case "Auto":
                        charSet = CharsetModifier.Auto;
                        break;

                    case "Ansi":
                        charSet = CharsetModifier.Ansi;
                        break;

                    default:
                        return(false);
                    }
                }
                break;

                case "EntryPoint":
                    pe = arg.Expression as PrimitiveExpression;
                    if (pe != null)
                    {
                        alias = pe.Value as string;
                    }
                    break;

                default:
                    return(false);
                }
            }
            if (setLastError && exactSpelling)
            {
                // Only P/Invokes with SetLastError and ExactSpelling can be converted to a DeclareDeclaration
                const Modifiers    removeModifiers = Modifiers.Static | Modifiers.Extern;
                DeclareDeclaration decl            = new DeclareDeclaration(method.Name, method.Modifier & ~removeModifiers,
                                                                            method.TypeReference,
                                                                            method.Parameters,
                                                                            method.Attributes,
                                                                            libraryName, alias, charSet);
                ReplaceCurrentNode(decl);
                base.VisitDeclareDeclaration(decl, null);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#11
0
 public DeclareDeclaration(string name, Modifier modifier, TypeReference returnType, List <ParameterDeclarationExpression> parameters, List <AttributeSection> attributes, string library, string alias, CharsetModifier charset) : base(modifier, attributes, name, parameters)
 {
     this.TypeReference = returnType;
     this.Library       = library;
     this.Alias         = alias;
     this.Charset       = charset;
 }
示例#12
0
	void Charset(out CharsetModifier charsetModifier) {
		charsetModifier = CharsetModifier.None;
		if (la.kind == 127 || la.kind == 210) {
		} else if (la.kind == 62) {
			Get();
			charsetModifier = CharsetModifier.Ansi;
		} else if (la.kind == 66) {
			Get();
			charsetModifier = CharsetModifier.Auto;
		} else if (la.kind == 223) {
			Get();
			charsetModifier = CharsetModifier.Unicode;
		} else SynErr(269);
	}
示例#13
0
	void Charset(
#line  1570 "VBNET.ATG" 
out CharsetModifier charsetModifier) {

#line  1571 "VBNET.ATG" 
		charsetModifier = CharsetModifier.None; 
		if (la.kind == 127 || la.kind == 210) {
		} else if (la.kind == 62) {
			lexer.NextToken();

#line  1572 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Ansi; 
		} else if (la.kind == 66) {
			lexer.NextToken();

#line  1573 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Auto; 
		} else if (la.kind == 223) {
			lexer.NextToken();

#line  1574 "VBNET.ATG" 
			charsetModifier = CharsetModifier.Unicode; 
		} else SynErr(267);
	}