Changeset 40 in projects for punch-card/lib/card.h


Ignore:
Timestamp:
Aug 25, 2009, 5:16:00 AM (10 years ago)
Author:
sven
Message:

Some first implemention of the Jones I/O Format.
Todo: Clean it all up

-- sven @ t29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • punch-card/lib/card.h

    r39 r40  
    5757        static const int word_length = 12;
    5858        Punch::CardBit bits[ word_length ];
     59
     60        CardWord(int value) {
     61                for(s=0; s<word_length; s++) {
     62                        set(s, (value << s) & 0x01);
     63                }
     64        }
     65
    5966
    6067        // getters and setters
     
    122129        }
    123130
     131        // cast word => int
     132        operator int() const {
     133                int ret = 0;
     134                for(int s=0; s<word_length; s++) {
     135                        ret |= get(s) << s;
     136                }
     137        }
    124138}; // class CardWord
    125 /*
    126 class CardWordIterator {
    127         int current_index;
    128         CardWord* card;
    129 
    130         CardWordIterator next();
    131         CardWordIterator previous();
    132 }
    133 */
    134139
    135140class Card {
     
    162167class CardFile {
    163168public:
     169        int default_col_length = 80;
     170
    164171        public list<Punch::Card> cards;
    165172        void write(CardFormat format, std::ostream& os);
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License