Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add completely untested multitasking code
taskswapHandler : pop ecx ; pop eip into ecx pusha mov ebx, [currentTaskNum] ; get the current task imul ebx, TASK_OBJ_SIZE add ebx, RunningTaskList mov [ebx+Task_eip], ecx mov [ebx+Task_stackLoc], esp ; store the relevent things ; get the next Task object into ebx taskswapHandler.goLoop : add ebx...
Add PoR patch to fix bonus STR not affecting martial art
.nds .relativeinclude on .erroronwarning on ; In vanilla PoR Martial Art does not take bonus STR (e.g. from STR Boost) into account when calculating its damage. ; This patch causes it to take bonus STR into account. .open "ftc/overlay9_0", 021CDF60h .org 0x022176CC ldrsh r1, [r4, 18h] ; Load bonus STR from 02111FE...
Return 0 for no items
; Based on http://codekata.com/kata/kata09-back-to-the-checkout/ org 8000h include src/zx-spec.asm spec_init describe 'price' it 'Returns 0 for no items' ld a,$FF call price assert_a_equal 0 spec_end price proc ret endp end 8000h
; Based on http://codekata.com/kata/kata09-back-to-the-checkout/ org 8000h include src/zx-spec.asm spec_init describe 'price' it 'Returns 0 for no items' ld a,$FF call price assert_a_equal 0 spec_end price proc ld a,0 ret endp end 8000h
Add patch to make wygol unlocked from the start in OoE
.nds .relativeinclude on .erroronwarning on .open "ftc/overlay9_22", 02223E00h ; Shanoa mode: Makes Ecclesia and Wygol be unlocked from the start. .org 0x0223B7F4 ; Code that would normally set Ecclesia as the default unlocked area. ldr r14, =021003CCh ldr r0, [r14] mov r1, 0x0000003C ; Sets both bits for Eccle...
Write to 0x70 instead 46
LLB R1, 70 #Address LHB R1, 0xCC LLB R2, 59 LLB R12, 34 LLB R13, 45 LLB R14, 78 SW R1, R1, 0 SW R12, R1, 1 SW R13, R1, 2 SW R14, R1, 3 LW R3, R1, 0 ADD R4, R2, R2 LW R7, R1, 1 ADD R4, R4, R4 LW R8, R1, 2 ADD R4, R4, R4 LW R9, R1, 3 ADD R4, R4, R4 SW R2, R1, 0 LW R5, R1, 1 LW R6, R1, 3 HLT
LLB R1, 0x70 #Address LHB R1, 0xCC LLB R2, 59 LLB R12, 34 LLB R13, 45 LLB R14, 78 SW R1, R1, 0 SW R12, R1, 1 SW R13, R1, 2 SW R14, R1, 3 LW R3, R1, 0 ADD R4, R2, R2 LW R7, R1, 1 ADD R4, R4, R4 LW R8, R1, 2 ADD R4, R4, R4 LW R9, R1, 3 ADD R4, R4, R4 SW R2, R1, 0 LW R5, R1, 1 LW R6, R1, 3 HLT
Add test for BR 3187743
;Testname=unoptimized; Arguments=-O0 -fbin -obr3187743.bin; Files=stdout stderr br3187743.bin ;Testname=optimized; Arguments=-Ox -fbin -obr3187743.bin; Files=stdout stderr br3187743.bin bits 64 vlddqu xmm0,[edi] vlddqu ymm0,[edi]
Include upper 32-bits of tsc.
; ; Copyright Mehdi Sotoodeh. All rights reserved. ; <mehdisotoodeh@gmail.com> ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that source code retains the ; above copyright notice and following disclaimer. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT ...
; ; Copyright Mehdi Sotoodeh. All rights reserved. ; <mehdisotoodeh@gmail.com> ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that source code retains the ; above copyright notice and following disclaimer. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT ...
Add patch to prevent overlapping events in first room of DoS
.nds .relativeinclude on .erroronwarning on ; This patch fixes issues that could happen in the first room of the castle if the player got one of the bad endings before seeing the cutscene with Hammer in that first room. ; The cutscene with Hammer would play at the same time as the bad ending cutscene, and could allow ...
Add patch for boss orbs to reload some boss rooms in OoE
.nds .relativeinclude on .erroronwarning on ; This patch makes it so getting a boss orb in Mystery Manor or Ecclesia will reload the room. ; This is because the cutscene after beating Albus/Barlowe won't play until the room is reloaded. ; Albus/Barlowe normally reload the room on defeat, but in boss randomizer somethi...
Test of immediate handling on 64-bit mode
bits 64 mov rax,1234567890abcdefh mov eax,1234567890abcdefh mov rax,dword 1234567890abcdefh mov rax,qword 1234567890abcdefh mov dword [rsi],1234567890abcdefh mov qword [rsi],1234567890abcdefh mov dword [rsi],dword 1234567890abcdefh mov qword [rsi],dword 1234567890abcdefh ; mov qword [rsi],qword 1234567890abcd...
Add patch to remove Shanoa back glow
.nds .relativeinclude on .erroronwarning on ; This patch makes the color at index 2 in Shanoa's palette (the glyph on her back) not glow and switch between colors automatically. .open "ftc/arm9.bin", 02000000h .org 0x0208C990 nop .close
Remove any space between chars
;;----------------------------------------------------------------------------;; ;; Reduce the font space ;; Copyright 2015 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License. ;; You may obtain...
;;----------------------------------------------------------------------------;; ;; Reduce the font space ;; Copyright 2015 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License. ;; You may obtain...
Fix familiar money give number position
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in familiars menu ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the Lic...
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in familiars menu ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the Lic...
Test for various ELF64 GOT references
;Testname=noerr; Arguments=-felf64 -ogotoff64.o; Files=stdout stderr gotoff64.o ;Testname=err; Arguments=-DERROR -felf64 -ogotoff64.o; Files=stdout stderr gotoff64.o bits 64 default rel extern foo mov r15,[foo wrt ..got] lea r12,[foo wrt ..got] %ifdef ERROR lea rax,[foo wrt ..gotoff] mov rax,[foo wrt ..gotoff...
Move health state in team menu
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in team menu ;; Copyright 2015 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License....
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in team menu ;; Copyright 2015 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License....
Set the stack-less kernel stack to a safe value
.file "context.asm" .text .align 2 .global kernel_enter .type kernel_enter, %function kernel_enter: mov r2, lr mrs r3, spsr msr cpsr, #0x9F /* system */ stmfd sp!, {r0, r2-r12, lr} mov r2, sp msr cpsr, #0x93 /* supervisor */ ldmfd sp!, {r4-r12, lr} /* mov sp, #0x1000 */ b syscall_handle (PLT) ....
.file "context.asm" .text .align 2 .global kernel_enter .type kernel_enter, %function kernel_enter: mov r2, lr mrs r3, spsr msr cpsr, #0x9F /* system */ stmfd sp!, {r0, r2-r12, lr} mov r2, sp msr cpsr, #0x93 /* supervisor */ ldmfd sp!, {r4-r12, lr} /* mov sp, #0x100000 */ b syscall_handle (PLT) ...
Make work with new BSPL ABI reqs
x0 = 0 ra = 1 dsp = 2 rsp = 3 gp = 4 gvp = 5 x16 = 16 x17 = 17 x18 = 18 include "sdtest.asm" ; exit the emulator. emu_exit: andi x16, x16, 255 slli x16, x16, 8 addi rsp, rsp, -8 sd x16, 0(rsp) csrrw x0, rsp, $780 jal x0, * ; Initialize the BSPL runtime environment. ; Then, kick off our tests. _cold: addi...
zero = 0 ra = 1 dsp = 2 ; Data stack pointer. rsp = 3 ; Return stack pointer. gvp = 4 ; Global variables pointer. gp = 13 dr16 = 5 dr17 = 6 dr18 = 7 dr19 = 8 dr20 = 9 dr21 = 10 dr22 = 11 dr23 = 12 x0 = 0 x16 = 16 x17 = 17 x18 = 18 include "sdtest.asm" ; exit the emulator. emu_exit: andi x16...
Implement yes in NASM for Mac OS X 64-bit
global _main global _start extern _puts section .text _main: add rsi, 8 _start: push rdi push rsi comp: sub rsp, 8 cmp rdi, 1 jg nz je zero nz: mov rdi, [rsi] jmp loop zero: mov rdi, y loop: call _puts add rsp, 8 pop rsi pop rdi jmp _start ret section .data y: db 'y'
Move slot color in item menu
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in the effect of items ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with th...
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in the effect of items ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with th...
Fix BR 1490407: size of the second operand of LAR/LSL
bits 64 lar ax,bx lar ax,[rsi] lar ax,word [rsi] lar eax,bx lar eax,[rsi] lar eax,word [rsi] lar rax,bx lar rax,[rsi] lar rax,word [rsi] lsl ax,bx lsl ax,[rsi] lsl ax,word [rsi] lsl eax,bx lsl eax,[rsi] lsl eax,word [rsi] lsl rax,bx lsl rax,[rsi] lsl rax,word [rsi]
Add armips patch to fix the vanilla PoR death softlock
.nds .relativeinclude on .erroronwarning on ; Fixes a vanilla bug where skipping the cutscene after you kill Death too quickly will prevent Death's boss death flag from being set. ; As a result of that bug the boss doors would relock after you exit the room, though Death himself wouldn't ever be fightable again. .ope...
Add patch to always show drop percentages in PoR
.nds .relativeinclude on .erroronwarning on ; This patch causes you to always have the Gambler Glasses effect of showing percentages instead of star ratings for enemy drops. .open "ftc/arm9.bin", 02000000h .org 0x02053074 ; Checks if you have Gambler Glasses equipped to see if it should hide the stars. mov r0, 2h ...
Add ARMIPS patch to disable sliding puzzle
.nds .relativeinclude on .erroronwarning on ; Disables the special doors of the sliding puzzle in Demon Guest House. .open "ftc/arm9.bin", 02000000h .org 0x0202738C ; This is where, upon going through any door, the game would start checking your current sector/room indexes to see if the door you went through was a...
Fix last position offset on colorwasher fx
//============================================================ // color washer routine //============================================================ colwash: lda color+$00 // load the current first color from table sta color+$28 // store in in last position of table to reset the cycle ldx #$00 ...
//============================================================ // color washer routine //============================================================ colwash: lda color+$00 // load the current first color from table sta color+$27 // store in in last position of table to reset the cycle ldx #$00 ...
Use rsp as stack pointer, not esp
[BITS 64] %include "src/asm_routines/constants.asm" global start extern rust_main section .entry start: ; update segments mov dx, gdt_selector_data ; data selector mov ss, dx ; stack segment mov ds, dx ; data segment mov es, dx ; extra segment mov fs, dx ; f-segment mov gs, dx ; g-...
[BITS 64] %include "src/asm_routines/constants.asm" global start extern rust_main section .entry start: ; update segments mov dx, gdt_selector_data ; data selector mov ss, dx ; stack segment mov ds, dx ; data segment mov es, dx ; extra segment mov fs, dx ; f-segment mov gs, dx ; g-...
Print "===" to the screen
; JUMP.ASM ; Make a jump and then hang ; Tell the compiler that this is offset 0. ; It isn't offset 0, but it will be after the jump. [ORG 0] jmp 07C0h:start ; Goto segment 07C0 start: ; Update the segment registers mov ax, cs mov ds, ax mov es, ax hang: ...
; 1.ASM ; Print "====" on the screen and hang ; Tell the compiler that this is offset 0. ; It isn't offset 0, but it will be after the jump. [ORG 0] jmp 07C0h:start ; Goto segment 07C0 start: ; Update the segment registers mov ax, cs mov ds, ax mov es, ax mov ah, ...
Add a test for various 32- and 64-bit relocations
bits 64 extern foo mov eax,[foo] mov rax,[foo] mov rax,[qword foo] mov eax,foo mov rax,dword foo mov rax,qword foo dd foo dq foo
Change name of entry function
bits 32 section .text align 4 dd 0x1BADB002 dd 0x00 dd - (0x1BADB002 + 0x00) global start extern main start: cli mov esp, kstack call main hlt section .bss resb 8192 kstack:
bits 32 section .text align 4 dd 0x1BADB002 dd 0x00 dd - (0x1BADB002 + 0x00) global start extern entry start: cli mov esp, kstack call entry hlt section .bss resb 8192 kstack:
Update patch to break balore blocks
.nds .relativeinclude on .erroronwarning on .open "ftc/overlay9_0", 0219E3E0h ; This makes it so that all melee weapons can break balore blocks, not just Julius's whip. .org 0x02212AB0 ; Branch of a switch statement taken for all melee weapons except Julius's whip. b 02212D64h ; Instead take the branch taken for J...
.nds .relativeinclude on .erroronwarning on .open "ftc/overlay9_0", 0219E3E0h ; This makes it so that all melee weapons can break balore blocks, not just Julius's whip. .org 0x02212AB0 ; Branch of a switch statement taken for all melee weapons except Julius's whip. b 02212D64h ; Instead take the branch taken for J...
Remove the branch for clarity
add $t0, $t1, $t2 sub $s0, $t0, $v0 exit beq $3, $8, 3 nop nop
add $t0, $t1, $t2 sub $s0, $t0, $v0 exit add $t0, $t1, $t2 nop nop
Fix changing starting room in PoR not changing Old Axe Armor mode's starting room
.nds .relativeinclude on .erroronwarning on .open "ftc/arm9.bin", 02000000h .org 0x02051F90 ; Where the original game's code for loading area/sector/room indexes is. b 020BFC00h ; Jump to some free space, where we will put our own code for loading the area/sector/room indexes. .org 0x020BFC00 ; Free space. mov r...
.nds .relativeinclude on .erroronwarning on .open "ftc/arm9.bin", 02000000h .org 0x02051F90 ; Where the original game's code for loading area/sector/room indexes is. b 020BFC00h ; Jump to some free space, where we will put our own code for loading the area/sector/room indexes. .org 0x020BFC00 ; Free space. mov r...
Increase items name textbox size
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in the effect of items ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with th...
;;----------------------------------------------------------------------------;; ;; Align the position of the textbox in the effect of items ;; Copyright 2014 Benito Palacios (aka pleonex) ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with th...
Test for mov [mem], sreg
global _start section .data align 16 mydword: dd 0 %include "header.inc" ; 32-bit register move should set higher bits to zero mov eax, -1 mov eax, ss and eax, 0xffff0000 ; 32-bit memory move should preserver higher bits mov dword [mydword], 0xdeadbeef mov [mydword], ss mov ...
Add patch to reveal whole map from the start for DoS
.nds .relativeinclude on .erroronwarning on ; Makes the entire map visible but greyed out from the start. .open "ftc/arm9.bin", 02000000h .org 0x020220C4 ; Make the game not care if you have the map items and just always draw unvisited tiles. mov r1, r8 nop .org 0x02024BE8 ; Makes rooms never be counted as ...
Rewrite the 16bit print routine.
; ============================================================================= ; Copyright (C) 2015 Manolis Fragkiskos Ragkousis -- see LICENSE.TXT ; ============================================================================= ;;; Print routine ;;; I push all the register to the stack. ;;; Set the bios routine for p...
; ============================================================================= ; Copyright (C) 2015 Manolis Fragkiskos Ragkousis -- see LICENSE.TXT ; ============================================================================= ;;; Print routine ;;; I push all the register to the stack. ;;; Set the bios routine for p...
Fix srg mapping in hook (round 2)
list n_IItemRenderer GETSTATIC net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.instance : Lnet/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer; ALOAD 1 INVOKEVIRTUAL net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.renderByItem (Lnet/minecraft/item/ItemStack;)V ...
list n_IItemRenderer GETSTATIC net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.field_147719_a : Lnet/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer; ALOAD 1 INVOKEVIRTUAL net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.func_179022_a (Lnet/minecraft/item/ItemSt...
Add patch to fix DoS tower boss in boss rando
.nds .relativeinclude on .erroronwarning on ; This patch for the boss randomizer prevents the boss in Gergoth's tower from being loaded in until the player enters the top floor of the tower. ; In order for the patch to work correctly, the boss entity should be at index 1 and the tower floors entity should be at index ...
Add basic background cycler example that is confirmed to work with 6502.Net.
.cpu "6502" .target "flat" * = $F000 BackgroundColor = $80 VSYNC = $00 VBLANK = $01 WSYNC = $02 COLUBK = $09 TIM64T = $296 INTIM = $284 Start SEI CLD LDX #$FF TXS LDA #0 ClearMem STA 0,X DEX BNE ClearMem MainLoop LDA #%00000010 STA VSYNC STA WSYNC STA WSYNC STA WSYNC LDA #43 STA TIM64T LDA #0 STA ...
Test of some addressing modes in 64-bit mode.
bits 64 mov rdx,[rax] mov eax,[byte rsp+0x01] mov eax,[byte rsp-0x01] mov eax,[byte rsp+0xFF] mov eax,[byte rsp-0xFF] mov eax,[rsp+0x08] mov eax,[rsp-0x01] mov eax,[rsp+0xFF] mov eax,[rsp-0xFF] mov rax,[rsp+56] mov [rsi],dl mov byte [rsi],'-' mov [rsi],al mov byte [rsi],' '
Add test for problematic floats
;; Known problematic floating-point numbers and their proper ;; encoding... dd 1.1e10 dd 0x5023e9ac ; Should be... dd 50.40e9 dd 0x513bc130 ; Should be... dq 1.4e23 dq 0x44bda56a4b0835c0 dq 50.48e21 dq 0x44a5610d7502feae dt 1.2e28 dq 0x9b18ab5df7180b6c dw 0x405c dt 50.46e25 dq 0xd0b...
Add test cases for IP-relative addressing
bits 64 ; extern foo mov rax,[foo] mov rax,[123456789abcdef0h] mov rbx,[foo] mov rax,[dword foo] mov rbx,[dword foo] mov rax,[qword foo] mov rax,[rel foo] mov rbx,[rel foo] mov rax,[rel dword foo] mov rax,[rel qword foo] mov rax,[es:foo] mov rax,[es:123456789abcdef0h] mov rbx,[es:foo] mov rax,[dword es:...
Switch dos stub processor spec to 386.
; Copyright 2011 Google Inc. ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, ...
; Copyright 2012 Google Inc. ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, ...
Add dependent types into EEPROM API
%{# #include <avr/eeprom.h> %} fun eeprom_read_byte (address: int): uint8 = "mac#" fun eeprom_write_byte (address: int, value: uint8): void = "mac#"
%{# #include <avr/eeprom.h> %} fun eeprom_read_byte {n:nat} (address: int n): uint8 = "mac#" fun eeprom_write_byte {n:nat} (address: int n, value: uint8): void = "mac#"
Include C raw source code
implement main0 () = ()
%{^ #include "LPC17xx.h" %} %{ volatile int g_LoopDummy; void c_blink(void) { LPC_GPIO1->FIODIR |= 1 << 18; // P1.18 connected to LED1 while(1) { int i; LPC_GPIO1->FIOPIN ^= 1 << 18; // Toggle P1.18 for (i = 0 ; i < 5000000 && !g_LoopDummy ; i++) { } } } %} extern fun c_blink (): void = "mac#" implem...
Add type to mbed interface
%{^ #include "mbed_interface.h" %} typedef char_p = cPtr0(char) fun mbed_mac_address: (char_p) -> void = "mac#"
Allow Creation of Hostname When File is Missing
(* Module: Hostname Parses /etc/hostname and /etc/mailname Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Hostname = autoload xfm (* View: lns *) let lns = [ label "hostname" . store Rx.word . Util.eol ] (* View: filter *...
(* Module: Hostname Parses /etc/hostname and /etc/mailname Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Hostname = autoload xfm (* View: lns *) let lns = [ label "hostname" . store Rx.word . Util.eol ] | Util.empty (* V...
Remove bogus reset of 'record' counter
# Parsing /etc/inittab #map # grammar inittab # include '/etc/inittab' '/system/config/inittab' #end grammar inittab token SEP ':' token EOL '\n' file: ( comment | record ) * comment: ( /#.*?\n/ | /[ \t]*\n/ ) record: counter 'record' . [ seq 'record' . [ label 'id' . store ..?...
# Parsing /etc/inittab map grammar inittab include '/etc/inittab' '/system/config/inittab' end grammar inittab token SEP ':' token EOL '\n' file: ( comment | record ) * comment: ( /#.*?\n/ | /[ \t]*\n/ ) record: [ seq 'record' . [ label 'id' . store ..? ] . SEP . ...
Remove trailing white spaces from puppet test
(* Tests for the PuppetFileserver module *) module Test_puppetfileserver = let fileserver = "# This a comment [mount1] # Mount1 options path /etc/puppet/files/%h allow host.domain1.com allow *.domain2.com deny badhost.domain2.com [mount2] allow * deny *.evil.example.com deny badhost.domain2.com [moun...
(* Tests for the PuppetFileserver module *) module Test_puppetfileserver = let fileserver = "# This a comment [mount1] # Mount1 options path /etc/puppet/files/%h allow host.domain1.com allow *.domain2.com deny badhost.domain2.com [mount2] allow * deny *.evil.example.com deny badhost.domain2.com [moun...
Add Sep.equal, used in nrpe.aug
(* Module: Sep Generic separators to build lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPLv2+, like the rest of Augeas. *) module Sep = let colon = Util.del_str ":" let comma = Util.del_str "," let space = del Rx.space " " let tab = del Rx.space "\t" let...
(* Module: Sep Generic separators to build lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPLv2+, like the rest of Augeas. *) module Sep = let colon = Util.del_str ":" let comma = Util.del_str "," let equal = Util.del_str "=" let space = del Rx.space " " let ...
Fix syntax error in test
module Fail_union_atype = (* This is illegal, otherwise we don't know which alternative *) (* to take for a tree { "a" = "?" } *) let del_str (s:string) = del s s let lns = [ key /a/ . store /b/ . del_str " (l)" | [ key /a/ . store /c/ . del_str " (r)" ] (* To make thi...
module Fail_union_atype = (* This is illegal, otherwise we don't know which alternative *) (* to take for a tree { "a" = "?" } *) let del_str (s:string) = del s s let lns = [ key /a/ . store /b/ . del_str " (l)" ] | [ key /a/ . store /c/ . del_str " (r)" ] (* To make thi...
Fix put test - it was checking for hte wrong result
module Pass_subtree_growth = (* Make sure that a subtree that is not the lowest one does indeed *) (* grow the tree, instead of just setting the label of an enclosed *) (* subtree. This is only a problem if the enclosed subtree does *) (* not have a label *) ...
module Pass_subtree_growth = (* Make sure that a subtree that is not the lowest one does indeed *) (* grow the tree, instead of just setting the label of an enclosed *) (* subtree. This is only a problem if the enclosed subtree does *) (* not have a label *) ...
Add more recent nagios lens
(* Module: NagiosConfig Parses /etc/{nagios{3,},icinga/*.cfg Authors: Sebastien Aperghis-Tramoni <sebastien@aperghis.net> Raphaël Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files ...
Add test for radicale lens
module Test_radicale = let conf = " [server] [encoding] [well-known] [auth] [git] [rights] [storage] [logging] [headers] " test Radicale.lns get conf = {} { "server" {} } { "encoding" {} } { "well-known" {} } { "auth" {} } { "git" ...
Add basic EPSG augeas lens
module EPSG = let proj = [ key /[^\/= \t\n]+/ . (Sep.equal . store Rx.no_spaces)? ] let entry = [ Util.del_str "<" . key Rx.integer . Util.del_str ">" . Sep.space . Build.opt_list proj Sep.space . Sep.space . Util.del_str "<>" . Util.eol ] let lns = (Util.empty | Util.comment | entry)*
Add /etc/mtab to known files
(* Parsing /etc/fstab *) module Fstab = autoload xfm let sep_tab = Sep.tab let sep_spc = Sep.space let comma = Sep.comma let eol = Util.eol let comment = Util.comment let empty = Util.empty let word = Rx.neg1 let spec = /[^,# \n\t][^ \n\t]*/ let comma_sep_list (l:string) = let...
(* Parsing /etc/fstab *) module Fstab = autoload xfm let sep_tab = Sep.tab let sep_spc = Sep.space let comma = Sep.comma let eol = Util.eol let comment = Util.comment let empty = Util.empty let word = Rx.neg1 let spec = /[^,# \n\t][^ \n\t]*/ let comma_sep_list (l:string) = let...
Store comments in subtrees so they are restored properly
# Parsing /etc/inittab map grammar pam # We really need to be able to exclude some files, like # backup files and .rpmsave files include '/etc/pam.d/*' '/system/config/pam' $basename end grammar pam token SEP /[ \t]+/ = '\t' token EOL '\n' token CONTROL /(\[[^\]]*\]|[^ \t]+)/ = 'none' token POUND_TO_...
# Parsing /etc/inittab map grammar pam # We really need to be able to exclude some files, like # backup files and .rpmsave files include '/etc/pam.d/*' '/system/config/pam' $basename end grammar pam token SEP /[ \t]+/ = '\t' token EOL '\n' token CONTROL /(\[[^\]]*\]|[^ \t]+)/ = 'none' token POUND_TO_...
Check that let expressions work
(* Test let expressions *) module Pass_let_exp = (* This definition is insanely roundabout; it's written that way *) (* since we want to exercise LET expressions *) let lns = let lbl = "a" in let spc = " " in let del_spaces (s:string) = del spc+ s in let del_str (s:string) = ...
Add another shortcut for Listary
#NoTrayIcon #Persistent #SingleInstance force #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ...
#NoTrayIcon #Persistent #SingleInstance force #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ...
Update for new bnet title scheme
email = %1% passwrd = %2% Checkd() { WinWait Blizzard App Login, ,3 WinMove 0, 0 WinActivate IfWinNotActive { Checkd() } if ErrorLevel { MsgBox unable to find Battle.net login window. Please record trying to login and report it at j20.pw/bnethelp exit } ...
email = %1% passwrd = %2% Checkd() { WinWait Blizzard Battle.net Login, ,3 WinMove 0, 0 WinActivate IfWinNotActive { Checkd() } if ErrorLevel { MsgBox unable to find Battle.net login window. Please record trying to login and report it at j20.pw/bnethelp exit...
Add hotkeys for changing keyboard language.
; ahk_class PotPlayer #SC01F::Send {Media_Play_Pause} $+1::Send {!} $+2::Send {@} $+3::Send {#} $+4::Send {$} $+5::Send {`%} $+6::Send {^} ;$+7::Send {&} $+8::Send {*}
#InstallKeybdHook #SingleInstance Force ; ahk_class PotPlayer #SC01F::Send {Media_Play_Pause} $+1::Send {!} $+2::Send {@} $+3::Send {#} $+4::Send {$} $+5::Send {`%} $+6::Send {^} ;$+7::Send {&} $+8::Send {*} GetKeyboardLayout() { HKL := DllCall("GetKeyboardLayout", "UInt", 0, "Ptr") Return HKL } GetKeyboardLayou...
Add special characters for Persian keyboard.
; ahk_class PotPlayer #SC01F::Send {Media_Play_Pause}
; ahk_class PotPlayer #SC01F::Send {Media_Play_Pause} $+1::Send {!} $+2::Send {@} $+3::Send {#} $+4::Send {$} $+5::Send {`%} $+6::Send {^} ;$+7::Send {&} $+8::Send {*}
Add reliable setup in conjunction with SharpKeys
FileEncoding, UTF-8 ; This file needs to be saved/encoded with "UTF-8 with BOM" ; Use Swedish characters on US-English keyboard ![:: Send, å !+{:: Send, Å !':: Send, ä !+':: Send, Ä !;:: Send, ö !+;:: Send, Ö ; does not work ; HHKB settings to mimic macOS behavior on Windows ; Lwin = <^ LWin::LCtrl <^Right:: Send, ...
FileEncoding, UTF-8 ; This file needs to be saved/encoded with "UTF-8 with BOM" ; Use Swedish characters on US-English keyboard ![:: Send, å !+{:: Send, Å !':: Send, ä !+':: Send, Ä !;:: Send, ö !+;:: Send, Ö ; does not work ; HHKB settings to mimic macOS behavior on Windows LWin::LCtrl ; this one is better to use...
Add path onto which to store this file
FileEncoding, UTF-8 ; This file needs to be saved/encoded with "UTF-8 with BOM" ; Use Swedish characters on US-English keyboard ![:: Send, å !+{:: Send, Å !':: Send, ä !+':: Send, Ä !;:: Send, ö !+;:: Send, Ö ; HHKB settings to mimic macOS behavior on Windows LWin::LCtrl ; this one is better to use SharpKeys for, a...
; Put this file in ; %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup FileEncoding, UTF-8 ; This file needs to be saved/encoded with "UTF-8 with BOM" ; Use Swedish characters on US-English keyboard ![:: Send, å !+{:: Send, Å !':: Send, ä !+':: Send, Ä !;:: Send, ö !+;:: Send, Ö ; HHKB settings to mimic macOS...
Add ahk-script to duplicate window width (useful with vertical monitors)
+#Up:: WinGetActiveTitle, Title WinRestore, %Title% SysGet, X1, 76 SysGet, Y1, 77 SysGet, Width, 78 SysGet, Height, 79 WinMove, %Title%,, X1, Y1, Width, Height return
Add simple AHK script to test mouse wheel jumping
~WheelDown:: GoingDown := True if GoingUp { MsgBox, , Problem, Mouse wheel is jumping VarSetCapacity(GoingDown,0) } return ~WheelUp:: GoingUp := True if GoingDown { MsgBox, , Problem, Mouse wheel is jumping VarSetCapacity(GoingUp,0) } return
Update for new login window
email = %1% passwrd = %2% Checkd() { WinWait Blizzard App Login, ,3 WinMove 0, 0 WinActivate IfWinNotActive { Checkd() } if ErrorLevel { MsgBox unable to find Battle.net login window. Please record trying to login and report it at j20.pw/bnethelp exit } ...
Add AHK for leftover debug dialog at completion of install/uninstall
#NoEnv SendMode Input SetWorkingDir %A_ScriptDir% SetTitleMatchMode, 1 ;matches if title begins with string DetectHiddenText, off ;will not search hidden window text DetectHiddenWindows, off ;will not detect hidden windows WinWait, Sandboxie ahk_class #32770, DONE, 120 WinActivate Send,{Enter} ExitApp
Add a script to launch the 'keep window on top' from other programs
#NoTrayIcon #Persistent #SingleInstance force #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ...
Add AHK script to reset cursor position for all pages in a section
#NoEnv #NoTrayIcon #SingleInstance force #Warn SendMode Input SetTitleMatchMode, 3 SetWorkingDir, %A_ScriptDir% procName := "ONENOTE.EXE" ; Set cursor to page title for all pages in the current section !q:: IfWinActive, ahk_exe %ProcName% { Send !{Home} Loop, 31 { Send ^+T Send {Home} ...
Add AutoHotkey configuration for np2
; Muhenkan (PC98 NFER key) LWin::Send {vk1D} ; Henkan (PC98 XFER key) ;RWin::Send {vk1C} ;^RWin::Send {vk1C} AppsKey::Send {vk1C} ^AppsKey::Send ^{vk1C} ;Muhenkan / 無変換 -> {vk1D} ;Henkan / 変換 -> {vk1C} ;Kana / かな -> {vkF2} ;IME ON/OF -> {vkF3}, {vkF4}
Add small windows autohotkey script.
Capslock::Ctrl ; Window management #h::SendEvent #{Left} #l::SendEvent #{Right} #j::SendEvent #{Down} #k::SendEvent #{Up} ; Windows Explorer Navigation #IfWinActive, ahk_class CabinetWClass ^h:: ControlGet renamestatus,Visible,,Edit1,A ControlGetFocus focussed, A if(renamestatus!=1&&(focussed=DirectUIHWND3...
Add new prefixes: feature, refactor and update
#!/usr/bin/awk -f BEGIN { # Determines whether to print 'Unreleased' banner at top UNRELEASED_COMMITS = 1 # Prefixes that determine whether a commit will be printed CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat): " FS="|" while ("git log --pretty='%D|%s|%H'" | getline) { IS_GIT_TAG = length($1) && match($1...
#!/usr/bin/awk -f BEGIN { # Determines whether to print 'Unreleased' banner at top UNRELEASED_COMMITS = 1 # Prefixes that determine whether a commit will be printed CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): " FS="|" while ("git log --pretty='%D|%s|%H'" | getline) { IS_GIT_TAG ...
Make sure newline at end of file
# Print lines from a WebScraper csv file after joining extra newlines # INVOCATION: # awk -f fixExtraLinesFrom-webscraper.awk BritBoxPrograms.csv { if (/^"/) printf ("\n" $0) else printf }
# Print lines from a WebScraper csv file after joining extra newlines # INVOCATION: # awk -f fixExtraLinesFrom-webscraper.awk BritBoxPrograms.csv { if (/^"/) printf ("\n" $0) else printf } END { printf ("\n") }
Update to output in markdown format
#!/usr/bin/awk -f BEGIN { # Determines whether to print 'Unreleased' banner at top UNRELEASED_COMMITS = 1 # Prefixes that determine whether a commit will be printed CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): " FS="|" while ("git log --pretty='%D|%s|%H'" | getline) { IS_GIT_TAG ...
#!/usr/bin/awk -f BEGIN { REPO_URL = getRepoURL() # Prefixes that determine whether a commit will be printed CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): " FS="|" # %D: tags # %s: commit message # %H: long hash # %h: short hash while ("git log --pretty='%D|%s|%H|%h'" | getline) ...
Clarify that input must be sorted
#!/usr/bin/env awk -f # # Computes the median. # # Usage: median # # Input: # - a column of numbers # # Output: # - median value BEGIN { i = 0 } { a[i++] = $1 } END { j = i/2 if ( i%2 == 1 ) { median = a[int(j)] } else { median = (a[j] + a[j-1])/2 } print median }
#!/usr/bin/env awk -f # # Computes the median. # # Usage: median # # Input: # - a sorted column of numbers # # Output: # - median value BEGIN { i = 0 } { a[i++] = $1 } END { j = i/2 if ( i%2 == 1 ) { median = a[int(j)] } else { median = (a[j] + a[j-1])/2 } print median }
Exclude any target with "Test" in the name
BEGIN { FS = "\n"; } /Targets:/ { while (getline && $0 != "") { if ($0 ~ /Tests/) continue; sub(/^ +/, ""); print; } }
BEGIN { FS = "\n"; } /Targets:/ { while (getline && $0 != "") { if ($0 ~ /Test/) continue; sub(/^ +/, ""); print; } }
Make this link against gtk+-3.24.4
#!/usr/bin/awk # # Patch the generated wrapper Swift code to handle special cases # BEGIN { depr_init = 0 } /open .* ColorSelection/ { depr_init = 1 } /public .* ColorSelection/ { depr_init = 1 } /public .* HSV/ { depr_init = 1 } /open .* HSV/ { depr_init = 1 } / init.. {/ { if (depr_init) { printf("@available(*, de...
#!/usr/bin/awk # # Patch the generated wrapper Swift code to handle special cases # BEGIN { depr_init = 0 ; comment = 0 } /open .* ColorSelection/ { depr_init = 1 } /public .* ColorSelection/ { depr_init = 1 } /public .* HSV/ { depr_init = 1 } /open .* HSV/ { depr_init = 1 } /open .* HSV/ { depr_init = 1 } /func getCol...
Revert "Fix bracket expression matches a character at gawk"
BEGIN { print "V1.0 {"; print " global:"; } { # Remove the CR character in case the sources are mapped from # a Windows share and contain CRLF line endings gsub(/\r/,"", $0); # Skip empty lines and comment lines starting with semicolon if (NF && !match($0, /^[[:space:]]*;/)) { print " " $0 ";";...
BEGIN { print "V1.0 {"; print " global:"; } { # Remove the CR character in case the sources are mapped from # a Windows share and contain CRLF line endings gsub(/\r/,"", $0); # Skip empty lines and comment lines starting with semicolon if (NF && !match($0, /^[:space:]*;/)) { print " " $0 ";"; ...
Include header files whose path begins with ../ .
#!/bin/awk # # $Id$ { if (NR == 1) { print } else { for (i = 1; i <= NF; i++) { if ($i ~ /^include\// || $i ~ /^src\// || $i ~ /^obj\// || $i == "\\") printf " " $i } print "" } }
#!/bin/awk # # $Id$ { if (NR == 1) { print } else { for (i = 1; i <= NF; i++) { if ($i ~ /^include\// || $i ~ /^src\// || $i ~ /^obj\// || $i ~ /^\.\.\// || $i == "\\") printf " " $i } print "" } }
Fix an output formatting bug in the rewriter script.
BEGIN{ now = systime() format = "%Y/%m/%d %H:%M:%S" } { split($1, DATE, "/") split($2, TIME, ":") $1 = "" $2 = "" t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3]) if (delta == "") { delta = no...
BEGIN{ now = systime() format = "%Y/%m/%d %H:%M:%S" } { split($1, DATE, "/") split($2, TIME, ":") t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3]) if (delta == "") { delta = now - t } out = st...
Fix awk script to work with cairo generated postscript
BEGIN{doit = 0} { if (doit) print $0 } $0 == "%%EndSetup" { doit = 1 }
BEGIN{doit = 0} { if (doit) print $0 } $0 = /%%End.*Setup/ { doit = 1 }
Add year differentation into monthly report
#!/usr/bin/awk -f BEGIN { FS = "," } $1 == "pld" { p += $2 } $1 == "val" { v += $2 } { "date -d "$3" +%B" | getline month monthly[month][$1] += $2 categorically[$1][$4] += $2 } END { print "Val spent "v"€" print "PLD spent "p"€" if ( p < v ) print "PLD owe "v - p"€ to val." else if ( p ...
#!/usr/bin/awk -f BEGIN { FS = "," } $1 == "pld" { p += $2 } $1 == "val" { v += $2 } { "date -d "$3" '+%B %Y'" | getline month_and_year monthly[month_and_year][$1] += $2 categorically[$1][$4] += $2 } END { print "Val spent "v"€" print "PLD spent "p"€" if ( p < v ) print "PLD owe "v - p"€ to v...
Support also different version of Hadoop (=Fedora).
# # Parsing output of: # # hdfs dfs -du -s '/user/*' # function dbstr(s) { if (s) { return "'" s "'" } else { return "NULL" } } function dbi(i) { if (i >= 0) { return i } else { return "NULL" } } BEGIN { FS="[ \t/]+" print "INSERT INTO measure (name) VALUES ('quota');"; } { used=$1 user=$4 print "INSERT IN...
# # Parsing output of: # # hdfs dfs -du -s '/user/*' # function dbstr(s) { if (s) { return "'" s "'" } else { return "NULL" } } function dbi(i) { if (i >= 0) { return i } else { return "NULL" } } BEGIN { FS="[ \t/]+" print "INSERT INTO measure (name) VALUES ('quota');"; } /^[0-9]+[ ]+[0-9]+[ ]+\/.*/ { used...
Add identifier KEY so we can see where we are in -v script
{ title = $0 if (match (title, /, The"$/)) { sub (/^"/,"\"The ", title) sub (/, The"$/,"\"", title) } printf ("echo ==\\> %3d: %s\n",NR,title) >> TITLES_SCRIPT printf ("./getIMDbInfoFrom-titles.py %s\n",title) >> TITLES_SCRIPT printf ("echo \n\n") >> TITLES_SCRIPT printf ("e...
{ title = $0 if (match (title, /, The"$/)) { sub (/^"/,"\"The ", title) sub (/, The"$/,"\"", title) } if (FILENAME ~ /Acorn/) KEY = "A" if (FILENAME ~ /BBox/) KEY = "B" if (FILENAME ~ /MHz/) KEY = "M" if (FILENAME ~ /Watched/) KEY = "W" ...
Add a close command to avoid too many files opened problems (encountered with large libpcap file)
BEGIN { session_count = 0; FS="|" OFS="|" } { if ($3 ~ "[0-9]+") { # See if the current line is already in the table frame_file = destDir "/frames/Frame"$3".html" session_line = "" "grep -i \"" session_token "\" " frame_file | getline session_line if (session_line == "" ) { $6 = "{0}...
BEGIN { session_count = 0; FS="|" OFS="|" } { if ($3 ~ "[0-9]+") { # See if the current line is already in the table frame_file = destDir "/frames/Frame"$3".html" session_line = "" "grep -i \"" session_token "\" " frame_file | getline session_line close(grep) if (session_line == "" ) {...
Define KEY_MAX for Python. (dm)
############################################################################### # BRLTTY - A background process providing access to the console screen (when in # text mode) for a blind person using a refreshable braille display. # # Copyright (C) 1995-2006 by The BRLTTY Developers. # # BRLTTY comes with ABSOLU...
############################################################################### # BRLTTY - A background process providing access to the console screen (when in # text mode) for a blind person using a refreshable braille display. # # Copyright (C) 1995-2006 by The BRLTTY Developers. # # BRLTTY comes with ABSOLU...
Use a file name prefix for generated labels
#!/usr/bin/awk -f # # Adds github compatible labels to level 1 and 2 markdown headings # in underline style. # # # Substitute github references with doxygen references. # /\(#[_a-z0-9-]*\)/ { gsub(/\(#[_a-z0-9-]*\)/, "<__REF__&__REF__>") gsub(/<__REF__\(#/, "(@ref ") gsub(/\)__REF__>/, ")") } # # If this line is u...
#!/usr/bin/awk -f # # Adds github compatible labels to level 1 and 2 markdown headings # in underline style. # # # Get file name prefix for references. # filename != FILENAME { filename = FILENAME # strip path "pwd" | getline path path = path "/" prefix = substr(filename, 1, length(path)) == path \ ? su...
Fix an awk script that doesn't seem to be very portable
BEGIN { } function extension(str){ n = split(str, parts, ".") if (n == 1){ return "<NO EXTENSION>" } else { return parts[n] } } $2 != "total" { by_type[extension($2)] += $1 } $2 ~ "CMakeLists.txt" { #cmake should not count as text by_type["txt"] -= $1 by_type["cmake"] += $1 } $2 ~ "test" { ...
BEGIN { } function getExtension(str){ n = split(str, parts, ".") if (n == 1){ return "<NO EXTENSION>" } else { return parts[n] } } $2 != "total" { by_type[getExtension($2)] += $1 } $2 ~ "CMakeLists.txt" { #cmake should not count as text by_type["txt"] -= $1 by_type["cmake"] += $1 } $2 ~ "tes...
Fix the modules path in the xpi chrome.manifests
{ content = $1 ~ /^(content|skin|locale)$/ } content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF } content { sub(/^\.\./, "", $NF); $NF = "jar:chrome/" name ".jar!" $NF } { sub("^\\.\\./liberator/", "", $NF) print }
{ content = $1 ~ /^(content|skin|locale)$/ } content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF } content { sub(/^\.\./, "", $NF); $NF = "jar:chrome/" name ".jar!" $NF } { sub("^\\.\\./common/", "", $NF) print }
Print last two lines in Avg
# Generate MHz_TV_Shows_minutes.csv by processing SHORT_SPREADSHEET to figure # average episode length # BEGIN { FS = "\t" } /^Title/ { printf ("%s\t%s\t%s\t%s\tAvg Len\t%s\t%s\t%s\t%s\t%s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9) } /=HYPERLINK/ { dur=$4 sub (/h/,"",dur) sub (/m/,"",dur) s...
# Generate MHz_TV_Shows_minutes.csv by processing SHORT_SPREADSHEET to figure # average episode length # BEGIN { FS = "\t" } /^Title/ { printf ("%s\t%s\t%s\t%s\tAvg Len\t%s\t%s\t%s\t%s\t%s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9) } /=HYPERLINK/ { dur=$4 sub (/h/,"",dur) sub (/m/,"",dur) s...
Handle mscorwks_unixexports.src with better regexp operator for compatibility
BEGIN { print "V1.0 {"; print " global:"; } { # Remove the CR character in case the sources are mapped from # a Windows share and contain CRLF line endings gsub(/\r/,"", $0); # Skip empty lines and comment lines starting with semicolon if (NF && !match($0, /^[:space:]*;/)) { print " " $0 ";"; ...
BEGIN { print "V1.0 {"; print " global:"; } { # Remove the CR character in case the sources are mapped from # a Windows share and contain CRLF line endings gsub(/\r/,"", $0); # Skip empty lines and comment lines starting with semicolon if (NF && !match($0, /^[ \t]*;/)) { print " " $0 ";"; } } ...
Fix for symbol table demangled names with spaces
# # Converts the output of 'nm' into a C source containing an array of symbols # that correspond to functions (t and T in terms of 'nm'). # # Usage: # nm -n image | awk -f nm2c.awk # # Date: Aug 28, 2012 # Author: Eldar Abusalimov # BEGIN { print "/* Auto-generated file. Do not edit. */"; print ""; print "#inc...
# # Converts the output of 'nm' into a C source containing an array of symbols # that correspond to functions (t and T in terms of 'nm'). # # Usage: # nm -n image | awk -f nm2c.awk # # Date: Aug 28, 2012 # Author: Eldar Abusalimov # BEGIN { print "/* Auto-generated file. Do not edit. */"; print ""; print "#inc...
Fix the pair generation and also speed up the sorting
#!/usr/bin/awk -f BEGIN { FS = OFS = "\t"; } { len = split($3, words, ", "); if (length(N) > 0 && len >= N) next; for (i = 1; i <= len - 1; i++) { for (j = i + 1; j <= len; j++) { print words[i], words[j], ORS, words[j], words[i] | "sort --parallel=$(nproc) -us"; } } }
#!/usr/bin/awk -f BEGIN { FS = "\t"; OFS = ""; } { len = split($3, words, ", "); if (length(N) > 0 && len >= N) next; for (i = 1; i <= len - 1; i++) { for (j = i + 1; j <= len; j++) { print words[i], FS, words[j], ORS, words[j], FS, words[i] | "sort --parallel=$(nproc) -S1G -u...
Handle cases where system time is adjusted backwards (e.g. by NTP).
{ if (1==NR) { startTimestamp = substr($1, 2, length($1) - 2) printf(";$FILEVERSION=1.3\n") printf(";$STARTTIME=%u.%u\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \ 10000000000 / 86400 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - m...
{ if (1==NR) { startTimestamp = substr($1, 2, length($1) - 2) printf(";$FILEVERSION=1.3\n") printf(";$STARTTIME=%u.%u\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \ 10000000000 / 86400 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - m...
Mark CVaListPointer array generators as unavailable on Linux
#!/usr/bin/awk # # Patch the generated wrapper Swift code to handle special cases # BEGIN { etpInit = 0 } /public convenience init.T: ErrorTypeProtocol./ { etpInit = 1 print " /// Convenience copy constructor, creating a unique copy" print " /// of the passed in Error. Needs to be freed using free()" print "...
#!/usr/bin/awk # # Patch the generated wrapper Swift code to handle special cases # BEGIN { etpInit = 0 ; vaptrptr = 0 } /public convenience init.T: ErrorTypeProtocol./ { etpInit = 1 print " /// Convenience copy constructor, creating a unique copy" print " /// of the passed in Error. Needs to be freed using f...
Check named_enable rather than just named_flags. PR: 3893 (sort of)
# $Id: ndcedit.awk,v 1.4 1997/02/22 16:08:19 peter Exp $ NR == 3 { print "#" print "# This file is generated automatically, do not edit it here!" print "# Please change src/usr.sbin/ndc/ndcedit.awk instead" print "#" print "" print "# If there is a global system configuration file, suck it in." print "if [ -f /...
# $Id: ndcedit.awk,v 1.5 1997/05/27 07:19:57 jkh Exp $ NR == 3 { print "#" print "# This file is generated automatically, do not edit it here!" print "# Please change src/usr.sbin/ndc/ndcedit.awk instead" print "#" print "" print "# If there is a global system configuration file, suck it in." print "if [ -f /et...
Fix extra comma in json file
BEGIN { FS = "\"" } /\/us\/movie\// { numMovies += 1 shortURL = $6 printf ("%s \"https://www.britbox.com%s\"", trailingComma, shortURL) >> EPISODES_JSON_FILE trailingComma = ",\n" } /\/us\/show\// { numShows += 1 shortURL = $6 printf ("%s \"https://www.britbox.com%s\"", trailingC...
BEGIN { FS = "\"" } /\/us\/movie\// { numMovies += 1 shortURL = $6 printf ("%s \"https://www.britbox.com%s\"", trailingEpisodesComma, shortURL) \ >> EPISODES_JSON_FILE trailingEpisodesComma = ",\n" } /\/us\/show\// { numShows += 1 shortURL = $6 printf ("%s \"https://www.b...
Add script for generating vendor header include lines
# Usage: awk -f <this_script> vendor/MKxxxx.h vendor/MKxxyy.h vendor/MKzzz.h ... /Processor[s]?:/ { i=0; if (FNR == NR) { printf "#if"; } else { printf "#elif"; } while(match($0, /MK.*/)) { if (i>0) { printf " || \\\n "; } printf " defined(CPU_MO...
Add new script for gln testing report
#!/usr/bin/awk -f # cat *.tdb | tdbout -t publisher,plugin,publisher:info[tester],status BEGIN { FS="\t" pn = 0 } { nn = split($2,na,/\./) lp2 = na[nn] if (!(($1,lp2) in b)) { p[pn] = $1 n[pn] = lp2 # n[pn] = $2 r[pn] = $3 pn++ } b[$1,lp2]++ c[$1,lp2,$4]++ ...
Add AWK script to generate a frequency table from a column of numbers
#!/usr/bin/env awk -f # # Generates a frequency table. # # Usage: frequency_table # # Input: # - a column of numbers # # Output: # - frequency table { total += 1 table[$1] += 1 } END { for (v in table) { count = table[v] print v OFS count OFS count/total } }