Resource: Platforms Database

Thomas Müller edited this page May 8, 2015 · 8 revisions

Platform Expansion

The platforms database is designed to reduce repetition within the User Agent files. When running a build, the platform "expansion" takes place, and replaces the #PLATFORM# token in UA matches with the interpolated platform match from the designated platform list.

For example, if you had the following platforms database:

{
  "platforms": {
    "Platform1": {
      "match": "*Platform 1*",
      "properties": {
        "Platform": "Platform 1",
        "Win32": "true"
      }
    },
    "Platform2": {
      "match": "*Platform 2*",
      "properties": {
        "Platform": "Platform 2",
        "Win32": "false",
        "Win64": "true"
      }
    }
  }
}

You could then use the Platform1 and Platform2 identifiers in the platforms definition in the UA JSON file:

{
  "division": "Division",
  "sortIndex": 100,
  "userAgents": [
    {
      "userAgent": "UA",
      "properties": {
        "Parent": "DefaultProperties",
        "Comment": "UA",
        "Browser": "UA"
      },
      "children": {
        "match": "UA String (#PLATFORM#)",
        "platforms": ["Platform1", "Platform2"]
      }
    }
  ]
}

In the generated INI file, this would generate 3 sections:

[UA]
Parent=DefaultProperties
Comment=UA
Browser=UA

[UA String (*Platform 1*)]
Parent=UA
Platform=Platform 1
Win32=true

[UA String (*Platform 2*)]
Parent=UA
Platform=Platform 2
Win32=false
Win64=true

Note that any properties in the platform definition are copied across into the child sections in the INI file (in the example, the Platform, Win32 and Win64 fields).

Platform Defintion

The definition for a platform should look like the following JSON object:

{
  /* Platform Identifier */: {
    "match": /* Match string */,
    "inherits": /* optional Parent Identifier */,
    "properties": {
      /* Properties for expansion */
    }
  }
}

Platform Property Definition

For platform information we have the following properties.

Platform

This is the Name of the platform.

Platform_Description

This is a description about the platform

Platform_Maker

The Comany/Organisation who builds/maintaines the platform

Win16

This property is set to "true" if the platform is a 16 bit Windows version. This property should be seen as deprecated. The properties Browser_Bits and Platform_Bits should be used instead.

Win32

This property is set to "true" if the platform is a 32 bit Windows version. This property should be seen as deprecated. The properties Browser_Bits and Platform_Bits should be used instead.

Win64

This property is set to "true" if the platform is a 64 bit Windows version. This property should be seen as deprecated. The properties Browser_Bits and Platform_Bits should be used instead.

Browser_Bits

This property holds the number of bits, the browser is compiled with. On Windows it is possible to run a 32 Bit application on a 64 Bit system.

Platform_Bits

This property holds the number of bits, the plaform has.

Notice

Some Platforms (e.g. Android, OS X) dont give information about the bit count. These platforms are set to 32 Bit.