1,263
questions
0
votes
1
answer
56
views
passing array in as subroutine argument in batch file
I have the following code:
@echo off
setlocal EnableDelayedExpansion
set array1[1]=1
set array1[2]=2
set array2[1]=3
set array2[2]=4
call :whatever %array1%
call :whatever %array2%
goto :eof
:...
0
votes
0
answers
100
views
Abaqus umat calls other subroutine but it doesn't update the array
I use the simple isotropic elastic material in uniaxial tension as an example. First the isotropic elastic behavior is directly coded inside the UMAT subroutine and it works fine below (OK.for).
Now I ...
1
vote
1
answer
107
views
Why is my code crashing with "Illegal address during kernel execution" when I use subroutines to copy or deallocate members of derived type variables?
I'm porting a big Fortran code to OpenACC and I'm struggling with some (rather simple) operations. I tried to summarize the problem in the test example that can be found below. I do know that the code ...
0
votes
1
answer
138
views
Advice on porting nested routines to OpenACC
I am quite new to OpenACC and I'd like to port a quite big Fortran code to GPUs. At present, the code is hybrid MPI and OpenMP, but we'd like to take advantage of GPUs on some big machines. The ...
2
votes
1
answer
54
views
Can a reference to an lvalue subroutine be used as an lvalue?
I'm having trouble using a Perl subroutine reference as an lvalue. Am I doing something wrong here, or is it not possible to do this? I'm using ActiveState Perl 5.20 on Windows.
package Warning {
...
0
votes
1
answer
24
views
Call an user defined function in PHPExcel
I have an addin in excel which has many user defined function for calculating gas properties etc.
I want to fetch the calculated value from a cell which has a formulae which is user defined. for eg I ...
0
votes
0
answers
62
views
Outout is affected for some weird silly reaons (print command as well as silly declaration of array)
I am new to this community. I am using ifort compiler for my abaqus subroutine. I was using it effortlessly until the last 2 weeks I have been struggling a lot! It is just that my output is affected ...
0
votes
0
answers
69
views
Print, write statement in Fortran module, subroutine
I am making a program 'maths.f90' that contains a few definitions:(r,n) that are sent to a fortran module 'geometry.f90' to simply calculate area of circle. Within that module there is a subroutine ...
0
votes
0
answers
19
views
Timer interrupt subroutine counters not working
I am working with the microcontroller Philips 80C552.
I have created this subroutine for my program's timer interrupt to execute every 5ms. I want to count different time-lengths and for that I use ...
1
vote
0
answers
47
views
Arm Cortex-M4 Sub Routines Unexpected Behavior
.include "Equates.s"
.syntax unified
.text
.global main
.global Delay
.global Top
Delay: mov r1,r3
ldr r2,=#0x000AAE60
...
1
vote
3
answers
61
views
Python subroutine returning NonType
So I have created this fruit machine in python and when I call the variable to check the results of the machine the subroutine returns a non type error
I have tried to force the returned variable into ...
1
vote
1
answer
63
views
Why My Assembler Subroutine doesn't get executed?
I'm currently creating code to begin a sequence lighting 10 leds whenever I push a button. However, when I apply my BTFSS and begin the simulation on Proteus, everything remains the same, even If I ...
0
votes
0
answers
9
views
Extract and expand a line from a list box to a text box and after the edit is complete contract it back to the list box from the textbox
The rules I created for a name: A segment letter, a separator, a 4 character abbreviation,
a separator, and a number counter 1 through 999.
1 LETTER, A THROUGH Z, '+', 1 THROUGH 4 LETTERS, ':', and 3 ...
0
votes
0
answers
56
views
javazoom package works in main but fails in subroutine (.NoClassDefFoundError: javazoom/jl/decoder/JavaLayerException)
I am building an MP3 player in java and the script I have written can play an mp3 in main but when I put the same code in a subroutine in a different java file, it fails.
Here is the script when its ...
1
vote
0
answers
24
views
MIPS recursive procedure storing on the heap
so for the program below, in which you jump back to the loop over and over in a recursive procedure, you would have to store the return address on the heap, but storing it in the same offset would ...
0
votes
0
answers
62
views
How to stop calling a subroutine in fortran
I am attempting to call a subroutine within my code that looks like this;
CALL RAYLEY(SIGR,AL2,Fwater,FNCR)
And when the code reaches this line, it gives me;
Program received signal SIGFPE:...
9
votes
1
answer
101
views
How does the scope effect EVAL of an infix:<> sub?
This code works as expected:
sub infix:<mean>(*@a) {
@a.sum / @a.elems
}
sub Mean (*@a) {
@a.sum / @a.elems
}
say EVAL 'Mean 2, 6, 4'; # Output: 4
say EVAL '2 mean 6 mean 4'; # ...
1
vote
1
answer
220
views
How to understand a subroutine without argument and bracket in Fortran
when learning F90, I saw most of tutorials or even some books teach that a subroutine has a format as below:
subroutine process_name (opt_args)
!main_codes_go_here
end subroutine process_name
Yet, ...
1
vote
2
answers
59
views
VB.Net :: Send reference for which Property or Method to Sub/Func?
I want to make a more universal "Progress Bar" which my API has some pre-defined methods. As the progress bar moves, I can update the Message which it displays. I have created a universal &...
0
votes
1
answer
49
views
Variable not getting executed, Type mismatch error,
I have filtered data, now I want to select immediate next cell in a row and Define a variable as string of that selected cell.
I tried applying variable as
Dim Id as string
Id=wb.ws.range("Q2:Q&...
0
votes
0
answers
186
views
Problem in pushing dword arguments on stack in assembly x64 [duplicate]
In my main function in C++ I pass 6 int arguments to a subroutine written in assembly x64. The first four arguments are in registers but I'm struggling with getting the last two from stack. Here's my ...
0
votes
1
answer
177
views
Abaqus - subroutines: is there a way to know in advance the number of loops the subroutine will perform?
I am a new user. Sorry if this question seems silly:
Is there a way to know in advance the number of loops the subroutine will perform?
(The subroutines can be USDFLD, VUMAT or UMAT, for example)
I am ...
6
votes
2
answers
142
views
Subroutine with same name in 2 different CPAN modules
I am getting this error when running perl:
[Thu Mar 16 00:24:23 2023] list_directory_1.cgi: Subroutine
main::getcwd redefined at /usr/lib/cgi-bin/list_directory_1.cgi line
15.
I think it is coming ...
3
votes
1
answer
89
views
Can I pop elements from the stack depending on whether they are used in a subroutine in Perl?
edit:
included my perl script
Is there a way to call a subroutine by providing the parameters as pop(@stack) and the values only to be poped from the stack if they are used in the subroutine.
In the ...
0
votes
1
answer
60
views
workbook: dynamic worksheets not accessible in subroutine
So I'm creating a workbook in a subroutine called CreateWorkbook, dynamically adding worksheets using SQL query, and assigning worksheets to an %ws object. When exporting, the workbook has all tabs.
...
0
votes
0
answers
14
views
how to call a Unix subroutine from another script [duplicate]
I have a shell script (named script_1.ksh) and I want to call a subroutine (called sun_1()) from another script (named script_2.ksh)
Is it possible that script_1.sh to be something like:
#!/bin/ksh
...
0
votes
0
answers
139
views
Fortran write statement raising syntax error, removing write statement raises other errors all over the code, even before the removed line
The problematic line:
if (nbuff(i).ne.nbuff(j)) write (6,*) 'swap mode:',i,' ',buff(i),' to ',buff(j)
which raises the error:
#5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( &...
0
votes
1
answer
573
views
Passing size of array as argument to a subroutine in fortran
I was wondering about the overhead of querying size of array in fortran. Old fortran (<f95) way was to pass the size of array to the arguments of subroutine:
subroutine asub(nelem,ar)
integer,...
2
votes
2
answers
103
views
How do I run a VBA Sub routine continuously when working in a Workbook and not only when the Workbook is opened?
I have made a sub routine to check for a password and a pre-defined expiry date. The code works, but only upon opening the Excel Workbook. Here is some code to show what I have so far:
Private Sub ...
0
votes
0
answers
12
views
can not add numbers to global variables from inside a function [duplicate]
I am doing a project for a computer science NEA and I need to solve this problem, the problem being that global variables just won't work in the function. I'm probably being stupid but I'm not the ...
2
votes
1
answer
1k
views
Passing arrays to subroutines in Fortran: Assumed shape vs explicit shape
When passing arrays to procedures, what is best in terms of (1) speed and (2) memory, assumed-shape or explicit shape? A similar question was asked some time ago in this forum but not in these terms:
...
-2
votes
3
answers
98
views
The user must enter a string that contains at least one lowercase “a”
The user must do the question above or the question keeps repeating so I need a while loop. I need to do this using a subroutine too. My code below isn't working.
public static boolean isAlpha(String ...
0
votes
1
answer
340
views
The user must enter a string that is greater than 6 characters long
How can I code this using subroutines in java with a loop so if they don't get it right it keeps repeating till they do. This is all i have so far. The user must enter a string that is greater than 6 ...
0
votes
0
answers
77
views
How to iterate through userform textboxes in a VBA sub-routine
In a userform, I want the user to input Time in textboxes named 'UFtime1', 'UFtime2', 'UFtime3' and so on. I have written code that makes the textbox only accept inputs in a certain format, and I want ...
2
votes
1
answer
445
views
Finding the execution time of a program in pascal
I want to find the execution time of a program I wrote in pascal but i dont know the syntax to do that.. is there a function that calculates it? I searched a little bit and found that people use the ...
4
votes
3
answers
441
views
Is it possible to implement subroutine call without a stack nor indirect addressing?
is it possible to use subroutine with a cpu that doesn't feature indirect addressing nor a way to store the program counter, it would only feature :
2 register A and B ( and a status register for ...
0
votes
1
answer
319
views
Abaqus HETVAL or DFLUX Input Variables : Possible to create heat flux dependent on stresses and strain rate?
I'm new to abaqus subroutines and Fortran in general and a bit confused right now. I'm trying to simulate the anelastic heat dissipation during cyclic loading. Because of that I need some way to ...
3
votes
1
answer
131
views
How to Bless Objects in a List Passed to a Subroutine?
In my Perl (v5.30.0) script, I have the world's simplest object:
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
package Thingee;
# Constructor with name new
sub new
{
my $type = ...
1
vote
2
answers
245
views
Can I pass arrays with undefined dimension to a Fortran subroutine as INTENT(INOUT)?
I need to pass arrays of variables to a subroutine that should change their values according to an external file. The problem is that this should be as generic as possible so if the file has n values ...
0
votes
1
answer
82
views
How can I call this subroutine to fill my array?
So I am making a vending machine code as a project, and I need to use this call this routine to fill my array:
static void Main(string[] args)
{
Product[] machine = new Product[9];...
2
votes
2
answers
85
views
How to stack function definitions in perl (call them all at once)?
So I want something like:
module0.pl
sub fun {
print "fun $_[0] from 0\n"
}
1
module1.pl
sub fun {
print "fun $_[0] from 1\n"
}
1
main.pl
BEGIN{push @INC, "."}...
1
vote
0
answers
198
views
VBA Code doesn't want to identify a sub when its public
So this is probably a very basic question, but I am having difficulty figuring out why my VBA code will not call up the subroutine properly. Every time I try to run it it gives the compile error box ...
0
votes
0
answers
27
views
Is it safe to have subroutine with the same name in different fortran modules? [duplicate]
I have written the following program and the output are as expected :
module mod1
contains
subroutine print_mod1()
call print_mod()
end subroutine print_mod1
...
1
vote
2
answers
94
views
Uninitialized value when moving sorting function to package
Say I got a file main.pl and a package package.pm
In main.pl I got the function
sub GetTimestampFromDateStr {
my $date_str = shift;
$logger->debug("[GetTimestampFromDateStr]:(...
-2
votes
2
answers
125
views
How do I do the BSR SUBR, and define the SUBR part of the code?
Question
The program is supposed to do the following:
Add up the first 6 data items ($1 to $6) stored at address label DATA.
Store the sum of the first 6 data items to address label SUM1.
Multiply ...
2
votes
3
answers
103
views
Making AWK code more efficient when evaluating sets of records
I have a file with 5 fields of content. I am evaluating 4 lines at a time in the file. So, records 1-4 are evaluated as a set. Records 5-8 are another set. Within each set, I want to extract the time ...
1
vote
0
answers
1k
views
Subroutine vs functions in python
I was reading about a coroutine here. Official docs say
Coroutines are a more generalized form of subroutines. Subroutines are
entered at one point and exited at another point. Coroutines can be
...
0
votes
2
answers
74
views
Splice array through subroutine
I am trying to use a subroutine to splice an array. What am I doing wrong?
$foo = 123223;
@data = split(//, $foo);
splice_data(\@data);
printf(@data);
sub splice_data{
splice(@data,3,1,1);
...
2
votes
1
answer
1k
views
Exception catching in FORM-ENDFORM in subroutine
I am using a subroutine (FORM, ENDFORM) where there is a class-method calling that raises an exception. I am catching the exception from the class-method calling, but how can I pass this exception to ...
1
vote
1
answer
70
views
Why does this perl program with dynamic scoping print 1?
Shouldn't this code print 2? After q() sub call in r(), the print should see the value changed by q(), but it doesn't.
sub p {
local $x = 0;
sub q {
$x = 2;
}
sub r {
local ...