2009-02-01から1ヶ月間の記事一覧

libharu:HPDFPage#get_line_cap

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_line_cap で、 2009022800.rb:8:in `get_line_cap': can't convert false into Integer (TypeError) from 2009022800.rb:8「return NUM2INT(i);」は「return INT2NUM(…

Commons Lang、Fraction#longValue()

import org.apache.commons.lang.math.Fraction; public class C2009022800 { public static void main(String[] args) { System.out.println(Fraction.ONE.longValue()); System.out.println(Fraction.ONE_HALF.longValue()); System.out.println(Fraction.…

値を返す、値を使う

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t"> } TOKEN : { <NUM: (["0"-"9"])+> } void Input() : { int i; } { ( i = Int() </num:></space:>…

libharu:HPDFPage#get_line_width

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_line_width で、 1.0

Commons Lang、Fraction#invert()

import org.apache.commons.lang.math.Fraction; public class C2009022700 { public static void main(String[] args) { System.out.println(Fraction.ONE.invert()); System.out.println(Fraction.ONE_HALF.invert()); System.out.println(Fraction.ONE_TH…

角括弧の前の「~」

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <ANY: ~[]> } void Input() : {} { ( <ANY> )+ <EOF> } で、 abc xyz</eof></any></any:></space:>…

libharu:HPDFPage#get_trans_matrix

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_trans_matrix で、 [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]

Commons Lang、Fraction#intValue()

import org.apache.commons.lang.math.Fraction; public class C2009022600 { public static void main(String[] args) { System.out.println(Fraction.ONE.intValue()); System.out.println(Fraction.ONE_HALF.intValue()); System.out.println(Fraction.ON…

簡単な例:角括弧 再び

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <ABC: ["a"-"c"]> | <DEFGH: ["d"-"e", "f"-"g", "h"]> } void Input() : {}…</defgh:></abc:></space:>

libharu:HPDFPage#get_current_font_size

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_current_font_size font = pdf.get_font("Helvetica", nil) page.set_font_and_size(font, 24.0) p page.get_current_font_size で、 0.0 24.0

Commons Lang、Fraction#hashCode()

import org.apache.commons.lang.math.Fraction; public class C2009022500 { public static void main(String[] args) { System.out.println(Fraction.ONE.hashCode()); System.out.println(Fraction.ONE.hashCode()); System.out.println(Fraction.ONE_HAL…

簡単な例:ルールの入れ子

SimpleExamples/Simple2.jj 改 PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t"> } void Input() : {} { ( Ru</space:>…

libharu:HPDFPage#get_current_font

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page font = page.get_current_font p font begin rescue p font.get_font_name end font = pdf.get_font("Helvetica", nil) page.set_font_and_size(font, 24.0) font = page.get_cur…

Commons Lang、Fraction.getReducedFraction()

import org.apache.commons.lang.math.Fraction; public class C2009022400 { public static void main(String[] args) { System.out.println(Fraction.getReducedFraction(1, 2)); System.out.println(Fraction.getReducedFraction(1, 3)); } } で、 1/2 1/3

簡単な例:SPECIAL_TOKEN

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t"> } TOKEN : { <A: "a"> | <B: "b"> | <C: "c"> } SPECIAL_TOKEN : { <D: "d"> | <E: "e"> | <F: "f"> } v…</f:></e:></d:></c:></b:></a:></space:>

libharu:HPDFPage#get_current_text_pos

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page font = pdf.get_font("Helvetica", nil) page.set_font_and_size(font, 24.0) p page.get_current_pos p page.get_current_text_pos #page.move_to(100, 100) p page.get_current…

Commons Lang、Fraction#getProperWhole()

import org.apache.commons.lang.math.Fraction; public class C2009022300 { public static void main(String[] args) { System.out.println(Fraction.ONE.getProperWhole()); System.out.println(Fraction.ONE_HALF.getProperWhole()); System.out.println…

簡単な例:アクション

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t"> } void Input() : {} { ( ( "a" )* "\n" )+ { System.out.p</space:>…

libharu:HPDFPage#get_current_pos

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_current_pos page.move_to(100, 100) p page.get_current_pos pdf.save_to_file(File.basename($0, ".rb") + ".pdf") で、 [0.0, 0.0] [100.0, 100.0]

Commons Lang、Fraction#getProperNumerator()

import org.apache.commons.lang.math.Fraction; public class C2009022200 { public static void main(String[] args) { System.out.println(Fraction.ONE.getProperNumerator()); System.out.println(Fraction.ONE_HALF.getProperNumerator()); System.out…

簡単な例:角括弧

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } void Input() : {} { [ "a" ] <EOF> } で、 a a Exception in </eof></space:>…

libharu:HPDFPage#get_gmode

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_gmode pdf.save_to_file(File.basename($0, ".rb") + ".pdf") で、 1

Commons Lang、Fraction#getNumerator()

import org.apache.commons.lang.math.Fraction; public class C2009022100 { public static void main(String[] args) { System.out.println(Fraction.ONE.getNumerator()); System.out.println(Fraction.ONE_HALF.getNumerator()); System.out.println(Fra…

簡単な例:0以上の繰り返し

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } void Input() : {} { ( "a" )* <EOF> } で、 a aa aaa b Excep</eof></space:>…

libharu:HPDFPage#text_width, #measure_text

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page font = pdf.get_font("Helvetica", nil) page.set_font_and_size(font, 24.0) p page.text_width("foo") p page.measure_text("foo", 20, 1) p page.measure_text("foo", 50, 1) …

Commons Lang、Fraction.getFraction()

import org.apache.commons.lang.math.Fraction; public class C2009022000 { public static void main(String[] args) { System.out.println(Fraction.getFraction(1)); System.out.println(Fraction.getFraction(1.0)); System.out.println(Fraction.getFr…

簡単な例:選択

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> | <B: "b"> | <C: "c"> } void Input() : {} { ( <A> | <B> | <C> …</c></b></a></c:></b:></a:></space:>

libharu:HPDFPage#get_width, #get_height

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_width p page.get_height pdf.save_to_file(File.basename($0, ".rb") + ".pdf") で、 595.0 841.0

Commons Lang、Fraction#getDenominator()

import org.apache.commons.lang.math.Fraction; public class C2009021900 { public static void main(String[] args) { System.out.println(Fraction.ONE.getDenominator()); System.out.println(Fraction.ONE_HALF.getDenominator()); System.out.println…

簡単な例:空白のスキップをしない

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) void Input() : {} { ( "a" )+ } で、 a aa Exception in thread "mai…