xref: /aosp_15_r20/external/google-smali/dexlib2/accessorTestGenerator/src/main/resources/AccessorTest.stg (revision 37f5703ca959d1ce24046e7595880d209e15c133)
1decl(type, name, value) ::= "<type> <name><init(value)>;"
2init(v) ::= "<if(v)> = <v><endif>"
3
4field_decl(type) ::= "private <type.name> <type.name>_val;"
5
6preinc_template(type) ::=  "++<type.name>_val;"
7postinc_template(type) ::= "<type.name>_val++;"
8predec_template(type) ::= "--<type.name>_val;"
9postdec_template(type) ::= "<type.name>_val--;"
10add_template(type) ::= "<type.name>_val += val;"
11sub_template(type) ::= "<type.name>_val -= val;"
12mul_template(type) ::= "<type.name>_val *= val;"
13div_template(type) ::= "<type.name>_val /= val;"
14rem_template(type) ::= "<type.name>_val %= val;"
15and_template(type) ::= "<type.name>_val &= val;"
16or_template(type) ::= "<type.name>_val |= val;"
17xor_template(type) ::= "<type.name>_val ^= val;"
18shl_template(type) ::= "<type.name>_val \<\<= val;"
19shr_template(type) ::= "<type.name>_val >>= val;"
20ushr_template(type) ::= "<type.name>_val >>>= val;"
21
22operation_template_name(operation) ::= "<operation.name>_template"
23
24binary_method(input, type, binary_operation) ::= <<
25public void <type.name>_<binary_operation.name>(<input> val) {
26    <(operation_template_name(binary_operation))(type)>
27}
28>>
29
30binary_methods(binary_operation, type) ::= <<
31<binary_operation.inputTypes:binary_method(type, binary_operation);separator="\n\n">
32>>
33
34unary_method(unary_operation, type) ::= <<
35public void <type.name>_<unary_operation.name>() {
36    <(operation_template_name(unary_operation))(type)>
37}
38>>
39
40type_methods(type) ::= <<
41<[type.unaryOperations:unary_method(type), type.binaryOperations:binary_methods(type)];separator="\n\n">
42>>
43
44
45file(types) ::= <<
46/*
47 * Copyright 2012, Google LLC
48 *
49 * Redistribution and use in source and binary forms, with or without
50 * modification, are permitted provided that the following conditions are
51 * met:
52 *
53 *     * Redistributions of source code must retain the above copyright
54 * notice, this list of conditions and the following disclaimer.
55 *     * Redistributions in binary form must reproduce the above
56 * copyright notice, this list of conditions and the following disclaimer
57 * in the documentation and/or other materials provided with the
58 * distribution.
59 *     * Neither the name of Google LLC nor the names of its
60 * contributors may be used to endorse or promote products derived from
61 * this software without specific prior written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
64 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
65 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
66 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
67 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
68 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
69 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
70 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
71 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
73 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74 */
75
76package com.android.tools.smali.dexlib2;
77
78public class AccessorTypes {
79    <types:field_decl();separator="\n">
80
81    private class Accessors {
82        <types:type_methods();separator="\n\n">
83    }
84}
85>>
86