DeepRead .flo

記事作成日:2024/04/27

Automate Flowchart ;LAFl 2024

Author : lighfu#29945
Author Website (JPN): http://mydevelop.starfree.jp/Automate/
Author Discord (JPN Only): https://discord.com/invite/bVFx8DVn5u

FirstCreateDate: 2022/08
LastModifyDate : 2024/04/18
Progress: 60%?

解析に必要なもの

解析難度

Jsonとかなら絶対にKeyがわかる構造なのでデータ構造が見えやすいですが、.flo はキーが見えない構造で1byteでも多かったり少なかったりするとエラーになります。

オンザフライなRead/Writing でバイト列を解析されるのでかなりめんどくさいです。Json や Xml で保存されていない。

ブロック個別に割り当てられているデータの数もバージョンによって変動し、さらには、ブロックに接続するパスをつなぐIDの規則性も簡略化されすぎて見つけにくい。

ヘッダは短時間で解析終了。
ボディー部分はその100倍以上の労力を費やしています。。。(⁠ノ⁠`⁠Д⁠´⁠)⁠ノ⁠彡⁠┻⁠━⁠┻ 〈 取り組み始めてから何年じゃい!

事前用語説明

  1. object: interface型と同等。ジェネリック型。number, text, array, dictionary, function, constructor などに該当。
  2. interface型: objectと同等。ジェネリック型。
  3. LCID (and CID): 2byte ごとのヘッダーに割り当てられる位置フラグ用のID、接続先ブロックへのリンク、変数名へのリンクなどに使われており、既存のヘッダに重複しないよう0x01開始の1飛ばしのカウンティングがされる。
  4. LEB128: 可変長のバイト列に使用されるエンコーディング。BIDやブロック座標にも使用される。128(0x80)で繰り上がりする。(たしか)
  5. BID: ブロックの内部ID。表示上のIDではない。
  6. flowdata: フローチャートのヘッダを除いた部分のバイト列。
  7. Datalist: stmtブロックの入出力引数に割り当てられている入力フィールドのdata群。個別はdata。
  8. stmlブロック: ブロックの正式名称(Statement block)の略称。さらに略してブロックともいう。
  9. expr: Expression の略称。Automate では式のことを指し、ここではInterface 型のバイト列のことを指すこともある(Automateのexprはinterface型にフォーマットされる為)
  10. asType: dictionary型のキーに付与できる接尾辞で特別な型変換タイプ指定

大まかな構成

ヘッダーバイト列

header, preorder?, version, Lid, blocks, flowdata....

i

flowdata 可変バイト列

別称: FlowStructure (フローストラクチャー/フロー構造体)

Bid, id, x, y, connectionElement,, datalists

ブロック情報とその並び方

Block Internal ID (bid)

ブロック自体のIDを示しています。

実数ID

1000, AccountPick,
        1001, ActivityStart,
        1002, ActivityStartResult,
        1003, AirplaneModeEnabled,
        1004, AmbientLight,
        1005, AmbientTemperature,
        1006, AppForeground,
        1007, AppInstalled,
        1008, AppKillBackground,
        1009, ArrayAdd,
        1010, ArrayRemove,
        1011, ArraySet,
        1012, VariableAssign,
        1013, AssistRequest,
        1014, AtmosphericPressure,
        1015, AudioRecordStart,
        1016, AudioRecordStop,
        1017, AudioVolume,
        1018, AudioVolumeSet,
        1019, AccountSyncEnabled,
        1020, AccountSyncSetState,
        1021, BatteryLevel,
        1022, BroadcastReceive,
        1023, BroadcastSend,
        1024, CallAnswer,
        1025, CallEnd,
        1026, CallIncoming,
        1027, CallNumber,
        1028, CallOutgoing,
        1029, CallState,
        1030, CellSignalLevel,
        1031, CaptureImage,
        1032, ClipboardGet,
        1033, ClipboardSet,
        1034, ComposeEmail,
        1035, ComposeMms,
        1036, ComposeSms,
        1037, ContactQuery,
        1038, ContactPick,
        1039, ContentCopy,
        1040, ContentPick,
        1041, ContentShared,
        1042, ContentView,
        1043, DatePick,
        1044, RingtoneGet,
        1045, RingtoneSet,
        1046, Delay,
        1047, DeviceDocked,
        1048, DeviceLock,
        1049, DeviceOrientation,
        1050, DeviceUnlocked,
        1051, DialNumber,
        1052, DialogChoice,
        1053, DialogConfirm,
        1054, DialogInput,
        1055, DictionaryPut,
        1056, DictionaryRemove,
        1057, DurationPick,
        1058, ExpressionDecision,
        1059, EmailSend,
        1060, Fork,
        1061, FiberStop,
        1062, FileDelete,
        1063, FileCopy,
        1064, FileList,
        1065, FileMonitor,
        1066, FileMakeDirectory,
        1067, FileMove,
        1068, FilePick,
        1069, FileRead,
        1070, FileWrite,
        1071, Flashlight,
        1072, FlowBeginning,
        1073, ForEach,
        1074, FtpDelete,
        1075, FtpDownload,
        1076, FtpList,
        1077, FtpUpload,
        1078, MediaStoreAdd,
        1079, GDriveDelete,
        1080, GDriveDownload,
        1081, GDriveList,
        1082, GDriveUpload,
        1083, GmailSend,
        1084, Geocoding,
        1085, GeocodingReverse,
        1087, HttpRequest,
        1088, LocationAt,
        1089, LocationGet,
        1090, LocationPick,
        1091, LocationShow,
        1092, LocationProviderEnabled,
        1093, LogAppend,
        1094, MediaButton,
        1095, MicrophoneMuted,
        1096, MicrophoneSetMute,
        1097, WifiNetworkPick,
        1098, NetworkType,
        1099, NfcEnabled,
        1100, NfcTagScanned,
        1101, NfcTagWrite,
        1102, NotificationCancel,
        1103, NotificationShow,
        1104, PlugInCondition,
        1105, PlugInEvent,
        1106, PlugInSetting,
        1107, PasswordFailed,
        1108, PowerSourcePlugged,
        1109, Proximity,
        1110, Roaming,
        1111, RingerMode,
        1112, RingerModeSet,
        1113, ScreenBrightness,
        1114, ScreenBrightnessSet,
        1116, ScreenOffTimeout,
        1117, ScreenOffTimeoutSet,
        1118, DeviceInteractive,
        1119, ScreenOrientation,
        1120, ToastShow,
        1121, SmsReceived,
        1122, SmsSend,
        1123, SmsSent,
        1124, SoundPlay,
        1125, SoundStop,
        1126, SpeechRecognition,
        1127, SpeakPlay,
        1128, SpeakStop,
        1129, SpeakToFile,
        1130, SpeakerphoneOn,
        1131, SpeakerphoneSetState,
        1132, StorageMediaMounted,
        1133, StorageSpace,
        1134, SystemSettingGet,
        1135, SystemSettingSet,
        1136, TakePicture,
        1137, TimeWindow,
        1138, TimePick,
        1139, VibrateStart,
        1140, VibrateStop,
        1141, WallpaperImageSet,
        1142, Weather,
        1143, WifiApEnabled,
        1144, WifiApSetState,
        1145, WifiNetworkConnect,
        1146, WifiNetworkConnected,
        1147, WifiEnabled,
        1148, WifiNetworkScan,
        1149, WifiSetState,
        1150, ZipExtract,
        1151, ZipCompress,
        1152, AudioPlayerControl,
        1153, BluetoothDeviceConnected,
        1154, BluetoothDevicePick,
        1155, BluetoothEnabled,
        1156, BluetoothSetState,
        1157, GmailUnreadCount,
        1158, ServiceStart,
        1159, ShellCommand,
        1160, WiredHeadset,
        1161, FlowStop,
        1162, MobileDataEnabled,
        1163, MobileDataSetState,
        1164, ShortcutStart,
        1165, AirplaneModeSetState,
        1166, LocationProviderSetState,
        1167, NfcSetState,
        1168, ScreenOrientationSet,
        1169, TimeAwait,
        1170, CalendarEventAdd,
        1171, CalendarPick,
        1172, FlowBeginningPick,
        1173, FlowStart,
        1174, FileExists,
        1175, RingtonePick,
        1176, RingerSilence,
        1177, InputMethodPick,
        1178, InputMethodSet,
        1179, PhysicalActivity,
        1180, ShellCommandSuperuser,
        1181, GoogleAssistantAction,
        1182, AlarmAdd,
        1183, ScreenLockSetState,
        1184, CellSiteNear,
        1185, CellSitePick,
        1186, CalendarEventGet,
        1187, CalendarEventQuery,
        1188, SystemLanguageGet,
        1189, TimeZoneGet,
        1190, NetworkConnected,
        1191, NotificationInteract,
        1192, NotificationPosted,
        1193, BluetoothTetherEnabled,
        1194, BluetoothTetherSetState,
        1195, FiberStopped,
        1196, ResolveActivity,
        1197, ResolveReceiver,
        1198, ResolveService,
        1200, ScreenLockSetState$a,
        1201, CarModeEnabled,
        1202, CarModeSetState,
        1203, NightModeEnabled,
        1204, NightModeSetState,
        1205, AttentionLight,
        1206, ColorPick,
        1207, DataUsage,
        1208, NetworkThroughput,
        1209, MobileOperator,
        1210, Alarm,
        1211, BluetoothDeviceConnect,
        1212, CpuSpeedGet,
        1213, CpuSpeedSet,
        1214, VariablesGive,
        1215, VariablesTake,
        1216, VariablesTake$a,
        1115, DeviceKeepAwake,
        1217, DeviceKeepAwake$a,
        1218, DeviceReboot,
        1219, DeviceShutdown,
        1220, MotionGesture,
        1221, AppKill,
        1222, BluetoothScoSetState,
        1223, BluetoothScoSetState$a,
        1224, TonePlay,
        1225, UsbTetherEnabled,
        1226, UsbTetherSetState,
        1227, Screenshot,
        1228, Ping,
        1229, Interact,
        1230, AccountSyncRequest,
        1231, WakeOnLanSend,
        1232, PowerSaveModeEnabled,
        1233, PowerSaveModeSetState,
        1234, MobileNetworkPreferredSet,
        1235, AppClearCache,
        1236, AccountGenericAdd,
        1237, AppPick,
        1238, MediaPlaying,
        1239, MediaTagsRead,
        1240, TimerAdd,
        1241, WifiSignalLevel,
        1242, AppNotificationsEnabled,
        1243, AppNotificationsSetState,
        1244, AndroidVersion,
        1245, InterruptionFilter,
        1246, InterruptionFilterSet,
        1247, FtpMakeDirectory,
        1248, GDriveMakeDirectory,
        1249, MmsSend,
        1250, AppOpMode,
        1251, AppOpModeSet,
        1252, MobileNetworkPreferred,
        1253, AtomicAdd,
        1254, AtomicClearAll,
        1255, AtomicCompareAndStore,
        1256, AtomicLoad,
        1257, AtomicStore,
        1258, DeviceAcceleration,
        1259, MagneticFieldStrength,
        1260, WallpaperLiveSet,
        1261, FlowPick,
        1262, MediaStoreRemove,
        1263, FailureCatch,
        1265, CloudMessageReceive,
        1266, CloudMessageSend,
        1267, SubscriptionPick,
        1268, SystemPropertyGet,
        1269, ToastPosted,
        1270, BluetoothDeviceDisconnect,
        1271, TimeZoneSet,
        1272, VideoRecordStart,
        1273, VideoRecordStop,
        1274, ScreenLockSetState$c,
        1275, n1,
        1276, NotificationAction,
        1277, BluetoothDeviceScan,
        1278, Subroutine,
        1279, GDriveShare,
        1280, DialogWeb,
        1281, DeviceRestart,
        1282, InfraredTransmit,
        1283, SignificantDeviceMotion,
        1284, SoundLevel,
        1285, CyanogenModProfile,
        1286, CyanogenModProfileSet,
        1287, Goto,
        1288, Label,
        1289, KeyboardVisible,
        1290, MobileDataNetworkType,
        1291, DeviceIdleModeActive,
        1292, RestrictBackgroundDataEnabled,
        1293, RestrictBackgroundDataSetState,
        1294, ContentChanged,
        1295, ContentDelete,
        1296, ContentInsert,
        1297, ContentQuery,
        1298, ContentUpdate,
        1299, DeviceIdleModeSetState,
        1300, Pedometer,
        1301, SystemLanguageSet,
        1302, DialogNumber,
        1303, QuickSettingsTileShow,
        1304, d2,
        1305, AppList,
        1306, AppNotificationsPriorityGet,
        1307, AppNotificationsPrioritySet,
        1308, AppNotificationsVisibilityGet,
        1309, AppNotificationsVisibilitySet,
        1310, AppUsage,
        1311, MobileServiceState,
        1312, NotificationPolicyGet,
        1313, NotificationPolicySet,
        1314, ProcessText,
        1315, ProcessTextResult,
        1316, LocationMock,
        1317, AudioStreamMuted,
        1318, AudioStreamSetMute,
        1319, DatabaseModify,
        1320, DatabaseQuery,
        1321, NotificationSnooze,
        1322, FingerprintGesture,
        1323, UssdRequest,
        1324, KeyPressed,
        1325, InteractTouch,
        1326, BroadcastSendOrdered,
        1327, Fullscreen,
        1328, PreferredActivity,
        1329, AudioDeviceConnected,
        1330, DisplayOn,
        1331, ToneStop,
        1332, NotificationChannelPick,
        1333, HotwordDetected,
        1334, AccessibilityButton,
        1335, DialogMessage,
        1336, AlternativeLaunch,
        1337, LogAwait,
        1338, KeySend,
        1339, HeartRate,
        1340, HingeAngle,
        1341, RelativeHumidity,
        1342, AdbShellCommand,
        1343, KeyChainAliasPick,
        1344, NsdDiscover,
        1345, CaptureVideo,
        1346, ActivityStartVoice,
        1347, ContentOffer,
        1348, ContentOfferResult,
        1349, AudioDeviceRecording,
        1350, ShortcutPin,
        1351, IconPick,
        1352, UserAsleep,
        1353, DisplayQuery,
        1354, InspectLayout,
        1355, CallScreening,
        1356, CallScreeningResponse,
        1357, SplitScreenModeEnabled,
        1358, ZipList,
        1359, SubscriptionSetState,
        1360, o0,
        1361, ImageLoad,
        1362, ImageUnload,
        1363, ImageWrite,
        1364, ImageCrop,
        1365, ImageFlip,
        1366, ImageRescale,
        1367, ImageRotate,
        1368, ImageSampleColor,
        1369, BatteryCharging,
        1370, BatteryProperties,
        1371, BluetoothDeviceBond,
        1372, BluetoothGattRead,
        1373, ShortcutUpdate,
        1374, SubscriptionDefaultGet,
        1375, SubscriptionDefaultSet,
        1376, StorageVolumeList,
        1377, DataNetworkDefault,
        1378, CameraAvailable,
        1379, KeySendCharacters,
        1380, AdbProtocolSet,
        1381, DisplayMetricsGet,
        1382, ShellCommandPrivileged,
        1383, BluetoothDeviceActiveSet,
        1384, DisplayPowerModeSet,
        1385, GDriveFileExists,
        1386, WifiApClientsConnected,
        1387, EthernetTetherSetState,
        1388, FeatureUsage,
        1389, TextRecognition,
        1390, UsbConfigured,
        1391, UsbFunctionSet,
        1392, QrCodeGenerate
        

Block X

ブロックの配置のX座標

Block Y

ブロックの配置のY座標

connectionElement || cid, lcid

通常は このアドレスのことを connectionElement と呼称しますが、CID, LCID と呼ぶこともあります。この違いは単純なリンクIDになっているか、なっていないかで分けられます。

接続先のブロックのIDを示している場合はCID(もしくはconnectionElement)と定義します。

接続先のブロックが後続に続いているのを示す場合はconnectionElementと定義します。

connectionElement は 接続先のブロックが自身のブロックよりも後方のアドレスにある場合、接続先のブロックが後続に配置される。
逆に、接続先のブロックが自身のブロックよりも前方のアドレスにある場合、接続先のブロックが後続に配置される。

① 後続に続くパターン
bid, id, x, y, [bid, id, x, y, connectionElement, datalist], datalist...

つまり、
bid, id, x, y, connectionElement, datalist...

② 後続に続かないただのリンクのパターン
bid, id, x, y, LCID, datalist...

後続に続く場合は今の datalist が後回される。 つまり、

後続に続かないブロックを bid1, id1, x1, y1, 0x00, data1.1, data1.2

後続ブロックの↓に接続すると、 bid2, id2, x2, y2, 0x00, data2.1, data2.2

↓のようになる。 bid1, id1, x1, y1, bid2, id2, x2, y2, 0x00, data2.1, data2.2,
data1.1, data1.2

どんな原理で、その2つのパターンが切り替わるのかわ不明。

説①
IDが小さいものが大きいものにリンクするとき、後続になる。
大きいものが小さいものにリンクするとCIDになる?

追記:後続になる場合は自身のブロックよりも高いIDの場合。

たとえば, ID2 - OUT ⇨ IN - ID3 な場合、
ID2 の後ろに ID3が後続になる。

たとえば, ID3 - OUT ⇨ IN - ID2 な場合、
ID3 の後続に ID2 は来ない。
ただし、ConnectedID に ID2 の 何らかのリンクID が代入される。

LCID Counting - 追記

順はアドレスのはじめからブロックがある順に並ぶ。そこにBIDなどは関与しない。
これを LCID Counting と呼ぶ。

LatentConnectionID Counting は、0x01から始まり、2byteのヘッダー(1バイト目が0x80以上 & 2バイト目が0x80以下)があるごとに0x02づつカウントが上がり、そのヘッダーとリンクされていく。詳しくは上の画像を参照

d2 02 03 11 22 33 cc 01 02 44 55
^^^^^             ^^^^^
LCID:0x01         LCID:0x03
        

そのため既存のヘッダに衝突しない特性を持つ。

01 03 05 07 09とカウントされるが、00 02 04 06 08 が既存のヘッダのカウント。

Datalist byte

誤解を防ぐために、Datalists から Datalist に名称変更しました。
statementブロックが持っているdata全体を datalistと表現します。data単体では data になります。
例: 8a 11 02 00 00 00 00 00 (太字部分が datalist)

ポイント

入力フォーム別 タイプ参照

フィールドがリセット状態なら 0x00 になる。
リセットするにはフォームを長押しするか、全ての文字列、値を削除する。

各型の詳細

datalist の型 (調査中の時点で)

string型 ⇨ length, data...

純粋な文字列型。FlowBeginning のタイトルに当たる。
Fxのインターフェースを持っていない入力フィールドに入力された文字列。
最初の1byteは可変バイトで、dataの長さを示す。
例: 0x08, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65
いきなりlengthから始まる。

boolean型 ⇨ 1byte

純粋な 0か1か の1byte。
解析がラク。固定長。

interface型 ⇨ ジェネリック型

public interface MyMethod() のような型

複数の型やヘッダがあるため分析に時間がかかっている。
入力フィールドでFxが選択できるものに当たる。
純粋でないstring型、number型などなどがそれぞれのヘッダで区別されている。
Fxが使用できる型に関して調査中。
以下は現時点で判明している型である。

interface bytes

短縮プレフィックスの説明





{
[0x80, 0x2]: "<",
[0x82, 0x2]: "%",
[0x84, 0x2]: "*",
[0x8e, 0x2]: "!=",
[0x90, 0x2]: "||",
[0x92, 0x2]: "〛",
[0x94, 0x2]: "-",
[0x98, 0x2]: "<",
[0x9a, 0x2]: "//",
[0xdc, 0x1]: "+",
[0xde, 0x1]: "&&",
[0xe0, 0x1]: "&",
[0xe4, 0x1]: "<<",
[0xe6, 0x1]: ">>",
[0xe8, 0x1]: ">>>",
[0xea, 0x1]: "|",
[0xec, 0x1]: "^",
[0xee, 0x1]: "++",
[0xf2, 0x1]: "/",
[0xf4, 0x1]: "=",
[0xf6, 0x1]: ">=",
[0xf8, 0x1]: ">",
[0xfe, 0x1]: "<="}[value]

{
{
[0x86, 0x02]: "-",
[0x8c, 0x02]: "!",
[0x96, 0x02]: "+",
[0x98, 0x02]: "++",
[0xe2, 0x01]: "~",
[0xfc, 0x0q]: "#"
}[value]

80 02 ... < ⇨ H, o1, o2o1 < o2
82 02 ... % ⇨ H, o1, o2o1 % o2
84 02 ... * ⇨ H, o1, o2o1 * o2
86 02 ... - ⇨ H, Obj ⇨ -Obj
88 02 ... [ (Array) ⇨ H, L, Obj...
8a 02 ... { (Dict) ⇨ H, L, Obj..., ConvFlag
8c 02 ... ! ⇨ H, Obj ⇨ !Obj
8e 02 ... != ⇨ H, o1, o2o1 != o2
90 02 ... || ⇨ H, o1, o2o1 || o2
92 02 ... [ (添字演算子) ⇨ H, Obj, Arg1.Obj
94 02 ... - ⇨ H, o1, o2o1 - o2
96 02 ... + ⇨ H, Obj ⇨ +Obj
98 02 ... ++ ⇨ H, Obj ⇨ ++Obj
9a 02 ... // ⇨ H, o1, o2o1 // o2
9c 02 ... ImportError
9e 02 ... ImportError
d0 01 ... Type: Double
d2 01 ... Type: InterpolationString
d4 01 ... Type: PureString
d6 01 ... Type: FixedString
d8 01 ... ?? ⇨ d4 01 d8 01 ?? 00 00 L text
da 01 ... Unknown
dc 01 ... + ⇨ H, o1, o2o1 + o2
de 01 ... && ⇨ H, o1, o2o1 && o2
e0 01 ... & ⇨ H, o1, o2o1 & o2
e2 01 ... ~ ⇨ H, Obj ⇨ ~Obj
e4 01 ... << ⇨ H, o1, o2o1 << o2
e6 01 ... >> ⇨ H, o1, o2o1 >> o2
e8 01 ... >>> ⇨ H, o1, o2o1 >>> o2
ea 01 ... | ⇨ H, o1, o2o1 | o2
ec 01 ... ^ ⇨ H, o1, o2o1 ^ o2
ee 01 ... ++ ⇨ H, o1, o2o1 ++ o2
f0 01 ... ⇨ H, o1, o2, o3 ⇨ o1 ? o2 : o3
f2 01 ... / ⇨ H, o1, o2o1 / o2
f4 01 ... = (三項演算子|IF文) ⇨ H, Obj
f6 01 ... >= ⇨ H, o1, o2o1 >= o2
f8 01 ... > ⇨ H, o1, o2o1 > o2
fa 01 ... ( ⇨ H, Obj ⇨ (Obj)
fc 01 ... # ⇨ H, Obj ⇨ #Obj
fe 01 ... <= ⇨ H, o1, o2o1 <= o2

斜線のo2は, 直接はオペランドに掛からないもの。たとえば、 96 02 は -(マイナスオペランド) で, 96 02 123 であれば、 123 - になる。しかし、エディタ上ではこれは不正な式になるため、96 02 123 456 が正しいが、 12 - 34 - 56 などの複数回連なった形で検証すると、o2に直接掛からないため、 96 02 96 02 12 34 56 になる。仮に直接掛かる場合は、96 02 12 96 02 34 96 02 56 になるはず。でもこうはならない。

太字と斜線> は要検証です。


Array 型


        // []
        88 02 00
        
        // [0.1, 0.2]
        88 02 02 D0 01 3F B9 99 99 99 99 99 9A D0 01 3F C9 99 99 99 99 99 9A
        
        // ["v1", "v2", "v3"]
        88 02 03 D4 01 02 76 31 D4 01 02 76 32 D4 01 02 76 33
        
        // [0.1, "v2", ["a1", "a2"], [], {}, Now]
        88 02 06 D0 01 3F B9 99 99 99 99 99 9A D4 01 02 76 32 88 02 02 D4 01 02 61 31 D4 01 02 61 32 88 02 00 8A 02 00 94 03
        
        

基本構文

シングル - [object]

88 02 01 object

ダブル - [object, object]

88 02 02 object object

トリプル - [object, object, object]

88 02 03 object object object

ポイント

読み方

  1. ヘッダー (88 02)
  2. 3byte目は elements length
  3. length>0なら進み、0なら終了
  4. interface型を読み取る
  5. 最大要素数まで4.を繰り返し
  6. 終了

Dictionary 型

// {} only
        8A 02 00
        
        // {0.1: 0.2}
        8A 02 01 D0 01 3F B9 99 99 99 99 99 9A D0 01 3F C9 99 99 99 99 99 9A 01
        
        // {"k1": "v1", "k2", "v2"}
        8A 02 02 D4 01 02 6B 31 D4 01 02 76 31 01 D4 01 02 6B 32 D4 01 02 76 32 01
        
        // {"k1": "v1", "k2": {"k2-1": "v2-1"}, "k3": "v3"}
        8A 02 03 D4 01 02 6B 31 D4 01 02 76 31 01 D4 01 02 6B 32 8A 02 01 D4 01 04 6B 32 2D 31 D4 01 04 76 32 2D 31 01 01 D4 01 02 6B 33 D4 01 02 76 33 01
        

  1. ヘッダは 8A 02
  2. 3byte目に length
  3. length0 なら body バイト列は無しで終了、そうでないなら次⇩
  4. Key を interface型で読み取り
  5. Dictionary 型なら 1. へ再帰処理
  6. Value を Interface型で読み取り
  7. Dictionary 型なら 1. へ再帰処理
  8. asType を1byte のフラグとして読み取り
  9. 規定のlengthまで繰り返すため 4. へ
  10. 終了

ポイント

asType

値 (Value) を特定の変換型としてバインドするためのもの。
構文は

Automate内でしかDictionaryを使わない(他アプリケーションとの相互通信をしない)ならこのようなasType を使用する機会は無い。
変換型を使用しない場合は 0x01に固定される。

変換型別のフラグ値

添字演算子 Object[num]

添字演算子がある場合、バイト列の順序が変更される。


        // 0.9[“a“]
        92 02 D0 01 3F EC CC CC CC CC CC CD D4 01 01 61
        
        // 0x10
        CA 01 40 30 00 00 00 00 00 00
        
        // 0x10[“a“[“b“[“c“]]]
        92 02 CA 01 40 30 00 00 00 00 00 00 92 02 D4 01 01 61 92 02 D4 01 01 62 D4 01 01 63
        
        // 0x10[“a“[“b“]]
        92 02 CA 01 40 30 00 00 00 00 00 00 92 02 D4 01 01 61 D4 01 01 62
        
        // 0x10[“a“]
        92 02 CA 01 40 30 00 00 00 00 00 00 D4 01 01 61
        
        
        // “abc“[“d“]
        92 02 D4 01 03 61 62 63 D4 01 01 64
        
        // [“aaa“, “bbb“]
        88 02 02 D4 01 03 61 61 61 D4 01 03 62 62 62
        
        // [“aaa“, “bbb“][“aaa“]
        92 02 88 02 02 D4 01 03 61 61 61 D4 01 03 62 62 62 D4 01 03 61 61 61
        
        // [“aaa“, “bbb“][“aaa“][“ccc“]
        92 02 92 02 88 02 02 D4 01 03 61 61 61 D4 01 03 62 62 62 D4 01 03 61 61 61 D4 01 03 63 63 63
        
        // {“aaa“﹕ “bbb“}[“ccc“]
        92 02 8A 02 01 D4 01 03 61 61 61 D4 01 03 62 62 62 01 D4 01 03 63 63 63
        
        // “aaa“ = “bbb“ ﹖ (“ccc“ = “ddd“ ﹖ “eee“ ﹕ “fff“) ﹕ “ggg“
        F0 01 F4 01 D4 01 03 61 61 61 D4 01 03 62 62 62 FA 01 F0 01 F4 01 D4 01 03 63 63 63 D4 01 03 64 64 64 D4 01 03 65 65 65 D4 01 03 66 66 66 D4 01 03 67 67 67
        
        // “aaa“ = “bbb“ ﹖ “ccc“ ﹕ “ddd“
        F0 01 F4 01 D4 01 03 61 61 61 D4 01 03 62 62 62 D4 01 03 63 63 63 D4 01 03 64 64 64
        
        

基本構文

シングル - object[key]

92 02 object key

Op1 object Op1.key

ダブル - object[key][key]

92 02 92 02 object key key

Op1 Op2 object Op1.key Op2.key

トリプル - object[key][key][key]

92 02 92 02 92 02 object key key key

Op1 Op2 Op3 object Op1.key Op2.key Op3.key

(Obj)

// -(-0.9)
        86 02 FA 01 86 02 D0 01 3F EC CC CC CC CC CC CD
        
        // (0.9) - (0.9)
        94 02 FA 01 D0 01 3F EC CC CC CC CC CC CD FA 01 D0 01 3F EC CC CC CC CC CC CD
        
        // (0.9 - (0.9))
        FA 01 94 02 D0 01 3F EC CC CC CC CC CC CD FA 01 D0 01 3F EC CC CC CC CC CC CD
        
        // ((“aaa“[“bbb“])[“ccc“] - [“ddd“])[“eee“]
        92 02 FA 01 94 02 92 02 FA 01 92 02 D4 01 03 61 61 61 D4 01 03 62 62 62 D4 01 03 63 63 63 88 02 01 D4 01 03 64 64 64 D4 01 03 65 65 65
        
        

Var / 変数 (hex:cc01)

変数は1度目の定義以降、位置ID(LCID)に置き換えられる。

// 1回目
        c4 10 02 00 00 00 00 cc 01 03 66 67 68
        
        // 2回目以降
        c4 10 02 00 00 00 00 ??
        
        ?? がLCIDが入る。
        

位置IDのカウンティングについては、LCIDカウンティングを参照

Function / 関数

d8 04 ... abs ... H, o1
e0 04 ... atan2 ... H, o1, o2
e0 05 ... concat ... H, L, o.. (o, ...)

関数は引数の数が可変であるなら、L が入る。これは配列の挙動と同じ。

関数表

内部ID, クラス名, 名前, 引数...

300, Abs, abs, number
        301, Acos, acos, number
        302, Asin, asin, number
        303, Atan, atan, number
        304, Atan2, atan2, y, x
        305, Ceil, ceil, number
        306, Contains, contains, container, value, flags 
        307, CoordFormat, coordFormat, number, pattern, flags
        308, Cos, cos, number
        309, DateFormat, dateFormat, timestamp, pattern, timeZone
        310, DateParts, dateParts, timestamp, timeZone
        311, Distance, distance, lat1, lon1, lat2, lon2
        312, PhoneEqual, phoneEqual, phone1, phone2
        313, Exp, exp, number
        314, Floor, floor, number
        315, JsonDecode, jsonDecode, text
        316, JsonEncode, jsonEncode, value
        317, Join, join, container, delimiter
        318, LocalTime, localTime, timestamp, timeZone
        319, Log, log, number
        320, LowerCase, lowerCase, text, language
        321, Date, date, year, month, dayOfMonth, timeZone
        322, Matches, matches, value, Regex
        323, Max, max, valueN...
        324, TimeMerge, timeMerge, timestamp, timeOfDay, timeZone
        325, MimeType, mineType, filename
        326, Min, min, valueN...
        327, NumberFormat, nunberFormat, number, pattern, language
        328, Pow, pow, base, exponent
        329, ReplaceAll, replaceAll, text, regex, placement
        330, Round, round, number
        331, Sift, sift, container, selection
        332, Sin, sin, number
        333, Split, split, text, regex
        334, Sqrt, sqrt, number
        335, Tan, tan, number
        336, Trim, trim, text
        337, Trunc, trunc, number
        338, UpperCase, upperCase, text, language
        339, UrlEncode, urlEncode, value, charset
        340, UtcTime, utcTime, timestamp, timeZone
        341, CliEncode, cliEncode, text
        342, Glob, glob, text, pattern
        343, Keys, keys, dictionary
        344, Shuffle, shuffle, array
        345, DurationFormat, durationFormat, duration, pattern, language
        346, Substr, substr, text, index, length
        347, Storage, storage, type, path
        348, Copy, copy, value, deep
        349, Random, random, number
        350, HexEncode, hexEncode, value, charset
        351, Char, char, number
        352, UrlDecode, urlDecode, text, charset
        353, Bearing, bearing, lat1, lon1, lat2, lon2
        354, Celsius, celsius, number
        355, Fahrenheit, fahrenheit, number
        356, Type, type, value
        357, XmlDecode, xmlDecode, text, flags, namespaces
        358, XmlEncode, xmlEncode, value, flags, namespaces
        359, Base64Decode, base64Decode, text, flags
        360, Base64Encode, base64Encode, text, flags
        361, HexDecode, hexDecode, text, charset
        362, Sum, sum, container
        363, Ctz, ctz, number
        364, Values, values, dictionary
        365, Declination, declination, lat, lon, alt, ts
        366, DateParse, dateParse, text, pattern, timeZone, language
        367, Filter, filter, container, flags
        368, Concat, concat, valueN...
        369, Extend, extend, dictN...
        370, Intersect, intersect, container1, container2
        371, Sort, sort, array, flags, pattern
        372, Time, time, hours, minutes, seconds, millisencods
        373, Disjoint, disjoint, container1, container2
        374, PhoneFormat, phoneFormat, phone, standard, country
        375, Reverse, reverse, array
        376, Distinct, distinct, array
        377, Levenshtein, levenshtein, text1, text2
        378, Crc32, crc32, text, flags
        379, Md5, md5, text, flags
        380, Sha1, sha1, text, flags
        381, SqlEncode, sqlEncode, value
        382, IndexOf, indexOf, container, value, startIndex
        383, Slice, slice, container, startIndex, endIndex
        384, FindAll, findAll, text, regex
        385, VersionCompare, vercmp, text1, text2
        386, ColorRecode, colorRecode, color, transform, alpha
        387, TimePart, timePart, timestamp, timeZone
        388, ConvType, convType, dictionary, key
        389, Clock, clock, type
        390, Except, except, container1, container2
        391, Union, union, containerN...
        392, FileUri, fileUri, path, flags
        393, Sha256, sha256, text, flags
        394, XPathEncode, xpathEncode, text
        395, SizeFormat, sizeFormat, size, pattern, language
        396, Uuid4, uuid4, hidden
        

Automate 覚書のホームに戻る
このサイトのホームに戻る