Class: Spoolprint::SpoolPrint
- Inherits:
-
Object
- Object
- Spoolprint::SpoolPrint
- Defined in:
- ext/native/spoolprint.c
Instance Method Summary collapse
Constructor Details
#initialize(*args) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'ext/native/spoolprint.c', line 51
VALUE spoolprintInit(int argc, VALUE* argv, VALUE self) {
VALUE namaDoc;
sp_ket ket;
char* nama = "\0";
size_t tempuh = 0;
MUAT_DATA(ket);
rb_scan_args(argc, argv, "01", &namaDoc);
if (argc > 0) {
Check_Type(namaDoc, RUBY_T_STRING);
nama = RSTRING_PTR(namaDoc);
}
while(*nama != 0 && ++tempuh < NAMA_JOB_MAX) {
*ket->tumpuan++ = *nama++;
}
ket->panjangNamaJob = ket->tumpuan - ket->teks;
*ket->tumpuan++ = 0;
}
|
Instance Method Details
#cetak ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'ext/native/spoolprint.c', line 71
VALUE spoolprintCetak(VALUE self) {
char *nDoc = ASAL_NAMA_DOC, *dicetak;
size_t panjang;
sp_ket ket;
MUAT_DATA(ket);
if (ket->panjangNamaJob > 0) {
nDoc = ket->teks;
dicetak = ket->teks + ket->panjangNamaJob + 2;
} else {
dicetak = ket->teks + 1;
}
if (*dicetak != 0x1b || *(dicetak + 1) != 0x40) return Qnil;
panjang = ket->tumpuan - dicetak;
return INT2FIX(spoolprint_dalam(nDoc, dicetak, panjang));
}
|
#taruh_raw(raw) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'ext/native/spoolprint.c', line 89
VALUE spoolprintRaw(VALUE self, VALUE raw) {
char* jukir;
size_t panjang;
sp_ket ket;
MUAT_DATA(ket);
Check_Type(raw, RUBY_T_STRING);
jukir = RSTRING_PTR(raw);
panjang = RSTRING_LEN(raw);
if (ket->tumpuan - ket->teks + panjang < PANJANG_TEKS) {
while (panjang--) *ket->tumpuan++ = *jukir++;
return Qtrue;
} else {
return Qfalse;
}
}
|