func (s *SketchSourceMerger) Run(ctx *types.Context) error {
	sketch := ctx.Sketch

	lineOffset := 0
	includeSection := ""
	if !sketchIncludesArduinoH(&sketch.MainFile) {
		includeSection += "#include <Arduino.h>\n"
		lineOffset++
	}
	includeSection += "#line 1 " + utils.QuoteCppString(sketch.MainFile.Name) + "\n"
	lineOffset++
	ctx.IncludeSection = includeSection

	source := includeSection
	source += addSourceWrappedWithLineDirective(&sketch.MainFile)
	lineOffset += 1
	for _, file := range sketch.OtherSketchFiles {
		source += addSourceWrappedWithLineDirective(&file)
	}

	ctx.LineOffset = lineOffset
	ctx.Source = source

	return nil
}
func (s *PrototypesAdder) Run(ctx *types.Context) error {
	debugOutput := ctx.DebugPreprocessor
	source := ctx.Source

	source = strings.Replace(source, "\r\n", "\n", -1)
	source = strings.Replace(source, "\r", "\n", -1)

	sourceRows := strings.Split(source, "\n")

	firstFunctionLine := ctx.PrototypesLineWhereToInsert
	if isFirstFunctionOutsideOfSource(firstFunctionLine, sourceRows) {
		return nil
	}

	insertionLine := firstFunctionLine + ctx.LineOffset - 1
	firstFunctionChar := len(strings.Join(sourceRows[:insertionLine], "\n")) + 1
	prototypeSection := composePrototypeSection(firstFunctionLine, ctx.Prototypes)
	ctx.PrototypesSection = prototypeSection
	source = source[:firstFunctionChar] + prototypeSection + source[firstFunctionChar:]

	if debugOutput {
		fmt.Println("#PREPROCESSED SOURCE")
		prototypesRows := strings.Split(prototypeSection, "\n")
		prototypesRows = prototypesRows[:len(prototypesRows)-1]
		for i := 0; i < len(sourceRows)+len(prototypesRows); i++ {
			if i < insertionLine {
				fmt.Printf("   |%s\n", sourceRows[i])
			} else if i < insertionLine+len(prototypesRows) {
				fmt.Printf("PRO|%s\n", prototypesRows[i-insertionLine])
			} else {
				fmt.Printf("   |%s\n", sourceRows[i-len(prototypesRows)])
			}
		}
		fmt.Println("#END OF PREPROCESSED SOURCE")
	}
	ctx.Source = source

	return nil
}