This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "interface.h" | |
void initialize(void) | |
{ | |
puts("Common Initialize\n"); | |
#if defined(PLATFORM_A) | |
puts("Initialize A\n"); | |
#elif defined(PLATFORM_B) | |
puts("Initialize B\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "interface.h" | |
void initialize(void) | |
{ | |
puts("Common Initialize\n"); | |
#if defined(PLATFORM_A) | |
puts("Initialize A\n"); | |
#elif defined(PLATFORM_B) | |
puts("Initialize B\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __INTERFACE__ | |
#define __INTERFACE__ | |
void initialize(void); | |
void do_stuff(void); | |
void cleanup(void); | |
#endif /* __INTERFACE__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "common.h" | |
#include "interface.h" | |
void initialize(void) | |
{ | |
common_initialize(); | |
puts("Initialize A\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "common.h" | |
#include "interface.h" | |
void initialize(void) | |
{ | |
common_initialize(); | |
puts("Initialize B\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int truncate_and_call(fn_ptr *fns, int index, char *user_string) | |
{ | |
char buf[64]; | |
// Truncate supplied string | |
strncpy(buf, user_string, sizeof(buf) - 1); | |
buf[sizeof(buf) - 1] = '\0'; | |
return fns[index](buf); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rx2Hlvk (Qy, | |
nUD, | |
t9, | |
zYH9 N | |
ksyIBG | |
qdE | |
lTq, | |
p -> (-> BIYUk)) | |
J | |
(Pd9VS B4UHTB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PRhIBRoYtbd5wqmJc1, | |
p2Zaa, | |
OtV4mBDJAEb19, | |
rAK_02Df7vsHH, | |
daQoBMUx9Aj7YDUMJ, | |
LlezBIRdO2YNa, | |
uzv, | |
wj evM | |
e2gSpGd0J1UTmebP_V | |
j1NdPRUoE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example depends on parsec >= 3.0 and the indents package >= 0.3.2. | |
To install indents, run the following command: | |
cabal install indents | |
> module Main where | |
> import Text.Parsec | |
> import Text.Parsec.Indent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Text.Parsec | |
import Text.Parsec.String | |
input_text :: String | |
input_text = "foo123:" | |
main :: IO () | |
main = do |