看看编辑器支持哪些常用的Markdown语法高亮(上)

C语言(标签:c):

#include 

int main(int argc, const char* argv[])
{
    puts("This is a C program...
");
}

C# 语言(标签:csharp)

using System;
using System.Collections;
using System.Text;

namespace CSharpTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is a C# program!");
             var stb = new StringBuilder(256);
             stb.Append("This is a string builder!");
            Console.WriteLine("string builder content: " + stb);
        }
    }
}

C++(标签:cpp)

#include 

auto main(int argc, const char* argv[]) -> int
{
    // Generic template lambda in C++20
    auto const genericLambda = [](const T& a) -> T {
        if constexpr (size < 0) {
            puts("Illegal size!!");
        }
        printf("size is: %d
", size);

        return a + T(1);
    };

    // Use the generic lambda
    auto const lamRet = genericLambda.template operator()  (100);
    printf("Generic lambda result: %d
", lamRet);
}

CMake(标签:cmake)

#project name
PROJECT(my_project)

#head file path
INCLUDE_DIRECTORIES(
include
)

#source directory
AUX_SOURCE_DIRECTORY(src DIR_SRCS)

CSS(标签:css)

p{
    width:100rpx;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
 }

CUDA(标签:cuda)

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include 

static constexpr auto arraySize = 1152U;

static __global__ void addKernel(int c[], const int a[], const int b[], int constValue)
{
    auto const gtid = threadIdx.x + blockDim.x * blockIdx.x;
    if (gtid >= arraySize) {
        return;
    }

    c[gtid] = a[gtid] * a[gtid] + (b[gtid] - constValue);
}

GLSL(标签:glsl)

#version 450
#extension GL_KHR_shader_subgroup_basic : enable
#extension GL_KHR_shader_subgroup_vote : enable

layout(local_size_x = 1024, local_size_y = 1, local_size_z = 1) in;

layout(std430, set = 0, binding = 0) buffer writeonly dst {
    highp int dstBuffer[];
};

layout(std430, set = 0, binding = 1) buffer readonly src {
    highp int srcBuffer[];
};

void main(void)
{
    const uint gid = gl_GlobalInvocationID.x;
    dstBuffer[gid] = srcBuffer[gid] + srcBuffer[gid];

    subgroupBarrier();

    if (gid == 1)
    {
        bool res1 = subgroupAny(gid == 1);
        bool res2 = subgroupAll(gid < 1024);
        dstBuffer[1] = int(res1) + int(res2);
    }
}

Go语言(标签:go)

package main
import "fmt"

func main() {
    fmt.Println("This is Golang program!")
}

HLSL(标签:hlsl)

// 这是一个计算着色器程序
 
struct BufType
{
    int i;
    float f;
};
 
// 对应于主机端的constant buffer
cbuffer cbNeverChanges : register(b0)
{
    int cValue0;
    int cValue1;
};
 
// 对应于主机端的Shader Resource View
StructuredBuffer buffer0 : register(t0);
StructuredBuffer buffer1 : register(t1);
 
// 对应于主机端的Unordered Access View
RWStructuredBuffer bufferOut : register(u0);
RWStructuredBuffer srcdstBuffer : register(u1);
 
// Direct3D中,一个线程组(threadgroup)最多允许1024个线程
[numthreads(1024, 1, 1)]
void CSMain(uint3 groupID : SV_GroupID, uint3 tid : SV_DispatchThreadID, 
    uint3 localTID : SV_GroupThreadID, uint gIdx : SV_GroupIndex)
{
    const int index = tid.x;
    const int cValue = cValue1 / cValue0;
    int resValue = (buffer0[index].i + buffer1[index].i) * cValue - srcdstBuffer[index];
    bufferOut[index].i = resValue;
    bufferOut[index].f = (buffer0[index].f + buffer1[index].f) * float(cValue);
 
    srcdstBuffer[index] = resValue;
}

HTML(标签:html)




    
    Hello, WebGL
    
    
    
    



    

WebGL demo

JSON(标签:json)

{
    "int" : 100, 
    "string" : "hello",
    "boolean" : true,
    "array": [-20, "hello, JSON", 50.25, false, { "key" : "value" }],
    "object" : { "name" : "abc", "key" : "value" }
}

Java(标签:java)

package com.zenny.demo;

public class Hello{
    public static void main(String[] args){
        System.out.println("Hello Java!");
    }
}

JavaScript(标签:javascript)

"use strict";

let gl;
let normalProgram;
let whitePlaneProgram;
let grayPlaneProgram;

let rectVertBuffer;
let colorBuffer;

let whitePlaneVertBuffer;
let whitePlaneTextureCoordBuffer;

let grayPlaneVertexBuffer;
let grayPlaneTextureCoordBuffer;

let texName;
let rotDegree = 0.0;
let doAnimation = false;

function doGLInit()
{
    let canvas = document.getElementById("canvas");

    canvas.width = 320 * window.devicePixelRatio;
    canvas.height = 320 * window.devicePixelRatio;
    
    gl = canvas.getContext("webgl", {antialias:true});
    
    createNormalRectangle();
    createCommonTexture();
    createWhitePlane();
    createGrayPlane();
    
    gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
    gl.clearColor(0.4, 0.5, 0.4, 1.0);
    gl.frontFace(gl.CCW);
    gl.enable(gl.BLEND);
    gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
}
展开阅读全文

页面更新:2024-03-23

标签:线程   编辑器   语法   常用   主机   语言   标签   程序   高亮

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top