.inc extension for PHP, Pascal, Assembly, SQL, C++, HTML and SourcePawn

This commit is contained in:
Paul Chaignon
2015-05-10 20:36:41 +02:00
parent 5bf8cf50ae
commit 0c2aeae00d
8 changed files with 610 additions and 0 deletions

View File

@@ -224,6 +224,7 @@ Assembly:
extensions:
- .asm
- .a51
- .inc
- .nasm
tm_scope: source.asm.x86
ace_mode: assembly_x86
@@ -409,6 +410,7 @@ C++:
- .hh
- .hpp
- .hxx
- .inc
- .inl
- .ipp
- .tcc
@@ -1251,6 +1253,7 @@ HTML:
- .html
- .htm
- .html.hl
- .inc
- .st
- .xht
- .xhtml
@@ -2322,6 +2325,7 @@ PHP:
- .aw
- .ctp
- .fcgi
- .inc
- .php3
- .php4
- .php5
@@ -2409,6 +2413,7 @@ Pascal:
- .pas
- .dfm
- .dpr
- .inc
- .lpr
- .pp
ace_mode: pascal
@@ -2892,6 +2897,7 @@ SQL:
- .sql
- .cql
- .ddl
- .inc
- .prc
- .tab
- .udf
@@ -3082,6 +3088,7 @@ SourcePawn:
- sourcemod
extensions:
- .sp
- .inc
- .sma
tm_scope: source.sp
ace_mode: text

View File

