Changeset 58b2638 for libcfa


Ignore:
Timestamp:
Dec 2, 2021, 5:11:22 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
8e658241
Parents:
1894e03
Message:

Added range_iterator, it now compiles.

Location:
libcfa/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    r1894e03 r58b2638  
    8484        time.hfa \
    8585        bits/weakso_locks.hfa \
     86        algorithms/range_iterator.hfa \
    8687        containers/maybe.hfa \
    8788        containers/pair.hfa \
  • libcfa/src/algorithms/range_iterator.cfa

    r1894e03 r58b2638  
    1414//
    1515
     16#include "range_iterator.hfa"
    1617
     18#include <stdio.h>
    1719
    18 void main(RangeParser & this) {
     20#include <fstream.hfa>
     21
     22void main(RangeIter & this) {
    1923        for() {
    2024                this._start = -1;
    2125                this._stop = -1;
    2226                int start_len = -1, stop_len = -1;
    23                 int ret = sscanf(this.text, "%u%n-%u%n", &this._start, &start_len, &stop, &stop_len);
     27                int ret = sscanf(this.text, "%u%n-%u%n", &this._start, &start_len, &this._stop, &stop_len);
    2428                switch(ret) {
    2529                case 0:
     
    4448                        }
    4549                        this.text += stop_len;
    46                         for(this.com i = this._start; this.com <= this._stop; this.com++) {
     50                        for(this.com = this._start; this.com <= this._stop; this.com++) {
    4751                                suspend;
    4852                        }
  • libcfa/src/algorithms/range_iterator.hfa

    r1894e03 r58b2638  
    1717        const char * text;
    1818        int com;
    19         int
     19        int _start;
     20        int _stop;
    2021};
    2122
     
    2425}
    2526
    26 static inline bool next(RangeIter & this) { return resume(this).com > 0; }
     27static inline bool moveNext(RangeIter & this) { resume(this); return this.com > 0; }
Note: See TracChangeset for help on using the changeset viewer.