Skip to content

Instantly share code, notes, and snippets.

View voidlizard's full-sized avatar

Dmitry Zuikov voidlizard

View GitHub Profile
#define __crc_h_
#include <stdint.h>
#define CRC32_POLY 0x04C11DB7
#define CRC32_INIT_REM 0xFFFFFFFF
#define CRC32_FINAL_XOR 0xFFFFFFFF
#define CRC32R_POLY 0xEDB88320
#define CRC32R_INIT_REM 0xFFFFFFFF
<class name="reportDia1" extends="modaldialog">
<simplelayout axis="y" spacing="10"/>
<vbox spacing="12">
<datapath xpath="ds_report_init:/report/params"/>
<hbox spacing="15" datapath="param">
<text width="100" datapath="text()"/>
<edittext width="200" datapath="@value" with="formfield"
fieldtype="$path{'@type'}"
fieldname="$path{'@key'}"
//
// NanoVM, a tiny java VM for the Atmel AVR family
// Copyright (C) 2005 by Till Harbaum <Till@Harbaum.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
/* VM BEGIN */
#ifdef BEEPVM_JMP_INTERPETER
JUMP(0);
#endif
/* VM END */
OPCODES_BEGIN
OP(NOP) {
NEXT();
}
initPort p fd = do
tattr' <- getTerminalAttributes fd
let init = [ (`withInputSpeed` B9600)
,(`withOutputSpeed` B9600)
,(`withoutMode` EnableParity)
,(`withoutMode` TwoStopBits)
,(`withoutMode` ProcessOutput)
,(`withoutMode` ProcessInput)
,(`withoutMode` KeyboardInterrupts)
,(`withoutMode` EnableEcho)
let port opts =
let fd = openfile opts.opt_port [O_RDWR] 0
in let ta = tcgetattr fd
in let ta' = { ta with
c_obaud = opts.opt_baudrate;
c_ibaud = opts.opt_baudrate;
c_istrip = false;
c_inlcr = false;
c_igncr = false;
c_icrnl = false;
/***************************************************
($ foreign "display" display ((:string) :unit) $)
($ foreign "newline" newline ((:unit) :unit) $)
($ foreign "sleep" sleep ((:int) :unit ) $)
(define (pysh s) (display s))
($ typeof main ((:unit) :unit) $)
(define (main)
/*
($ foreign "display" display ((:string) :unit) $)
($ foreign "newline" newline ((:unit) :unit) $)
($ foreign "sleep" sleep ((:int) :unit ) $)
(define (pysh s) (display s))
($ typeof main ((:unit) :unit) $)
/*
($ foreign "display" display ((:string) :unit) $)
($ foreign "newline" newline ((:unit) :int) $)
($ foreign "sleep" sleep ((:int) :) $)
(define (pysh s) (display s))
($ typeof main ((:unit) :unit) $)
(define (main)
@voidlizard
voidlizard / gist:1262287
Created October 4, 2011 17:46
hopc closures work in a first approach
dmz@slim:~/hop$ cat t/hof2.hop
;; ($ foreign "display" display ((:string) :unit) $)
#lang scheme
(define (fa) "A")
(define (fb) "B")
(define (func1) (let ((s (fa)) (s1 (fb)))
(lambda (x) (let ((z "qqq"))
(begin (display s)