@@ -0,0 +1,245 @@
push r2
dint
nop
bis #MPYDLYWRTEN,&MPY32CTL0
bic #MPYDLY32,&MPY32CTL0
mov #SUMEXT,r13
clr r12
mov @r15+,r4
mov @r15+,r5
mov @r15+,r6
mov @r15+,r7
mov @r15+,r8
mov @r15+,r9
mov @r15+,r10
mov @r15+,r11
sub #2*8,r15
/* SELF_STEP_FIRST */
mov r4,&MPY32L
mov r5,&MPY32H
mov r4,&OP2L
mov r5,&OP2H
/* COLUMN_END */
mov &RES0,2*0(r14)
mov &RES1,2*(0+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
/* STEP_1 */
mov r4,&MAC32L
mov r5,&MAC32H
mov r6,&OP2L
mov r7,&OP2H
add &SUMEXT,r12
mov r6,&OP2L
mov r7,&OP2H
/* COLUMN_END */
mov &RES0,2*2(r14)
add @r13,r12
mov &RES1,2*(2+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* STEP_1 */
mov r4,&MAC32L
mov r5,&MAC32H
mov r8,&OP2L
mov r9,&OP2H
add &SUMEXT,r12
mov r8,&OP2L
mov r9,&OP2H
/* SELF_STEP */
mov r6,&MAC32L
mov r7,&MAC32H
add @r13,r12
mov r6,&OP2L
mov r7,&OP2H
/* COLUMN_END */
mov &RES0,2*4(r14)
add @r13,r12
mov &RES1,2*(4+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* STEP_1 */
mov r4,&MAC32L
mov r5,&MAC32H
mov r10,&OP2L
mov r11,&OP2H
add &SUMEXT,r12
mov r10,&OP2L
mov r11,&OP2H
/* STEP_2MORE */
mov r6,&MAC32L
mov r7,&MAC32H
add @r13,r12
mov r8,&OP2L
mov r9,&OP2H
add &SUMEXT,r12
mov r8,&OP2L
mov r9,&OP2H
/* COLUMN_END */
mov &RES0,2*6(r14)
add @r13,r12
mov &RES1,2*(6+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* STEP_1 */
mov r4,&MAC32L
mov r5,&MAC32H
mov 2*8(r15),&OP2L
mov 2*9(r15),&OP2H
add &SUMEXT,r12
mov 2*8(r15),&OP2L
mov 2*9(r15),&OP2H
/* STEP_2MORE */
mov r6,&MAC32L
mov r7,&MAC32H
add @r13,r12
mov r10,&OP2L
mov r11,&OP2H
add &SUMEXT,r12
mov r10,&OP2L
mov r11,&OP2H
/* SELF_STEP */
mov r8,&MAC32L
mov r9,&MAC32H
add @r13,r12
mov r8,&OP2L
mov r9,&OP2H
/* COLUMN_END */
mov &RES0,2*8(r14)
add @r13,r12
mov &RES1,2*(8+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
mov 2*8(r15),r4
mov 2*(8+1)(r15),r5
/* STEP_1 */
mov r6,&MAC32L
mov r7,&MAC32H
mov r4,&OP2L
mov r5,&OP2H
add &SUMEXT,r12
mov r4,&OP2L
mov r5,&OP2H
/* STEP_2MORE */
mov r8,&MAC32L
mov r9,&MAC32H
add @r13,r12
mov r10,&OP2L
mov r11,&OP2H
add &SUMEXT,r12
mov r10,&OP2L
mov r11,&OP2H
/* COLUMN_END */
mov &RES0,2*10(r14)
add @r13,r12
mov &RES1,2*(10+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* STEP_1 */
mov r8,&MAC32L
mov r9,&MAC32H
mov r4,&OP2L
mov r5,&OP2H
add &SUMEXT,r12
mov r4,&OP2L
mov r5,&OP2H
/* SELF_STEP */
mov r10,&MAC32L
mov r11,&MAC32H
add @r13,r12
mov r10,&OP2L
mov r11,&OP2H
/* COLUMN_END */
mov &RES0,2*12(r14)
add @r13,r12
mov &RES1,2*(12+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* STEP_1 */
mov r10,&MAC32L
mov r11,&MAC32H
mov r4,&OP2L
mov r5,&OP2H
add &SUMEXT,r12
mov r4,&OP2L
mov r5,&OP2H
/* COLUMN_END */
mov &RES0,2*14(r14)
add @r13,r12
mov &RES1,2*(14+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* SELF_STEP_1 */
mov r4,&MAC32L
mov r5,&MAC32H
mov r4,&OP2L
mov r5,&OP2H
/* COLUMN_END */
mov &RES0,2*16(r14)
add @r13,r12
mov &RES1,2*(16+1)(r14)
mov &RES2,&RES0
mov &RES3,&RES1
mov r12,&RES2
clr &RES3
clr r12
/* END */
mov &RES0,2*18(r14)
mov &RES1,2*(18+1)(r14)
pop r2
eint

34
samples/C++/instances.inc Normal file
View File

@@ -0,0 +1,34 @@
#include "QPBO.h"
#ifdef _MSC_VER
#pragma warning(disable: 4661)
#endif
// Instantiations
template class QPBO<int>;
template class QPBO<float>;
template class QPBO<double>;
template <>
inline void QPBO<int>::get_type_information(char*& type_name, char*& type_format)
{
type_name = "int";
type_format = "d";
}
template <>
inline void QPBO<float>::get_type_information(char*& type_name, char*& type_format)
{
type_name = "float";
type_format = "f";
}
template <>
inline void QPBO<double>::get_type_information(char*& type_name, char*& type_format)
{
type_name = "double";
type_format = "Lf";
}

31
samples/HTML/rpanel.inc Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" charset="UTF-8" type="text/css" href="main.css">
<meta charset="UTF-8">
</head>
<body>
<div id="panel_header_main_form">
<p id="panel_header_main_form_title">Поддержка:</p>
</div>
<table>
<tbody>
<tr>
<td>
<p>Москва:</p>
</td>
<td>
<p>+7-902-7-800-807</p>
</td>
</tr>
<tr>
<td>
<p>Регионы:</p>
</td>
<td>
<p>+7-902-7-800-807</p>
</td>
</tr>
</tbody>
</table>
</body>

View File

@@ -0,0 +1,142 @@
<?php
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'single' => TRUE,
'title' => t('File display'),
'description' => t('Displays the file with a configurable style.'),
'required context' => new ctools_context_required(t('File'), 'entity:file'),
'category' => t('File'),
'defaults' => array(
'displays' => array(),
),
);
/**
* Render the node content.
*/
function file_entity_file_display_content_type_render($subtype, $conf, $panel_args, $context) {
if (!empty($context) && empty($context->data)) {
return;
}
$file = isset($context->data) ? clone($context->data) : NULL;
$block = new stdClass();
$block->module = 'file_entity';
$block->delta = $file->fid;
if (empty($file)) {
$block->delta = 'placeholder';
$block->title = t('File display');
$block->content = t('File display goes here.');
}
else {
if (!empty($conf['identifier'])) {
$file->ctools_template_identifier = $conf['identifier'];
}
$block->title = $file->filename;
$block->content = file_view_file($file, $conf['displays']);
}
if (!empty($conf['link']) && $file) {
$block->title_link = entity_uri('file', $file);
}
return $block;
}
/**
* Edit form for this plugin.
*/
function file_entity_file_display_content_type_edit_form($form, &$form_state) {
$conf = $form_state['conf'];
$form['#tree'] = TRUE;
$form['#attached']['js'][] = drupal_get_path('module', 'file_entity') . '/file_entity.admin.js';
// Retrieve available formatters for this file. We can load all file types
// since we don't know which type the file is at this point.
$formatters = file_info_formatter_types();
// Formatter status.
$form['displays']['status'] = array(
'#type' => 'item',
'#title' => t('Enabled displays'),
'#prefix' => '<div id="file-displays-status-wrapper">',
'#suffix' => '</div>',
);
$i=0;
foreach ($formatters as $name => $formatter) {
$form['displays']['status'][$name] = array(
'#type' => 'checkbox',
'#title' => check_plain($formatter['label']),
'#default_value' => !empty($conf['displays'][$name]['status']),
'#description' => isset($formatter['description']) ? filter_xss($formatter['description']) : NULL,
'#parents' => array('displays', $name, 'status'),
'#weight' => (isset($formatter['weight']) ? $formatter['weight'] : 0) + ($i / 1000),
);
$i++;
}
// Formatter order (tabledrag).
$form['displays']['order'] = array(
'#type' => 'item',
'#title' => t('Display precedence order'),
'#theme' => 'file_entity_file_display_order',
);
foreach ($formatters as $name => $formatter) {
$form['displays']['order'][$name]['label'] = array(
'#markup' => check_plain($formatter['label']),
);
$form['displays']['order'][$name]['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight for @title', array('@title' => $formatter['label'])),
'#title_display' => 'invisible',
'#delta' => 50,
'#default_value' => isset($conf['displays'][$name]['weight']) ? $conf['displays'][$name]['weight'] : 0,
'#parents' => array('displays', $name, 'weight'),
);
$form['displays']['order'][$name]['#weight'] = $form['displays']['order'][$name]['weight']['#default_value'];
}
// Formatter settings.
$form['display_settings_title'] = array(
'#type' => 'item',
'#title' => t('Display settings'),
);
$form['display_settings'] = array(
'#type' => 'vertical_tabs',
);
$i=0;
foreach ($formatters as $name => $formatter) {
if (isset($formatter['settings callback']) && ($function = $formatter['settings callback']) && function_exists($function)) {
$defaults = !empty($formatter['default settings']) ? $formatter['default settings'] : array();
$settings = !empty($conf['displays'][$name]['settings']) ? $conf['displays'][$name]['settings'] : array();
$settings += $defaults;
$settings_form = $function($form, $form_state, $settings, $name, $file_type, $view_mode);
if (!empty($settings_form)) {
$form['displays']['settings'][$name] = array(
'#type' => 'fieldset',
'#title' => check_plain($formatter['label']),
'#parents' => array('displays', $name, 'settings'),
'#group' => 'display_settings',
'#weight' => (isset($formatter['weight']) ? $formatter['weight'] : 0) + ($i / 1000),
) + $settings_form;
}
}
$i++;
}
return $form;
}
function file_entity_file_display_content_type_edit_form_submit($form, &$form_state) {
// Copy everything from our defaults.
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
$form_state['conf'][$key] = $form_state['values'][$key];
}
}
function file_entity_file_display_content_type_admin_title($subtype, $conf, $context) {
return t('"@s" content', array('@s' => $context->identifier));
}

View File

@@ -0,0 +1,37 @@
function GetUnixMangaImageURL: Boolean;
var
i: Integer;
l: TStringList;
s: String;
begin
l := TStringList.Create;
s := manager.container.PageContainerLinks[workCounter];
Result := GetPage(TObject(l), s , manager.container.Manager.retryConnect);
if Self.Terminated then
begin
l.Free;
parse.Free;
Exit;
end;
parse := TStringList.Create;
Parser := THTMLParser.Create(PChar(l.Text));
Parser.OnFoundTag := OnTag;
Parser.OnFoundText := OnText;
Parser.Exec;
Parser.Free;
l.Free;
if parse.Count > 0 then
begin
for i := 0 to parse.Count - 1 do
begin
if (Pos('STYLE="border', parse[i]) > 0) and (Pos('<IMG', parse[i]) > 0) then
begin
manager.container.PageLinks[workCounter] := Trim(GetVal(parse[i], 'SRC'));
Break;
end;
end;
end;
parse.Free;
end;

View File

@@ -0,0 +1,23 @@
# Helper for hostcache_*.test
# Set a known initial state for the test
flush status;
flush hosts;
flush user_resources;
flush privileges;
# Print critical setup
select @@global.debug;
select @@global.max_connect_errors;
select @@global.max_user_connections;
select @@global.max_connections;
# Make sure there are no remaining records that can change the test outcome
select `User`, `Host` from mysql.`user` where `host` like '%\\%%';
select `User`, `Host` from mysql.`user` where `user` like '192.%';
select `User`, `Host` from mysql.`user` where `user` like '2001:%';
select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%';

View File

@@ -0,0 +1,91 @@
/* Fixed point arithmetic
*
* (c) Copyright 1998-2011, ITB CompuPhase
* This file is provided as is (no warranties).
*/
#pragma library Fixed
const fround_method: {
fround_round = 0,
fround_floor,
fround_ceil,
fround_tozero,
fround_unbiased
}
native Fixed:fixed(value);
native Fixed:strfixed(const string[]);
native Fixed:fmul(Fixed:oper1, Fixed:oper2);
native Fixed:fdiv(Fixed:dividend, Fixed:divisor);
native Fixed:ffract(Fixed:value);
native fround(Fixed:value, fround_method:method=fround_round);
native Fixed:fpower(Fixed:value, exponent);
native Fixed:fsqroot(Fixed:value);
native Fixed:fabs(Fixed:value);
#pragma rational Fixed(3)
/* user defined operators */
native Fixed:operator*(Fixed:oper1, Fixed:oper2) = fmul;
native Fixed:operator/(Fixed:oper1, Fixed:oper2) = fdiv;
native Fixed:operator=(oper) = fixed;
stock Fixed:operator++(Fixed:oper)
return oper + fixed(1);
stock Fixed:operator--(Fixed:oper)
return oper - fixed(1);
stock Fixed:operator*(Fixed:oper1, oper2)
return Fixed: (_:oper1 * oper2); /* "*" is commutative */
stock Fixed:operator/(Fixed:oper1, oper2)
return oper1 / fixed(oper2);
stock Fixed:operator/(oper1, Fixed:oper2)
return fdiv(fixed(oper1), oper2);
stock Fixed:operator+(Fixed:oper1, oper2)
return oper1 + fixed(oper2); /* "+" is commutative */
stock Fixed:operator-(Fixed:oper1, oper2)
return oper1 - fixed(oper2);
stock Fixed:operator-(oper1, Fixed:oper2)
return fixed(oper1) - oper2;
stock bool:operator>(Fixed:oper1, oper2)
return oper1 > fixed(oper2);
stock bool:operator>(oper1, Fixed:oper2)
return fixed(oper1) > oper2;
stock bool:operator>=(Fixed:oper1, oper2)
return oper1 >= fixed(oper2);
stock bool:operator>=(oper1, Fixed:oper2)
return fixed(oper1) >= oper2;
stock bool:operator<(Fixed:oper1, oper2)
return oper1 < fixed(oper2);
stock bool:operator<(oper1, Fixed:oper2)
return fixed(oper1) < oper2;
stock bool:operator<=(Fixed:oper1, oper2)
return oper1 <= fixed(oper2);
stock bool:operator<=(oper1, Fixed:oper2)
return fixed(oper1) <= oper2;
stock bool:operator==(Fixed:oper1, oper2) /* "==" is commutative */
return oper1 == fixed(oper2);
stock bool:operator!=(Fixed:oper1, oper2) /* "!=" is commutative */
return oper1 != fixed(oper2);
/* forbidden operations */
forward operator%(Fixed:oper1, Fixed:oper2);
forward operator%(Fixed:oper1, oper2);
forward operator%(oper1, Fixed:oper2);