about summary refs log blame commit diff stats
path: root/archive/2.transect/ex5.k2
blob: 0d7148fe22729297a412721ab85416d1bdfc7bf9 (plain) (tree)





























                                                                                  
# read a character from stdin, save it to a local on the stack, write it to stdout

fn main [
  var x : char
  call read 0/stdin, x, 1/size
  result/EBX <- call write 1/stdout, x, 1/size
  call exit-EBX
]

fn read fd : int, x : (address array byte), size : int [
  EBX <- copy fd
  ECX <- copy x
  EDX <- copy size
  EAX <- copy 3/read
  syscall
]

fn write fd : int, x : (address array byte), size : int [
  EBX <- copy fd
  ECX <- copy x
  EDX <- copy size
  EAX <- copy 4/write
  syscall
]

# like exit, but assumes the code is already in EBX
fn exit-EBX [
  code/EAX <- copy 1/exit
  syscall
]
t'>
34
35
36






                                       
                                                    







                             
         





                        
           

                                                                                      
                                                                                  


                                                                                      

              
                                  
                                

                                  
image: golang:1.13

variables:
  REPO_NAME: framagit.org/andinus/cetus

before_script:
  - mkdir -p $GOPATH/src/$REPO_NAME
  - cp -fr $CI_PROJECT_DIR/* $GOPATH/src/$REPO_NAME/
  - cd $GOPATH/src/$REPO_NAME

stages:
  - build
  - deploy

compile:
    stage: build
    only:
      refs:
        - web
        - tags
        - master
        - schedules
        - merge_requests
    script:
      - cd $GOPATH/src/$REPO_NAME/cmd/cetus-nasa
      - GOOS=openbsd GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-nasa-openbsd-amd64
      - GOOS=linux GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-nasa-linux-amd64
      - cd $GOPATH/src/$REPO_NAME/cmd/cetus-bing
      - GOOS=openbsd GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-bing-openbsd-amd64
      - GOOS=linux GOARCH=amd64 go build -o $CI_PROJECT_DIR/cetus-bing-linux-amd64
    artifacts:
      paths:
        - cetus-nasa-openbsd-amd64
        - cetus-nasa-linux-amd64
        - cetus-bing-openbsd-amd64
        - cetus-bing-linux-amd64