diff options
Diffstat (limited to 'kviewshell/plugins/djvu/libdjvu')
33 files changed, 272 insertions, 272 deletions
diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuDocEditor.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuDocEditor.cpp index 62a07442..67223e1f 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuDocEditor.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuDocEditor.cpp @@ -468,7 +468,7 @@ DjVuDocEditor::insert_file(const GURL &file_url, const GUTF8String &parent_id, // Strip any INCL chunks file_pool=strip_incl_chunks(file_pool); - // Check if tqparent ID is valid + // Check if parent ID is valid GP<DjVmDir::File> parent_frec(dir->id_to_file(parent_id)); if (!parent_frec) parent_frec=dir->name_to_file(parent_id); @@ -499,7 +499,7 @@ DjVuDocEditor::insert_file(const GURL &file_url, const GUTF8String &parent_id, files_map[id]=f; } - // And insert it into the tqparent DjVuFile + // And insert it into the parent DjVuFile parent_file->insert_file(id, chunk_num); return id; @@ -966,7 +966,7 @@ DjVuDocEditor::remove_file(const GUTF8String &id, bool remove_unref, GMap<GUTF8String, void *> & ref_map) // Private function, which will remove file with ID id. // - // If will also remove all INCL chunks in tqparent files pointing + // If will also remove all INCL chunks in parent files pointing // to this one // // Finally, if remove_unref is TRUE, we will go down the files @@ -982,9 +982,9 @@ DjVuDocEditor::remove_file(const GUTF8String &id, bool remove_unref, for(GPosition pos=*parents;pos;++pos) { const GUTF8String parent_id((*parents).key(pos)); - const GP<DjVuFile> tqparent(get_djvu_file(parent_id)); - if (tqparent) - tqparent->unlink_file(id); + const GP<DjVuFile> parent(get_djvu_file(parent_id)); + if (parent) + parent->unlink_file(id); } delete parents; parents=0; diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuDocument.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuDocument.cpp index 51da0692..3b33d943 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuDocument.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuDocument.cpp @@ -1391,12 +1391,12 @@ DjVuDocument::add_to_cache(const GP<DjVuFile> & f) void DjVuDocument::notify_file_flags_changed(const DjVuFile * source, - long set_tqmask, long clr_tqmask) + long set_mask, long clr_mask) { // Don't check here if the document is initialized or not. // This function may be called when it's not. // check(); - if (set_tqmask & DjVuFile::DECODE_OK) + if (set_mask & DjVuFile::DECODE_OK) { set_file_aliases(source); if (cache) add_to_cache((DjVuFile *) source); @@ -1414,7 +1414,7 @@ DjVuDocument::notify_file_flags_changed(const DjVuFile * source, process_threqs(); } - if (set_tqmask & DjVuFile::DATA_PRESENT) + if (set_mask & DjVuFile::DATA_PRESENT) process_threqs(); // May be we can extract thumbnails now } diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuDocument.h b/kviewshell/plugins/djvu/libdjvu/DjVuDocument.h index 91ab849b..418d0814 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuDocument.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuDocument.h @@ -800,7 +800,7 @@ public: virtual GP<DjVuFile> id_to_file(const DjVuPort * source, const GUTF8String &id); virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url); virtual void notify_file_flags_changed(const DjVuFile * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); virtual GList<GURL> get_url_names(void); virtual void set_recover_errors(ErrorRecoveryAction=ABORT); diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuFile.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuFile.cpp index 564cdb0c..862c5fd0 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuFile.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuFile.cpp @@ -398,10 +398,10 @@ DjVuFile::notify_chunk_done(const DjVuPort *, const GUTF8String &) void DjVuFile::notify_file_flags_changed(const DjVuFile * src, - long set_tqmask, long clr_tqmask) + long set_mask, long clr_mask) { check(); - if (set_tqmask & (DECODE_OK | DECODE_FAILED | DECODE_STOPPED)) + if (set_mask & (DECODE_OK | DECODE_FAILED | DECODE_STOPPED)) { // Signal threads waiting for file termination finish_mon.enter(); @@ -414,7 +414,7 @@ DjVuFile::notify_file_flags_changed(const DjVuFile * src, chunk_mon.leave(); } - if ((set_tqmask & ALL_DATA_PRESENT) && src!=this && + if ((set_mask & ALL_DATA_PRESENT) && src!=this && are_incl_files_created() && is_data_present()) { if (src!=this && are_incl_files_created() && is_data_present()) @@ -931,7 +931,7 @@ DjVuFile::decode_chunk( const GUTF8String &id, const GP<ByteStream> &gbs, desc.format( ERR_MSG("DjVuFile.tqshape_dict") "\t%d", fgjd->get_tqshape_count() ); } - // Sjbz (JB2 encoded tqmask) + // Sjbz (JB2 encoded mask) else if (chkid=="Sjbz" && (djvu || djvi)) { if (this->fgjb) @@ -943,19 +943,19 @@ DjVuFile::decode_chunk( const GUTF8String &id, const GP<ByteStream> &gbs, // ---- end hack fgjb->decode(gbs, static_get_fgjd, (void*)this); this->fgjb = fgjb; - desc.format( ERR_MSG("DjVuFile.fg_tqmask") "\t%d\t%d\t%d", + desc.format( ERR_MSG("DjVuFile.fg_mask") "\t%d\t%d\t%d", fgjb->get_width(), fgjb->get_height(), get_dpi(fgjb->get_width(), fgjb->get_height())); } - // Smmr (MMR-G4 encoded tqmask) + // Smmr (MMR-G4 encoded mask) else if (chkid=="Smmr" && (djvu || djvi)) { if (this->fgjb) G_THROW( ERR_MSG("DjVuFile.dupl_Sxxx") ); set_can_compress(true); this->fgjb = MMRDecoder::decode(gbs); - desc.format( ERR_MSG("DjVuFile.G4_tqmask") "\t%d\t%d\t%d", + desc.format( ERR_MSG("DjVuFile.G4_mask") "\t%d\t%d\t%d", fgjb->get_width(), fgjb->get_height(), get_dpi(fgjb->get_width(), fgjb->get_height())); } diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuFile.h b/kviewshell/plugins/djvu/libdjvu/DjVuFile.h index 6f81c8e4..e81ef2d5 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuFile.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuFile.h @@ -215,9 +215,9 @@ public: GP<IW44Image> bg44; /// Pointer to the background component of DjVu image (Raw). GP<GPixmap> bgpm; - /// Pointer to the tqmask of foreground component of DjVu image (JB2 encoded). + /// Pointer to the mask of foreground component of DjVu image (JB2 encoded). GP<JB2Image> fgjb; - /// Pointer to the optional tqshape dictionary for the tqmask (JB2 encoded). + /// Pointer to the optional tqshape dictionary for the mask (JB2 encoded). GP<JB2Dict> fgjd; /// Pointer to a colors layer for the foreground component of DjVu image. GP<GPixmap> fgpm; @@ -610,7 +610,7 @@ public: virtual bool inherits(const GUTF8String &class_name) const; virtual void notify_chunk_done(const DjVuPort * source, const GUTF8String &name); virtual void notify_file_flags_changed(const DjVuFile * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); virtual void set_recover_errors(const ErrorRecoveryAction=ABORT); virtual void set_verbose_eof(const bool verbose_eof=true); virtual void report_error(const GException &ex,const bool=true); diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.cpp index 772583ec..b31b04bf 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.cpp @@ -142,7 +142,7 @@ DjVuProgressTask::set_callback(djvu_progress_callback *_callback) } DjVuProgressTask::DjVuProgressTask(const char *xtask,int nsteps) - : task(xtask),tqparent(0), nsteps(nsteps), runtostep(0), gdata(0), data(0) + : task(xtask),parent(0), nsteps(nsteps), runtostep(0), gdata(0), data(0) { // gtask=task; { @@ -158,7 +158,7 @@ DjVuProgressTask::DjVuProgressTask(const char *xtask,int nsteps) startdate = curdate; if (!d.head) d.lastsigdate = curdate + INITIAL; - tqparent = d.head; + parent = d.head; d.head = this; } } @@ -171,8 +171,8 @@ DjVuProgressTask::~DjVuProgressTask() { if (data->head != this) G_THROW( ERR_MSG("DjVuGlobal.not_compatible") ); - data->head = tqparent; - if (!tqparent) + data->head = parent; + if (!parent) { unsigned long curdate = GOS::ticks(); if((*(data->callback))(data->gtask?data->gtask:"",curdate-startdate, curdate-startdate)) @@ -210,9 +210,9 @@ DjVuProgressTask::signal(unsigned long curdate, unsigned long estdate) { const unsigned long enddate = startdate+ (unsigned long)(((float)(estdate-startdate) * (float)nsteps) / (float)inprogress); - if (tqparent) + if (parent) { - tqparent->signal(curdate, enddate); + parent->signal(curdate, enddate); } else if (data && data->callback && curdate<enddate) { diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.h b/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.h index 1e52d698..3d26c8cf 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuGlobal.h @@ -268,7 +268,7 @@ public: const char *task; static djvu_progress_callback *set_callback(djvu_progress_callback *ptr=0); private: - DjVuProgressTask *tqparent; + DjVuProgressTask *parent; int nsteps; int runtostep; unsigned long startdate; diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuImage.h b/kviewshell/plugins/djvu/libdjvu/DjVuImage.h index 30fc9898..84c9165d 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuImage.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuImage.h @@ -185,13 +185,13 @@ public: function returns a null pointer until the decoder actually processes an #"BGjp"# chunk. */ GP<GPixmap> get_bgpm() const; - /** Returns a pointer to the tqmask of the foreground component of a DjVu - image. The tqmask of the foreground component is always a JB2 image in + /** Returns a pointer to the mask of the foreground component of a DjVu + image. The mask of the foreground component is always a JB2 image in this implementation. This function returns a null pointer until the decoder actually processes an #"Sjbz"# chunk. */ GP<JB2Image> get_fgjb() const; /** Returns a pointer to the colors of the foreground component of a DjVu - image. The tqmask of the foreground component is always a small pixmap in + image. The mask of the foreground component is always a small pixmap in this implementation. This function returns a null pointer until the decoder actually processes an #"FG44"# chunk. */ GP<GPixmap> get_fgpm() const; @@ -284,7 +284,7 @@ public: \begin{verbatim} DJVU Image (2325x3156) version 17: 0.0 Kb 'INFO' Page information. - 17.3 Kb 'Sjbz' JB2 foreground tqmask (2325x3156) + 17.3 Kb 'Sjbz' JB2 foreground mask (2325x3156) 2.5 Kb 'BG44' IW44 background (775x1052) 1.0 Kb 'FG44' IW44 foreground colors (194x263) 3.0 Kb 'BG44' IW44 background (part 2). @@ -318,7 +318,7 @@ public: /** This function returns true if this object contains a well formed {\em Bilevel DjVu Image}. Calling function #get_bitmap# on a well formed bilevel image should always return a non zero value. Note that function - #get_bitmap# works as soon as a foreground tqmask component is present, + #get_bitmap# works as soon as a foreground mask component is present, regardless of the fact that the image follows the rules or not. */ int is_legal_bilevel() const; /** This function returns true if this object contains a well formed {\em @@ -351,7 +351,7 @@ public: This function returns a null pointer if there is not enough information in the DjVu image to properly render the desired image. */ GP<GPixmap> get_pixmap(const GRect &rect, const GRect &all, double gamma=0) const; - /** Renders the tqmask of the foreground layer of the DjVu image. This + /** Renders the mask of the foreground layer of the DjVu image. This functions is a wrapper for \Ref{JB2Image::get_bitmap}. Argument #align# specified the tqalignment of the rows of the returned images. Setting #align# to #4#, for instance, will adjust the bitmap border in order to diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuPalette.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuPalette.cpp index a3f11bd0..4e49fe12 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuPalette.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuPalette.cpp @@ -107,7 +107,7 @@ fmin(float a, float b) DjVuPalette::DjVuPalette() - : tqmask(0), hist(0), pmap(0) + : mask(0), hist(0), pmap(0) { } @@ -124,7 +124,7 @@ DjVuPalette::operator=(const DjVuPalette &ref) { delete hist; delete pmap; - tqmask = 0; + mask = 0; palette = ref.palette; colordata = ref.colordata; } @@ -132,7 +132,7 @@ DjVuPalette::operator=(const DjVuPalette &ref) } DjVuPalette::DjVuPalette(const DjVuPalette &ref) - : tqmask(0), hist(0), pmap(0) + : mask(0), hist(0), pmap(0) { this->operator=(ref); } @@ -147,18 +147,18 @@ DjVuPalette::allocate_hist() if (! hist) { hist = new GMap<int,int>; - tqmask = 0; + mask = 0; } else { GMap<int,int> *old = hist; hist = new GMap<int,int>; - tqmask = (tqmask<<1)|(0x010101); + mask = (mask<<1)|(0x010101); for (GPosition p = *old; p; ++p) { int k = old->key(p); int w = (*old)[p]; - (*hist)[k | tqmask] += w; + (*hist)[k | mask] += w; } delete old; } @@ -540,7 +540,7 @@ DjVuPalette::decode(GP<ByteStream> gbs) delete pmap; hist = 0; pmap = 0; - tqmask = 0; + mask = 0; // Code version int version = bs.read8(); if ( (version & 0x7f) != DJVUPALETTEVERSION) diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuPalette.h b/kviewshell/plugins/djvu/libdjvu/DjVuPalette.h index 1195bf5a..7f9884f1 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuPalette.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuPalette.h @@ -210,7 +210,7 @@ public: private: // Histogram - int tqmask; + int mask; GMap<int,int> *hist; // Quantization data struct PColor { unsigned char p[4]; }; @@ -240,7 +240,7 @@ DjVuPalette::histogram_clear() { delete hist; hist = 0; - tqmask = 0; + mask = 0; } inline void @@ -250,7 +250,7 @@ DjVuPalette::histogram_add(const unsigned char *bgr, int weight) { if (!hist || hist->size()>=0x4000) allocate_hist(); - int key = (bgr[0]<<16)|(bgr[1]<<8)|(bgr[2])|(tqmask); + int key = (bgr[0]<<16)|(bgr[1]<<8)|(bgr[2])|(mask); (*hist)[key] += weight; } } @@ -271,7 +271,7 @@ DjVuPalette::histogram_norm_and_add(const int *bgr, int weight) int p2 = bgr[2]/weight; if (p2>255) p2=255; if (!hist || hist->size()>=0x4000) allocate_hist(); - int key = (p0<<16)|(p1<<8)|(p2)|(tqmask); + int key = (p0<<16)|(p1<<8)|(p2)|(mask); (*hist)[key] += weight; } } diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuPort.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuPort.cpp index 16b873ba..8cf9b967 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuPort.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuPort.cpp @@ -576,22 +576,22 @@ DjVuPortcaster::notify_chunk_done(const DjVuPort * source, const GUTF8String &na void DjVuPortcaster::notify_file_flags_changed(const DjVuFile * source, - long set_tqmask, long clr_tqmask) + long set_mask, long clr_mask) { GPList<DjVuPort> list; compute_closure(source, list); for(GPosition pos=list; pos; ++pos) - list[pos]->notify_file_flags_changed(source, set_tqmask, clr_tqmask); + list[pos]->notify_file_flags_changed(source, set_mask, clr_mask); } void DjVuPortcaster::notify_doc_flags_changed(const DjVuDocument * source, - long set_tqmask, long clr_tqmask) + long set_mask, long clr_mask) { GPList<DjVuPort> list; compute_closure(source, list); for(GPosition pos=list; pos; ++pos) - list[pos]->notify_doc_flags_changed(source, set_tqmask, clr_tqmask); + list[pos]->notify_doc_flags_changed(source, set_mask, clr_mask); } void diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuPort.h b/kviewshell/plugins/djvu/libdjvu/DjVuPort.h index 430b7842..3e63c901 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuPort.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuPort.h @@ -230,20 +230,20 @@ public: \end{itemize} @param source \Ref{DjVuFile}, which flags have been changed - @param set_tqmask bits, which have been set - @param clr_tqmask bits, which have been cleared */ + @param set_mask bits, which have been set + @param clr_mask bits, which have been cleared */ virtual void notify_file_flags_changed(const class DjVuFile * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); /** This notification is sent after the \Ref{DjVuDocument} flags have been changed. This happens, for example, after it receives enough data and can determine its structure (#BUNDLED#, #OLD_INDEXED#, etc.). @param source \Ref{DjVuDocument}, which flags have been changed - @param set_tqmask bits, which have been set - @param clr_tqmask bits, which have been cleared */ + @param set_mask bits, which have been set + @param clr_mask bits, which have been cleared */ virtual void notify_doc_flags_changed(const class DjVuDocument * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); /** This notification is sent from time to time while decoding is in progress. The purpose is obvious: to provide a way to know how much @@ -459,13 +459,13 @@ public: function in each of the ports from the destination list starting from the closest. */ virtual void notify_file_flags_changed(const class DjVuFile * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); /** Computes destination list for #source# and calls the corresponding function in each of the ports from the destination list starting from the closest. */ virtual void notify_doc_flags_changed(const class DjVuDocument * source, - long set_tqmask, long clr_tqmask); + long set_mask, long clr_mask); /** Computes destination list for #source# and calls the corresponding function in each of the ports from the destination list starting from diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp index c6606a48..6b460864 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuText.cpp @@ -183,14 +183,14 @@ DjVuTXT::Zone::memuse() const #ifndef NEED_DECODER_ONLY void DjVuTXT::Zone::encode( - const GP<ByteStream> &gbs, const Zone * tqparent, const Zone * prev) const + const GP<ByteStream> &gbs, const Zone * parent, const Zone * prev) const { ByteStream &bs=*gbs; // Encode type bs.write8(ztype); // Modify text_start and bounding rectangle based on the context - // (whether there is a previous non-zero same-level-child or tqparent) + // (whether there is a previous non-zero same-level-child or parent) int start=text_start; int x=rect.xmin, y=rect.ymin; int width=rect.width(), height=rect.height(); @@ -212,13 +212,13 @@ DjVuTXT::Zone::encode( y=y-prev->rect.ymin; } start-=prev->text_start+prev->text_length; - } else if (tqparent) + } else if (parent) { - // Encode offset from the upper left corner of the tqparent + // Encode offset from the upper left corner of the parent // in the coord system in that corner with x to the right and y down - x=x-tqparent->rect.xmin; - y=tqparent->rect.ymax-(y+height); - start-=tqparent->text_start; + x=x-parent->rect.xmin; + y=parent->rect.ymax-(y+height); + start-=parent->text_start; } // Encode rectangle bs.write16(0x8000+x); @@ -243,7 +243,7 @@ DjVuTXT::Zone::encode( void DjVuTXT::Zone::decode(const GP<ByteStream> &gbs, int maxtext, - const Zone * tqparent, const Zone * prev) + const Zone * parent, const Zone * prev) { ByteStream &bs=*gbs; // Decode type @@ -273,11 +273,11 @@ DjVuTXT::Zone::decode(const GP<ByteStream> &gbs, int maxtext, y=y+prev->rect.ymin; } text_start+=prev->text_start+prev->text_length; - } else if (tqparent) + } else if (parent) { - x=x+tqparent->rect.xmin; - y=tqparent->rect.ymax-(y+height); - text_start+=tqparent->text_start; + x=x+parent->rect.xmin; + y=parent->rect.ymax-(y+height); + text_start+=parent->text_start; } rect=GRect(x, y, width, height); // Get tqchildren size @@ -484,12 +484,12 @@ DjVuTXT::Zone::get_smallest(GList<GRect> &list, const int padding) const } void -DjVuTXT::get_zones(int zone_type, const Zone *tqparent, +DjVuTXT::get_zones(int zone_type, const Zone *parent, GList<Zone *> & zone_list) const - // get all the zones of type zone_type under zone node tqparent + // get all the zones of type zone_type under zone node parent { - // search all branches under tqparent - const Zone *zone=tqparent; + // search all branches under parent + const Zone *zone=parent; for( int cur_ztype=zone->ztype; cur_ztype<zone_type; ++cur_ztype ) { GPosition pos; diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuText.h b/kviewshell/plugins/djvu/libdjvu/DjVuText.h index 1db6da10..54708324 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuText.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuText.h @@ -148,10 +148,10 @@ public: /** Finds the smallest rectangles and appends them to the list. */ void get_smallest(GList<GRect> &list) const; /** Finds the smallest rectangles and appends them to the list after - padding the smallest unit to fit width or height for the tqparent rectangle + padding the smallest unit to fit width or height for the parent rectangle and adding the number of specified pixels. */ void get_smallest(GList<GRect> &list,const int padding) const; - /// Find out this Zone's tqparent. + /// Find out this Zone's parent. const Zone *get_parent(void) const; private: friend class DjVuTXT; @@ -161,9 +161,9 @@ public: unsigned int memuse() const; static const int version; void encode(const GP<ByteStream> &bs, - const Zone * tqparent=0, const Zone * prev=0) const; + const Zone * parent=0, const Zone * prev=0) const; void decode(const GP<ByteStream> &bs, int maxtext, - const Zone * tqparent=0, const Zone * prev=0); + const Zone * parent=0, const Zone * prev=0); }; /** Textual data for this page. The content of this string is encoded using the UTF8 code. @@ -207,9 +207,9 @@ public: GList<Zone*> find_text_in_rect(GRect target_rect, GUTF8String &text) const; /** Find the text specified by the rectangle. */ GList<GRect> find_text_with_rect(const GRect &box, GUTF8String &text, const int padding=0) const; - /** Get all zones of zone type zone_type under node tqparent. + /** Get all zones of zone type zone_type under node parent. zone_list contains the return value. */ - void get_zones(int zone_type, const Zone *tqparent, GList<Zone *> & zone_list) const; + void get_zones(int zone_type, const Zone *parent, GList<Zone *> & zone_list) const; /** Returns the number of bytes needed by this data structure. It's used by caching routines to estimate the size of a \Ref{DjVuImage}. */ unsigned int get_memory_usage() const; diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuToPS.cpp b/kviewshell/plugins/djvu/libdjvu/DjVuToPS.cpp index a45a9112..618cb108 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuToPS.cpp +++ b/kviewshell/plugins/djvu/libdjvu/DjVuToPS.cpp @@ -456,12 +456,12 @@ store_doc_setup(ByteStream &str) write(str, "%% -- procs for foreground layer\n" "/g {gsave 0 0 0 0 5 index 5 index setcachedevice\n" - " true [1 0 0 1 0 0] 5 4 roll imagetqmask grestore\n" + " true [1 0 0 1 0 0] 5 4 roll imagemask grestore\n" "} bind def\n" "/gn {gsave 0 0 0 0 6 index 6 index setcachedevice\n" " true [1 0 0 1 0 0] 3 2 roll 5 1 roll \n" " { 1 sub 0 index 2 add 1 index 1 add roll\n" - " } imagetqmask grestore pop \n" + " } imagemask grestore pop \n" "} bind def\n" "/c {setcolor rmoveto glyphshow} bind def\n" "/s {rmoveto glyphshow} bind def\n" @@ -1180,22 +1180,22 @@ print_fg(ByteStream &str, { unsigned char * row_bits = (*bitmap)[current_row]; unsigned char acc = 0; - unsigned char tqmask = 0; + unsigned char mask = 0; for(int current_col=0; current_col<columns; current_col++) { - if (tqmask == 0) - tqmask = 0x80; + if (mask == 0) + mask = 0x80; if (row_bits[current_col]) - acc |= tqmask; - tqmask >>= 1; - if (tqmask == 0) + acc |= mask; + mask >>= 1; + if (mask == 0) { *s=acc; s++; - acc = tqmask = 0; + acc = mask = 0; } } - if (tqmask != 0) + if (mask != 0) { *s=acc; s++; @@ -1584,16 +1584,16 @@ print_image_lev1(ByteStream &str, { unsigned char *pix = (*bm)[y]; unsigned char acc = 0; - unsigned char tqmask = 0; + unsigned char mask = 0; char *data; for (int x=grectBand.width(); x>0; x--, pix++) { - if (tqmask == 0) - tqmask = 0x80; + if (mask == 0) + mask = 0x80; if (! *pix) - acc |= tqmask; - tqmask >>= 1; - if (tqmask == 0) + acc |= mask; + mask >>= 1; + if (mask == 0) { data = bin2hex[acc]; acc = 0; @@ -1607,7 +1607,7 @@ print_image_lev1(ByteStream &str, } } } - if (tqmask != 0) + if (mask != 0) { data = bin2hex[acc]; *buf_ptr++ = data[0]; @@ -2230,10 +2230,10 @@ create(void) void DjVuToPS::DecodePort:: notify_file_flags_changed(const DjVuFile *source, - long set_tqmask, long clr_tqmask) + long set_mask, long clr_mask) { // WARNING! This function is called from another thread - if (set_tqmask & (DjVuFile::DECODE_OK | + if (set_mask & (DjVuFile::DECODE_OK | DjVuFile::DECODE_FAILED | DjVuFile::DECODE_STOPPED )) { diff --git a/kviewshell/plugins/djvu/libdjvu/DjVuToPS.h b/kviewshell/plugins/djvu/libdjvu/DjVuToPS.h index 761b6e23..95d547bb 100644 --- a/kviewshell/plugins/djvu/libdjvu/DjVuToPS.h +++ b/kviewshell/plugins/djvu/libdjvu/DjVuToPS.h @@ -121,7 +121,7 @@ public: would be your best choice. \item[Mode] ({\em COLOR}, {\em FORE}, {\em BACK}, or {\em BW}) Specifies how the \Ref{DjVuImage}s will be rendered (all layers, - foreground layer, background layer, and the tqmask respectively) + foreground layer, background layer, and the mask respectively) \item[Color] ({\em TRUE} or {\em FALSE}). Choosing {\em FALSE} converts color images to gray scale. \item[Gamma] Printer color correction. diff --git a/kviewshell/plugins/djvu/libdjvu/GBitmap.cpp b/kviewshell/plugins/djvu/libdjvu/GBitmap.cpp index 223a43e1..696367e7 100644 --- a/kviewshell/plugins/djvu/libdjvu/GBitmap.cpp +++ b/kviewshell/plugins/djvu/libdjvu/GBitmap.cpp @@ -814,19 +814,19 @@ GBitmap::read_pbm_raw(ByteStream &bs) for (int n = nrows-1; n>=0; n--) { unsigned char acc = 0; - unsigned char tqmask = 0; + unsigned char mask = 0; for (int c = 0; c<ncolumns; c++) { - if (!tqmask) + if (!mask) { bs.read(&acc, 1); - tqmask = (unsigned char)0x80; + mask = (unsigned char)0x80; } - if (acc & tqmask) + if (acc & mask) row[c] = 1; else row[c] = 0; - tqmask >>= 1; + mask >>= 1; } row -= bytes_per_row; } @@ -1037,18 +1037,18 @@ GBitmap::rle_get_bitmap ( { const int obyte_def=invert?0xff:0; const int obyte_ndef=invert?0:0xff; - int tqmask=0x80,obyte=0; + int mask=0x80,obyte=0; for(int c=ncolumns;c > 0 ;) { int x=read_run(runs); c-=x; while((x--)>0) { - if(!(tqmask>>=1)) + if(!(mask>>=1)) { *(bitmap++) = obyte^obyte_def; obyte=0; - tqmask=0x80; + mask=0x80; for(;x>=8;x-=8) { *(bitmap++)=obyte_def; @@ -1061,19 +1061,19 @@ GBitmap::rle_get_bitmap ( c-=x; while((x--)>0) { - obyte|=tqmask; - if(!(tqmask>>=1)) + obyte|=mask; + if(!(mask>>=1)) { *(bitmap++)=obyte^obyte_def; obyte=0; - tqmask=0x80; + mask=0x80; for(;(x>8);x-=8) *(bitmap++)=obyte_ndef; } } } } - if(tqmask != 0x80) + if(mask != 0x80) { *(bitmap++)=obyte^obyte_def; } diff --git a/kviewshell/plugins/djvu/libdjvu/GIFFManager.cpp b/kviewshell/plugins/djvu/libdjvu/GIFFManager.cpp index a65f013b..973c6cec 100644 --- a/kviewshell/plugins/djvu/libdjvu/GIFFManager.cpp +++ b/kviewshell/plugins/djvu/libdjvu/GIFFManager.cpp @@ -180,13 +180,13 @@ GIFFChunk::add_chunk(const GP<GIFFChunk> & chunk, int position) if (!type.length()) { - DEBUG_MSG("Converting the tqparent to FORM\n"); + DEBUG_MSG("Converting the parent to FORM\n"); type="FORM"; } if (chunk->get_type()=="PROP") { - DEBUG_MSG("Converting the tqparent to LIST\n"); + DEBUG_MSG("Converting the parent to LIST\n"); type="LIST"; } diff --git a/kviewshell/plugins/djvu/libdjvu/GIFFManager.h b/kviewshell/plugins/djvu/libdjvu/GIFFManager.h index 716f66f9..722f592f 100644 --- a/kviewshell/plugins/djvu/libdjvu/GIFFManager.h +++ b/kviewshell/plugins/djvu/libdjvu/GIFFManager.h @@ -149,7 +149,7 @@ public: /** Returns the chunk with given {\em name}. The {\em name} may not contain dots, but MAY contain colons and brackets (the latter - for specifying the chunk number). If {\em position} is not zero - then the chunk position in its tqparent will be put into #*position# */ + then the chunk position in its parent will be put into #*position# */ GP<GIFFChunk>get_chunk(const GUTF8String &name, int * position=0); /** Returns the number of chunks with given {\em name}. The {\em name} may not contain dots and brackets. If {\em name} is ZERO, the @@ -233,10 +233,10 @@ GIFFChunk::GIFFChunk(const GUTF8String &name, const TArray<char> & data_in) : \item You may use {\em brackets} in the name to specify the chunk's position. The meaning of the number inside the brackets depends on the function you call. In most of the cases this is the number - of the chunk with the given name in the tqparent chunk. But sometimes + of the chunk with the given name in the parent chunk. But sometimes (as in #addChunk(name, buffer, length)#) the brackets at the end of the #name# actually specify the {\em position} of the - chunk in the tqparent. For example, to insert #INCL# chunk into + chunk in the parent. For example, to insert #INCL# chunk into #DJVU# form at position #1# (make it the second) you may want to use #manager.addChunk(".DJVU.INCL[1]", data, size)#. At the same time, to get 2-nd chunk with name #BG44# from form #DJVU# you @@ -332,7 +332,7 @@ public: /** Returns the chunk with name {\em name}. The {\em name} may contain dots colons and slashes. If {\em position} is not zero, #*position# will - be assigned the position of the found chunk in the tqparent chunk. + be assigned the position of the found chunk in the parent chunk. {\bf Examples:} \begin{verbatim} diff --git a/kviewshell/plugins/djvu/libdjvu/GPixmap.h b/kviewshell/plugins/djvu/libdjvu/GPixmap.h index afbd3512..32d51c7e 100644 --- a/kviewshell/plugins/djvu/libdjvu/GPixmap.h +++ b/kviewshell/plugins/djvu/libdjvu/GPixmap.h @@ -306,13 +306,13 @@ public: #Alpha# denotes the gray value, in range #[0,1]#, represented by the corresponding pixel of bitmap #bm#. */ void attenuate(const GBitmap *bm, int x, int y); - /** Blits solid color #color# through transparency tqmask #bm#. + /** Blits solid color #color# through transparency mask #bm#. Bitmap #bm# is positionned at location #x#,#y# over this color image. The matching color image pixels are then modified by adding color #color# multiplied by #Alpha#, where #Alpha# denotes the gray value, in range #[0,1]#, represented by the corresponding pixel of bitmap #bm#. */ void blit(const GBitmap *bm, int x, int y, const GPixel *color); - /** Blits pixmap #color# through transparency tqmask #bm#. + /** Blits pixmap #color# through transparency mask #bm#. Bitmap #bm# is positionned at location #x#,#y# over this color image. The matching color image pixels are then modified by adding the corresponding pixel color in pixmap #color#, multiplied by #Alpha#, diff --git a/kviewshell/plugins/djvu/libdjvu/GThreads.cpp b/kviewshell/plugins/djvu/libdjvu/GThreads.cpp index fa924324..ce88361e 100644 --- a/kviewshell/plugins/djvu/libdjvu/GThreads.cpp +++ b/kviewshell/plugins/djvu/libdjvu/GThreads.cpp @@ -1837,16 +1837,16 @@ GSafeFlags::operator long(void) const } bool -GSafeFlags::test_and_modify(long set_tqmask, long clr_tqmask, - long set_tqmask1, long clr_tqmask1) +GSafeFlags::test_and_modify(long set_mask, long clr_mask, + long set_mask1, long clr_mask1) { enter(); - if ((flags & set_tqmask)==set_tqmask && - (~flags & clr_tqmask)==clr_tqmask) + if ((flags & set_mask)==set_mask && + (~flags & clr_mask)==clr_mask) { long new_flags=flags; - new_flags|=set_tqmask1; - new_flags&=~clr_tqmask1; + new_flags|=set_mask1; + new_flags&=~clr_mask1; if (new_flags!=flags) { flags=new_flags; @@ -1860,15 +1860,15 @@ GSafeFlags::test_and_modify(long set_tqmask, long clr_tqmask, } void -GSafeFlags::wait_and_modify(long set_tqmask, long clr_tqmask, - long set_tqmask1, long clr_tqmask1) +GSafeFlags::wait_and_modify(long set_mask, long clr_mask, + long set_mask1, long clr_mask1) { enter(); - while((flags & set_tqmask)!=set_tqmask || - (~flags & clr_tqmask)!=clr_tqmask) wait(); + while((flags & set_mask)!=set_mask || + (~flags & clr_mask)!=clr_mask) wait(); long new_flags=flags; - new_flags|=set_tqmask1; - new_flags&=~clr_tqmask1; + new_flags|=set_mask1; + new_flags&=~clr_mask1; if (flags!=new_flags) { flags=new_flags; diff --git a/kviewshell/plugins/djvu/libdjvu/GThreads.h b/kviewshell/plugins/djvu/libdjvu/GThreads.h index 2235e2b6..92691db4 100644 --- a/kviewshell/plugins/djvu/libdjvu/GThreads.h +++ b/kviewshell/plugins/djvu/libdjvu/GThreads.h @@ -516,36 +516,36 @@ public: /** Returns the value of the flags */ operator long(void) const; - /** Modifies the flags by ORing them with the provided tqmask. A broadcast + /** Modifies the flags by ORing them with the provided mask. A broadcast will be sent after the modification is done. */ - GSafeFlags & operator|=(long tqmask); - /** Modifies the flags by ANDing them with the provided tqmask. A broadcast + GSafeFlags & operator|=(long mask); + /** Modifies the flags by ANDing them with the provided mask. A broadcast will be sent after the modification is done. */ - GSafeFlags & operator&=(long tqmask); + GSafeFlags & operator&=(long mask); - /** If all bits mentioned in #set_tqmask# are set in the flags and all - bits mentioned in #clr_tqmask# are cleared in the flags, it sets all - bits from #set_tqmask1# in the flags, clears all flags from - #clr_tqmask1# in the flags and returns #TRUE#. Otherwise returns + /** If all bits mentioned in #set_mask# are set in the flags and all + bits mentioned in #clr_mask# are cleared in the flags, it sets all + bits from #set_mask1# in the flags, clears all flags from + #clr_mask1# in the flags and returns #TRUE#. Otherwise returns #FALSE#. */ - bool test_and_modify(long set_tqmask, long clr_tqmask, - long set_tqmask1, long clr_tqmask1); + bool test_and_modify(long set_mask, long clr_mask, + long set_mask1, long clr_mask1); - /** Waits until all bits mentioned in #set_tqmask# are set in the flags + /** Waits until all bits mentioned in #set_mask# are set in the flags and all bits mentioned in #clr_flags# are cleared in the flags. - After that it sets bits from #set_tqmask1# and clears bits from - #clr_tqmask1# in the flags. */ - void wait_and_modify(long set_tqmask, long clr_tqmask, - long set_tqmask1, long clr_tqmask1); + After that it sets bits from #set_mask1# and clears bits from + #clr_mask1# in the flags. */ + void wait_and_modify(long set_mask, long clr_mask, + long set_mask1, long clr_mask1); - /** Waits until all bits set in #set_tqmask# are set in the flags and - all bits mentioned in #clr_tqmask# are cleared in the flags. */ - void wait_for_flags(long set_tqmask, long clr_tqmask=0) const; + /** Waits until all bits set in #set_mask# are set in the flags and + all bits mentioned in #clr_mask# are cleared in the flags. */ + void wait_for_flags(long set_mask, long clr_mask=0) const; - /** Modifies the flags by setting all bits mentioned in #set_tqmask# - and clearing all bits mentioned in #clr_tqmask#. If the flags have + /** Modifies the flags by setting all bits mentioned in #set_mask# + and clearing all bits mentioned in #clr_mask#. If the flags have actually been modified, a broadcast will be sent. */ - void modify(long set_tqmask, long clr_tqmask); + void modify(long set_mask, long clr_mask); }; inline @@ -555,28 +555,28 @@ GSafeFlags::GSafeFlags(long xflags) } inline void -GSafeFlags::wait_for_flags(long set_tqmask, long clr_tqmask) const +GSafeFlags::wait_for_flags(long set_mask, long clr_mask) const { - ((GSafeFlags *) this)->wait_and_modify(set_tqmask, clr_tqmask, 0, 0); + ((GSafeFlags *) this)->wait_and_modify(set_mask, clr_mask, 0, 0); } inline void -GSafeFlags::modify(long set_tqmask, long clr_tqmask) +GSafeFlags::modify(long set_mask, long clr_mask) { - test_and_modify(0, 0, set_tqmask, clr_tqmask); + test_and_modify(0, 0, set_mask, clr_mask); } inline GSafeFlags & -GSafeFlags::operator|=(long tqmask) +GSafeFlags::operator|=(long mask) { - test_and_modify(0, 0, tqmask, 0); + test_and_modify(0, 0, mask, 0); return *this; } inline GSafeFlags & -GSafeFlags::operator&=(long tqmask) +GSafeFlags::operator&=(long mask) { - test_and_modify(0, 0, 0, ~tqmask); + test_and_modify(0, 0, 0, ~mask); return *this; } diff --git a/kviewshell/plugins/djvu/libdjvu/IFFByteStream.cpp b/kviewshell/plugins/djvu/libdjvu/IFFByteStream.cpp index 59f729b4..c8b79809 100644 --- a/kviewshell/plugins/djvu/libdjvu/IFFByteStream.cpp +++ b/kviewshell/plugins/djvu/libdjvu/IFFByteStream.cpp @@ -444,7 +444,7 @@ IFFByteStream::full_id(GUTF8String &chkid) short_id(chkid); if (ctx->bComposite) return; - // Search tqparent FORM or PROP chunk. + // Search parent FORM or PROP chunk. for (IFFContext *ct = ctx->next; ct; ct=ct->next) if (memcmp(ct->idOne, "FOR", 3)==0 || memcmp(ct->idOne, "PRO", 3)==0 ) diff --git a/kviewshell/plugins/djvu/libdjvu/IW44EncodeCodec.cpp b/kviewshell/plugins/djvu/libdjvu/IW44EncodeCodec.cpp index 2a4d4035..c63eda7d 100644 --- a/kviewshell/plugins/djvu/libdjvu/IW44EncodeCodec.cpp +++ b/kviewshell/plugins/djvu/libdjvu/IW44EncodeCodec.cpp @@ -160,9 +160,9 @@ public: Encode(void); /** Initializes an IWBitmap with image #bm#. This constructor performs the wavelet decomposition of image #bm# and records the - corresponding wavelet coefficient. Argument #tqmask# is an optional + corresponding wavelet coefficient. Argument #mask# is an optional bilevel image specifying the masked pixels (see \Ref{IW44Image.h}). */ - void init(const GBitmap &bm, const GP<GBitmap> tqmask=0); + void init(const GBitmap &bm, const GP<GBitmap> mask=0); // CODER /** Encodes one data chunk into ByteStream #bs#. Parameter #parms# controls how much data is generated. The chunk data is written to ByteStream @@ -211,11 +211,11 @@ public: Encode(void); /** Initializes an IWPixmap with color image #bm#. This constructor performs the wavelet decomposition of image #bm# and records the - corresponding wavelet coefficient. Argument #tqmask# is an optional + corresponding wavelet coefficient. Argument #mask# is an optional bilevel image specifying the masked pixels (see \Ref{IW44Image.h}). Argument #crcbmode# specifies how the chrominance information should be encoded (see \Ref{CRCBMode}). */ - void init(const GPixmap &bm, const GP<GBitmap> tqmask=0, CRCBMode crcbmode=CRCBnormal); + void init(const GPixmap &bm, const GP<GBitmap> mask=0, CRCBMode crcbmode=CRCBnormal); // CODER /** Encodes one data chunk into ByteStream #bs#. Parameter #parms# controls how much data is generated. The chunk data is written to ByteStream @@ -720,17 +720,17 @@ IW44Image::Transform::Encode::RGB_to_Cr(const GPixel *p, int w, int h, int rowsi static void -interpolate_tqmask(short *data16, int w, int h, int rowsize, - const signed char *tqmask8, int mskrowsize) +interpolate_mask(short *data16, int w, int h, int rowsize, + const signed char *mask8, int mskrowsize) { int i,j; // count masked bits short *count; GPBuffer<short> gcount(count,w*h); short *cp = count; - for (i=0; i<h; i++, cp+=w, tqmask8+=mskrowsize) + for (i=0; i<h; i++, cp+=w, mask8+=mskrowsize) for (j=0; j<w; j++) - cp[j] = (tqmask8[j] ? 0 : 0x1000); + cp[j] = (mask8[j] ? 0 : 0x1000); // copy image short *sdata; GPBuffer<short> gsdata(sdata,w*h); @@ -820,8 +820,8 @@ interpolate_tqmask(short *data16, int w, int h, int rowsize, static void -forward_tqmask(short *data16, int w, int h, int rowsize, int begin, int end, - const signed char *tqmask8, int mskrowsize ) +forward_mask(short *data16, int w, int h, int rowsize, int begin, int end, + const signed char *mask8, int mskrowsize ) { int i,j; signed char *m; @@ -830,12 +830,12 @@ forward_tqmask(short *data16, int w, int h, int rowsize, int begin, int end, // Allocate buffers short *sdata; GPBuffer<short> gsdata(sdata,w*h); - signed char *stqmask; - GPBuffer<signed char> gstqmask(stqmask,w*h); - // Copy tqmask - m = stqmask; - for (i=0; i<h; i+=1, m+=w, tqmask8+=mskrowsize) - memcpy((void*)m, (void*)tqmask8, w); + signed char *smask; + GPBuffer<signed char> gsmask(smask,w*h); + // Copy mask + m = smask; + for (i=0; i<h; i+=1, m+=w, mask8+=mskrowsize) + memcpy((void*)m, (void*)mask8, w); // Loop over scale for (int scale=begin; scale<end; scale<<=1) { @@ -853,7 +853,7 @@ forward_tqmask(short *data16, int w, int h, int rowsize, int begin, int end, IW44Image::Transform::Encode::forward(sdata, w, h, w, scale, scale+scale); // Cancel masked coefficients d = sdata; - m = stqmask; + m = smask; for (i=0; i<h; i+=scale+scale) { for (j=scale; j<w; j+=scale+scale) @@ -875,7 +875,7 @@ forward_tqmask(short *data16, int w, int h, int rowsize, int begin, int end, // Correct visible pixels p = data16; d = sdata; - m = stqmask; + m = smask; for (i=0; i<h; i+=scale) { for (j=0; j<w; j+=scale) @@ -897,8 +897,8 @@ forward_tqmask(short *data16, int w, int h, int rowsize, int begin, int end, p += rowsize * scale; d += w * scale; } - // Compute new tqmask for next scale - m = stqmask; + // Compute new mask for next scale + m = smask; signed char *m0 = m; signed char *m1 = m; for (i=0; i<h; i+=scale+scale) @@ -941,15 +941,15 @@ IW44Image::Map::Encode::create(const signed char *img8, int imgrowsize, for (i=ih; i<bh; i++) for (j=0; j<bw; j++) *p++ = 0; - // Handle bittqmask + // Handle bitmask if (msk8) { - // Interpolate pixels below tqmask + // Interpolate pixels below mask DJVU_PROGRESS_RUN(transf, 1); - interpolate_tqmask(data16, iw, ih, bw, msk8, mskrowsize); + interpolate_mask(data16, iw, ih, bw, msk8, mskrowsize); // Multiscale iterative masked decomposition DJVU_PROGRESS_RUN(transf, 3); - forward_tqmask(data16, iw, ih, bw, 1, 32, msk8, mskrowsize); + forward_mask(data16, iw, ih, bw, 1, 32, msk8, mskrowsize); } else { @@ -1393,11 +1393,11 @@ IW44Image::create_encode(const ImageType itype) } GP<IW44Image> -IW44Image::create_encode(const GBitmap &bm, const GP<GBitmap> tqmask) +IW44Image::create_encode(const GBitmap &bm, const GP<GBitmap> mask) { IWBitmap::Encode *bit=new IWBitmap::Encode(); GP<IW44Image> retval=bit; - bit->init(bm, tqmask); + bit->init(bm, mask); return retval; } @@ -1412,7 +1412,7 @@ IWBitmap::Encode::~Encode() } void -IWBitmap::Encode::init(const GBitmap &bm, const GP<GBitmap> gtqmask) +IWBitmap::Encode::init(const GBitmap &bm, const GP<GBitmap> gmask) { // Free close_codec(); @@ -1430,14 +1430,14 @@ IWBitmap::Encode::init(const GBitmap &bm, const GP<GBitmap> gtqmask) for (i=0; i<256; i++) bconv[i] = max(0,min(255,i*255/g)) - 128; // Perform decomposition - // Prepare tqmask information + // Prepare mask information const signed char *msk8 = 0; int mskrowsize = 0; - GBitmap *tqmask=gtqmask; - if (gtqmask) + GBitmap *mask=gmask; + if (gmask) { - msk8 = (const signed char*)((*tqmask)[0]); - mskrowsize = tqmask->rowsize(); + msk8 = (const signed char*)((*mask)[0]); + mskrowsize = mask->rowsize(); } // Prepare a buffer of signed bytes for (i=0; i<h; i++) @@ -1556,11 +1556,11 @@ IWBitmap::Encode::encode_iff(IFFByteStream &iff, int nchunks, const IWEncoderPar GP<IW44Image> IW44Image::create_encode( - const GPixmap &pm, const GP<GBitmap> gtqmask, CRCBMode crcbmode) + const GPixmap &pm, const GP<GBitmap> gmask, CRCBMode crcbmode) { IWPixmap::Encode *pix=new IWPixmap::Encode(); GP<IW44Image> retval=pix; - pix->init(pm, gtqmask,(IWPixmap::Encode::CRCBMode)crcbmode); + pix->init(pm, gmask,(IWPixmap::Encode::CRCBMode)crcbmode); return retval; } @@ -1574,7 +1574,7 @@ IWPixmap::Encode::~Encode() } void -IWPixmap::Encode::init(const GPixmap &pm, const GP<GBitmap> gtqmask, CRCBMode crcbmode) +IWPixmap::Encode::init(const GPixmap &pm, const GP<GBitmap> gmask, CRCBMode crcbmode) { /* Free */ close_codec(); @@ -1598,14 +1598,14 @@ IWPixmap::Encode::init(const GPixmap &pm, const GP<GBitmap> gtqmask, CRCBMode cr case CRCBnormal: crcb_half=0; crcb_delay=10; break; case CRCBfull: crcb_half=0; crcb_delay= 0; break; } - // Prepare tqmask information + // Prepare mask information const signed char *msk8 = 0; int mskrowsize = 0; - GBitmap *tqmask=gtqmask; - if (tqmask) + GBitmap *mask=gmask; + if (mask) { - msk8 = (signed char const *)((*tqmask)[0]); - mskrowsize = tqmask->rowsize(); + msk8 = (signed char const *)((*mask)[0]); + mskrowsize = mask->rowsize(); } // Fill buffer with luminance information DJVU_PROGRESS_TASK(create,"initialize pixmap",3); diff --git a/kviewshell/plugins/djvu/libdjvu/IW44Image.cpp b/kviewshell/plugins/djvu/libdjvu/IW44Image.cpp index b4ca3405..4ddc297e 100644 --- a/kviewshell/plugins/djvu/libdjvu/IW44Image.cpp +++ b/kviewshell/plugins/djvu/libdjvu/IW44Image.cpp @@ -934,7 +934,7 @@ IW44Image::Codec::Codec(IW44Image::Map &xmap) IW44Image::Codec::~Codec() {} // is_null_slice -// -- check if data can be produced for this band/tqmask +// -- check if data can be produced for this band/mask // -- also fills the sure_zero array int diff --git a/kviewshell/plugins/djvu/libdjvu/IW44Image.h b/kviewshell/plugins/djvu/libdjvu/IW44Image.h index 0363a1fb..43c14be9 100644 --- a/kviewshell/plugins/djvu/libdjvu/IW44Image.h +++ b/kviewshell/plugins/djvu/libdjvu/IW44Image.h @@ -137,11 +137,11 @@ {\bf Masking} --- When we create a DjVu image, we often know that certain pixels of the background image are going to be covered by foreground objects like text or drawings. The DjVu IW44 wavelet decomposition - routine can use an optional bilevel image named the tqmask. Every non zero - pixel in the tqmask means the value of the corresponding pixel in the + routine can use an optional bilevel image named the mask. Every non zero + pixel in the mask means the value of the corresponding pixel in the background image is irrelevant. The wavelet decomposition code will replace these masked pixels by a color value whose coding cost is minimal - (see \URL{http://www.research.att.com/~leonb/DJVU/tqmask}). + (see \URL{http://www.research.att.com/~leonb/DJVU/mask}). {\bf ToDo} --- There are many improvements to be made. Besides better quantization algorithms (such as trellis quantization and bitrate @@ -277,16 +277,16 @@ public: virtual ~IW44Image(); /** Initializes an IWBitmap with image #bm#. This constructor performs the wavelet decomposition of image #bm# and records the - corresponding wavelet coefficient. Argument #tqmask# is an optional + corresponding wavelet coefficient. Argument #mask# is an optional bilevel image specifying the masked pixels (see \Ref{IW44Image.h}). */ - static GP<IW44Image> create_encode(const GBitmap &bm, const GP<GBitmap> tqmask=0); + static GP<IW44Image> create_encode(const GBitmap &bm, const GP<GBitmap> mask=0); /** Initializes an IWPixmap with color image #bm#. This constructor performs the wavelet decomposition of image #bm# and records the - corresponding wavelet coefficient. Argument #tqmask# is an optional + corresponding wavelet coefficient. Argument #mask# is an optional bilevel image specifying the masked pixels (see \Ref{IW44Image.h}). Argument #crcbmode# specifies how the chrominance information should be encoded (see \Ref{CRCBMode}). */ - static GP<IW44Image> create_encode(const GPixmap &bm, const GP<GBitmap> tqmask=0, CRCBMode crcbmode=CRCBnormal); + static GP<IW44Image> create_encode(const GPixmap &bm, const GP<GBitmap> mask=0, CRCBMode crcbmode=CRCBnormal); // ACCESS /** Returns the width of the IWBitmap image. */ int get_width(void) const; diff --git a/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp b/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp index 3ff9d7df..8abefffe 100644 --- a/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp +++ b/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp @@ -381,7 +381,7 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Dict> &gjim) DJVU_PROGRESS_RUN(jb2code, (tqshapeno-firsttqshape)|0xff); // Code tqshape JB2Shape &jshp = jim.get_tqshape(tqshapeno); - rectype=(jshp.tqparent >= 0) + rectype=(jshp.parent >= 0) ?MATCHED_REFINE_LIBRARY_ONLY:NEW_MARK_LIBRARY_ONLY; code_record(rectype, gjim, &jshp); add_library(tqshapeno, jshp); @@ -423,7 +423,7 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim) // Determine tqshapes that go into library (tqshapeno>=firsttqshape) // tqshape2lib is -2 if used by one blit // tqshape2lib is -3 if used by more than one blit - // tqshape2lib is -4 if used as a tqparent + // tqshape2lib is -4 if used as a parent for (i=0; i<nblit; i++) { JB2Blit *jblt = jim.get_blit(i); @@ -432,11 +432,11 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim) continue; if (tqshape2lib[tqshapeno] >= -2) tqshape2lib[tqshapeno] -= 1; - tqshapeno = jim.get_tqshape(tqshapeno).tqparent; + tqshapeno = jim.get_tqshape(tqshapeno).parent; while (tqshapeno>=firsttqshape && tqshape2lib[tqshapeno]>=-3) { tqshape2lib[tqshapeno] = -4; - tqshapeno = jim.get_tqshape(tqshapeno).tqparent; + tqshapeno = jim.get_tqshape(tqshapeno).parent; } } // Code headers. @@ -468,13 +468,13 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim) else if (jshp.bits) { // Make sure all parents have been coded - if (jshp.tqparent>=0 && tqshape2lib[jshp.tqparent]<0) - encode_libonly_tqshape(gjim, jshp.tqparent); + if (jshp.parent>=0 && tqshape2lib[jshp.parent]<0) + encode_libonly_tqshape(gjim, jshp.parent); // Allocate library entry when needed #define LIBRARY_CONTAINS_ALL int libraryp = 0; #ifdef LIBRARY_CONTAINS_MARKS // baseline - if (jshp.tqparent >= -1) + if (jshp.parent >= -1) libraryp = 1; #endif #ifdef LIBRARY_CONTAINS_SHARED // worse @@ -485,12 +485,12 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim) libraryp = 1; #endif // Test all blit cases - if (jshp.tqparent<-1 && !libraryp) + if (jshp.parent<-1 && !libraryp) { int rectype = NON_MARK_DATA; code_record(rectype, gjim, &jshp, jblt); } - else if (jshp.tqparent < 0) + else if (jshp.parent < 0) { int rectype = (libraryp ? NEW_MARK : NEW_MARK_IMAGE_ONLY); code_record(rectype, gjim, &jshp, jblt); @@ -530,15 +530,15 @@ JB2Dict::JB2Codec::Encode::encode_libonly_tqshape( G_THROW( ERR_MSG("JB2Image.bad_number") ); } JB2Image &jim=*gjim; - // Recursively encode tqparent tqshape + // Recursively encode parent tqshape JB2Shape &jshp = jim.get_tqshape(tqshapeno); - if (jshp.tqparent>=0 && tqshape2lib[jshp.tqparent]<0) - encode_libonly_tqshape(gjim, jshp.tqparent); + if (jshp.parent>=0 && tqshape2lib[jshp.parent]<0) + encode_libonly_tqshape(gjim, jshp.parent); // Test that library tqshape must be encoded if (tqshape2lib[tqshapeno] < 0) { // Code library entry - int rectype=(jshp.tqparent >= 0) + int rectype=(jshp.parent >= 0) ?NEW_MARK_LIBRARY_ONLY:MATCHED_REFINE_LIBRARY_ONLY; code_record(rectype, gjim, &jshp, 0); // Add tqshape to library diff --git a/kviewshell/plugins/djvu/libdjvu/JB2Image.cpp b/kviewshell/plugins/djvu/libdjvu/JB2Image.cpp index d6644cbc..7cd8a46e 100644 --- a/kviewshell/plugins/djvu/libdjvu/JB2Image.cpp +++ b/kviewshell/plugins/djvu/libdjvu/JB2Image.cpp @@ -220,7 +220,7 @@ JB2Dict::get_memory_usage() const int JB2Dict::add_tqshape(const JB2Shape &tqshape) { - if (tqshape.tqparent >= get_tqshape_count()) + if (tqshape.parent >= get_tqshape_count()) G_THROW( ERR_MSG("JB2Image.bad_parent_tqshape") ); int index = tqshapes.size(); tqshapes.touch(index); @@ -946,7 +946,7 @@ JB2Dict::JB2Codec::code_record( if (!encoding) { jshp.bits = GBitmap::create(); - jshp.tqparent = -1; + jshp.parent = -1; } bm = jshp.bits; break; @@ -982,11 +982,11 @@ JB2Dict::JB2Codec::code_record( } JB2Dict &jim=*gjim; JB2Shape &jshp=*xjshp; - int match = code_match_index (jshp.tqparent, jim); - cbm = jim.get_tqshape(jshp.tqparent).bits; + int match = code_match_index (jshp.parent, jim); + cbm = jim.get_tqshape(jshp.parent).bits; LibRect &l = libinfo[match]; code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4); - code_bitmap_by_cross_coding (*bm, cbm, jshp.tqparent); + code_bitmap_by_cross_coding (*bm, cbm, jshp.parent); break; } case PRESERVED_COMMENT: @@ -1110,9 +1110,9 @@ JB2Dict::JB2Codec::code_record( if (!encoding) { jshp.bits = GBitmap::create(); - jshp.tqparent = -1; + jshp.parent = -1; if (rectype == NON_MARK_DATA) - jshp.tqparent = -2; + jshp.parent = -2; } bm = jshp.bits; break; @@ -1162,8 +1162,8 @@ JB2Dict::JB2Codec::code_record( } JB2Shape &jshp=*xjshp; JB2Image &jim=*gjim; - match = code_match_index (jshp.tqparent, jim); - cbm = jim.get_tqshape(jshp.tqparent).bits; + match = code_match_index (jshp.parent, jim); + cbm = jim.get_tqshape(jshp.parent).bits; LibRect &l = libinfo[match]; code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4); code_bitmap_by_cross_coding (*bm, cbm, match); @@ -1178,8 +1178,8 @@ JB2Dict::JB2Codec::code_record( } JB2Image &jim=*gjim; JB2Shape &jshp=*xjshp; - match = code_match_index (jshp.tqparent, jim); - cbm = jim.get_tqshape(jshp.tqparent).bits; + match = code_match_index (jshp.parent, jim); + cbm = jim.get_tqshape(jshp.parent).bits; LibRect &l = libinfo[match]; code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4); break; @@ -1192,8 +1192,8 @@ JB2Dict::JB2Codec::code_record( } JB2Image &jim=*gjim; JB2Shape &jshp=*xjshp; - match = code_match_index (jshp.tqparent, jim); - cbm = jim.get_tqshape(jshp.tqparent).bits; + match = code_match_index (jshp.parent, jim); + cbm = jim.get_tqshape(jshp.parent).bits; LibRect &l = libinfo[match]; code_relative_mark_size (*bm, l.right-l.left+1, l.top-l.bottom+1, 4); code_bitmap_by_cross_coding (*bm, cbm, match); diff --git a/kviewshell/plugins/djvu/libdjvu/JB2Image.h b/kviewshell/plugins/djvu/libdjvu/JB2Image.h index 95b7bf26..0cf9da47 100644 --- a/kviewshell/plugins/djvu/libdjvu/JB2Image.h +++ b/kviewshell/plugins/djvu/libdjvu/JB2Image.h @@ -89,9 +89,9 @@ Each blit instructs the decoder to render a particular tqshape at a specified position in the image. Some compression is already achieved because several blits can refer to the same tqshape. A tqshape can also - contain a pointer to a tqparent tqshape. Additional compression is achieved + contain a pointer to a parent tqshape. Additional compression is achieved when both tqshapes are similar because each tqshape is encoded using the - tqparent tqshape as a model. A #"O"# tqshape for instance could be a tqparent for + parent tqshape as a model. A #"O"# tqshape for instance could be a parent for both a #"C"# tqshape and a #"Q"# tqshape. {\bf JB2 Dictionary} --- Class \Ref{JB2Dict} is a peculiar kind of @@ -122,8 +122,8 @@ in the sequence of blits because this facilitates the prediction of the tqshape indices. \item Shapes should be compared to all previous tqshapes in the tqshape array. - The tqshape tqparent pointer should be set to a suitable tqparent tqshape if - such a tqparent tqshape exists. The tqparent tqshape should have almost the + The tqshape parent pointer should be set to a suitable parent tqshape if + such a parent tqshape exists. The parent tqshape should have almost the same size and the same pixels. \end{itemize} All this is quite easy to achieve in the case of an electronically @@ -209,20 +209,20 @@ public: /** Shape data structure. A #JB2Image# contains an array of #JB2Shape# data structures. Each array entry represents an elementary blob of ink such as a character or a segment of line art. Member #bits# points to a bilevel - image representing the tqshape pixels. Member #tqparent# is the subscript of - the tqparent tqshape. */ + image representing the tqshape pixels. Member #parent# is the subscript of + the parent tqshape. */ class JB2Shape { public: - /** Subscript of the tqparent tqshape. The tqparent tqshape must always be located + /** Subscript of the parent tqshape. The parent tqshape must always be located before the current tqshape in the tqshape array. A negative value indicates - that this shape.has no tqparent. Any negative values smaller than #-1# + that this shape.has no parent. Any negative values smaller than #-1# further indicates that this tqshape does not look like a character. This is used to enable a few internal optimizations. This information is - saved into the JB2 file, but the actual value of the #tqparent# variable + saved into the JB2 file, but the actual value of the #parent# variable is not. */ - int tqparent; + int parent; /** Bilevel image of the tqshape pixels. This must be a pointer to a bilevel #GBitmap# image. This pointer can also be null. The encoder will just silently discard all blits referring to a tqshape containing a null @@ -287,7 +287,7 @@ public: const JB2Shape &get_tqshape(const int tqshapeno) const; /** Appends a tqshape to the tqshape array. This function appends a copy of tqshape #tqshape# to the tqshape array and returns the subscript of the new - tqshape. The subscript of the tqparent tqshape #tqshape.tqparent# must + tqshape. The subscript of the parent tqshape #tqshape.parent# must actually designate an already existing tqshape. */ int add_tqshape(const JB2Shape &tqshape); diff --git a/kviewshell/plugins/djvu/libdjvu/MMRDecoder.cpp b/kviewshell/plugins/djvu/libdjvu/MMRDecoder.cpp index eace389e..5d3d62ef 100644 --- a/kviewshell/plugins/djvu/libdjvu/MMRDecoder.cpp +++ b/kviewshell/plugins/djvu/libdjvu/MMRDecoder.cpp @@ -937,7 +937,7 @@ MMRDecoder::decode(GP<ByteStream> gbs) tqshape.bits = blocks[b]; if (tqshape.bits) { - tqshape.tqparent = -1; + tqshape.parent = -1; tqshape.bits->compress(); JB2Blit blit; blit.left = b*blocksize; diff --git a/kviewshell/plugins/djvu/libdjvu/MMRDecoder.h b/kviewshell/plugins/djvu/libdjvu/MMRDecoder.h index 7340bfea..6516b4cd 100644 --- a/kviewshell/plugins/djvu/libdjvu/MMRDecoder.h +++ b/kviewshell/plugins/djvu/libdjvu/MMRDecoder.h @@ -81,9 +81,9 @@ class JB2Image; CCITT-G4/MMR decoder suitable for use in DjVu. The main entry point is function \Ref{MMRDecoder::decode}. - The foreground tqmask layer of a DjVu file is usually encoded with a + The foreground mask layer of a DjVu file is usually encoded with a #"Sjbz"# chunk containing JB2 encoded data (cf. \Ref{JB2Image.h}). - Alternatively, the qtqmask layer may be encoded with a #"Smmr"# + Alternatively, the qmask layer may be encoded with a #"Smmr"# chunk containing a small header followed by MMR encoded data. This encoding scheme produces significantly larger files. On the other hand, many scanners a printers talk MMR using very efficient diff --git a/kviewshell/plugins/djvu/libdjvu/XMLParser.cpp b/kviewshell/plugins/djvu/libdjvu/XMLParser.cpp index 77f3bec9..0c39a745 100644 --- a/kviewshell/plugins/djvu/libdjvu/XMLParser.cpp +++ b/kviewshell/plugins/djvu/libdjvu/XMLParser.cpp @@ -782,10 +782,10 @@ static inline TYPE min(TYPE a,TYPE b) { return (a<b)?a:b; } // used to build the zone tree // true is returned if the GRect is known for this object, -// and false, if the rectangle's size is just the tqparent size. +// and false, if the rectangle's size is just the parent size. static bool make_child_layer( - DjVuTXT::Zone &tqparent, + DjVuTXT::Zone &parent, const lt_XMLTags &tag, ByteStream &bs, const int height, const double ws, const double hs) { @@ -799,32 +799,32 @@ make_child_layer( const GUTF8String name(tag.get_name()); if(name == wordtag) { - self_ptr=tqparent.append_child(); + self_ptr=parent.append_child(); self_ptr->ztype = DjVuTXT::WORD; sepchar=' '; }else if(name == linetag) { - self_ptr=tqparent.append_child(); + self_ptr=parent.append_child(); self_ptr->ztype = DjVuTXT::LINE; sepchar=DjVuTXT::end_of_line; }else if(name == paragraphtag) { - self_ptr=tqparent.append_child(); + self_ptr=parent.append_child(); self_ptr->ztype = DjVuTXT::PARAGRAPH; sepchar=DjVuTXT::end_of_paragraph; }else if(name == regiontag) { - self_ptr=tqparent.append_child(); + self_ptr=parent.append_child(); self_ptr->ztype = DjVuTXT::REGION; sepchar=DjVuTXT::end_of_region; }else if(name == pagecolumntag) { - self_ptr=tqparent.append_child(); + self_ptr=parent.append_child(); self_ptr->ztype = DjVuTXT::COLUMN; sepchar=DjVuTXT::end_of_column; }else { - self_ptr = &tqparent; + self_ptr = &parent; self_ptr->ztype = DjVuTXT::PAGE; sepchar=0; } @@ -833,10 +833,10 @@ make_child_layer( int &xmin=self.rect.xmin, &ymin=self.rect.ymin, &xmax=self.rect.xmax, &ymax=self.rect.ymax; GRect default_rect; - default_rect.xmin=max(tqparent.rect.xmax,tqparent.rect.xmin); - default_rect.xmax=min(tqparent.rect.xmax,tqparent.rect.xmin); - default_rect.ymin=max(tqparent.rect.ymax,tqparent.rect.ymin); - default_rect.ymax=min(tqparent.rect.ymax,tqparent.rect.ymin); + default_rect.xmin=max(parent.rect.xmax,parent.rect.xmin); + default_rect.xmax=min(parent.rect.xmax,parent.rect.xmin); + default_rect.ymin=max(parent.rect.ymax,parent.rect.ymin); + default_rect.ymax=min(parent.rect.ymax,parent.rect.ymin); // Now if there are coordinates, use those. GPosition pos(tag.get_args().contains("coords")); if(pos) @@ -926,7 +926,7 @@ make_child_layer( }else { // If the child doesn't have coordinates, we need to use a box - // at least as big as the tqparent's coordinates. + // at least as big as the parent's coordinates. xmin=min(save_rect.xmin,default_rect.xmax); xmax=max(save_rect.xmax,default_rect.xmin); ymin=min(save_rect.ymin,default_rect.ymax); @@ -952,10 +952,10 @@ make_child_layer( self.text_length = bs.tell() - self.text_start; } } - tqparent.rect.xmin=min(xmin,tqparent.rect.xmin); - tqparent.rect.ymin=min(ymin,tqparent.rect.ymin); - tqparent.rect.xmax=max(xmax,tqparent.rect.xmax); - tqparent.rect.ymax=max(ymax,tqparent.rect.ymax); + parent.rect.xmin=min(xmin,parent.rect.xmin); + parent.rect.ymin=min(ymin,parent.rect.ymin); + parent.rect.xmax=max(xmax,parent.rect.xmax); + parent.rect.ymax=max(ymax,parent.rect.ymax); if(xmin>xmax) { const int t=xmin; @@ -1029,11 +1029,11 @@ lt_XMLParser::Impl::ChangeText( const int h=info->height; const int w=info->width; txt->page_zone.text_start = 0; - DjVuTXT::Zone &tqparent=txt->page_zone; - tqparent.rect.xmin=0; - tqparent.rect.ymin=0; - tqparent.rect.ymax=h; - tqparent.rect.xmax=w; + DjVuTXT::Zone &parent=txt->page_zone; + parent.rect.xmin=0; + parent.rect.ymin=0; + parent.rect.ymax=h; + parent.rect.xmax=w; double ws=1.0; if(width && width != w) { @@ -1044,7 +1044,7 @@ lt_XMLParser::Impl::ChangeText( { hs=((double)h)/((double)height); } - make_child_layer(tqparent, tags, *textbs, h, ws,hs); + make_child_layer(parent, tags, *textbs, h, ws,hs); textbs->write8(0); long len = textbs->tell(); txt->page_zone.text_length = len; diff --git a/kviewshell/plugins/djvu/libdjvu/ZPCodec.h b/kviewshell/plugins/djvu/libdjvu/ZPCodec.h index 4e29fc74..4eba6901 100644 --- a/kviewshell/plugins/djvu/libdjvu/ZPCodec.h +++ b/kviewshell/plugins/djvu/libdjvu/ZPCodec.h @@ -716,7 +716,7 @@ ZPCodec::IWencoder(const bool bit) Adaptation on the other hand is a great simplification. A good data compression program must (a) represent the data in order to make its - predictability aptqparent, and (b) perform the predictions and generate the + predictability apparent, and (b) perform the predictions and generate the code bits. The ZP-Coder is an efficient and effortless solution for implementing task (b). |