<commit_before>#lang scheme/base
(require scheme/unit
         racket/future
         "option-sig.rkt")

(provide setup:option@ set-flag-params)

;; a way to define a parameter that is set from an alist of names and values
(define defined-flag-params (make-parameter '()))
(define-syntax-rule (define-flag-param name default)
  (define name
    (let ([param (make-parameter default)])
      (defined-flag-params (cons (cons 'name param) (defined-flag-params)))
      param)))
(define (set-flag-params* flags flag-params)
  (for ([name+param flag-params])
    (cond [(assq (car name+param) flags)
           => (lambda (x) ((cdr name+param) (cadr x)))])))
;; this macro is used to actually do the setting, `more ...' is for additional
;; parameters to set
(define-syntax-rule (set-flag-params flags more ...)
  (set-flag-params* flags (list* (cons 'more more) ... (defined-flag-params))))

(define-unit setup:option@
  (import)
  (export setup-option^)

  (define setup-program-name (make-parameter "raco setup"))

  (define-flag-param parallel-workers (min (processor-count) 8))
  (define-flag-param verbose #f)
  (define-flag-param make-verbose #f)
  (define-flag-param compiler-verbose #f)
  (define-flag-param clean #f)
  (define-flag-param compile-mode #f)
  (define-flag-param make-zo #t)
  (define-flag-param make-launchers #t)
  (define-flag-param make-info-domain #t)<commit_msg>limit build parallelism to 4 on a 32-bit machine<commit_after>#lang scheme/base
(require scheme/unit
         racket/future
         "option-sig.rkt")

(provide setup:option@ set-flag-params)

;; a way to define a parameter that is set from an alist of names and values
(define defined-flag-params (make-parameter '()))
(define-syntax-rule (define-flag-param name default)
  (define name
    (let ([param (make-parameter default)])
      (defined-flag-params (cons (cons 'name param) (defined-flag-params)))
      param)))
(define (set-flag-params* flags flag-params)
  (for ([name+param flag-params])
    (cond [(assq (car name+param) flags)
           => (lambda (x) ((cdr name+param) (cadr x)))])))
;; this macro is used to actually do the setting, `more ...' is for additional
;; parameters to set
(define-syntax-rule (set-flag-params flags more ...)
  (set-flag-params* flags (list* (cons 'more more) ... (defined-flag-params))))

(define-unit setup:option@
  (import)
  (export setup-option^)

  (define setup-program-name (make-parameter "raco setup"))

  (define-flag-param parallel-workers (min (processor-count) 
                                           (if (fixnum? (arithmetic-shift 1 40))
                                               8    ; 64-bit machine
                                               4))) ; 32-bit machine
  (define-flag-param verbose #f)
  (define-flag-param make-verbose #f)
  (define-flag-param compiler-verbose #f)
  (define-flag-param clean #f)
  (define-flag-param compile-mode #f)
  (define-flag-param make-zo #t)
  (define-flag-param make-launchers #t)
  (define-flag-param make-info-domain #t)
{'fraction_non_alphanumeric': 0.14710743801652892, 'fraction_numerical': 0.004297520661157025, 'mean_word_length': 3.034666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '495443', 'n_tokens_mistral': 973, 'n_tokens_neox': 935, 'n_words': 275}