Skip to content

Instantly share code, notes, and snippets.

@scalone
Created November 30, 2017 23:59
Show Gist options
  • Save scalone/56a948526ad21542166496c01e24dbdd to your computer and use it in GitHub Desktop.
Save scalone/56a948526ad21542166496c01e24dbdd to your computer and use it in GitHub Desktop.
<!-- fn_align_center -->
<function name="fn_align_center">
<integervariable value="21" variable="iDisplayColumns"/>
<integervariable value="0" variable="iLenMessage"/>
<integervariable value="1" variable="iCharCount"/>
<integervariable value="0" variable="iSpaceCount"/>
<if variable="$(iIsPrint)" operator="equalto" value="1">
<integervariable value="42" variable="iDisplayColumns" />
<else />
<!-- # Device Model -->
<readfile filename="config.dat" key="model" variabledestination="$(sDeviceModel)" />
<!-- #Special Screen Models -->
<string.find string="$(sSpecialScreenModels)" substring="$(sDeviceModel)" start="0" variablereturn="$(iRet)" />
<if variable="$(iRet)" operator="greaterthanorequalto" value="0">
<string.find string="$(sBigScreenModels)" substring="$(sDeviceModel)" start="0" variablereturn="$(iRet)" />
<if variable="$(iRet)" operator="greaterthanorequalto" value="0">
<integervariable value="30" variable="iDisplayColumns"/>
<else />
<integervariable value="26" variable="iDisplayColumns"/>
</if>
</if>
</if>
<string.trim string="$(sMessageToAlign)" variablereturn="$(sMessageToAlign)"/>
<string.length value="$(sMessageToAlign)" variablereturn="$(iLenMessage)"/>
<if variable="$(iLenMessage)" operator="lessthan" value="$(iDisplayColumns)">
<mathematicaloperation firstvalue="$(iDisplayColumns)" operator="-" secondvalue="$(iLenMessage)" variabledestination="$(iSpaceCount)"/>
<mathematicaloperation firstvalue="$(iSpaceCount)" operator="/" secondvalue="2" variabledestination="$(iSpaceCount)" />
<while variable="$(iCharCount)" operator="lessthanorequalto" value="$(iSpaceCount)">
<mathematicaloperation firstvalue="$(iCharCount)" operator="+" secondvalue="1" variabledestination="$(iCharCount)"/>
<joinstring firstvalue=" " secondvalue="$(sMessageToAlign)" variabledestination="$(sMessageToAlign)"/>
</while>
</if>
<!-- reset IsPrint flag -->
<integervariable value="0" variable="iIsPrint" />
</function>
<!-- fn_show_message -->
<function name="fn_show_message">
<stringvariable value="" variable="sMsg" />
<integervariable value="0" variable="iElements" />
<integervariable value="0" variable="iLine" />
<integervariable value="0" variable="iI" />
<if variable="$(sMessage)" operator="notequalto" value="">
<string.elements string="$(sMessage)" delimiter="|" variablereturn="$(iElements)" />
<while variable="$(iI)" operator="lessthan" value="$(iElements)">
<string.elementat string="$(sMessage)" element_index="$(iI)" delimiter="|" variablereturn="$(sMessageToAlign)" />
<if variable="$(sMessageToAlign)" operator="notequalto" value=" ">
<if variable="$(sMessageToAlign)" operator="notequalto" value="">
<callfunction name="fn_align_center" />
<display line="$(iLine)" column="0" message="$(sMessageToAlign)" />
</if>
</if>
<integeroperator operator="++" variablesource="$(iLine)" />
<integeroperator operator="++" variablesource="$(iI)" />
</while>
</if>
</function>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment